-
Автор темы
- #1
Здраствуйте есть у кого нибудь обновленная структура ?
Как только не пытался, всё ровно краш
Как только не пытался, всё ровно краш
C++:
struct IRenderer {
public:
Vec3 GetViewCamera() { return *(Vec3*)((DWORD64)this + 0x17C0); }
float GetWidth() {
return *(int*)((DWORD64)this + (0x14B7F0));//
}
float GetHeight() {
return *(int*)((DWORD64)this + (0x14B7F4));//
}
IDXGISwapChain* GetIDXGISwapChain() { return *(IDXGISwapChain**)((uintptr_t)this + 0x14D000); }
void DrawDynVB(SVF_P3F_C4B_T2F* pBuf, uint16_t* pInds, int nVerts, int nInds, int nPrimType)
{
CallFunction<void(__fastcall*)(PVOID, SVF_P3F_C4B_T2F*, uint16_t*, int, int, int)>(this, 0x208)(this, pBuf, pInds, nVerts, nInds, nPrimType);
}
void Set2DMode(bool enable, int ortox, int ortoy, float znear = -1e10f, float zfar = 1e10f)
{
CallFunction<void(__fastcall*)(PVOID, bool, int, int, float, float)>(this, 0x8C0)(this, enable, ortox, ortoy, znear, zfar);
}
void SetWhiteTexture() { CallFunction<void(__fastcall*)(PVOID)>(this, 0x250)(this); }
void SetState(int State, int AlphaRef = -1) { CallFunction<void(__fastcall*)(PVOID, int, int)>(this, 0xD4)(this, State, AlphaRef); }
void SetCullMode(int mode) { CallFunction<void(__fastcall*)(PVOID, int)>(this, 0x748)(this, mode); }
void PreRender() {
Set2DMode(true, GetWidth(), GetHeight());
}
void PostRender() {
Set2DMode(false, 0, 0);
}
void DrawPrimitive(eRenderPrimitiveType PrimitiveType, const std::initializer_list<SVF_P3F_C4B_T2F> pBuf, const std::initializer_list<uint16_t> pInds) {
SetWhiteTexture();
DrawDynVB((SVF_P3F_C4B_T2F*)pBuf.begin(), (uint16_t*)pInds.begin(), (int)pBuf.size(), (int)pInds.size(), PrimitiveType);
}
bool ProjectToScreen(SWorldToScreen* pWorldToScreen) { return CallFunction<bool(__thiscall*)(PVOID, SWorldToScreen*)>(this, 0x380)(this, pWorldToScreen); }
bool WorldToScreen(Vec3 vPos, Vec3& vOut) {
SWorldToScreen pWorldToScreen;
pWorldToScreen.toX = vPos.x;
pWorldToScreen.toY = vPos.y;
pWorldToScreen.toZ = vPos.z;
pWorldToScreen.outX = &vOut.x;
pWorldToScreen.outY = &vOut.y;
pWorldToScreen.outZ = &vOut.z;
ProjectToScreen(&pWorldToScreen);
vOut.x *= (GetWidth() * 0.01f);
vOut.y *= (GetHeight() * 0.01f);
vOut.z *= 1.0f;
return ((vOut.z < 1.0f) && (vOut.x > 0) && (vOut.x < GetWidth()) && (vOut.y > 0) && (vOut.y < GetHeight()));
}
float GetHypotenuse(Vec3 vPos) {
Vec3 vScreen = { typeZero::ZERO };
if (WorldToScreen(vPos, vScreen))
{
FLOAT PositionX = 0.f;
FLOAT PositionY = 0.f;
FLOAT ScreenCenterX = (GetWidth() / 2.0f);
FLOAT ScreenCenterY = (GetHeight() / 2.0f);
PositionX = vScreen.x > ScreenCenterX ? vScreen.x - ScreenCenterX : ScreenCenterX - vScreen.x;
PositionY = vScreen.y > ScreenCenterY ? vScreen.y - ScreenCenterY : ScreenCenterY - vScreen.y;
return sqrt(PositionX * PositionX + PositionY * PositionY);
}
return 9999.0f;
}
bool IsFov(Vec3 vBonePos, int fov) {
return GetHypotenuse(vBonePos) <= fov * 4;
}
};