SimpleGL  1.1.0
A framework for platform independent rendering
batching.hpp
Go to the documentation of this file.
1 
8 #ifndef BATCHING_HPP
9 #define BATCHING_HPP
10 
11 #include "SimpleGL_Export.h"
12 
13 #include <vector>
14 
15 #include <glm/glm.hpp>
16 
17 #include "transform.hpp"
18 
19 namespace sgl {
20 
26  class SIMPLEGL_EXPORT Batch {
27 
28  protected:
31 
33  bool drawing;
34 
37 
39  std::vector<glm::vec3> vertices;
40 
42  std::vector<glm::vec4> colors;
43 
45  std::vector<glm::vec2> texCoords;
46 
48  std::vector<glm::vec3> normals;
49 
51  Batch(void);
52 
53  public:
55  ~Batch(void);
56 
58  virtual void begin();
59 
61  virtual void end();
62 
64  virtual void flush() = 0;
65 
72  void vertex(float x, float y);
73 
81  void vertex(float x, float y, float z);
82 
88  void vertex(glm::vec2 vertex);
89 
95  void vertex(glm::vec3 vertex);
96 
104  void color(float r, float g, float b);
105 
114  void color(float r, float g, float b, float a);
115 
121  void color(glm::vec3 color);
122 
128  void color(glm::vec4 color);
129 
136  void texCoord(float s, float t);
137 
143  void texCoord(glm::vec2 texCoord);
144 
152  void normal(float nx, float ny, float nz);
153 
159  void normal(glm::vec3 normal);
160 
166  void setModel(glm::mat4 model);
167 
173  glm::mat4 getModel();
174 
180  void setView(glm::mat4 view);
181 
187  glm::mat4 getView();
188 
194  void setProjection(glm::mat4 projection);
195 
201  glm::mat4 getProjection();
202  };
203 }
204 
205 #endif /* BATCHING_HPP */
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
This struct contains information to calculate the Model-View-Projection-Matrix.
Definition: transform.hpp:40
std::vector< glm::vec3 > vertices
The storage for vertices.
Definition: batching.hpp:39
bool drawing
Tells if the batch is drawing.
Definition: batching.hpp:33
int numVertices
The counter for the number of vertices.
Definition: batching.hpp:36
std::vector< glm::vec2 > texCoords
The storage for texture coordinates.
Definition: batching.hpp:45
This class defines methods for batch rendering.
Definition: batching.hpp:26
Transformation transformation
The transformation for the batch.
Definition: batching.hpp:30
std::vector< glm::vec4 > colors
The storage for colors.
Definition: batching.hpp:42
std::vector< glm::vec3 > normals
The storage for normals.
Definition: batching.hpp:48