Enum Class VertexAttribute
- All Implemented Interfaces:
Serializable,Comparable<VertexAttribute>,Constable
location pairs each attribute with a shader input
(layout(location = ...)), so meshes and material shaders agree without
per-material wiring.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPer-vertex tint in linear RGBA (not sRGB), with glTFCOLOR_0semantics, multiplied into the material's base colour, its alpha, and its emissive.Four per-vertex floats with no fixed meaning, reaching the surface function asv_params.Four more of the same, reaching the surface function asv_params1.A second texture coordinate set: glTFTEXCOORD_1. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intNumber of float components.final intShader input location (matcheslayout(location = ...)). -
Method Summary
Modifier and TypeMethodDescriptionstatic VertexAttributeReturns the enum constant of this class with the specified name.static VertexAttribute[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
POSITION
-
NORMAL
-
UV0
-
COLOR
Per-vertex tint in linear RGBA (not sRGB), with glTFCOLOR_0semantics, multiplied into the material's base colour, its alpha, and its emissive. Not clamped: a component above 1 is a legitimate over-range tint, and routing it through emissive is what lets one draw call carry a different HDR colour per vertex. A mesh without this attribute shades as if every vertex were opaque white. -
UV1
A second texture coordinate set: glTFTEXCOORD_1. Reaches the surface function asv_uv1; the built-in materials ignore it, so it costs a mesh that carries it nothing but the bandwidth.What it is for is anything that samples one texture at two places and combines the results: a lightmap beside a detail map, a terrain blend, or the cross-fade between two cells of a sprite sheet. A mesh without it reads
(0, 0). -
PARAMS
Four per-vertex floats with no fixed meaning, reaching the surface function asv_params. The built-in materials never read them.This is the custom vertex stream every renderer eventually grows, and it exists because the alternative is worse: an application that needs one more number per vertex otherwise smuggles it through a channel that already means something (a colour component, an unused UV), and every later reader has to know. A mesh without it reads
(0, 0, 0, 0), so zero should be the identity of whatever a surface decides these mean.Only useful together with
Material.Surface: nothing else can read them. -
PARAMS1
Four more of the same, reaching the surface function asv_params1.A second stream rather than a wider first one, which is the whole decision here. Widening
PARAMSto eight floats would cost every mesh that carries it four floats per vertex it does not use, and a vertex attribute is at most four components in the shading languages this compiles to; eight would be two inputs whatever the enum said, so the only question is whether an application can decline the second one. It can, this way.It exists because
PARAMS's own argument does not stop at four. An application that runs out smuggles the fifth number through a channel that already means something, and every later reader has to know; that is exactly as true of the fifth as it was of the first. A mesh without this reads(0, 0, 0, 0), so zero should again be the identity.Reach for
PARAMSfirst and fill it. Two half-used streams cost bandwidth that one full one does not.
-
-
Field Details
-
location
public final int locationShader input location (matcheslayout(location = ...)). -
components
public final int componentsNumber of float components.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-