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

Work on CPlayerVisor

This commit is contained in:
Jack Andersen
2017-05-29 17:45:31 -10:00
parent 58d8d4fcd2
commit 0c5e4efc46
19 changed files with 636 additions and 150 deletions

View File

@@ -56,4 +56,17 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
}
zeus::CVector3f CCompoundTargetReticle::CalculateOrbitZoneReticlePosition(const CStateManager&) const { return {}; }
float CCompoundTargetReticle::CalculateClampedScale(const zeus::CVector3f& pos, float scale,
float clampMin, float clampMax,
const CStateManager& mgr)
{
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;
return zeus::clamp(clampMin, unclampedX, clampMax) / unclampedX * scale;
}
}