metaforce/Runtime/GuiSys/CTargetingManager.cpp

40 lines
1.5 KiB
C++
Raw Normal View History

#include "Runtime/GuiSys/CTargetingManager.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/Camera/CGameCamera.hpp"
#include "Runtime/Graphics/CCubeRenderer.hpp"
2017-04-02 03:03:37 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2017-04-02 03:03:37 +00:00
2018-12-08 05:30:43 +00:00
CTargetingManager::CTargetingManager(const CStateManager& mgr) : x0_targetReticule(mgr) {}
2017-04-02 03:03:37 +00:00
bool CTargetingManager::CheckLoadComplete() const {
return x0_targetReticule.CheckLoadComplete() && x21c_orbitPointMarker.CheckLoadComplete();
2017-04-03 01:39:23 +00:00
}
2018-12-08 05:30:43 +00:00
void CTargetingManager::Update(float dt, const CStateManager& stateMgr) {
x0_targetReticule.Update(dt, stateMgr);
x21c_orbitPointMarker.Update(dt, stateMgr);
2017-04-03 01:39:23 +00:00
}
void CTargetingManager::Draw(const CStateManager& mgr, bool hideLockon) {
CGraphics::SetAmbientColor(zeus::skWhite);
2018-12-08 05:30:43 +00: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 22:46:15 +00:00
frustum.updatePlanes(camXf,
zeus::SProjPersp(zeus::degToRad(curCam->GetFov()), CGraphics::GetViewportAspect(), 1.f, 100.f));
2018-12-08 05:30:43 +00:00
g_Renderer->SetClippingPlanes(frustum);
2022-02-27 22:46:15 +00:00
g_Renderer->SetPerspective(curCam->GetFov(), CGraphics::GetViewportWidth(), CGraphics::GetViewportHeight(),
curCam->GetNearClipDistance(), curCam->GetFarClipDistance());
2018-12-08 05:30:43 +00:00
x0_targetReticule.Draw(mgr, hideLockon);
2017-05-18 19:27:21 +00:00
}
2018-12-08 05:30:43 +00:00
void CTargetingManager::Touch() { x0_targetReticule.Touch(); }
2017-05-18 19:27:21 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce