32 virtual void render()
const = 0;
37 GLuint
vao()
const {
return _vao; }
42 bool hasUV()
const {
return _hasUV; }
63 bool _isDynamic =
false;
64 bool _initialized =
false;
65 std::vector<GLuint> _buffers;
66 std::vector<GLfloat> _data[5];
67 enum VertexAttribute {
98 void setVertexData(VertexAttribute type,
int vertexId,
const glm::vec4& data);
118 glm::vec4
vertexData(VertexAttribute type,
int vertexId)
const;
145 virtual void init() = 0;
154 std::vector<GLfloat>* points,
155 std::vector<GLfloat>* normals,
156 std::vector<GLfloat>* texCoords =
nullptr,
157 std::vector<GLfloat>* tangents =
nullptr);
159 virtual void deleteBuffers();
163 #endif // AGL_MESH_H_
GLuint vao() const
Return the vertex array object corresponding to this mesh.
Definition: mesh.h:37
virtual void render() const =0
Draw this mesh.
bool hasUV() const
Return whether this mesh has UV coordinates defined.
Definition: mesh.h:42
virtual void setIsDynamic(bool on)
Set whether or not this is a dynamic mesh.
Definition: mesh.cpp:120
bool isDynamic() const
Query whether or not this is a dynamic mesh.
Definition: mesh.h:57
void initBuffers(std::vector< GLfloat > *points, std::vector< GLfloat > *normals, std::vector< GLfloat > *texCoords=nullptr, std::vector< GLfloat > *tangents=nullptr)
Call initBuffers from init() to set the data for this mesh.
Definition: mesh.cpp:9
void setVertexData(VertexAttribute type, int vertexId, const glm::vec4 &data)
Set vertex properties.
Definition: mesh.cpp:125
int numVertices() const
Get the number of vertices.
Definition: mesh.h:79
Global utilities and common third party includes.
virtual void init()=0
Override init to specifiy vertex data for the mesh.
glm::vec4 vertexData(VertexAttribute type, int vertexId) const
Get vertex properties.
Definition: mesh.cpp:146
Base class for meshes.
Definition: mesh.h:18