public final class VertexAttribute extends Object
VertexAttributes.Usage
, its number of components and its shader alias. The Usage is used
for uniquely identifying the vertex attribute from among its VertexAttributes siblings. The number of components
defines how many components the attribute has. The alias defines to which shader attribute this attribute should bind. The alias
is used by a Mesh
when drawing with a ShaderProgram
. The alias can be changed at any time.Modifier and Type | Field and Description |
---|---|
String |
alias
the alias for the attribute used in a
ShaderProgram |
boolean |
normalized
For fixed types, whether the values are normalized to either -1f and +1f (signed) or 0f and +1f (unsigned)
|
int |
numComponents
the number of components this attribute has
|
int |
offset
the offset of this attribute in bytes, don't change this!
|
int |
type
the OpenGL type of each component, e.g.
|
int |
unit
optional unit/index specifier, used for texture coordinates and bone weights
|
int |
usage
The attribute
VertexAttributes.Usage , used for identification. |
Constructor and Description |
---|
VertexAttribute(int usage,
int numComponents,
int type,
boolean normalized,
String alias)
Constructs a new VertexAttribute.
|
VertexAttribute(int usage,
int numComponents,
int type,
boolean normalized,
String alias,
int unit)
Constructs a new VertexAttribute.
|
VertexAttribute(int usage,
int numComponents,
String alias)
Constructs a new VertexAttribute.
|
VertexAttribute(int usage,
int numComponents,
String alias,
int unit)
Constructs a new VertexAttribute.
|
Modifier and Type | Method and Description |
---|---|
static VertexAttribute |
Binormal() |
static VertexAttribute |
BoneWeight(int unit) |
static VertexAttribute |
ColorPacked() |
static VertexAttribute |
ColorUnpacked() |
VertexAttribute |
copy() |
boolean |
equals(Object obj)
Tests to determine if the passed object was created with the same parameters
|
boolean |
equals(VertexAttribute other) |
int |
getKey() |
int |
getSizeInBytes() |
int |
hashCode() |
static VertexAttribute |
Normal() |
static VertexAttribute |
Position() |
static VertexAttribute |
Tangent() |
static VertexAttribute |
TexCoords(int unit) |
public final int usage
VertexAttributes.Usage
, used for identification.public final int numComponents
public final boolean normalized
public final int type
GL20.GL_FLOAT
or GL20.GL_UNSIGNED_BYTE
public int offset
public String alias
ShaderProgram
public int unit
public VertexAttribute(int usage, int numComponents, String alias)
usage
- The attribute VertexAttributes.Usage
, used to select the type
and for identification.numComponents
- the number of components of this attribute, must be between 1 and 4.alias
- the alias used in a shader for this attribute. Can be changed after construction.public VertexAttribute(int usage, int numComponents, String alias, int unit)
usage
- The attribute VertexAttributes.Usage
, used to select the type
and for identification.numComponents
- the number of components of this attribute, must be between 1 and 4.alias
- the alias used in a shader for this attribute. Can be changed after construction.unit
- Optional unit/index specifier, used for texture coordinates and bone weightspublic VertexAttribute(int usage, int numComponents, int type, boolean normalized, String alias)
usage
- The attribute VertexAttributes.Usage
, used for identification.numComponents
- the number of components of this attribute, must be between 1 and 4.type
- the OpenGL type of each component, e.g. GL20.GL_FLOAT
or GL20.GL_UNSIGNED_BYTE
. Since Mesh
stores vertex data in 32bit floats, the total size of this attribute (type size times number of components) must be a
multiple of four.normalized
- For fixed types, whether the values are normalized to either -1f and +1f (signed) or 0f and +1f (unsigned)alias
- The alias used in a shader for this attribute. Can be changed after construction.public VertexAttribute(int usage, int numComponents, int type, boolean normalized, String alias, int unit)
usage
- The attribute VertexAttributes.Usage
, used for identification.numComponents
- the number of components of this attribute, must be between 1 and 4.type
- the OpenGL type of each component, e.g. GL20.GL_FLOAT
or GL20.GL_UNSIGNED_BYTE
. Since Mesh
stores vertex data in 32bit floats, the total size of this attribute (type size times number of components) must be a
multiple of four bytes.normalized
- For fixed types, whether the values are normalized to either -1f and +1f (signed) or 0f and +1f (unsigned)alias
- The alias used in a shader for this attribute. Can be changed after construction.unit
- Optional unit/index specifier, used for texture coordinates and bone weightspublic VertexAttribute copy()
offset
is not copied and must
be recalculated, as is typically done by the VertexAttributes that owns the VertexAttribute.public static VertexAttribute Position()
public static VertexAttribute TexCoords(int unit)
public static VertexAttribute Normal()
public static VertexAttribute ColorPacked()
public static VertexAttribute ColorUnpacked()
public static VertexAttribute Tangent()
public static VertexAttribute Binormal()
public static VertexAttribute BoneWeight(int unit)
public boolean equals(Object obj)
public boolean equals(VertexAttribute other)
public int getKey()
public int getSizeInBytes()
Copyright © 2019. All rights reserved.