Advertisement
allen343434

Untitled

Mar 23rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. D3DXVECTOR3* CTools::W2S(LPDIRECT3DDEVICE9 pDevice, D3DXVECTOR3 &Position)
  2. {
  3. D3DXVECTOR3 vWorldLocation = Position;
  4. pDevice->GetTransform(D3DTS_VIEW, &ViewMatrix);
  5. pDevice->GetTransform(D3DTS_PROJECTION, &ProjMatrix);
  6. pDevice->GetTransform(D3DTS_WORLD, &WorldMatrix);
  7. pDevice->GetViewport(&viewPort);
  8.  
  9. D3DXMatrixIdentity(&Identity);
  10. D3DXVec3Project(&Position, &vWorldLocation, &viewPort, &ProjMatrix, &ViewMatrix, &Identity);
  11.  
  12. if (Position.z < 1)
  13. {
  14. return &Position;
  15. }
  16. return NULL;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement