Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::MultiDrawElementsBase Class Referenceabstract

Base interface for all MultiDrawElements* sub classes. More...

#include <MultiDrawElements.hpp>

+ Inheritance diagram for vl::MultiDrawElementsBase:

Public Member Functions

virtual bool primitiveRestartEnabled () const
 Returns whether the primitive-restart functionality is enabled or not. More...
 
void setPrimitiveRestartEnabled (bool enabled)
 Enables the primitive-restart functionality. More...
 
void finalizeSetup ()
 Calls computePointerVector(), computeBufferObjectPointerVector() and resizes the base vertex array to fit the count vector. More...
 
void setCountVector (const std::vector< GLsizei > &vcount)
 Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements(). More...
 
void setCountVector (const GLsizei *vcount, size_t size)
 Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements(). More...
 
const std::vector< GLsizei > & countVector () const
 The count vector used as 'count' parameter of glMultiDrawElements. More...
 
std::vector< GLsizei > & countVector ()
 The count vector used as 'count' parameter of glMultiDrawElements. More...
 
void setBaseVertices (const std::vector< GLint > &base_verts)
 Returns the list of base vertices, one for each primitive. More...
 
const std::vector< GLint > & baseVertices () const
 Returns the list of base vertices, one for each primitive. More...
 
std::vector< GLint > & baseVertices ()
 Returns the list of base vertices, one for each primitive. More...
 
virtual void computePointerVector ()=0
 Computes the pointer vector to be used when BufferObjects are DISABLED. More...
 
virtual void computeBufferObjectPointerVector ()=0
 Computes the pointer vector to be used when BufferObjects are ENABLED. More...
 
- Public Member Functions inherited from vl::DrawCall
 DrawCall ()
 Constructor. More...
 
DrawCalloperator= (const DrawCall &other)
 Assignment operator. More...
 
void setPrimitiveType (EPrimitiveType type)
 Sets the draw call's primitive type. More...
 
EPrimitiveType primitiveType () const
 Returns the draw call's primitive type. More...
 
virtual void render (bool use_bo=true) const =0
 Executes the draw call. More...
 
virtual ref< DrawCallclone () const =0
 Returns a clone of the draw call. More...
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode)=0
 Updates the index buffer's BufferObject if marked as dirty. More...
 
virtual void deleteBufferObject ()=0
 Deletes the index buffer's BufferObject. More...
 
void setEnabled (bool enable)
 Enables/disables the draw call. More...
 
bool isEnabled () const
 True if the draw call is enabled. More...
 
virtual TriangleIterator triangleIterator () const =0
 Returns a TriangleIterator used to iterate through the triangles of a DrawCall. More...
 
virtual IndexIterator indexIterator () const =0
 Returns a IndexIterator used to iterate through the virtual indices of a DrawCall. More...
 
u32 countIndices () const
 Counts the number of virtual indices of a DrawCall., i.e. More...
 
u32 countTriangles () const
 Counts the number of virtual triangles of a DrawCall., i.e. More...
 
virtual int instances () const
 Returns the number of instances for this set of primitives. More...
 
virtual unsigned int primitiveRestartIndex ()
 Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported. More...
 
void setPatchParameter (PatchParameter *patch_param)
 Attach a PatchParameter to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
PatchParameterpatchParameter ()
 The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
const PatchParameterpatchParameter () const
 The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

bool mPrimitiveRestartEnabled
 
std::vector< GLsizei > mCountVector
 
std::vector< GLint > mBaseVertices
 
- Protected Attributes inherited from vl::DrawCall
ref< PatchParametermPatchParameter
 
EPrimitiveType mType
 
bool mEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::DrawCall
void applyPatchParameters () const
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

Base interface for all MultiDrawElements* sub classes.

Implements the index-type-independent interface of the class. That is you can cast to MultiDrawElementsBase* and access its members without needing to know whether the actual class is a vl::MultiDrawElementsUInt, vl::MultiDrawElementsUShort or vl::MultiDrawElementsUByte.

Definition at line 52 of file MultiDrawElements.hpp.

Member Function Documentation

◆ baseVertices() [1/2]

const std::vector<GLint>& vl::MultiDrawElementsBase::baseVertices ( ) const
inline

◆ baseVertices() [2/2]

