32 #ifndef IndexIterator_INCLUDE_ONCE 33 #define IndexIterator_INCLUDE_ONCE 50 VL_DEBUG_SET_OBJECT_NAME()
53 virtual bool hasNext()
const = 0;
54 virtual bool next() = 0;
70 VL_DEBUG_SET_OBJECT_NAME()
73 int index() {
return mIterator->index(); }
74 bool hasNext() {
return mIterator->hasNext(); }
75 bool next() {
return mIterator->next(); }
92 VL_DEBUG_SET_OBJECT_NAME()
106 return mCurPos != mStart + mCount;
125 template<
class TArray>
133 VL_DEBUG_SET_OBJECT_NAME()
137 void initialize(
const TArray* idx_array,
const std::vector<GLint>* p_base_vertices,
const std::vector<GLsizei>* p_vert_counts,
138 int base_vert,
bool prim_restart_on,
unsigned int prim_restart_idx )
141 mBaseVert = base_vert;
142 mpBaseVertices = p_base_vertices;
143 mpVertCounts = p_vert_counts;
147 mPrimRestartEnabled = prim_restart_on;
148 mPrimRestartIdx = prim_restart_idx;
150 if (mArray && mArray->size())
152 mIndex = mArray->at(0) + mBaseVert;
158 VL_CHECK( p_base_vertices->size() == p_vert_counts->size() )
160 mBaseCount = (*p_vert_counts)[mBaseIdx];
162 mIndex = (*mpBaseVertices)[mBaseIdx];
168 return mCurPos != (int)mArray->size();
174 while( mCurPos < (
int)mArray->size() && mArray->at(mCurPos) == mPrimRestartIdx && mPrimRestartEnabled )
176 if ( mCurPos < (
int)mArray->size() )
178 mIndex = mArray->at(mCurPos) + mBaseVert;
186 mBaseCount = (*mpVertCounts)[mBaseIdx];
188 mIndex += (*mpBaseVertices)[mBaseIdx];
196 mCurPos = (int)mArray->size();
IndexIteratorDrawArrays()
Index iterator operating over DrawElements, DrawRangeElements and MultiDrawElements.
const std::vector< GLint > * mpBaseVertices
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
ref< IndexIteratorAbstract > mIterator
void initialize(int start, int count)
Visualization Library main namespace.
void initialize(IndexIteratorAbstract *iterator)
Abstract class used as base for all the index iterators specializations.
void initialize(const TArray *idx_array, const std::vector< GLint > *p_base_vertices, const std::vector< GLsizei > *p_vert_counts, int base_vert, bool prim_restart_on, unsigned int prim_restart_idx)
virtual bool hasNext() const
The base class for all the reference counted objects.
Index iterator operating used by DrawArrays.
const std::vector< GLsizei > * mpVertCounts
virtual bool hasNext() const
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
virtual bool hasNext() const =0
unsigned int mPrimRestartIdx
The ref<> class is used to reference-count an Object.
Wraps a IndexIteratorAbstract to iterate over the indices of a DrawCall.