2019-12-22 12:04:07 -08:00
|
|
|
#include "Runtime/GuiSys/CTargetingManager.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
|
|
|
#include "Runtime/Camera/CGameCamera.hpp"
|
2022-02-24 23:45:25 -08:00
|
|
|
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
2017-04-01 20:03:37 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2017-04-01 20:03:37 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
CTargetingManager::CTargetingManager(const CStateManager& mgr) : x0_targetReticule(mgr) {}
|
2017-04-01 20:03:37 -07:00
|
|
|
|
2020-05-02 18:56:55 -07:00
|
|
|
bool CTargetingManager::CheckLoadComplete() const {
|
|
|
|
return x0_targetReticule.CheckLoadComplete() && x21c_orbitPointMarker.CheckLoadComplete();
|
2017-04-02 18:39:23 -07:00
|
|
|
}
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
void CTargetingManager::Update(float dt, const CStateManager& stateMgr) {
|
|
|
|
x0_targetReticule.Update(dt, stateMgr);
|
|
|
|
x21c_orbitPointMarker.Update(dt, stateMgr);
|
2017-04-02 18:39:23 -07:00
|
|
|
}
|
|
|
|
|
2020-04-09 18:28:50 -07:00
|
|
|
void CTargetingManager::Draw(const CStateManager& mgr, bool hideLockon) {
|
2019-02-23 23:15:54 -08:00
|
|
|
CGraphics::SetAmbientColor(zeus::skWhite);
|
2018-12-07 21:30:43 -08:00
|
|
|
CGraphics::DisableAllLights();
|
|
|
|
x21c_orbitPointMarker.Draw(mgr);
|
|
|
|
const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
|
|
|
|
zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
|
|
|
|
CGraphics::SetViewPointMatrix(camXf);
|
|
|
|
zeus::CFrustum frustum;
|
2022-02-27 14:46:15 -08:00
|
|
|
frustum.updatePlanes(camXf,
|
|
|
|
zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), CGraphics::GetViewportAspect(), 1.f, 100.f));
|
2018-12-07 21:30:43 -08:00
|
|
|
g_Renderer->SetClippingPlanes(frustum);
|
2022-02-27 14:46:15 -08:00
|
|
|
g_Renderer->SetPerspective(curCam->GetFov(), CGraphics::GetViewportWidth(), CGraphics::GetViewportHeight(),
|
|
|
|
curCam->GetNearClipDistance(), curCam->GetFarClipDistance());
|
2018-12-07 21:30:43 -08:00
|
|
|
x0_targetReticule.Draw(mgr, hideLockon);
|
2017-05-18 12:27:21 -07:00
|
|
|
}
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
void CTargetingManager::Touch() { x0_targetReticule.Touch(); }
|
2017-05-18 12:27:21 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|