SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
sgl::Batch Class Referenceabstract

This class defines methods for batch rendering. More...

#include <batching.hpp>

Inheritance diagram for sgl::Batch:
sgl::BatchGL sgl::BatchVK

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...
 

Detailed Description

This class defines methods for batch rendering.

Definition at line 26 of file batching.hpp.

Constructor & Destructor Documentation

sgl::Batch::Batch ( void  )
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.

Member Function Documentation

void sgl::Batch::begin ( )
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.

Parameters
rThe red component.
gThe green component.
bThe 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.

Parameters
rThe red component.
gThe green component.
bThe blue component.
aThe alpha component.

Definition at line 68 of file batching.cpp.

void sgl::Batch::color ( glm::vec3  color)

Defines a new color with specified components.

Parameters
colorThe 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.

Parameters
colorThe color to define.

Definition at line 76 of file batching.cpp.

void sgl::Batch::end ( )
virtual

Ends the drawing, this should also flush the batch.

Definition at line 39 of file batching.cpp.

virtual void sgl::Batch::flush ( )
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.

Returns
The current model matrix.

Definition at line 101 of file batching.cpp.

glm::mat4 sgl::Batch::getProjection ( )

Gets the projection matrix.

Returns
The current projection matrix.

Definition at line 119 of file batching.cpp.

glm::mat4 sgl::Batch::getView ( )

Gets the view matrix.

Returns
The current view matrix.

Definition at line 110 of file batching.cpp.

void sgl::Batch::normal ( float  nx,
float  ny,
float  nz 
)

Defines a new normal with specified values.

Parameters
nxThe X-Coordinate.
nyThe Y-Coordinate.
nzThe Z-Coordinate.

Definition at line 88 of file batching.cpp.

void sgl::Batch::normal ( glm::vec3  normal)

Defines a new normal with specified values.

Parameters
normalThe normal to define.

Definition at line 92 of file batching.cpp.

void sgl::Batch::setModel ( glm::mat4  model)

Sets the model matrix.

Parameters
modelThe model matrix.

Definition at line 96 of file batching.cpp.

void sgl::Batch::setProjection ( glm::mat4  projection)

Sets the projection matrix.

Parameters
projectionThe projection matrix.

Definition at line 114 of file batching.cpp.

void sgl::Batch::setView ( glm::mat4  view)

Sets the view matrix.

Parameters
viewThe view matrix.

Definition at line 105 of file batching.cpp.

void sgl::Batch::texCoord ( float  s,
float  t 
)

Defines a new texture coordinate with specified values.

Parameters
sThe S-Coordinate.
tThe 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.

Parameters
texCoordThe 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.

Parameters
xThe X-Coordinate.
yThe 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.

Parameters
xThe X-Coordinate.
yThe Y-Coordinate.
zThe Z-Coordinate.

Definition at line 51 of file batching.cpp.

void sgl::Batch::vertex ( glm::vec2  vertex)

Defines a new vertex at specified coordinates.

Parameters
vertexThe 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.

Parameters
vertexThe vertex to define.

Definition at line 59 of file batching.cpp.

Member Data Documentation

std::vector<glm::vec4> sgl::Batch::colors
protected

The storage for colors.

Definition at line 42 of file batching.hpp.

bool sgl::Batch::drawing
protected

Tells if the batch is drawing.

Definition at line 33 of file batching.hpp.

std::vector<glm::vec3> sgl::Batch::normals
protected

The storage for normals.

Definition at line 48 of file batching.hpp.

int sgl::Batch::numVertices
protected

The counter for the number of vertices.

Definition at line 36 of file batching.hpp.

std::vector<glm::vec2> sgl::Batch::texCoords
protected

The storage for texture coordinates.

Definition at line 45 of file batching.hpp.

Transformation sgl::Batch::transformation
protected

The transformation for the batch.

Definition at line 30 of file batching.hpp.

std::vector<glm::vec3> sgl::Batch::vertices
protected

The storage for vertices.

Definition at line 39 of file batching.hpp.


The documentation for this class was generated from the following files: