|
发表于 2004-9-7 15:40:00
|
显示全部楼层
Re:请教,怎么得到一个物体的世界坐标,谢谢!!
if( m_pChild )
{
// Save the old matrix sate
D3DMATRIX matWorldOld, matWorldNew;
pd3dDevice->GetTransform( D3DTRANSFORMSTATE_WORLD, &matWorldOld );
// Concat the frame matrix with the current world matrix
matWorldNew = m_mat * matWorldOld;
pd3dDevice->SetTransform( D3DTRANSFORMSTATE_WORLD, &matWorldNew );
// Render the child nodes
m_pChild->Render( pd3dDevice, bAlpha );
// Restore the old matrix state
pd3dDevice->SetTransform( D3DTRANSFORMSTATE_WORLD, &matWorldOld );
}
在渲染前设置好世界坐标,就像绘制普通无题诗一样的 |
|