Archived

This topic is now archived and is closed to further replies.

delete

transformations

Recommended Posts

hi all; i am trying to my transformation function to work the way i want it. basicly i have a node that has matrixes for world trans and a float for scale. when the children want to update there transformations the take in to account their parents. i am trying to combine the parents and child rotations then trans then scale but seperately.does any one know what i am doing wrong in this function.
  

class CCyFrame : public CCyObject
{


public:
	CCyFrame();
	virtual~CCyFrame();
     
// Variables

protected:
	
    CCyNode* m_pParentNode; 

// Functions

public:
	// Update the position of this objects

	void UpdateGS(); 
	virtual void UpdateWD();	
	 
	//Render the objects

	 void OnRender(CDXRender& rRenderer); 
	 virtual void Draw(CDXRender& rRenderer) = 0;
	// set parent		

    inline void SetParent (CCyNode* pCyParent){m_pParentNode = pCyParent;}

protected:
	     friend class CDXRender;
	     friend class CCyNode;
	     //Local & World Transform

	     D3DXMATRIX m_LRMatrix;
             D3DXMATRIX m_WRMatrix;
             D3DXMATRIX  m_LTrans;
             D3DXMATRIX  m_WTrans;
	     float m_LScale;
	     float m_WScale;
};
















void CCyFrame::UpdateWD()
{

 if (m_pParentNode)
 {
m_WScale  =  m_pParentNode->m_WScale * m_LScale;	
DXMatrixMultiply(&m_WRMatrix, &m_pParentNode->m_WRMatrix, &m_LRMatrix ); 
D3DXMatrixMultiply(&m_WTrans,&m_pParentNode->m_WTrans,&m_LTrans);

 }
 
 else
 {
  
m_WRMatrix = m_LRMatrix; 
m_WTrans   = m_LTrans;
m_WScale   = m_LScale;
 }


};
  

Share this post


Link to post
Share on other sites