SimpleGL
1.1.0
A framework for platform independent rendering
|
This class defines methods for batch rendering. More...
#include <batching.hpp>
Public Member Functions | |
~Batch (void) | |
Destroys a batch. More... | |
virtual void | begin () |
Starts drawing with the default mode. More... | |
virtual void | end () |
Ends the drawing, this should also flush the batch. More... | |
virtual void | flush ()=0 |
Flushes the batch, could be used if the batch would overflow. More... | |
void | vertex (float x, float y) |
Defines a new vertex at specified coordinates. More... | |
void | vertex (float x, float y, float z) |
Defines a new vertex at specified coordinates. More... | |
void | vertex (glm::vec2 vertex) |
Defines a new vertex at specified coordinates. More... | |
void | vertex (glm::vec3 vertex) |
Defines a new vertex at specified coordinates. More... | |
void | color (float r, float g, float b) |
Defines a new color with specified components. More... | |
void | color (float r, float g, float b, float a) |
Defines a new color with specified components. More... | |
void | color (glm::vec3 color) |
Defines a new color with specified components. More... | |
void | color (glm::vec4 color) |
Defines a new color with specified components. More... | |
void | texCoord (float s, float t) |
Defines a new texture coordinate with specified values. More... | |
void | texCoord (glm::vec2 texCoord) |
Defines a new texture coordinate with specified values. More... | |
void | normal (float nx, float ny, float nz) |
Defines a new normal with specified values. More... | |
void | normal (glm::vec3 normal) |
Defines a new normal with specified values. More... | |
void | setModel (glm::mat4 model) |
Sets the model matrix. More... | |
glm::mat4 | getModel () |
Gets the model matrix. More... | |
void | setView (glm::mat4 view) |
Sets the view matrix. More... | |
glm::mat4 | getView () |
Gets the view matrix. More... | |
void | setProjection (glm::mat4 projection) |
Sets the projection matrix. More... | |
glm::mat4 | getProjection () |
Gets the projection matrix. More... | |
Protected Member Functions | |
Batch (void) | |
Initializes a new batch. More... | |
Protected Attributes | |
Transformation | transformation |
The transformation for the batch. More... | |
bool | drawing |
Tells if the batch is drawing. More... | |
int | numVertices |
The counter for the number of vertices. More... | |
std::vector< glm::vec3 > | vertices |
The storage for vertices. More... | |
std::vector< glm::vec4 > | colors |
The storage for colors. More... | |
std::vector< glm::vec2 > | texCoords |
The storage for texture coordinates. More... | |
std::vector< glm::vec3 > | normals |
The storage for normals. More... | |
This class defines methods for batch rendering.
Definition at line 26 of file batching.hpp.
|
protected |
Initializes a new batch.
Definition at line 15 of file batching.cpp.
sgl::Batch::~Batch | ( | void | ) |
Destroys a batch.
Definition at line 27 of file batching.cpp.
|
virtual |
Starts drawing with the default mode.
Reimplemented in sgl::BatchGL.
Definition at line 31 of file batching.cpp.
void sgl::Batch::color | ( | float | r, |
float | g, | ||
float | b | ||
) |
Defines a new color with specified components.
r | The red component. |
g | The green component. |
b | The blue component. |
Definition at line 64 of file batching.cpp.
void sgl::Batch::color | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Defines a new color with specified components.
r | The red component. |
g | The green component. |
b | The blue component. |
a | The alpha component. |
Definition at line 68 of file batching.cpp.
void sgl::Batch::color | ( | glm::vec3 | color | ) |
Defines a new color with specified components.
color | The color to define. |
Definition at line 72 of file batching.cpp.
void sgl::Batch::color | ( | glm::vec4 | color | ) |
Defines a new color with specified components.
color | The color to define. |
Definition at line 76 of file batching.cpp.
|
virtual |
Ends the drawing, this should also flush the batch.
Definition at line 39 of file batching.cpp.
|
pure virtual |
Flushes the batch, could be used if the batch would overflow.
Implemented in sgl::BatchGL, and sgl::BatchVK.
glm::mat4 sgl::Batch::getModel | ( | ) |
Gets the model matrix.
Definition at line 101 of file batching.cpp.
glm::mat4 sgl::Batch::getProjection | ( | ) |
Gets the projection matrix.
Definition at line 119 of file batching.cpp.
glm::mat4 sgl::Batch::getView | ( | ) |
void sgl::Batch::normal | ( | float | nx, |
float | ny, | ||
float | nz | ||
) |
Defines a new normal with specified values.
nx | The X-Coordinate. |
ny | The Y-Coordinate. |
nz | The Z-Coordinate. |
Definition at line 88 of file batching.cpp.
void sgl::Batch::normal | ( | glm::vec3 | normal | ) |
Defines a new normal with specified values.
normal | The normal to define. |
Definition at line 92 of file batching.cpp.
void sgl::Batch::setModel | ( | glm::mat4 | model | ) |
Sets the model matrix.
model | The model matrix. |
Definition at line 96 of file batching.cpp.
void sgl::Batch::setProjection | ( | glm::mat4 | projection | ) |
Sets the projection matrix.
projection | The projection matrix. |
Definition at line 114 of file batching.cpp.
void sgl::Batch::setView | ( | glm::mat4 | view | ) |
void sgl::Batch::texCoord | ( | float | s, |
float | t | ||
) |
Defines a new texture coordinate with specified values.
s | The S-Coordinate. |
t | The T-Coordinate. |
Definition at line 80 of file batching.cpp.
void sgl::Batch::texCoord | ( | glm::vec2 | texCoord | ) |
Defines a new texture coordinate with specified values.
texCoord | The texture coordinate to define. |
Definition at line 84 of file batching.cpp.
void sgl::Batch::vertex | ( | float | x, |
float | y | ||
) |
Defines a new vertex at specified coordinates.
x | The X-Coordinate. |
y | The Y-Coordinate. |
Definition at line 47 of file batching.cpp.
void sgl::Batch::vertex | ( | float | x, |
float | y, | ||
float | z | ||
) |
Defines a new vertex at specified coordinates.
x | The X-Coordinate. |
y | The Y-Coordinate. |
z | The Z-Coordinate. |
Definition at line 51 of file batching.cpp.
void sgl::Batch::vertex | ( | glm::vec2 | vertex | ) |
Defines a new vertex at specified coordinates.
vertex | The vertex to define. |
Definition at line 55 of file batching.cpp.
void sgl::Batch::vertex | ( | glm::vec3 | vertex | ) |
Defines a new vertex at specified coordinates.
vertex | The vertex to define. |
Definition at line 59 of file batching.cpp.
|
protected |
The storage for colors.
Definition at line 42 of file batching.hpp.
|
protected |
Tells if the batch is drawing.
Definition at line 33 of file batching.hpp.
|
protected |
The storage for normals.
Definition at line 48 of file batching.hpp.
|
protected |
The counter for the number of vertices.
Definition at line 36 of file batching.hpp.
|
protected |
The storage for texture coordinates.
Definition at line 45 of file batching.hpp.
|
protected |
The transformation for the batch.
Definition at line 30 of file batching.hpp.
|
protected |
The storage for vertices.
Definition at line 39 of file batching.hpp.