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::ModelMultiTextured Class Reference

This class is for the complex objects in the scene. More...

Inheritance diagram for vis2::ModelMultiTextured:
vis2::DrawableObject

Public Member Functions

 ModelMultiTextured (const char *_id_name, const glm::vec3 _id_color, const glm::vec3 _contour_color, glm::mat4 &_modelMatrix, LoaderOBJ *_loader, ShaderController *_shader_controller)
 Constructor. More...
 
virtual ~ModelMultiTextured ()
 Destructor. More...
 
virtual void update (double _deltaT)
 Standard function for framerate-independent updates. More...
 
virtual void draw (glm::mat4 &_projectionMatrix)
 Standard drawing function, uses the standard shader program (slot 0) More...
 
virtual void assignShaderController (ShaderController *_shader_ctrl, const unsigned int _slot)
 Function for assigning additional shader controllers. More...
 
virtual void updateModelMatrix (glm::mat4 &_modelMatrix)
 Updates the model matrix. More...
 
virtual void draw (glm::mat4 &_projectionMatrix, const unsigned int _slot)
 Drawing function that uses the shader program occupying slot _slot. More...
 
const char * getIdName () const
 getter for the object's unique name More...
 
glm::vec3 getIdColor () const
 getter for the object's unique color More...
 
- Public Member Functions inherited from vis2::DrawableObject
 DrawableObject (glm::mat4 &_modelMatrix)
 Constructor. More...
 
virtual ~DrawableObject ()
 Destructor. More...
 

Protected Attributes

const char * id_name
 the unique name of this object More...
 
const glm::vec3 id_color
 the unique color of this object (used in the color_ID shader program) More...
 
const glm::vec3 contour_color
 the edge color to use in edge detecting shaders More...
 
LoaderOBJloader_Ptr
 pointer to the geometry loader, which fills index_count, and buffers vao_handle to index_buffer_handle More...
 
unsigned int index_count
 nr of polygons to be drawn More...
 
ShaderControllershader_ctrl [3]
 is a pointer to the standard, solid color, and transparency shader controller for this object More...
 
GLuint vao_handle [3]
 handle to the vertex array object for the standard, solid color, and transparency shader program More...
 
bool vao_setup_done [3]
 signifies if the setup for shader slot 0, 1, or 2 was completed 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 uv_buffer_handle
 handle to the uv buffer object containing the vertex texture coordinates in object space More...
 
GLuint index_buffer_handle
 handle to the vertex buffer object containing the face indices for each polygon More...
 
- Protected Attributes inherited from vis2::DrawableObject
glm::mat4 modelMatrix
 holds the current model matrix More...
 

Private Member Functions

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

Detailed Description

This class is for the complex objects in the scene.

The class contains methods for loading geometry, multiple textures and shader programs as wells as
for rendering in multiple modes.

Definition at line 22 of file ModelMultiTextured.h.

Constructor & Destructor Documentation

ModelMultiTextured::ModelMultiTextured ( const char *  _id_name,
const glm::vec3  _id_color,
const glm::vec3  _contour_color,
glm::mat4 &  _modelMatrix,
LoaderOBJ _loader,
ShaderController _shader_controller 
)

Constructor.

Parameters
[in]_id_nameis the unique name of this object,
[in]_id_coloris the unique color of this object, used in picking algorithms,
[in]_contour_coloris the color to use in edge detecting shaders,
[in]_modelMatrixis the model matrix for the object,
[in]_loaderis the geometry loader.
[in]_shader_controlleris the standard diffuse shader and cannot be NULL. All other textures and shader programs are optional.

Definition at line 9 of file ModelMultiTextured.cpp.

ModelMultiTextured::~ModelMultiTextured ( )
virtual

Destructor.

Deletes the VBOs and the VAO built in the constructor.

Definition at line 88 of file ModelMultiTextured.cpp.

vis2::ModelMultiTextured::ModelMultiTextured ( const ModelMultiTextured )
private

Hidden copy-constructor.

Member Function Documentation

void ModelMultiTextured::assignShaderController ( ShaderController _shader_ctrl,
const unsigned int  _slot 
)
virtual

