diff options
Diffstat (limited to 'src/batch.hpp')
| -rw-r--r-- | src/batch.hpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/batch.hpp b/src/batch.hpp new file mode 100644 index 0000000..444a547 --- /dev/null +++ b/src/batch.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include <vector> + +#include "glad/glad.h" +#include <glm/glm.hpp> + +#include "texture.hpp" + +class Batch +{ + public: + unsigned int VAO, VBO, EBO; + std::vector<float> vertices = {}; + std::vector<unsigned int> indices = {}; + unsigned int size, batch_limit; + unsigned int last_texture = 0; + + Batch(unsigned int batch_limit = 8192); + int drawTexture( + Texture texture, + float x, + float y, + float width, + float height, + glm::vec4 color + ); + int drawRectangle( + float x, + float y, + float width, + float height, + glm::vec4 color + ); + void flush_batch(); + private: + int primativeDrawQuad( + unsigned int texture_id, + glm::vec3 a, + glm::vec3 b, + glm::vec3 c, + glm::vec3 d, + glm::vec4 color + ); +}; |
