xFile_Render Class Reference

Class for rendering an XFile on PS2. More...

#include <xFile_Render.h>

Collaboration diagram for xFile_Render:

Collaboration graph

List of all members.

Public Member Functions

 xFile_Render ()
virtual ~xFile_Render ()
void render (DWORD time=0)
bool load (LPCSTR fileName, bool verboseOutput=true)
void setGlobalPose (const Matrix4x4 &newPose)
void setAnimation (LPCSTR animationSetName=NULL)

Protected Member Functions

bool initialise ()
 XFile Loader Instance.
bool cleanUp ()
bool reset ()
AnimationSet * getAnimationSet (LPCSTR animationSetName)
void updateAnimation (DWORD time=0, bool Loop=true)
void update (Frame *parent)
bool createSubsets ()
bool cleanSubsets ()
bool loadTextures ()
bool cleanTextures ()
int getTextureIndex (Material *material)
int AddSubsetToDMA (Subset *pSubset, bool bTransparent)
void drawMesh (int subsetMeshIndex)
void SetWorldMatrix (const Matrix4x4 &matWorld)
void SetWVPMatrix (const Matrix4x4 &matWVP)

Protected Attributes

mappedTexture ** textures
 Stores the number of textures used by the XFile.
UINT numSubsetMeshes
 Array of mappedTextures representing Textures specified in the XFile.
SubsetMesh ** subsetMeshes
 Stores the number of subset meshes constructed from the XFile.
AnimationSet * setAnimationSet
 Array of SubsetMeshes constructed from the XFile specification.
bool verbose
 Stores true if the.
bool isAnimated
 Stores true if.
bool loaded
 Stores true if the loaded XFile has Animation Data, otherwise stores false.
Matrix4x4 matDiff
 Stores true if loaded successfully, otherwise false. Used to stop render calls to broken instances.
int previousKey
 Used to calculate the difference between two key frame transforms (used for linear interpolation).

Detailed Description

Class for rendering an XFile on PS2.

This class provides a PS2 platform specific interface to Render a DirectX (.X) format file.

David Beirne

Definition at line 28 of file xFile_Render.h.

Constructor & Destructor Documentation

xFile_Render::xFile_Render (  ) 

Default no-args constructor, initialises class instance.

Definition at line 9 of file xFile_Render.cpp.

References initialise().

xFile_Render::~xFile_Render (  )  [virtual]

Default destructor, clears any memory used by class instance.

Definition at line 17 of file xFile_Render.cpp.

References cleanUp().

Member Function Documentation

void xFile_Render::render ( DWORD  time = 0  ) 

Draws the XFile to the screen at its current transformation.

Definition at line 440 of file xFile_Render.cpp.

References drawMesh(), isAnimated, loaded, numSubsetMeshes, xFile_Loader::rootFrame, SetWorldMatrix(), subsetMeshes, update(), and updateAnimation().

