VoltAir
|
A helper class to access and iterate over an interleaved vertex attribute array. More...
Classes | |
class | Iterator |
An iterator over a vertex attribute array. More... | |
Public Types | |
typedef Iterator | iterator |
typedef const Iterator | const_iterator |
Public Member Functions | |
AttributeArray () | |
Constructs an attribute array which is marked as invalid. More... | |
AttributeArray (int count, GLbyte *arrayBase, int stride, const Attribute *attribute) | |
Constructs an attribute array which points to a buffer in memory. More... | |
bool | isValid () const |
Returns whether this attribute array points to a valid array and can be accessed. More... | |
const Attribute * | getAttribute () const |
Gets the definition of the attributes in this array. More... | |
const T & | operator[] (int index) const |
Gets a constant reference to the element at the given index. More... | |
T & | operator[] (int index) |
Gets a mutable reference to the element at the given index. More... | |
const Iterator | begin () const |
Gets a const iterator pointing to the beginning of the array. More... | |
Iterator | begin () |
Gets an iterator pointing to the beginning of the array. More... | |
const Iterator | end () const |
Gets a const iterator pointing to immediately beyond the last element of the array. More... | |
Iterator | end () |
Gets an iterator pointing to immediately beyond the last element of the array. More... | |
template<typename Y > | |
AttributeArray< Y > | getAsType () const |
Reinterprets this array as an array of a different type. More... | |
A helper class to access and iterate over an interleaved vertex attribute array.
Vertex data is stored as a list of packed vertices. Each vertex is defined by a set of attributes. This means that for any particular attribute, subsequent values are separated by the size of the vertex. This class helps deal with these discontigious arrays as iterable lists.
typedef const Iterator AttributeArray< T >::const_iterator |
A const iterator over the array.
typedef Iterator AttributeArray< T >::iterator |
A mutable iterator over the array.
|
inline |
Constructs an attribute array which is marked as invalid.
|
inline |
Constructs an attribute array which points to a buffer in memory.
count | Number of elements in the array |
arrayBase | Pointer to the first element in the array |
stride | Number of bytes between elements |
attribute | Pointer to the definition of the attributes in this array |
|
inline |
Gets a const iterator pointing to the beginning of the array.
|
inline |
Gets an iterator pointing to the beginning of the array.
|
inline |
Gets a const iterator pointing to immediately beyond the last element of the array.
|
inline |
Gets an iterator pointing to immediately beyond the last element of the array.
|
inline |
Reinterprets this array as an array of a different type.
This method allows the data in the array to be reinterpreted as a different C++ type. For example, if the data being accessed is a 2D float vector, this method can be used to get the array as an AttributeArray with custom 2D vector container elements.
|
inline |
Gets the definition of the attributes in this array.
|
inline |
Returns whether this attribute array points to a valid array and can be accessed.
If this attribute array was associated with a mesh, an invalid array indicates that the attribute requested did not exist in the mesh.
|
inline |
Gets a constant reference to the element at the given index.
index | Index of the element to get |
|
inline |
Gets a mutable reference to the element at the given index.
index | Index of the element to get |