blob: d1c4d7a1990674aaef6d30e7581e70a58696a857 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifndef spritebatch_h
#define spritebatch_h
#include <iostream>
#include <vector>
#include <GL/glew.h>
#include "geoshader.hpp"
#include "dna.hpp"
class RenderBatch {
public:
RenderBatch(GLuint Offset, GLuint NumVertices) : offset(Offset),
numVertices(NumVertices){}
GLuint offset;
GLuint numVertices;
};
class SpriteBatch
{
public:
SpriteBatch(GeoShader theshader);
void init();
void begin();
void end();
void draw(Rectangle r, DNA::Visuals v);
void renderBatch();
private:
void createRenderBatches();
void createVertexArray();
GLuint _vbo;
GLuint _vao;
std::vector<std::pair<Rectangle,DNA::Visuals>*> _gfxPtr;
std::vector<std::pair<Rectangle,DNA::Visuals>> _gfx;
std::vector<RenderBatch> _renderBatches;
GeoShader shader;
};
#endif
|