AGL
A graphics library
agl::Cube Class Reference

Draw a cube mesh. More...

#include <cube.h>

Public Member Functions

 Cube (GLfloat size=1.0f)
 
- Public Member Functions inherited from agl::TriangleMesh
virtual void render () const
 Draw this mesh. More...
 
- Public Member Functions inherited from agl::Mesh
GLuint vao () const
 Return the vertex array object corresponding to this mesh.
 
bool hasUV () const
 Return whether this mesh has UV coordinates defined.
 
bool isDynamic () const
 Query whether or not this is a dynamic mesh. More...
 

Protected Member Functions

void init () override
 Override init to specifiy vertex data for the mesh. More...
 
- Protected Member Functions inherited from agl::TriangleMesh
void initBuffers (std::vector< GLuint > *indices, 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. More...
 
- Protected Member Functions inherited from agl::Mesh
int numVertices () const
 Get the number of vertices.
 
void setVertexData (VertexAttribute type, int vertexId, const glm::vec4 &data)
 Set vertex properties. More...
 
glm::vec4 vertexData (VertexAttribute type, int vertexId) const
 Get vertex properties. More...
 
virtual void setIsDynamic (bool on)
 Set whether or not this is a dynamic mesh. More...
 
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. More...
 
virtual void deleteBuffers ()
 

Additional Inherited Members

- Protected Types inherited from agl::Mesh
enum  VertexAttribute {
  INDEX = 0, POSITION, NORMAL, UV,
  TANGENT, NUM_ATTRIBUTES
}
 
- Protected Attributes inherited from agl::TriangleMesh
GLuint _nIndices = 0
 
- Protected Attributes inherited from agl::Mesh
GLuint _nVerts = 0
 
GLuint _vao = 0
 
bool _hasUV = false
 
bool _isDynamic = false
 
bool _initialized = false
 
std::vector< GLuint > _buffers
 
std::vector< GLfloat > _data [5]
 

Detailed Description

Draw a cube mesh.

Member Function Documentation

◆ init()

void agl::Cube::init ( )
overrideprotectedvirtual

Override init to specifiy vertex data for the mesh.

init() will be called automatically the first time render() is called. Overridden implementations of init() should call initBuffers.

See also
initBuffers(std::vector<GLuint>*, std::vector<GLfloat>*, std::vector<GLfloat>*, std::vector<GLfloat>*, std::vector<GLfloat>*)

Implements agl::Mesh.


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