my world to screen is a bit offset (to the top), im doing it in DX9 EndScene.
anyone have a fix?
here is my code:
Code:
bool WorldScreen(const CFloat3& World, CInt2& Screen) override
{
CFloat3 Position = World - MW3::ViewMatrix->Origin;
CFloat3 Transform(Position.Dot(MW3::Refdef->ViewAxis[1]), Position.Dot(MW3::Refdef->ViewAxis[2]), Position.Dot(MW3::Refdef->ViewAxis[0]));
if (Transform.m_Z < 0.1f)
return false;
Screen.m_X = (float)MW3::Refdef->Width * 0.5f * (1 - (Transform.m_X / MW3::Refdef->FovX / Transform.m_Z));
Screen.m_Y = (float)MW3::Refdef->Height * 0.5f * (1 - (Transform.m_Y / MW3::Refdef->FovY / Transform.m_Z));
return true;
}
Code:
MW3::ViewMatrix = (MW3::CViewMatrix*)0x01065BEC;
MW3::Refdef = (MW3::Refdef_t*)0x96C1B0; //0x9681B0;