17 #ifndef ATTRIBUTEARRAY_H
18 #define ATTRIBUTEARRAY_H
44 Iterator(GLbyte* ptr,
int stride) : mPtr(ptr), mStride(stride) {
53 return mPtr == other.mPtr;
114 GLbyte* mPtr =
nullptr;
141 mArrayBase(arrayBase),
143 mAttribute(attribute) {
166 assert(
isValid() && index >= 0 && index < mCount);
167 return *(
const T*) (mArrayBase + mStride * index);
175 assert(
isValid() && index >= 0 && index < mCount);
176 return *(T*) (mArrayBase + mStride * index);
184 return Iterator(mArrayBase, mStride);
191 return Iterator(mArrayBase, mStride);
198 return Iterator(mArrayBase + mStride * mCount, mStride);
205 return Iterator(mArrayBase + mStride * mCount, mStride);
221 GLbyte* mArrayBase =
nullptr;
226 #endif // ATTRIBUTEARRAY_H
bool isValid() const
Returns whether this attribute array points to a valid array and can be accessed. ...
Definition: AttributeArray.h:153
Iterator end()
Gets an iterator pointing to immediately beyond the last element of the array.
Definition: AttributeArray.h:203
Header declaring and including types common to renderer classes such as Vector2. Also includes GL hea...
Iterator begin()
Gets an iterator pointing to the beginning of the array.
Definition: AttributeArray.h:189
void operator--()
Moves this iterator back one element.
Definition: AttributeArray.h:104
const T & operator*() const
Returns a constant reference to the current element.
Definition: AttributeArray.h:69
const T & operator[](int index) const
Gets a constant reference to the element at the given index.
Definition: AttributeArray.h:165
The definition of a vertex attribute, such as a position vector, or a texture coordinate.
Definition: Attribute.h:31
void operator++()
Moves this iterator forward one element.
Definition: AttributeArray.h:92
T * operator->()
Arrow operator dereferencing the current element.
Definition: AttributeArray.h:85
AttributeArray< Y > getAsType() const
Reinterprets this array as an array of a different type.
Definition: AttributeArray.h:216
Iterator iterator
Definition: AttributeArray.h:121
An iterator over a vertex attribute array.
Definition: AttributeArray.h:37
Iterator(GLbyte *ptr, int stride)
Construct an iterator.
Definition: AttributeArray.h:44
AttributeArray()
Constructs an attribute array which is marked as invalid.
Definition: AttributeArray.h:130
const Iterator end() const
Gets a const iterator pointing to immediately beyond the last element of the array.
Definition: AttributeArray.h:196
bool operator==(const Iterator &other) const
Compares two iterators to test if they point to the same element.
Definition: AttributeArray.h:52
bool operator!=(const Iterator &other) const
Compares two iterators to test if they do not point to the same element.
Definition: AttributeArray.h:61
const Attribute * getAttribute() const
Gets the definition of the attributes in this array.
Definition: AttributeArray.h:158
const Iterator begin() const
Gets a const iterator pointing to the beginning of the array.
Definition: AttributeArray.h:182
AttributeArray(int count, GLbyte *arrayBase, int stride, const Attribute *attribute)
Constructs an attribute array which points to a buffer in memory.
Definition: AttributeArray.h:139
const Iterator const_iterator
Definition: AttributeArray.h:125
A helper class to access and iterate over an interleaved vertex attribute array.
Definition: AttributeArray.h:31