www.pudn.com > DirectX source.zip > CFrameNode.h, change:2002-03-09,size:2494b


/*! 
	@file : CFrameNode.h 
	Contains the header of class CFrameNode 
 
	@author Sarmad Kh. Abdulla 
*/ 
//------------------------------------------------------------------------------ 
 
 
//! Represents a frame used to construct a scene hierarchy 
/*! This class represents a frame which is part of a hierarchy mesh. This frame can 
	contain a child frame or a mesh. */ 
class CFrameNode : public CObject 
{ 
// construction / destruction 
public: 
	CFrameNode() 
	{ 
		InitObject(); 
	} 
	virtual ~CFrameNode() 
	{ 
		Destroy(); 
	} 
 
// member functions 
public: 
	//! Load an object into this frame from an x file 
	void Load( LPDIRECTXFILEDATA pxofobj, LPDIRECT3DDEVICE8 pd3ddevice, 
		class CSkinMesh * pskinmesh ); 
	//! Destroy the frame and all of its childs 
	virtual void Destroy( void ); 
	//! Update the matrix of this frame and all of its childs by updating the combined matrix 
	void Update( D3DXMATRIX * mat ); 
	//! Render the child meshes of this frame and its childs 
	void Render( LPDIRECT3DDEVICE8 pd3ddevice ); 
	//! Find a bone with the specified name in this frame hierarchy 
	CFrameNode * FindFrame( const char * framename ); 
	//! Find the bones for each child skin mesh 
	void FindBones( CFrameNode * prootframe ); 
	//! Get a pointer to the combined matrix 
	D3DXMATRIX * GetCombinedMatrix( void ) 
	{ 
		return &CombinedMatrix; 
	} 
	//! Get a pointer to the original matrix 
	D3DXMATRIX * GetOriginalMatrix( void ) 
	{ 
		return &OriginalMatrix; 
	} 
	//! Set the transformation matrix 
	void SetTransformationMatrix( D3DXMATRIX * pmat ) 
	{ 
		TransformationMatrix = *pmat; 
	} 
	//! Return the name of this frame. The name is used to find a specified bone. 
	string & GetName( void ) 
	{ 
		return Name; 
	} 
	//! Set the name of this frame. The name is used to find a specified bone in the hierarchy. 
	void SetName( const char * name ) 
	{ 
		Name = name; 
	} 
protected: 
	//! Initializes object's variables 
	void InitObject( void ); 
 
// member variables 
protected: 
	CObject Meshes;						//!< The meshes link list head 
	string Name;						//!< The name of the frame 
	D3DXMATRIX TransformationMatrix;	//!< The transformation of the frame 
	D3DXMATRIX OriginalMatrix;			//!< The matrix originally loaded with the frame 
	/*! This matrix is the one that's updated at each rendering operation. 
		It's obtained by combining the matrix of this frame with the matrix  
		of the parent frame. */ 
	D3DXMATRIX CombinedMatrix;			//!< The combined matrix 
};