CSCI441 OpenGL Library 5.9.0
CS@Mines CSCI441 Computer Graphics Course Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
CSCI441::MD5Model Class Reference

stores a Doom3 MD5 Mesh + Animation More...

#include <MD5Model.hpp>

Classes

struct  MD5Animation
 stores an entire animation sequence for a given MD5 Model More...
 
struct  MD5AnimationState
 stores state of current animation frame More...
 
struct  MD5BaseFrameJoint
 base frame joint More...
 
struct  MD5BoundingBox
 bounding box containing the model during animation More...
 
struct  MD5Joint
 a joint of the MD5 Skeleton More...
 
struct  MD5JointInfo
 information pertaining to each animation joint More...
 
struct  MD5Mesh
 mesh that comprises the model's skin More...
 
struct  MD5Texture
 texture handle for the model More...
 
struct  MD5Triangle
 a triangle on the mesh More...
 
struct  MD5Vertex
 a vertex on the mesh More...
 
struct  MD5Weight
 the weight for a mesh vertex More...
 

Public Member Functions

 MD5Model ()
 initializes an empty MD5 Model
 
 ~MD5Model ()
 deallocates any used memory on the CPU and GPU
 
 MD5Model (const MD5Model &)=delete
 do not allow MD5 models to be copied
 
MD5Modeloperator= (const MD5Model &)=delete
 do not allow MD5 models to be copied
 
bool loadMD5Model (const char *MD5_MESH_FILE, const char *MD5_ANIM_FILE="")
 loads a corresponding md5mesh and md5anim file to the object
 
bool isAnimated () const
 returns if the MD5 Model has an accompanying animation
 
bool readMD5Model (const char *FILENAME)
 parses md5mesh file and allocates corresponding mesh data
 
void allocVertexArrays (GLuint vPosAttribLoc, GLuint vColorAttribLoc, GLuint vTexCoordAttribLoc)
 binds model VBOs to attribute pointer locations
 
void draw () const
 draws all the meshes that make up the model
 
void drawSkeleton () const
 draws the skeleton joints (as points) and bones (as lines)
 
bool readMD5Anim (const char *filename)
 reads in an animation sequence from an external file
 
void animate (GLfloat dt)
 advances the model forward in its animation sequence the corresponding amount of time based on frame rate
 

Detailed Description

stores a Doom3 MD5 Mesh + Animation

Constructor & Destructor Documentation

◆ MD5Model()

CSCI441::MD5Model::MD5Model ( )
inline

initializes an empty MD5 Model

Note
need to call loadMD5Model() or readMD5Model() after construction to actually load in a mesh file

Member Function Documentation

◆ allocVertexArrays()

void CSCI441::MD5Model::allocVertexArrays ( GLuint  vPosAttribLoc,
GLuint  vColorAttribLoc,
GLuint  vTexCoordAttribLoc 
)
inline

binds model VBOs to attribute pointer locations

Parameters
vPosAttribLoclocation of vertex position attribute
vColorAttribLoclocation of vertex color attribute
vTexCoordAttribLoclocation of vertex texture coordinate attribute
Note
color attribute used when drawing the skeleton
texCoord attribute used when drawing the mesh

◆ animate()

void CSCI441::MD5Model::animate ( GLfloat  dt)
inline

advances the model forward in its animation sequence the corresponding amount of time based on frame rate

Parameters
dtdelta time since last frame

◆ isAnimated()

bool CSCI441::MD5Model::isAnimated ( ) const
inline

returns if the MD5 Model has an accompanying animation

Returns
true if animation exists for model

◆ loadMD5Model()

bool CSCI441::MD5Model::loadMD5Model ( const char *  MD5_MESH_FILE,
const char *  MD5_ANIM_FILE = "" 
)
inline

loads a corresponding md5mesh and md5anim file to the object

Parameters
MD5_MESH_FILEname of file to load mesh from
MD5_ANIM_FILEname of file to load animation from
Returns
true if both mesh and animation loaded successfully and are compatible

◆ readMD5Anim()

bool CSCI441::MD5Model::readMD5Anim ( const char *  filename)
inline

reads in an animation sequence from an external file

Parameters
filename*.md5anim file to open
Returns
true iff mesh and animation are compatible

◆ readMD5Model()

bool CSCI441::MD5Model::readMD5Model ( const char *  FILENAME)
inline

parses md5mesh file and allocates corresponding mesh data

Parameters
FILENAME*.md5mesh file to load
Returns
true if file parsed successfully

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