Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CalcScreenCoords(D3DXVECTOR3 *vecWorld, D3DXVECTOR3 *vecScreen)
- {
- /** C++-ifyed function 0x71DA00, formerly called by CHudSA::CalcScreenCoors **/
- // Get the static view matrix as D3DXMATRIX
- D3DXMATRIX m((float *)(0xB6FA2C));
- // Get the static virtual screen (x,y)-sizes
- DWORD *dwLenX = (DWORD *)(0xC17044);
- DWORD *dwLenY = (DWORD *)(0xC17048);
- //DWORD *dwLenZ = (DWORD*)(0xC1704C);
- //double aspectRatio = (*dwLenX) / (*dwLenY);
- // Do a transformation
- vecScreen->x = (vecWorld->z * m._31) + (vecWorld->y * m._21) + (vecWorld->x * m._11) + m._41;
- vecScreen->y = (vecWorld->z * m._32) + (vecWorld->y * m._22) + (vecWorld->x * m._12) + m._42;
- vecScreen->z = (vecWorld->z * m._33) + (vecWorld->y * m._23) + (vecWorld->x * m._13) + m._43;
- // Get the correct screen coordinates
- double fRecip = (double)1.0 / vecScreen->z; //(vecScreen->z - (*dwLenZ));
- vecScreen->x *= abs((float)(fRecip * (*dwLenX)));
- vecScreen->y *= abs((float)(fRecip * (*dwLenY)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement