32 #ifndef DrawRangeElements_INCLUDE_ONCE 33 #define DrawRangeElements_INCLUDE_ONCE 119 template <
class arr_type>
127 static const index_type primitive_restart_index = index_type(~0);
136 bool operator<(const Triangle<index_type>& b)
const 138 if (ABC[0] != b.ABC[0])
139 return ABC[0] < b.ABC[0];
141 if (ABC[1] != b.ABC[1])
142 return ABC[1] < b.ABC[1];
144 return ABC[2] < b.ABC[2];
149 { T tmp = ABC[0]; ABC[0] = ABC[1]; ABC[1] = ABC[2]; ABC[2] = tmp; }
151 { T tmp = ABC[0]; ABC[0] = ABC[1]; ABC[1] = ABC[2]; ABC[2] = tmp; }
158 VL_DEBUG_SET_OBJECT_NAME()
162 mIndexBuffer =
new arr_type;
171 super::operator=(other);
208 const arr_type*
indexBuffer()
const {
return mIndexBuffer.get(); }
213 indexBuffer()->updateBufferObject(mode);
218 indexBuffer()->bufferObject()->deleteBufferObject();
226 if ( !use_bo && !indexBuffer()->size() )
237 glPrimitiveRestartIndex(primitive_restart_index);
VL_CHECK_OGL();
242 const GLvoid* ptr = indexBuffer()->bufferObject()->ptr();
243 if (use_bo && indexBuffer()->bufferObject()->handle())
245 VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer()->bufferObject()->handle());
VL_CHECK_OGL()
250 VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
VL_CHECK_OGL()
255 const char*ptr_end =
NULL;
259 ptr_end = (
char*)ptr +
sizeof(index_type)*(use_bo ? indexBuffer()->sizeBufferObject() : indexBuffer()->size());
262 ptr = (
char*)ptr + mOffset;
267 ptr = (
char*)ptr + mOffset;
270 ptr_end = (
char*)ptr +
sizeof(index_type)*mCount;
274 const GLsizei count = (GLsizei)((index_type*)ptr_end - (index_type*)ptr);
349 VL_DEBUG_SET_OBJECT_NAME();
362 VL_DEBUG_SET_OBJECT_NAME();
375 VL_DEBUG_SET_OBJECT_NAME();
ref< arr_type > mIndexBuffer
void setBaseVertex(int base_vertex)
If base_vertx is != 0 glDrawRangeElementsBaseVertex/glDrawRangeElementsInstancedBaseVertex will be us...
virtual unsigned int primitiveRestartIndex()
Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported...
Index iterator operating over DrawElements, DrawRangeElements and MultiDrawElements.
void setIndexBuffer(arr_type *index_buffer)
The BufferObject containing the indices used to render.
IndexIterator indexIterator() const
Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.
int i32
32 bits signed integer
virtual void deleteBufferObject()
Deletes the index buffer's BufferObject.
DrawRangeElements(EPrimitiveType primitive=PT_TRIANGLES, int r_start=0, int r_end=primitive_restart_index)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Wrapper for the OpenGL function glDrawRangeElements().
u32 offset() const
The offset in bytes from which the index buffer will be read.
void setRangeStart(int rstart)
Sets the range start.
int rangeEnd() const
Returns the range end.
virtual bool primitiveRestartEnabled() const
Returns whether the primitive-restart functionality is enabled or not.
bool mPrimitiveRestartEnabled
Visualization Library main namespace.
void initialize(IndexIteratorAbstract *iterator)
void applyPatchParameters() const
i32 count() const
The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from of...
const arr_type * indexBuffer() const
The BufferObject containing the indices used to render.
virtual ref< DrawCall > clone() const
Returns a clone of the draw call.
unsigned int u32
32 bits unsigned integer
arr_type::scalar_type index_type
arr_type * indexBuffer()
The BufferObject containing the indices used to render.
Iterator used to extract the indices of every single triangle of a DrawCall regardless of the primiti...
DrawRangeElementsUShort(EPrimitiveType primitive=PT_TRIANGLES, int r_start=0, int r_end=GLushort(~0))
void setOffset(u32 offset)
The offset in bytes from which the index buffer will be read.
virtual void updateDirtyBufferObject(EBufferObjectUpdateMode mode)
Updates the index buffer's BufferObject if marked as dirty.
Base interface for all DrawRangeElements* sub classes.
void setRangeEnd(int rend)
Sets the range end.
int rangeStart() const
Returns the range start.
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements.
DrawRangeElementsUInt(EPrimitiveType primitive=PT_TRIANGLES, int r_start=0, int r_end=GLuint(~0))
void setCount(i32 count)
The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from of...
virtual IndexIterator indexIterator() const =0
Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.
DrawRangeElements & operator=(const DrawRangeElements &other)
virtual void render(bool use_bo) const
Executes the draw call.
bool Has_Primitive_Restart
The ref<> class is used to reference-count an Object.
Wraps a IndexIteratorAbstract to iterate over the indices of a DrawCall.
void setPrimitiveRestartEnabled(bool enabled)
Enables the primitive-restart functionality.
TriangleIterator triangleIterator() const
Returns a TriangleIterator used to iterate through the triangles of a DrawCall.
EPrimitiveType primitiveType() const
Returns the draw call's primitive type.
int baseVertex() const
Returns the currently used base vertex.
DrawRangeElementsUByte(EPrimitiveType primitive=PT_TRIANGLES, int r_start=0, int r_end=GLubyte(~0))