jubilant-funicular
|
#include <SpriteBatch.h>
Public Member Functions | |
SpriteBatch () | |
constructor and destructor | |
void | init () |
initializes the batch | |
void | begin () |
begins collection of glyphs for the batch | |
void | end () |
ends collection of glyphs and prepares to render | |
void | addGlyph (crvec4 posRect, GLuint texture=0, crvec4 uvRect=glm::vec4(0, 0, 1, 1), crvec4 color=glm::vec4(1), float depth=0.5) |
void | addGlyph (crvec4 posRect, crvec4 uvRect, GLuint texture, float depth=0.5, crvec4 color=glm::vec4(1)) |
void | addGlyph (crvec2 corner1, crvec2 corner2, crvec4 uvRect, GLuint texture, float depth=0.5, crvec4 color=glm::vec4(1)) |
void | addGlyph (crvec4 posRect, crvec4 uvRect, GLuint texture, crvec4 color, float angle=0.0f, float depth=0.5) |
void | addGlyph (crvec2 corner1, crvec2 corner2, crvec4 uvRect, GLuint texture, crvec4 color, float angle=0.0f, float depth=0.5) |
void | render () const |
renders the batch | |
Private Member Functions | |
void | createVertexArrayObject () |
creates the vertex array object | |
void | createRenderBatches () |
creates the render batches | |
void | sortGlyphs () |
sorts the glyphs | |
Static Private Member Functions | |
static bool | compareTexture (Glyph *lhs, Glyph *rhs) |
comparers used to sort | |
static bool | compareDepth (Glyph *lhs, Glyph *rhs) |
Private Attributes | |
std::vector< Glyph * > | m_glyphPointers |
pointers to the glyphs to be rendered (used for sorting) | |
std::vector< Glyph > | m_glyphs |
the glyphs to be rendered (used for fast vector operations) | |
std::vector< RenderBatch > | m_renderBatches |
the render batches used for rendering the glyphs | |
GLuint | m_vao = 0 |
ids of the vertex buffer object and vertex array object used to render the glyphs | |
GLuint | m_vbo = 0 |
represents a collection of sprites to be drawn
If you want to draw a shape other than a square, use PrimitiveBatch instead
Allow for custom vertex types (Important)
Rewrite to use glDrawElements instead of glDrawArrays
Definition at line 87 of file SpriteBatch.h.
void nta::SpriteBatch::addGlyph | ( | crvec4 | posRect, |
GLuint | texture = 0 , |
||
crvec4 | uvRect = glm::vec4(0,0,1,1) , |
||
crvec4 | color = glm::vec4(1) , |
||
float | depth = 0.5 |
||
) |
adds a glyph to the batch
Definition at line 100 of file SpriteBatch.cpp.
Referenced by nta::ParticleBatch2D::draw(), nta::SpriteFont::drawText(), and nta::SpriteFont::drawTexture().