std::vector<GLint>& vl::MultiDrawElementsBase::baseVertices ( )
inline

Returns the list of base vertices, one for each primitive.

Definition at line 108 of file MultiDrawElements.hpp.

References computeBufferObjectPointerVector(), computePointerVector(), and mBaseVertices.

◆ computeBufferObjectPointerVector()

virtual void vl::MultiDrawElementsBase::computeBufferObjectPointerVector ( )
pure virtual

Computes the pointer vector to be used when BufferObjects are ENABLED.

Call this function after having updated the count vector and the index buffer indexBuffer().

Note
Normally you don't need to call this function as setCountVector() already calls it.

Implemented in vl::MultiDrawElements< arr_type >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by baseVertices(), finalizeSetup(), and vlX::VLXClassWrapper_DrawCall::importDrawCall().

◆ computePointerVector()

virtual void vl::MultiDrawElementsBase::computePointerVector ( )
pure virtual

Computes the pointer vector to be used when BufferObjects are DISABLED.

Call this function after having updated the count vector and the index buffer indexBuffer().

Note
Normally you don't need to call this function as setCountVector() already calls it.

Implemented in vl::MultiDrawElements< arr_type >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by baseVertices(), finalizeSetup(), and vlX::VLXClassWrapper_DrawCall::importDrawCall().

◆ countVector() [1/2]

const std::vector<GLsizei>& vl::MultiDrawElementsBase::countVector ( ) const
inline

◆ countVector() [2/2]

std::vector<GLsizei>& vl::MultiDrawElementsBase::countVector ( )
inline

The count vector used as 'count' parameter of glMultiDrawElements.

Definition at line 97 of file MultiDrawElements.hpp.

References mCountVector.

◆ finalizeSetup()

void vl::MultiDrawElementsBase::finalizeSetup ( )
inline

Calls computePointerVector(), computeBufferObjectPointerVector() and resizes the base vertex array to fit the count vector.

Note
Must be called after the index buffer has been filled.

Definition at line 65 of file MultiDrawElements.hpp.

References computeBufferObjectPointerVector(), computePointerVector(), mBaseVertices, and mCountVector.

Referenced by setCountVector().

◆ primitiveRestartEnabled()

virtual bool vl::MultiDrawElementsBase::primitiveRestartEnabled ( ) const
inlinevirtual

◆ setBaseVertices()

void vl::MultiDrawElementsBase::setBaseVertices ( const std::vector< GLint > &  base_verts)
inline

Returns the list of base vertices, one for each primitive.

This will enable the use of glMultiDrawElementsBaseVertex() to render a set of primitives. See also http://www.opengl.org/sdk/docs/man3/xhtml/glMultiDrawElementsBaseVertex.xml

Definition at line 102 of file MultiDrawElements.hpp.

References mBaseVertices.

Referenced by vl::Geometry::shrinkDrawCalls().

◆ setCountVector() [1/2]

void vl::MultiDrawElementsBase::setCountVector ( const std::vector< GLsizei > &  vcount)
inline

Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements().

Note
Must be called after the index buffer has been filled.

Definition at line 77 of file MultiDrawElements.hpp.

References finalizeSetup(), and mCountVector.

Referenced by vl::DaeLoader::generateGeometry(), vl::Geometry::mergeDrawCallsWithMultiDrawElements(), vl::MultiDrawElements< ArrayUShort1 >::operator=(), and vl::Geometry::shrinkDrawCalls().

◆ setCountVector() [2/2]

void vl::MultiDrawElementsBase::setCountVector ( const GLsizei *  vcount,
size_t  size 
)
inline

Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements().

Note
Must be called after the index buffer has been filled.

Definition at line 85 of file MultiDrawElements.hpp.

References finalizeSetup(), and mCountVector.

◆ setPrimitiveRestartEnabled()

void vl::MultiDrawElementsBase::setPrimitiveRestartEnabled ( bool  enabled)
inline

Member Data Documentation

◆ mBaseVertices

std::vector<GLint> vl::MultiDrawElementsBase::mBaseVertices
protected

◆ mCountVector

std::vector<GLsizei> vl::MultiDrawElementsBase::mCountVector
protected

◆ mPrimitiveRestartEnabled

bool vl::MultiDrawElementsBase::mPrimitiveRestartEnabled
protected

The documentation for this class was generated from the following file: