NvGLModel Class Reference

Drawable geometric model using GL VBOs. More...

#include <NvGLModel.h>

List of all members.

Public Member Functions

void loadModelFromObjData (char *fileData)
 Load the model from OBJ format data Loads a model from OBJ-formatted file data.
void rescaleModel (float radius)
 Rescale the model geometry.
void initBuffers (bool computeTangents=false)
 Initialize or update the model geometry VBOs.
void drawElements (GLint positionHandle)
 Draw the model using the current shader (positions) Binds the vertex position array to the given attribute array index and draws the model with the currently bound shader.
void drawElements (GLint positionHandle, GLint normalHandle)
 Draw the model using the current shader (positions and normals) Binds the vertex position and normal arrays to the given attribute array indices and draws the model with the currently bound shader.
void drawElements (GLint positionHandle, GLint normalHandle, GLint texcoordHandle)
 Draw the model using the current shader (positions, UVs and normals) Binds the vertex position, UV and normal arrays to the given attribute array indices and draws the model with the currently bound shader.
void drawElements (GLint positionHandle, GLint normalHandle, GLint texcoordHandle, GLint tangentHandle)
 Draw the model using the current shader (positions, UVs, normals and tangents) Binds the vertex position, UV, normal and tangent arrays to the given attribute array indices and draws the model with the currently bound shader.
NvModelgetModel ()
 Get the low-level geometry data.
void computeCenter ()
 Updates the center point of the model.

Public Attributes

nv::vec3f m_center
 The computed center of the bounding box of the app.


Detailed Description

Drawable geometric model using GL VBOs.

Supports loading from OBJ file data. Contains positions as well as optional normals, UVs, and tangent vectors


Member Function Documentation

void NvGLModel::drawElements ( GLint  positionHandle,
GLint  normalHandle,
GLint  texcoordHandle,
GLint  tangentHandle 
)

Draw the model using the current shader (positions, UVs, normals and tangents) Binds the vertex position, UV, normal and tangent arrays to the given attribute array indices and draws the model with the currently bound shader.

Parameters:
[in] positionHandle the vertex attribute array index that represents position in the current shader
[in] normalHandle the vertex attribute array index that represents normals in the current shader
[in] texcoordHandle the vertex attribute array index that represents UVs in the current shader
[in] tangentHandle the vertex attribute array index that represents tangents in the current shader

void NvGLModel::drawElements ( GLint  positionHandle,
GLint  normalHandle,
GLint  texcoordHandle 
)

Draw the model using the current shader (positions, UVs and normals) Binds the vertex position, UV and normal arrays to the given attribute array indices and draws the model with the currently bound shader.

Parameters:
[in] positionHandle the vertex attribute array index that represents position in the current shader
[in] normalHandle the vertex attribute array index that represents normals in the current shader
[in] texcoordHandle the vertex attribute array index that represents UVs in the current shader

void NvGLModel::drawElements ( GLint  positionHandle,
GLint  normalHandle 
)

Draw the model using the current shader (positions and normals) Binds the vertex position and normal arrays to the given attribute array indices and draws the model with the currently bound shader.

Parameters:
[in] positionHandle the vertex attribute array index that represents position in the current shader
[in] normalHandle the vertex attribute array index that represents normals in the current shader

void NvGLModel::drawElements ( GLint  positionHandle  ) 

Draw the model using the current shader (positions) Binds the vertex position array to the given attribute array index and draws the model with the currently bound shader.

Parameters:
[in] positionHandle the vertex attribute array index that represents position in the current shader

NvModel* NvGLModel::getModel (  ) 

Get the low-level geometry data.

Returns the underlying geometry model data instance

Returns:
a pointer to the NvModel instance that holds the client-memory data

void NvGLModel::initBuffers ( bool  computeTangents = false  ) 

Initialize or update the model geometry VBOs.

Parameters:
[in] computeTangents if set to true, then tangent vectors will be computed to be in the S texture coordinate direction. This may require vertices to be duplicated in order to allow multiple tangents at a point. This can cause model size explosion, and should be done only if required.

void NvGLModel::loadModelFromObjData ( char *  fileData  ) 

Load the model from OBJ format data Loads a model from OBJ-formatted file data.

Parameters:
[in] fileData pointer to the OBJ file loaded into memory. This pointer is not cached in the object, and may be freed after this call returns

void NvGLModel::rescaleModel ( float  radius  ) 

Rescale the model geometry.

Rescales the model geometry and centers it around the origin. Does NOT update the vertex buffers. Applications should update the VBOs via initBuffers

Parameters:
[in] radius the desired new radius. The model geometry will be rescaled to fit this radius


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