Vis 2 Demo  1.0
Technical illustration type real-time rendering of geometry
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
vis2::GeometricObject Class Referenceabstract

This is the base class for all objects that require geometry to be drawn by OpenGL. More...

Inheritance diagram for vis2::GeometricObject:
vis2::DrawableObject vis2::GeometricObjectTextured vis2::SpinningCube vis2::ModelTextured vis2::SpinningCubeTextured

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...
 
- Public Member Functions inherited from vis2::DrawableObject
 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...
 
Shadershader_Ptr
 is a pointer to the shader this object uses More...
 
- Protected Attributes inherited from vis2::DrawableObject
glm::mat4 modelMatrix
 holds the current model matrix More...
 

Private Member Functions

 GeometricObject (const GeometricObject &)
 Hidden copy-constructor. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

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).

Parameters
[in]_modelMatrixis the model matrix that places the object in the world coordinate system,
[in]_shaderis the shader program used by this object,
[in]_positions_Ptris a pointer to the vertex positions array,
[in]_pos_sizeis is the size of the vertex positions array,
[in]_normals_Ptris a pointer to the vertex normals array,
[in]_norm_sizeis the size of the vertex normals array,
[in]_index_Ptris a pointer to the face index array,
[in]_ind_sizeis the size of the face index array.

Definition at line 6 of file GeometricObject.cpp.

GeometricObject::~GeometricObject ( )
virtual

Destructor.

Deletes the VBOs and the VAO built in the constructor.

Definition at line 62 of file GeometricObject.cpp.

vis2::GeometricObject::GeometricObject ( const GeometricObject )
private

Hidden copy-constructor.

Member Function Documentation

void GeometricObject::draw ( glm::mat4 &  _projectionMatrix)
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.

Parameters
[in]_projectionMatrixpasses 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.

virtual void vis2::GeometricObject::update ( double  _deltaT)
pure virtual

Member Data Documentation

GLuint vis2::GeometricObject::index_buffer_handle
protected

handle to the vertex buffer object containing the face indices for each polygon

Definition at line 58 of file GeometricObject.h.

unsigned int vis2::GeometricObject::index_count
protected

nr of polygons to be drawn

Definition at line 54 of file GeometricObject.h.

GLuint vis2::GeometricObject::normal_buffer_handle
protected

handle to the normal buffer object containing the vertex normals in object space

Definition at line 57 of file GeometricObject.h.

GLuint vis2::GeometricObject::position_buffer_handle
protected

handle to the vertex buffer object containing the vertex coordinates in object space

Definition at line 56 of file GeometricObject.h.

Shader* vis2::GeometricObject::shader_Ptr
protected

is a pointer to the shader this object uses

Definition at line 60 of file GeometricObject.h.

GLuint vis2::GeometricObject::vao_handle
protected

handle to the vertex attribute object

Definition at line 55 of file GeometricObject.h.


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