diff options
Diffstat (limited to 'inc/opengl/spritebatch.hpp')
-rw-r--r-- | inc/opengl/spritebatch.hpp | 72 |
1 files changed, 27 insertions, 45 deletions
diff --git a/inc/opengl/spritebatch.hpp b/inc/opengl/spritebatch.hpp index 3ece593..94ca97c 100644 --- a/inc/opengl/spritebatch.hpp +++ b/inc/opengl/spritebatch.hpp @@ -9,55 +9,37 @@ class RenderBatch {
-public:
- RenderBatch(GLuint Offset, GLuint NumVertices) : offset(Offset),
- numVertices(NumVertices){
- }
- GLuint offset;
- GLuint numVertices;
- //GLuint texture;
+ public:
+ RenderBatch(GLuint Offset, GLuint NumVertices) : offset(Offset),
+ numVertices(NumVertices){}
+ GLuint offset;
+ GLuint numVertices;
};
-
class SpriteBatch
{
- public:
- SpriteBatch(GeoShader theshader);
- ~SpriteBatch();
- // Initializes the spritebatch
- void init();
- // Begins the spritebatch
- void begin();
- // Ends the spritebatch
- void end();
- // Adds a glyph to the spritebatch
- void draw(const GraphicsData& gfxData);
- // Renders the entire SpriteBatch to the screen
- void renderBatch();
-
- private:
- // Creates all the needed RenderBatches
- void createRenderBatches();
- // Generates our VAO and VBO
- void createVertexArray();
- // Sorts glyphs according to _sortType
- //void sortGlyphs();
- // Comparators used by sortGlyphs()
- //static bool compareFrontToBack(Glyph* a, Glyph* b);
- //static bool compareBackToFront(Glyph* a, Glyph* b);
- //static bool compareTexture(Glyph* a, Glyph* b);
-
- GLuint _vbo;
- GLuint _vao;
-
- //GlyphSortType _sortType;
-
- std::vector<GraphicsData*> _gfxPtr; ///< This is for sorting
- std::vector<GraphicsData> _gfx; ///< These are the actual glyphs
- std::vector<RenderBatch> _renderBatches;
-
- GeoShader shader;
-
+ public:
+ SpriteBatch(GeoShader theshader);
+ ~SpriteBatch();
+
+ void init();
+ void begin();
+ void end();
+ void draw(const GraphicsData& gfxData);
+ void renderBatch();
+
+ private:
+ void createRenderBatches();
+ void createVertexArray();
+
+ GLuint _vbo;
+ GLuint _vao;
+
+ std::vector<GraphicsData*> _gfxPtr; ///< This is for sorting
+ std::vector<GraphicsData> _gfx; ///< These are the actual glyphs
+ std::vector<RenderBatch> _renderBatches;
+
+ GeoShader shader;
};
#endif
|