APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics

public final Class VertexAttributes

extends Object
implements Iterable<VertexAttribute>, Comparable<VertexAttributes>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, java.lang.Iterable
Imports
java.util.Iterator, .NoSuchElementException, com.badlogic.gdx.utils.Collections, .GdxRuntimeException

Instances of this class specify the vertex attributes of a mesh. VertexAttributes are used by Mesh instances to define its vertex structure. Vertex attributes have an order. The order is specified by the order they are added to this class.
Author
mzechner, Xoppa

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
public static class
VertexAttributes.Usage

The usage of a vertex attribute.

Field Summary

Modifier and TypeField and Description
private final VertexAttribute[]
attributes

the attributes in the order they were specified

private int
boneWeightUnits

cache for bone weight units.

private VertexAttributes.ReadonlyIterable<VertexAttribute>
private long
mask

cache of the value calculated by getMask()

private int
textureCoordinates

cache for texture coordinate units.

public final int
vertexSize

the size of a single vertex in bytes

Constructor Summary

AccessConstructor and Description
public
VertexAttributes(VertexAttribute... attributes)

Constructor, sets the vertex attributes in a specific order

Method Summary

Modifier and TypeMethod and Description
private int
public int
compareTo(VertexAttributes o)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
equals(final Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public VertexAttribute
findByUsage(int
The usage of the VertexAttribute to find.
usage
)

Returns the first VertexAttribute for the given usage.

public VertexAttribute
get(int
the index
index
)

Returns: the VertexAttribute at the given index

public int
getBoneWeights()

Returns: Number of bone weights based on VertexAttribute#unit

public long

Returns:

the mask
getMask
()

Calculates a mask based on the contained VertexAttribute instances.

public long

Returns:

the mask with attributes count packed into the last 32 bits.
getMaskWithSizePacked
()

Calculates the mask based on VertexAttributes#getMask() and packs the attributes count into the last 32 bits.

public int
getOffset(int
The usage of the VertexAttribute.
usage
,
int defaultIfNotFound)

Returns the offset for the first VertexAttribute with the specified usage.

public int
getOffset(int
The usage of the VertexAttribute.
usage
)

Returns the offset for the first VertexAttribute with the specified usage.

public int
getTextureCoordinates()

Returns: Number of texture coordinates based on VertexAttribute#unit

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public Iterator<VertexAttribute>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public int
size()

Returns: the number of attributes

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

attributesback to summary
private final VertexAttribute[] attributes

the attributes in the order they were specified

boneWeightUnitsback to summary
private int boneWeightUnits

cache for bone weight units.

iterableback to summary
private VertexAttributes.ReadonlyIterable<VertexAttribute> iterable
maskback to summary
private long mask

cache of the value calculated by getMask()

textureCoordinatesback to summary
private int textureCoordinates

cache for texture coordinate units.

vertexSizeback to summary
public final int vertexSize

the size of a single vertex in bytes

Constructor Detail

VertexAttributesback to summary
public VertexAttributes(VertexAttribute... attributes)

Constructor, sets the vertex attributes in a specific order

Method Detail

calculateOffsetsback to summary
private int calculateOffsets()
compareToback to summary
public int compareTo(VertexAttributes o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
findByUsageback to summary
public VertexAttribute findByUsage(int usage)

Returns the first VertexAttribute for the given usage.

Parameters
usage:int

The usage of the VertexAttribute to find.

getback to summary
public VertexAttribute get(int index)
Parameters
index:int

the index

Returns:VertexAttribute

the VertexAttribute at the given index

getBoneWeightsback to summary
public int getBoneWeights()
Returns:int

Number of bone weights based on VertexAttribute#unit

getMaskback to summary
public long getMask()

Calculates a mask based on the contained VertexAttribute instances. The mask is a bit-wise or of each attributes VertexAttribute#usage.

Returns:long

the mask

getMaskWithSizePackedback to summary
public long getMaskWithSizePacked()

Calculates the mask based on VertexAttributes#getMask() and packs the attributes count into the last 32 bits.

Returns:long

the mask with attributes count packed into the last 32 bits.

getOffsetback to summary
public int getOffset(int usage, int defaultIfNotFound)

Returns the offset for the first VertexAttribute with the specified usage.

Parameters
usage:int

The usage of the VertexAttribute.

getOffsetback to summary
public int getOffset(int usage)

Returns the offset for the first VertexAttribute with the specified usage.

Parameters
usage:int

The usage of the VertexAttribute.

getTextureCoordinatesback to summary
public int getTextureCoordinates()
Returns:int

Number of texture coordinates based on VertexAttribute#unit

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
iteratorback to summary
public Iterator<VertexAttribute> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
See Also
Collections#allocateIterators
sizeback to summary
public int size()
Returns:int

the number of attributes

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

com.badlogic.gdx.graphics back to summary

private Class VertexAttributes.ReadonlyIterable<T>

extends Object
implements Iterable<T>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable

Field Summary

Modifier and TypeField and Description
private final T[]
private VertexAttributes.ReadonlyIterator<T>
private VertexAttributes.ReadonlyIterator<T>

Constructor Summary

AccessConstructor and Description
public
ReadonlyIterable(T[] array)

Method Summary

Modifier and TypeMethod and Description
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private final T[] array
iterator1back to summary
private VertexAttributes.ReadonlyIterator<T> iterator1
iterator2back to summary
private VertexAttributes.ReadonlyIterator<T> iterator2

Constructor Detail

ReadonlyIterableback to summary
public ReadonlyIterable(T[] array)

Method Detail

iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
com.badlogic.gdx.graphics back to summary

private Class VertexAttributes.ReadonlyIterator<T>

extends Object
implements Iterator<T>, Iterable<T>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable, java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final T[]
pack-priv int
pack-priv boolean

Constructor Summary

AccessConstructor and Description
public
ReadonlyIterator(T[] array)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private final T[] array
indexback to summary
pack-priv int index
validback to summary
pack-priv boolean valid

Constructor Detail

ReadonlyIteratorback to summary
public ReadonlyIterator(T[] array)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
resetback to summary
public void reset()
com.badlogic.gdx.graphics back to summary

public final Class VertexAttributes.Usage

extends Object
Class Inheritance

The usage of a vertex attribute.
Author
mzechner

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BiNormalback to summary
public static final int BiNormal
BoneWeightback to summary
public static final int BoneWeight
ColorPackedback to summary
public static final int ColorPacked
ColorUnpackedback to summary
public static final int ColorUnpacked
Genericback to summary
public static final int Generic
Normalback to summary
public static final int Normal
Positionback to summary
public static final int Position
Tangentback to summary
public static final int Tangent
TextureCoordinatesback to summary
public static final int TextureCoordinates

Constructor Detail

Usageback to summary
public Usage()