Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- -----------------------------------------
- * Game hacking QTS ( Quickie Tip Series )
- * no. 10 - World to screen
- -----------------------------------------
- * Author: SEGnosis - GHAnon.net
- * Thanks to:
- * bitterbanana - No known site
- * Drunken Cheetah - No known site
- * fatboy88 - No known site
- * Geek4Ever - No known site
- * learn_more - www.uc-forum.com
- * Novocaine - http://ilsken.net/blog/?page_id=64
- * Philly0494 - No known site
- * Roverturbo - www.uc-forum.com
- * SilentKarma - www.halocoders.com - offline
- * Strife - www.uc-forum.com
- * Wieter20 - No known site
- */
- #define IsW2SValid(a)( ( a.x == -1000 && a.y == -1000 ) ? false : true )
- struct FVect3
- {
- float x,y,z;
- };
- //----------------------------------//
- POINT World2Screen( FVect3 vPos )
- {
- POINT ptRet = { -1000, -1000 };
- D3DXVECTOR3 vScreen,
- vWorld( vPos.x, vPos.y, vPos.z );
- static D3DXMATRIX m_mxProjection,
- m_mxView,
- m_mxWorld;
- pDevice->GetTransform( D3DTS_VIEW, &m_mxView );
- pDevice->GetTransform( D3DTS_PROJECTION, &m_mxProjection );
- pDevice->GetTransform( D3DTS_WORLD, &m_mxWorld );
- pDevice->GetViewport( &m_ViewPort );
- D3DXVec3Project( &vScreen, &vWorld, &m_ViewPort, &m_mxProjection, &m_mxView, &m_mxWorld );
- if( vScreen.z <= 1 )
- {
- ptRet.x = vScreen.x;
- ptRet.y = vScreen.y;
- }
- return ptRet;
- }
- //----------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement