Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- D3DXVECTOR3* CTools::W2S(LPDIRECT3DDEVICE9 pDevice, D3DXVECTOR3 &Position)
- {
- D3DXVECTOR3 vWorldLocation = Position;
- pDevice->GetTransform(D3DTS_VIEW, &ViewMatrix);
- pDevice->GetTransform(D3DTS_PROJECTION, &ProjMatrix);
- pDevice->GetTransform(D3DTS_WORLD, &WorldMatrix);
- pDevice->GetViewport(&viewPort);
- D3DXMatrixIdentity(&Identity);
- D3DXVec3Project(&Position, &vWorldLocation, &viewPort, &ProjMatrix, &ViewMatrix, &Identity);
- if (Position.z < 1)
- {
- return &Position;
- }
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement