![]() |
Vis 2 Demo
1.0
Technical illustration type real-time rendering of geometry
|
This is the base class for all objects that require geometry to be drawn by OpenGL. More...
Public Member Functions | |
GeometricObject (glm::mat4 _modelMatrix, Shader *_shader, const float *_positions_Ptr, const unsigned int _pos_size, const float *_normals_Ptr, const unsigned int _norm_size, const unsigned int *_index_Ptr, const unsigned int _ind_size) | |
Constructor. More... | |
virtual | ~GeometricObject () |
Destructor. More... | |
virtual void | update (double _deltaT)=0 |
Abstract update function. More... | |
virtual void | draw (glm::mat4 &_projectionMatrix) |
Draw function. More... | |
![]() | |
DrawableObject (glm::mat4 &_modelMatrix) | |
Constructor. More... | |
virtual | ~DrawableObject () |
Destructor. More... | |
Protected Attributes | |
unsigned int | index_count |
nr of polygons to be drawn More... | |
GLuint | vao_handle |
handle to the vertex attribute object More... | |
GLuint | position_buffer_handle |
handle to the vertex buffer object containing the vertex coordinates in object space More... | |
GLuint | normal_buffer_handle |
handle to the normal buffer object containing the vertex normals in object space More... | |
GLuint | index_buffer_handle |
handle to the vertex buffer object containing the face indices for each polygon More... | |
Shader * | shader_Ptr |
is a pointer to the shader this object uses More... | |
![]() | |
glm::mat4 | modelMatrix |
holds the current model matrix More... | |
Private Member Functions | |
GeometricObject (const GeometricObject &) | |
Hidden copy-constructor. More... | |
This is the base class for all objects that require geometry to be drawn by OpenGL.
An abstract interface for ensuring all geometric objects contain at least positions, normals and face index arrays.
Definition at line 14 of file GeometricObject.h.
GeometricObject::GeometricObject | ( | glm::mat4 | _modelMatrix, |
Shader * | _shader, | ||
const float * | _positions_Ptr, | ||
const unsigned int | _pos_size, | ||
const float * | _normals_Ptr, | ||
const unsigned int | _norm_size, | ||
const unsigned int * | _index_Ptr, | ||
const unsigned int | _ind_size | ||
) |
Constructor.
The constructor builds Vertex Buffer Objects (VBO) of out of the input arrays
and attaches them to a Vertex Attribute Object (VAO).
[in] | _modelMatrix | is the model matrix that places the object in the world coordinate system, |
[in] | _shader | is the shader program used by this object, |
[in] | _positions_Ptr | is a pointer to the vertex positions array, |
[in] | _pos_size | is is the size of the vertex positions array, |
[in] | _normals_Ptr | is a pointer to the vertex normals array, |
[in] | _norm_size | is the size of the vertex normals array, |
[in] | _index_Ptr | is a pointer to the face index array, |
[in] | _ind_size | is the size of the face index array. |
Definition at line 6 of file GeometricObject.cpp.
|
virtual |
Destructor.
Deletes the VBOs and the VAO built in the constructor.
Definition at line 62 of file GeometricObject.cpp.
|
private |
Hidden copy-constructor.
|
virtual |
Draw function.
This function activates the shader program, passes the updates to the shader uniform variables,
binds the Vertex Attribute Object (VAO), makes a draw call, then unbinds both the VAO and the shader program.
[in] | _projectionMatrix | passes the combined view and projectino matrices. |
Implements vis2::DrawableObject.
Reimplemented in vis2::GeometricObjectTextured, vis2::ModelTextured, vis2::SpinningCube, and vis2::SpinningCubeTextured.
Definition at line 71 of file GeometricObject.cpp.
|
pure virtual |
Abstract update function.
Implements vis2::DrawableObject.
Implemented in vis2::GeometricObjectTextured, vis2::ModelTextured, vis2::SpinningCubeTextured, and vis2::SpinningCube.
|
protected |
handle to the vertex buffer object containing the face indices for each polygon
Definition at line 58 of file GeometricObject.h.
|
protected |
nr of polygons to be drawn
Definition at line 54 of file GeometricObject.h.
|
protected |
handle to the normal buffer object containing the vertex normals in object space
Definition at line 57 of file GeometricObject.h.
|
protected |
handle to the vertex buffer object containing the vertex coordinates in object space
Definition at line 56 of file GeometricObject.h.
|
protected |
is a pointer to the shader this object uses
Definition at line 60 of file GeometricObject.h.
|
protected |
handle to the vertex attribute object
Definition at line 55 of file GeometricObject.h.