diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-03 13:26:37 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-03 13:27:23 +0000 |
commit | 86e4aa6265ade205aba94494a7a31a83b5686387 (patch) | |
tree | d7f9998b55d3fcc2b083242086afd05c1d436b6e /yage/render/spritebatch.h | |
parent | 9038ee45f93b1ae07a28a516781676ebe3a67536 (diff) | |
download | YAGE-86e4aa6265ade205aba94494a7a31a83b5686387.tar.gz YAGE-86e4aa6265ade205aba94494a7a31a83b5686387.zip |
[Engine] [Example] Reenabled vsync and working on example.
Diffstat (limited to 'yage/render/spritebatch.h')
-rw-r--r-- | yage/render/spritebatch.h | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/yage/render/spritebatch.h b/yage/render/spritebatch.h index 35d9a1b1..fb9f6337 100644 --- a/yage/render/spritebatch.h +++ b/yage/render/spritebatch.h @@ -9,7 +9,6 @@ #ifndef YAGE_SPRITE_BATCH_H #define YAGE_SPRITE_BATCH_H -#include "../data/renderbatch.h" #include "../data/vertex.h" #include "batch.h" @@ -21,33 +20,42 @@ namespace yage { -class SpriteBatch; +namespace details +{ + +struct RenderBatch { + GLint offset; + GLsizei num_vertices; + GLuint texture; + + RenderBatch(GLint offset_i, GLsizei num_vertices_i, GLuint texture_i) + : offset(offset_i), num_vertices(num_vertices_i), texture(texture_i) + { + } +}; /** Glyph with information of the texture. */ -class Glyph -{ -private: - GLuint texture_; - float depth_; - Vertex top_left_; - Vertex top_right_; - Vertex bottom_right_; - Vertex bottom_left_; - -public: - Glyph(GLuint texture, float depth, const Vertex &top_left, - const Vertex &top_right, const Vertex &bottom_right, - const Vertex &bottom_left); - - GLuint texture() const { return texture_; } - float depth() const { return depth_; } - Vertex top_left() const { return top_left_; } - Vertex top_right() const { return top_right_; } - Vertex bottom_right() const { return bottom_right_; } - Vertex bottom_left() const { return bottom_left_; } +struct Glyph { + GLuint texture; + float depth; + Vertex top_left; + Vertex top_right; + Vertex bottom_right; + Vertex bottom_left; + + Glyph(GLuint texture_i, float depth_i, const Vertex &top_left_i, + const Vertex &top_right_i, const Vertex &bottom_right_i, + const Vertex &bottom_left_i) + : texture(texture_i), depth(depth_i), top_left(top_left_i), + top_right(top_right_i), bottom_right(bottom_right_i), + bottom_left(bottom_left_i) + { + } }; +} // namespace details + class SpriteBatch { public: @@ -56,9 +64,9 @@ public: private: GLuint vao_; GLuint vbo_; - std::vector<Glyph> glyphs_; - std::vector<Glyph *> glyph_ptrs_; - std::vector<RenderBatch> render_batches_; + std::vector<details::Glyph> glyphs_; + std::vector<details::Glyph *> glyph_ptrs_; + std::vector<details::RenderBatch> render_batches_; public: SpriteBatch(); |