27#ifndef VERTEX_MANAGER_H_
28#define VERTEX_MANAGER_H_
30#define GLM_FORCE_RADIANS
31#include <glm/gtc/matrix_transform.hpp>
43class VERTEX_CONTAINER;
63 explicit VERTEX_MANAGER( std::shared_ptr<VERTEX_CONTAINER> aContainer );
88 bool Reserve(
unsigned int aSize );
102 return Vertex( aVertex.
x, aVertex.
y, aVertex.
z );
115 bool Vertex( GLfloat aX, GLfloat aY, GLfloat aZ );
143 bool Vertices(
const VERTEX aVertices[],
unsigned int aSize );
168 inline void Color( GLfloat aRed, GLfloat aGreen, GLfloat aBlue, GLfloat aAlpha )
189 inline void Shader( GLfloat aShaderType, GLfloat aParam1 = 0.0f, GLfloat aParam2 = 0.0f,
190 GLfloat aParam3 = 0.0f )
208 inline void Translate( GLfloat aX, GLfloat aY, GLfloat aZ )
224 inline void Rotate( GLfloat aAngle, GLfloat aX, GLfloat aY, GLfloat aZ )
239 inline void Scale( GLfloat aX, GLfloat aY, GLfloat aZ )
288 void FinishItem()
const;
311 void ChangeItemDepth(
const VERTEX_ITEM& aItem, GLfloat aDepth )
const;
331 void SetShader(
SHADER& aShader )
const;
341 void BeginDrawing()
const;
353 void EndDrawing()
const;
358 void EnableDepthTest(
bool aEnabled );
370 void putVertex(
VERTEX& aTarget, GLfloat aX, GLfloat aY, GLfloat aZ )
const;
A color representation with 4 components: red, green, blue, alpha.
Provide the access to the OpenGL shaders.
bool Vertex(const VERTEX &aVertex)
Add a vertex with the given coordinates to the currently set item.
const glm::mat4 & GetTransformation() const
void Map()
Map vertex buffer.
bool m_noTransform
State machine variables True in case there is no need to transform vertices.
void Abandon()
Give up ownership of the container's GL objects without deleting them.
void Color(const COLOR4D &aColor)
Change currently used color that will be applied to newly added vertices.
bool Reserve(unsigned int aSize)
Allocate space for vertices, so it will be used with subsequent Vertex() calls.
void Rotate(GLfloat aAngle, GLfloat aX, GLfloat aY, GLfloat aZ)
Multiply the current matrix by a rotation matrix, so the newly vertices will be rotated by the given ...
void Color(GLfloat aRed, GLfloat aGreen, GLfloat aBlue, GLfloat aAlpha)
Change currently used color that will be applied to newly added vertices.
glm::mat4 m_transform
Currently used transform matrix.
void PopMatrix()
Pop the current transformation matrix stack.
void Shader(GLfloat aShaderType, GLfloat aParam1=0.0f, GLfloat aParam2=0.0f, GLfloat aParam3=0.0f)
Change currently used shader and its parameters that will be applied to newly added vertices.
std::stack< glm::mat4 > m_transformStack
Stack of transformation matrices, used for Push/PopMatrix.
VERTEX_MANAGER(bool aCached)
unsigned int m_reservedSpace
Currently available reserved space.
VERTEX * m_reserved
Currently reserved chunk to store vertices.
GLubyte m_color[COLOR_STRIDE]
Currently used color.
bool Vertex(const VECTOR2D &aXY, GLfloat aZ)
Add a vertex with the given coordinates to the currently set item.
void PushMatrix()
Push the current transformation matrix stack.
void Scale(GLfloat aX, GLfloat aY, GLfloat aZ)
Multiply the current matrix by a scaling matrix, so the newly vertices will be scaled by the given fa...
GLfloat m_shader[SHADER_STRIDE]
Currently used shader and its parameters.
void Unmap()
Unmap vertex buffer.
std::shared_ptr< GPU_MANAGER > m_gpu
GPU manager for data transfers and drawing operations.
void Translate(GLfloat aX, GLfloat aY, GLfloat aZ)
Multiply the current matrix by a translation matrix, so newly vertices will be translated by the give...
std::shared_ptr< VERTEX_CONTAINER > m_container
Container for vertices, may be cached or noncached.
The Cairo implementation of the graphics abstraction layer.
static constexpr size_t COLOR_STRIDE
static constexpr size_t SHADER_STRIDE
VECTOR2< double > VECTOR2D
Common defines and consts used in vertex related classes.