www.pudn.com > DirectX source.zip > CMeshNode.h


/*! 
	@file : CMeshNode.h 
	Contains the header of class CMeshNode. 
 
	@author Sarmad Kh. Abdulla 
*/ 
//------------------------------------------------------------------------------ 
 
 
//! A mesh object in a skin hierarchy mesh 
/*! This class holds a mesh that's part of a hierarchy mesh. */ 
class CMeshNode : public CObject 
{ 
// construction / destruction 
public: 
	CMeshNode() 
	{ 
		InitObject(); 
	} 
	virtual ~CMeshNode() 
	{ 
		Destroy(); 
	} 
 
// member functions 
public: 
	//! Create the mesh object from an x file data object 
	void Create( LPDIRECTXFILEDATA pxofobj, LPDIRECT3DDEVICE8 pd3ddevice ); 
	//! Generate the blended mesh and its associated data. 
	void GenerateMesh( void ); 
	//! Destroy the current mesh 
	virtual void Destroy( void ); 
	//! Return the name of this mesh. 
	string & GetName( void ) 
	{ 
		return Name; 
	} 
	//! Set the name of this mesh. 
	void SetName( const char * name ) 
	{ 
		Name = name; 
	} 
	//! Find the bones of this mesh 
	void FindBones( class CFrameNode * prootframe ); 
	//! Render the mesh to a device 
	void Render( LPDIRECT3DDEVICE8 pd3ddevice ); 
protected: 
	//! Initialize the mesh's variables 
	void InitObject( void ); 
 
// member variables 
protected: 
	string Name;							//!< The name of the mesh 
	// mesh variables 
	LPD3DXSKINMESH pD3DXSkinMesh;			//!< Pointer to the D3DX skin mesh 
	LPD3DXMESH pD3DXBlendedMesh;			//!< Pointer to the blended mesh 
	DWORD * rgiAdjacency;					//!< The adjacency array 
	// materials 
	D3DMATERIAL8 * aMaterial;				//!< The array of materials 
	LPDIRECT3DTEXTURE8 * apD3DTexture;		//!< The array of textures 
	DWORD dwMaterialCount;					//!< The number of materials 
	// skinning info 
	DWORD dwAttrCount;						//!< The attribute count 
    DWORD dwMaxFaceInfl;					//!< Maximum face influence 
	D3DXMATRIX ** apBoneMatrix;				//!< Bones' matrices array 
	LPD3DXBUFFER pBoneNamesBuf;				//!< Bones' names buffer 
	D3DXMATRIX * aBoneOffsetMatrix;			//!< Bones' offset matrices 
	LPD3DXBUFFER pBoneCombinationBuf;		//!< Bone combinations buffer 
};