My Project
Public Member Functions | Public Attributes | List of all members
ParaEngine::CMDXModel Class Reference

This is the ParaX mesh and animation file format model. More...

#include <MDXModel.h>

Public Member Functions

bool Load (const char *inName)
 Load mode from file. More...
 
bool LoadFromX (const char *inName)
 
bool SaveToX (const char *inName, bool bText)
 if bText is true, it will be saved as text version, otherwise, binary format More...
 
void InitDeviceObjects ()
 
void DeleteDeviceObjects ()
 
void AdvanceTime (double dTimeDelta)
 advance the animation. More...
 
void Render (SceneState *sceneState)
 
void UpdateAnim (int animNum)
 
int GetAnimNum (const char *animName)
 if not found(at least 2 characters match) return 0, which is the default animation this is tailored to work for warcraft3 naming conventions. More...
 
void PreviousAnim ()
 
void NextAnim ()
 
void SetModelColor (float r, float g, float b)
 
void SetModelColor (D3DXCOLOR modelcolor)
 
D3DXCOLOR * GetModelColor ()
 
void SetBlendingTime (float fTime)
 
void BuildShadowVolume (ShadowVolume *pShadowVolume, LightParams *pLight, D3DXMATRIX *mxWorld)
 
float ComputeBoundingBox (D3DXVECTOR3 *pMin, D3DXVECTOR3 *pMax)
 pMin:[out] Pointer to a D3DXVECTOR3 structure, describing the returned lower-left corner of the bounding box. More...
 
void SetCurrentAnimInfo (AnimInfo *ai)
 
void GetCurrentAnimInfo (AnimInfo *ai)
 

Public Attributes

CSkeleton skeleton
 
CGeoset geosets
 
CMaterialMap materialMap
 
CTexture texture
 
CSequence sequences
 
CCameras cameras
 
AnimInfo currentAnimInfo
 
AnimInfo nextAnimInfo
 
float fBlendingTime
 
int m_nUseShadowCap
 
int nDefaultStandIndex
 
int nDefaultWalkIndex
 

Detailed Description

This is the ParaX mesh and animation file format model.

It can load from Para X file or MDX file, and save to X file. Please refer to "ParaEngineXFileDef.h" for Para X file template definition. It also supports shadow casting.

Member Function Documentation

§ AdvanceTime()

void ParaEngine::CMDXModel::AdvanceTime ( double  dTimeDelta)

advance the animation.

it may loop to the beginning. currentAnimInfo.currentFrame = currentAnimInfo.startFrame, if the end of animation is reached. the caller can test the above expression to see whether the end of animation has been reached.

load the stand-0 animation.

randomly decide whether to loop or start loiter. rarity value is used in this case.

§ BuildShadowVolume()

void ParaEngine::CMDXModel::BuildShadowVolume ( ShadowVolume pShadowVolume,
LightParams pLight,
D3DXMATRIX *  mxWorld 
)

calculate the skeleton matrices

check if object is too small, if so its shadow will not be rendered

we will not test screen distance if the object neither has a bounding box or a bounding sphere 

i.e. we will draw its shadow anyway

check to see if object may be in shadow. We only performance this test if object does not enforce capping

we use z-fail algorithm, if camera may be in the shadow or the object does not

performance screen distance testing

if object enforces capping, we will use Z_FAIL algorithm

§ ComputeBoundingBox()

float ParaEngine::CMDXModel::ComputeBoundingBox ( D3DXVECTOR3 *  pMin,
D3DXVECTOR3 *  pMax 
)

pMin:[out] Pointer to a D3DXVECTOR3 structure, describing the returned lower-left corner of the bounding box.

See Remarks. pMax:[out] Pointer to a D3DXVECTOR3 structure, describing the returned upper-right corner of the bounding box. See Remarks. @ return: bounding sphere's radius

§ GetAnimNum()

int ParaEngine::CMDXModel::GetAnimNum ( const char *  animName)

if not found(at least 2 characters match) return 0, which is the default animation this is tailored to work for warcraft3 naming conventions.

return the index of the sequence that matches most characters in the animName any spaces are omitted

§ Load()

bool ParaEngine::CMDXModel::Load ( const char *  inName)

Load mode from file.

If it is a para x file, it must has the file extension .x. otherwise it will be recognized as MDX file. Files will first be searched in the current directory, then in the directory of the current MPQ file.

§ LoadFromX()

bool ParaEngine::CMDXModel::LoadFromX ( const char *  inName)

Load animation file ParaEngine X file format

§ SaveToX()

bool ParaEngine::CMDXModel::SaveToX ( const char *  inName,
bool  bText 
)

if bText is true, it will be saved as text version, otherwise, binary format

save animation to ParaEngine X file


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