Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool screen_transform(const Vector3& vIn, Vector3& vOut){
- auto cliente_mod = _GetModuleHandleW(L"client_panorama.dll");
- static ptrdiff_t ptrViewMatrix;
- if (!ptrViewMatrix){
- ptrViewMatrix = (ptrdiff_t)(PatternScan(cliente_mod, OBFUSCATED("0F 10 05 ? ? ? ? 8D 85 ? ? ? ? B9")));
- ptrViewMatrix += 0x3;
- ptrViewMatrix = *reinterpret_cast<uintptr_t*>(ptrViewMatrix);
- ptrViewMatrix += 176;
- }
- if (!ptrViewMatrix) { return false; }
- Matrix4x4 vMatrix = *(Matrix4x4*)(ptrViewMatrix);
- vOut[0] = vMatrix.m[0][0] * vIn[0] + vMatrix.m[0][1] * vIn[1] + vMatrix.m[0][2] * vIn[2] + vMatrix.m[0][3];
- vOut[1] = vMatrix.m[1][0] * vIn[0] + vMatrix.m[1][1] * vIn[1] + vMatrix.m[1][2] * vIn[2] + vMatrix.m[1][3];
- float w = vMatrix.m[3][0] * vIn[0] + vMatrix.m[3][1] * vIn[1] + vMatrix.m[3][2] * vIn[2] + vMatrix.m[3][3];
- if (w < 0.01){
- vOut.x *= 100000;
- vOut.y *= 100000;
- return false;
- }
- vOut.x /= w;
- vOut.y /= w;
- return true;
- }
- bool WorldToScreen(const Vector3& in, Vector3& out){
- if (screen_transform(in, out)) {
- int w = 0, h = 0;
- i_EngineClient->GetScreenSize(w, h);
- out.x = (w / 2.0f) + (out.x * w) / 2.0f;
- out.y = (h / 2.0f) - (out.y * h) / 2.0f;
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement