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

This class produces a cube that rotates around the y-axis. More...

Inheritance diagram for vis2::SpinningCube:
vis2::GeometricObject vis2::DrawableObject

Public Member Functions

 SpinningCube (glm::mat4 _modelMatrix, Shader *_shader)
 Constructor. More...
 
virtual ~SpinningCube ()
 Destructor. More...
 
virtual void update (double _deltaT)
 Update function, called every frame. More...
 
virtual void updateMm (glm::mat4 &_newModelMatrix)
 Function for moving the cube in world space. More...
 
virtual void draw (glm::mat4 &_projectionMatrix)
 Draw function, called every frame. More...
 
- Public Member Functions inherited from vis2::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. More...
 
virtual ~GeometricObject ()
 Destructor. More...
 
- Public Member Functions inherited from vis2::DrawableObject
 DrawableObject (glm::mat4 &_modelMatrix)
 Constructor. More...
 
virtual ~DrawableObject ()
 Destructor. More...
 

Private Member Functions

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

Static Private Attributes

static const float generic_positions [CUBE_VERTEX_COUNT *3]
 the vertex positions for a generic cube with pivot in (0,0,0) and edge length 2 More...
 
static const float generic_normlas [CUBE_VERTEX_COUNT *3]
 the vertex normals for the generic cube with pivot in (0,0,0) and edge length 2 More...
 
static const unsigned int generic_indices [CUBE_INDEX_COUNT]
 the face indices for the generic cube with pivot in (0,0,0) and edge length 2 More...
 

Additional Inherited Members

- Protected Attributes inherited from vis2::GeometricObject
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...
 

Detailed Description

This class produces a cube that rotates around the y-axis.

This class is well suited for testing the basic setup of an OpenGL application.

Definition at line 13 of file SpinningCube.h.

Constructor & Destructor Documentation

SpinningCube::SpinningCube ( glm::mat4  _modelMatrix,
vis2::Shader _shader 
)

Constructor.

Parameters
[in]_modelMatrixis the model matrix that places the object in the world coordinate system,
[in]_shaderis the shader program used by this object.
The geometry description is contained within the class.

Definition at line 5 of file SpinningCube.cpp.

SpinningCube::~SpinningCube ( )
virtual

Destructor.

Definition at line 17 of file SpinningCube.cpp.

vis2::SpinningCube::SpinningCube ( const SpinningCube )
private

Hidden copy-constructor.

Member Function Documentation

void SpinningCube::draw ( glm::mat4 &  _projectionMatrix)
virtual

Draw function, called every frame.

Calls its parent's draw function.

Reimplemented from vis2::GeometricObject.

Definition at line 34 of file SpinningCube.cpp.

void SpinningCube::update ( double  _deltaT)
virtual

Update function, called every frame.

Parameters
[in]_deltaTis the duration of the last frame in seconds. The cube rotates around its vertical axis.

Implements vis2::GeometricObject.

Definition at line 21 of file SpinningCube.cpp.

void SpinningCube::updateMm ( glm::mat4 &  _newModelMatrix)
virtual

Function for moving the cube in world space.

Parameters
[in]_newModelMatrixis the new model matrix to replace the old one.

Definition at line 29 of file SpinningCube.cpp.

Member Data Documentation

const unsigned int SpinningCube::generic_indices
staticprivate
Initial value:
=
{
0, 1, 2,
0, 2, 3,
4, 5, 6,
4, 6, 7,
8, 9, 10,
8, 10, 11,
12, 13, 14,
12, 14, 15,
16, 17, 18,
16, 18, 19,
20, 21, 22,
20, 22, 23
}

the face indices for the generic cube with pivot in (0,0,0) and edge length 2

Definition at line 47 of file SpinningCube.h.

const float SpinningCube::generic_normlas
staticprivate

the vertex normals for the generic cube with pivot in (0,0,0) and edge length 2

Definition at line 46 of file SpinningCube.h.

const float SpinningCube::generic_positions
staticprivate

the vertex positions for a generic cube with pivot in (0,0,0) and edge length 2

Definition at line 45 of file SpinningCube.h.


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