bool xFile_Render::load ( LPCSTR  fileName,
bool  verboseOutput = true 

Loads the specified XFile.

Definition at line 72 of file xFile_Render.cpp.

References xFile_Loader::animationSets, createSubsets(), isAnimated, xFile_Loader::load(), loaded, loadTextures(), reset(), xFile_Loader::rootFrame, setAnimationSet, and update().

void xFile_Render::setGlobalPose ( const Matrix4x4 &  newPose  ) 

Sets the current world pose of the entire XFile.

new global pose matrix.

Definition at line 508 of file xFile_Render.cpp.

References loaded, and xFile_Loader::rootFrame.

void xFile_Render::setAnimation ( LPCSTR  animationSetName = NULL  ) 

Sets the current AnimationSet of the XFile (used to switch between animations).

name of animation set to set.

Definition at line 179 of file xFile_Render.cpp.

References xFile_Loader::frames, getAnimationSet(), isAnimated, previousKey, and setAnimationSet.

bool xFile_Render::initialise (  )  [protected]

XFile Loader Instance.

Initialises object instance memory.

Definition at line 25 of file xFile_Render.cpp.

References isAnimated, loaded, numSubsetMeshes, previousKey, setAnimationSet, subsetMeshes, textures, and verbose.

Referenced by reset(), and xFile_Render().

bool xFile_Render::cleanUp (  )  [protected]

Cleans up all memory used by this Object instance.

Definition at line 51 of file xFile_Render.cpp.

References cleanSubsets(), and cleanTextures().

Referenced by reset(), and ~xFile_Render().

bool xFile_Render::reset (  )  [protected]

Resets all memory used by Object instance (cleanUp then Initialise).

Definition at line 62 of file xFile_Render.cpp.

References cleanUp(), and initialise().

Referenced by load().

AnimationSet * xFile_Render::getAnimationSet ( LPCSTR  animationSetName  )  [protected]

Searches for an AnimationSet with the name specified and returns a reference to the first animationSet found if any, otherwise returns NULL.

pointer to matching AnimatinoSet if found, or NULL if none found.
name of animation set to find.

Definition at line 153 of file xFile_Render.cpp.

References xFile_Loader::animationSets.

Referenced by setAnimation().

void xFile_Render::updateAnimation ( DWORD  time = 0,
bool  Loop = true 
) [protected]

Recursively updates the frame hierarchy of the XFile.

current time.
loop - set to true to loop animation or false to play once

Definition at line 219 of file xFile_Render.cpp.

References matDiff, previousKey, and setAnimationSet.

Referenced by render().

void xFile_Render::update ( Frame *  parent  )  [protected]

Recursively updates the frame hierarchy of the XFile (call before rendering if a change has been made).

frame from which to begin updating (usually the root frame when calling), used for recursion.

Definition at line 423 of file xFile_Render.cpp.

Referenced by load(), and render().

bool xFile_Render::createSubsets (  )  [protected]

Creates SubsetMeshes from the meshes in the XFile (splits the meshes into subsets / arranges triangles by material).

true on succeeded, false on fail.

Definition at line 106 of file xFile_Render.cpp.

References AddSubsetToDMA(), Subset::DMAAddress, Subset::faces, getTextureIndex(), xFile_Loader::meshes, numSubsetMeshes, Subset::pMaterial, Subset::pMesh, SubsetMesh::pMesh, subsetMeshes, SubsetMesh::subsets, and Subset::TextureIndex.

Referenced by load().

bool xFile_Render::cleanSubsets (  )  [protected]

Cleans up all memory associated with the subsets.

true on success, false on fail.

Definition at line 299 of file xFile_Render.cpp.

References numSubsetMeshes, and subsetMeshes.

Referenced by cleanUp().

bool xFile_Render::loadTextures (  )  [protected]

Loads the textures specified by filename in the XFile into PS2 Specific Textures in memory.

true on success, false on fail.

Definition at line 317 of file xFile_Render.cpp.

References mappedTexture::FileName, mappedTexture::texture, xFile_Loader::textureFileNames, and textures.

Referenced by load().

bool xFile_Render::cleanTextures (  )  [protected]

Cleans up all memory associated with Textures.

true on success, false on fail.

Definition at line 380 of file xFile_Render.cpp.

References textures.

Referenced by cleanUp().

int xFile_Render::getTextureIndex ( Material *  material  )  [protected]

Searches through the textures Array and returns the index of any texture which matches the FIRST specified in the material instance passed into the parameter.

index of texture in mappedTexture array, or -1 if none found.
pointer to material from which to find the texture.

Definition at line 399 of file xFile_Render.cpp.

References textures.

Referenced by createSubsets().

int xFile_Render::AddSubsetToDMA ( Subset pSubset,
bool  bTransparent 
) [protected]

Unpacks and adds a subset of a mesh to static memory, returning its address.

DMA Address Index of subset memory.
Subset to Add to the DMA.
true if transparent, false if opaque.

Definition at line 543 of file xFile_Render.cpp.

References Subset::faces, SubsetMesh::pMesh, and Subset::pMesh.

Referenced by createSubsets().

void xFile_Render::drawMesh ( int  subsetMeshIndex  )  [protected]

Draws all subsets of the mesh specified by its SubsetMeshes index.

Definition at line 470 of file xFile_Render.cpp.

References subsetMeshes, SubsetMesh::subsets, mappedTexture::texture, and textures.

Referenced by render().

void xFile_Render::SetWorldMatrix ( const Matrix4x4 &  matWorld  )  [protected]

Sets the current world pose of the entire XFile.

new global pose matrix.

Definition at line 521 of file xFile_Render.cpp.

Referenced by render().

void xFile_Render::SetWVPMatrix ( const Matrix4x4 &  matWVP  )  [protected]

Allows the WorldViewProjection matrix to be set.

new worldViewProjection matrix.

Definition at line 532 of file xFile_Render.cpp.

The documentation for this class was generated from the following files:
Generated on Sun May 18 21:45:10 2008 for PS2X by  doxygen 1.5.4