![]() |
Vis 2 Demo
1.0
Technical illustration type real-time rendering of geometry
|
This is the base class for all objects that require both geometry and a texture to be drawn by OpenGL. More...
Public Member Functions | |
GeometricObjectTextured (glm::mat4 _modelMatrix, Shader *_shader, Texture *_diffuse_texture, const float *_positions_Ptr, const unsigned int _pos_size, const float *_normals_Ptr, const unsigned int _norm_size, const float *_uv_Ptr, const unsigned int _uv_size, const unsigned int *_index_Ptr, const unsigned int _ind_size) | |
Constructor. More... | |
virtual | ~GeometricObjectTextured () |
Destructor. More... | |
virtual void | update (double _deltaT)=0 |
Abstract update function. More... | |
virtual void | draw (glm::mat4 &_projectionMatrix) |
Draw function. More... | |
![]() | |
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... | |
![]() | |
DrawableObject (glm::mat4 &_modelMatrix) | |
Constructor. More... | |
virtual | ~DrawableObject () |
Destructor. More... | |
Protected Attributes | |
GLuint | uv_buffer_handle |
handle to the uv buffer object containing the vertex texture coordinates in object space More... | |
Texture * | diffuse_texture_Ptr |
handle to the texture for this object More... | |
![]() | |
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 | |
GeometricObjectTextured (const GeometricObjectTextured &) | |
Hidden copy-constructor. More... | |
This is the base class for all objects that require both geometry and a texture to be drawn by OpenGL.
An abstract interface for ensuring all textured geometric objects contain positions, normals and
texture coordiate arrays, a face index array, and at least one texture.
Definition at line 15 of file GeometricObjectTextured.h.
GeometricObjectTextured::GeometricObjectTextured | ( | glm::mat4 | _modelMatrix, |
Shader * | _shader, | ||
Texture * | _diffuse_texture, | ||
const float * | _positions_Ptr, | ||
const unsigned int | _pos_size, | ||
const float * | _normals_Ptr, | ||
const unsigned int | _norm_size, | ||
const float * | _uv_Ptr, | ||
const unsigned int | _uv_size, | ||
const unsigned int * | _index_Ptr, | ||
const unsigned int | _ind_size | ||
) |
Constructor.
In addition to the Vertex Buffer Objects (VBO) built by the parent constructor this
constructor builds a VBO of out of the input texture coordinate array
and attaches it to the 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] | _diffuse_texture | is the pointer to a texture 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] | _uv_Ptr | is a pointer to the texture coordinates array, |
[in] | _uv_size | is the size of the texture coordinates 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 GeometricObjectTextured.cpp.
|
virtual |
Destructor.
Deletes the VBOs and the VAO built in the constructor.
Definition at line 50 of file GeometricObjectTextured.cpp.
|
private |
Hidden copy-constructor.
|
virtual |
Draw function.
This function activates the shader program, passes the updates to the shader uniform variables,
binds the texture and passes it to the shader,
binds the Vertex Attribute Object (VAO), makes a draw call, then unbinds the VAO and the shader program.
[in] | _projectionMatrix | passes the combined view and projection matrices. |
Reimplemented from vis2::GeometricObject.
Reimplemented in vis2::ModelTextured, and vis2::SpinningCubeTextured.
Definition at line 59 of file GeometricObjectTextured.cpp.
|
pure virtual |
Abstract update function.
Implements vis2::GeometricObject.
Implemented in vis2::ModelTextured, and vis2::SpinningCubeTextured.
|
protected |
handle to the texture for this object
Definition at line 64 of file GeometricObjectTextured.h.
|
protected |
handle to the uv buffer object containing the vertex texture coordinates in object space
Definition at line 63 of file GeometricObjectTextured.h.