CObjModel Class Reference

Implementation of IMeshModel. More...

Inheritance diagram for CObjModel:

IMeshModel IModel

List of all members.

Public Member Functions

 CObjModel (void)
 Constructs a CObjModel object.
QString getName (void)
 Returns the name of this model.
void render (const VertexAttribLocations *attribs, const vec4_t *overrideColor)
 Sends the stored geometry to OpenGL via vertex arrays.
void renderNormals (void)
 Draws the vertex normals stored in this model.
void renderTangents (void)
 Draw vertex tangent space basis stored in this model.
int getPrimitiveType (void)
 Returns the primitive type of this model.
QString getPrimitiveTypeName (void)
 Returns the primitive type if this model in a human readable format.
float getBoundingRadius (void)
 Returns the bounding radius of this model.
void getBoundingBox (vec3_t &mins, vec3_t &maxs)
 Returns the bounding box of this model.
bool loadObjModel (const QString &fileName)
 Loads a model from a file.
void printStatistics (void) const
 Prints mesh statistics to stderr.

Classes

class  AutoWaitCursor
 Helper class for displaying the wait cursor.
class  Face
 Face information.
class  Index
 Helper for indexing the data arrays.


Detailed Description

Implementation of IMeshModel.

Constructor & Destructor Documentation

CObjModel::CObjModel ( void   ) 

Constructs a CObjModel object.


Member Function Documentation

QString CObjModel::getName ( void   )  [inline, virtual]

Returns the name of this model.

Implements IModel.

void CObjModel::render ( const VertexAttribLocations attribs,
const vec4_t overrideColor 
) [virtual]

Sends the stored geometry to OpenGL via vertex arrays.

It enables OpenGL client state, binds vertex arrays, draws them and disables the client state.

Parameters:
attribs Custom vertex attribute locations. If this model has these attributes available, they will be bound to the indexed custom vertex attributes. If one of these attributes is -1, it will not be used. If this parameters is set to NULL, no custom attributes will be used.
overrideColor If this parameters if != NULL, then this color will be used as vertex color instead of the values stored in this model.

Implements IModel.

void CObjModel::renderNormals ( void   )  [virtual]

Draws the vertex normals stored in this model.

If no normal are available, this call has no effect. It loops through all vertices and draws a colored line starting at the vertex position and pointing into the normal's direction. The colors are chosen from the largest component: x == red, Y == green, Z == blue.

Implements IModel.

void CObjModel::renderTangents ( void   )  [virtual]

Draw vertex tangent space basis stored in this model.

If no tangent space vectors are available, this call has no effect. Otherwise it draws a line from the vertex position in the direction of each tangent space vector. Tangent == red, Bitangent == green, Normal == blue.

Implements IModel.

int CObjModel::getPrimitiveType ( void   )  [virtual]

Returns the primitive type of this model.

It assumes that the model is constructed of only one primitive type.

Returns:
OpenGL primitive type of this model.

Implements IModel.

QString CObjModel::getPrimitiveTypeName ( void   )  [virtual]

Returns the primitive type if this model in a human readable format.

It assumes that the model is constructeed of only one primitive type.

Returns:
OpenGL primitive type of this model as human readable string.

Implements IModel.

float CObjModel::getBoundingRadius ( void   )  [virtual]

Returns the bounding radius of this model.

Returns:
A bounding sphere radius that can be used for culling, etc.

Implements IModel.

void CObjModel::getBoundingBox ( vec3_t mins,
vec3_t maxs 
) [virtual]

Returns the bounding box of this model.

The bounding box is defined by minimum and maximum coordinates.

Parameters:
mins Buffer to store the minimum coordiantes of the bounding box.
maxs Buffer to store the maximum coordiantes of the bounding box.

Implements IModel.

bool CObjModel::loadObjModel ( const QString &  fileName  )  [virtual]

Loads a model from a file.

The file to load is assumed to be of .OBJ format. If loading fails, then this object looses the data stored in it.

Parameters:
fileName Name of the file to load.
Returns:
Ture if loading succeeded, flase otherwise.

Implements IMeshModel.

void CObjModel::printStatistics ( void   )  const

Prints mesh statistics to stderr.


The documentation for this class was generated from the following file:
Generated on Sun Mar 2 17:12:32 2008 for Shader Maker by  doxygen 1.5.4