PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
TriangleShape.hpp
Go to the documentation of this file.
1 #ifndef TRIANGLESHAPE_HPP
2 #define TRIANGLESHAPE_HPP
3 
4 #include "GL/glew.h"
5 #include <glm/glm.hpp>
8 #include "core/GLStates.hpp"
9 
10 namespace pk
11 {
21  class TriangleShape : public GLDrawable, public GLTransformable
22  {
23  private:
29 
30  void updateNormals(GLfloat * vertices, unsigned int verticeCount, unsigned int * indices, unsigned int stride);
31 
37  void updateGeometry();
38 
39  public:
49  TriangleShape(GLfloat width, GLfloat height);
50 
51  virtual ~TriangleShape();
52 
58  void setFillColor(glm::vec4 fillColor);
59 
67  glm::vec4 &getFillColor(){ return m_fillColor; };
68 
74  void setVertexColors(GLfloat colors [16]);
75 
83  GLfloat* getVertexColors(){ return m_vertexColors; };
84 
91  void draw(GLStates& states);
92 
93  private:
94  glm::vec4 m_fillColor;
95  GLfloat m_vertexColors [16];
96  };
97 }
98 
99 #endif // TRIANGLESHAPE_HPP
GLfloat * getVertexColors()
Get the current vertex colors for the TriangleShape.
Definition: TriangleShape.hpp:83
Definition: Game.hpp:7
virtual ~TriangleShape()
Decorator class for creating easing OpenGL transformations for game objects.
Definition: GLTransformable.hpp:51
Definition: GLDrawable.hpp:16
void setVertexColors(GLfloat colors [16])
Set the individual values for the vertex colors of the TriangleShape.
Definition: TriangleShape.hpp:67
void setFillColor(glm::vec4 fillColor)
TriangleShape()
Default constructor - INACCESSIBLE!
Definition: TriangleShape.hpp:28
GLfloat m_vertexColors[16]
Array of individual vertex colors.
Definition: TriangleShape.hpp:95
Stores the states used to draw OpenGL objects.
Definition: GLStates.hpp:16
void draw(GLStates &states)
Draw the TriangleShape to the screen.
Definition: TriangleShape.hpp:83
void updateNormals(GLfloat *vertices, unsigned int verticeCount, unsigned int *indices, unsigned int stride)
glm::vec4 m_fillColor
Triangle fill color.
Definition: TriangleShape.hpp:94
void updateGeometry()
Update the internal geometry of the TriangleShape.
Create a drawable TriangleShape using OpenGL. Useful for basic test programs, but not very flexible -...
Definition: TriangleShape.hpp:21
glm::vec4 & getFillColor()
Get the current fill color for the TriangleShape.
Definition: TriangleShape.hpp:67