bool project_to_screen(int* v, const Vector3& in, Vector3& out) const {
Matrix44 identity;
identity.SetIdentity();
Matrix44 view = driver.Read<Matrix44>(IOGameAddress::pProjectToScreen);
Matrix44 projection = driver.Read<Matrix44>(IOGameAddress::pProjectToScreen + 0x40);
if (__mathVector3Project(&out, &in, v, &projection, &view, &identity)) {
out.x = out.x * 100.0f / (float)v[2];
out.y = out.y * 100.0f / (float)v[3];
return true;
}
return false;
}
bool WorldToScreen(const Vector3& in, Vector3& out) const {
int v[4] = { 0, 0, globals.Width, globals.Height };
project_to_screen(v, in, out);
if (out.z < 0.0f || out.z > 1.0f)
return false;
out.x = out.x * ((float)v[2] / 100.0f);
out.y = out.y * ((float)v[3] / 100.0f);
return true;
}