Skip to content

VertexAttribute

enum VertexAttribute
Package: dev.joid.lib.bridge.render.vertex · Module: core · Source: VertexAttribute.java

The attributes of a JOID vertex, each with its shader input, its location, its byte offset and its format.

A backend declares its vertex input from these values: one binding of VertexBuffer.STRIDE bytes, one attribute per constant. GlslShaderTranslator writes the same locations with layout(location = n) for a dialect with explicit locations; for the other dialects, the backend binds them when it links the program.

ReturnsSignatureSummary
VertexAttributeof(ShaderBuiltin builtin) factoryReturns the attribute that feeds a built-in input of the shader, or null when the built-in is not a vertex attribute.

ReturnsSignatureSummary
ShaderBuiltingetBuiltin()Returns the built-in input of the shader that receives the attribute.
intgetLocation()Returns the location of the attribute in the vertex input of the shader.
intgetOffset()Returns the offset of the attribute in a vertex, in bytes.
intgetComponents()Returns the number of components of the attribute.
VertexComponentgetComponent()Returns the type of each component.
booleanisNormalized()If true, the integer components reach the shader scaled to 0 to 1 when unsigned, or -1 to 1 when signed.
ValueSummary
POSITIONThe position: three floats at offset 0, location 0.
TEXTURE_COORDINATEThe texture coordinate: two floats at offset 12, location 1.
COLORThe color: four normalized unsigned bytes, red, green, blue then alpha, at offset 20, location 2.
NORMALThe normal: three normalized signed bytes at offset 24, location 3.

VertexAttribute of(ShaderBuiltin builtin) factory

Returns the attribute that feeds a built-in input of the shader, or null when the built-in is not a vertex attribute.

ShaderBuiltin getBuiltin()

Returns the built-in input of the shader that receives the attribute.

int getLocation()

Returns the location of the attribute in the vertex input of the shader.

int getOffset()

Returns the offset of the attribute in a vertex, in bytes.

int getComponents()

Returns the number of components of the attribute.

VertexComponent getComponent()

Returns the type of each component.

boolean isNormalized()

If true, the integer components reach the shader scaled to 0 to 1 when unsigned, or -1 to 1 when signed.

POSITION

The position: three floats at offset 0, location 0.

TEXTURE_COORDINATE

The texture coordinate: two floats at offset 12, location 1.

COLOR

The color: four normalized unsigned bytes, red, green, blue then alpha, at offset 20, location 2.

NORMAL

The normal: three normalized signed bytes at offset 24, location 3.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page