Package com.badlogic.gdx.graphics
Class VertexAttributes
- java.lang.Object
-
- com.badlogic.gdx.graphics.VertexAttributes
-
- All Implemented Interfaces:
java.lang.Comparable<VertexAttributes>,java.lang.Iterable<VertexAttribute>
public final class VertexAttributes extends java.lang.Object implements java.lang.Iterable<VertexAttribute>, java.lang.Comparable<VertexAttributes>
Instances of this class specify the vertex attributes of a mesh. VertexAttributes are used byMeshinstances to define its vertex structure. Vertex attributes have an order. The order is specified by the order they are added to this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVertexAttributes.UsageThe usage of a vertex attribute.
-
Field Summary
Fields Modifier and Type Field Description intvertexSizethe size of a single vertex in bytes
-
Constructor Summary
Constructors Constructor Description VertexAttributes(VertexAttribute... attributes)Constructor, sets the vertex attributes in a specific order
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(VertexAttributes o)booleanequals(java.lang.Object obj)VertexAttributefindByUsage(int usage)Returns the first VertexAttribute for the given usage.VertexAttributeget(int index)intgetBoneWeights()longgetMask()Calculates a mask based on the containedVertexAttributeinstances.longgetMaskWithSizePacked()Calculates the mask based ongetMask()and packs the attributes count into the last 32 bits.intgetOffset(int usage)Returns the offset for the first VertexAttribute with the specified usage.intgetOffset(int usage, int defaultIfNotFound)Returns the offset for the first VertexAttribute with the specified usage.intgetTextureCoordinates()inthashCode()java.util.Iterator<VertexAttribute>iterator()intsize()java.lang.StringtoString()
-
-
-
Constructor Detail
-
VertexAttributes
public VertexAttributes(VertexAttribute... attributes)
Constructor, sets the vertex attributes in a specific order
-
-
Method Detail
-
getOffset
public int getOffset(int usage, int defaultIfNotFound)Returns the offset for the first VertexAttribute with the specified usage.- Parameters:
usage- The usage of the VertexAttribute.
-
getOffset
public int getOffset(int usage)
Returns the offset for the first VertexAttribute with the specified usage.- Parameters:
usage- The usage of the VertexAttribute.
-
findByUsage
public VertexAttribute findByUsage(int usage)
Returns the first VertexAttribute for the given usage.- Parameters:
usage- The usage of the VertexAttribute to find.
-
size
public int size()
- Returns:
- the number of attributes
-
get
public VertexAttribute get(int index)
- Parameters:
index- the index- Returns:
- the VertexAttribute at the given index
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getMask
public long getMask()
Calculates a mask based on the containedVertexAttributeinstances. The mask is a bit-wise or of each attributesVertexAttribute.usage.- Returns:
- the mask
-
getMaskWithSizePacked
public long getMaskWithSizePacked()
Calculates the mask based ongetMask()and packs the attributes count into the last 32 bits.- Returns:
- the mask with attributes count packed into the last 32 bits.
-
getBoneWeights
public int getBoneWeights()
- Returns:
- Number of bone weights based on
VertexAttribute.unit
-
getTextureCoordinates
public int getTextureCoordinates()
- Returns:
- Number of texture coordinates based on
VertexAttribute.unit
-
compareTo
public int compareTo(VertexAttributes o)
- Specified by:
compareToin interfacejava.lang.Comparable<VertexAttributes>
-
iterator
public java.util.Iterator<VertexAttribute> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<VertexAttribute>- See Also:
Collections.allocateIterators
-
-