2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 17:47:43 +00:00

Missing SCAN packaging fix

This commit is contained in:
Jack Andersen
2018-05-07 16:11:07 -10:00
parent 9d25d44fe8
commit 70e791babc
83 changed files with 272 additions and 173 deletions

View File

@@ -1030,8 +1030,10 @@ float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos,
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
zeus::CVector3f viewPos = cam->GetTransform().transposeRotate(pos - cam->GetTransform().origin);
float unclampedX = (cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x -
cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x) * 640.f;
viewPos = zeus::CVector3f(viewPos.x, viewPos.z, -viewPos.y);
float realX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos).x;
float offsetX = cam->GetPerspectiveMatrix().multiplyOneOverW(viewPos + zeus::CVector3f(scale, 0.f, 0.f)).x;
float unclampedX = (offsetX - realX) * 640;
return zeus::clamp(clampMin, unclampedX, clampMax) / unclampedX * scale;
}