jubilant-funicular
|
represents a collection of primitives to be drawn More...
#include <PrimitiveBatch.h>
Public Member Functions | |
PrimitiveBatch () | |
constructor and destructor | |
int | numPrimitives () const |
returns number of primitives to be rendered | |
void | init () |
initializes the batch | |
void | begin () |
begins collection of primitive | |
void | end () |
ends collection of primitive and prepares for rendering | |
void | addPrimitive (Primitive *primitive) |
adds a primitive to the batch | |
void | addPrimitive (const std::initializer_list< Vertex2D > &vertices, GLuint textureID=-1, float depth=NTA_DEFAULT_DEPTH) |
template<class Iterator > | |
void | addPrimitive (Iterator first, Iterator last, GLuint textureID=-1, float depth=NTA_DEFAULT_DEPTH) |
void | addPrimitive (std::size_t numSides, crvec2 center=glm::vec2(0), float sideLength=1.0, crvec4 color=glm::vec4(1), float orientation=0., float depth=NTA_DEFAULT_DEPTH) |
void | render () const |
renders the primitives | |
Private Member Functions | |
void | createVertexArrayObject () |
creates vertex array object | |
void | createRenderBatches () |
creates render batches More... | |
void | sortPrimitives () |
sorts primitives | |
GLenum | toPrimitiveType (unsigned int numVertices) const |
return primitive to be drawn | |
Static Private Member Functions | |
static bool | compareTexture (Primitive *lhs, Primitive *rhs) |
comparers used for sorting | |
static bool | comparePrimitive (Primitive *lhs, Primitive *rhs) |
static bool | compareDepth (Primitive *lhs, Primitive *rhs) |
Private Attributes | |
std::vector< Primitive * > | m_primitives |
std::vector< RenderBatch > | m_renderBatches |
the render batches used to draw the primitives | |
GLuint | m_vao = 0 |
ids for the vertex buffer object and vertex array object used for rendering | |
GLuint | m_vbo = 0 |
represents a collection of primitives to be drawn
Definition at line 46 of file PrimitiveBatch.h.
|
private |
creates render batches
Definition at line 86 of file PrimitiveBatch.cpp.
Referenced by end().
|
private |
the primitives to be drawn
Definition at line 62 of file PrimitiveBatch.h.
Referenced by addPrimitive(), begin(), createRenderBatches(), numPrimitives(), and sortPrimitives().