Function for assigning additional shader controllers.

Each shader controller slot can be assigned only once. The standard shader program
is assigned in the constructor.

Parameters
[in]_shader_ctrlis the shader program controller to be assigned to
[in]_slot,whichcan take values VIS2_SHADER_DIFFUSE_SLOT, VIS2_SHADER_COLORID_SLOT or VIS2_SHADER_TRANSP_SLOT.

Definition at line 130 of file ModelMultiTextured.cpp.

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

Standard drawing function, uses the standard shader program (slot 0)

Parameters
[in]_projectionMatrixis the current projection matrix of the camera.

Implements vis2::DrawableObject.

Definition at line 105 of file ModelMultiTextured.cpp.

void ModelMultiTextured::draw ( glm::mat4 &  _projectionMatrix,
const unsigned int  _slot 
)
virtual

Drawing function that uses the shader program occupying slot _slot.

Parameters
[in]_projectionMatrixis the current projection matrix of the camera,
[in]_slotis the id of the shader program to be used

Definition at line 157 of file ModelMultiTextured.cpp.

glm::vec3 vis2::ModelMultiTextured::getIdColor ( ) const
inline

getter for the object's unique color

Definition at line 84 of file ModelMultiTextured.h.

const char* vis2::ModelMultiTextured::getIdName ( ) const
inline

getter for the object's unique name

Definition at line 81 of file ModelMultiTextured.h.

void ModelMultiTextured::update ( double  _deltaT)
virtual

Standard function for framerate-independent updates.

Parameters
[in]_deltaTis the duration of the last frame in seconds.

Implements vis2::DrawableObject.

Definition at line 101 of file ModelMultiTextured.cpp.

void ModelMultiTextured::updateModelMatrix ( glm::mat4 &  _modelMatrix)
virtual

Updates the model matrix.

Parameters
[in]_modelMatrixis the new model matrix.

Definition at line 152 of file ModelMultiTextured.cpp.

Member Data Documentation

const glm::vec3 vis2::ModelMultiTextured::contour_color
protected

the edge color to use in edge detecting shaders

Definition at line 90 of file ModelMultiTextured.h.

const glm::vec3 vis2::ModelMultiTextured::id_color
protected

the unique color of this object (used in the color_ID shader program)

Definition at line 89 of file ModelMultiTextured.h.

const char* vis2::ModelMultiTextured::id_name
protected

the unique name of this object

Definition at line 88 of file ModelMultiTextured.h.

GLuint vis2::ModelMultiTextured::index_buffer_handle
protected

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

Definition at line 104 of file ModelMultiTextured.h.

unsigned int vis2::ModelMultiTextured::index_count
protected

nr of polygons to be drawn

Definition at line 94 of file ModelMultiTextured.h.

LoaderOBJ* vis2::ModelMultiTextured::loader_Ptr
protected

pointer to the geometry loader, which fills index_count, and buffers vao_handle to index_buffer_handle

Definition at line 92 of file ModelMultiTextured.h.

GLuint vis2::ModelMultiTextured::normal_buffer_handle
protected

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

Definition at line 102 of file ModelMultiTextured.h.

GLuint vis2::ModelMultiTextured::position_buffer_handle
protected

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

Definition at line 101 of file ModelMultiTextured.h.

ShaderController* vis2::ModelMultiTextured::shader_ctrl[3]
protected

is a pointer to the standard, solid color, and transparency shader controller for this object

Definition at line 96 of file ModelMultiTextured.h.

GLuint vis2::ModelMultiTextured::uv_buffer_handle
protected

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

Definition at line 103 of file ModelMultiTextured.h.

GLuint vis2::ModelMultiTextured::vao_handle[3]
protected

handle to the vertex array object for the standard, solid color, and transparency shader program

Definition at line 98 of file ModelMultiTextured.h.

bool vis2::ModelMultiTextured::vao_setup_done[3]
protected

signifies if the setup for shader slot 0, 1, or 2 was completed

Definition at line 99 of file ModelMultiTextured.h.


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