Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualstc.5421

Posted 07 December 2012 - 12:12 AM

Simply transform your 3d position by view projection matrix .
md3dDevice->GetTransform(D3DTS_PROJECTION,&pm);
md3dDevice->GetTransform(D3DTS_VIEW,&vm);
D3DXMATRIX vp;
D3DXMatrixMultiply( &vp, &vm, &pm );
D3DXVECTOR4 posBase;
D3DXVec4Transform(&posBase,&D3DXVECTOR4(m_positionVal.x,m_positionVal.y,m_positionVal.z,1.0f),&vp);
posBase.x/=posBase.w; // Screen space X pos
posBase.y/=posBase.w; // Screen space Y pos
posBase.z/=posBase.w;


#1stc.5421

Posted 06 December 2012 - 11:47 PM

Simply transform your 3d position by view projection matrix .
md3dDevice->GetTransform(D3DTS_PROJECTION,&pm);

md3dDevice->GetTransform(D3DTS_VIEW,&vm);
D3DXMatrixMultiply( &vp, &vm, &pm );
D3DXVECTOR4 posBase;
D3DXVec4Transform(&posBase,&D3DXVECTOR4(m_positionVal.x,m_positionVal.y,m_positionVal.z,1.0f),&vp);
posBase.x/=posBase.w; // Screen space X pos
posBase.y/=posBase.w; // Screen space Y pos
posBase.z/=posBase.w;


PARTNERS