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/CBooRenderer.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;
frustum.updatePlanes(camXf, zeus::SProjPersp(zeus::degToRad(curCam->GetFov()),
2019-01-23 07:52:19 +00:00
g_Viewport.aspect, 1.f, 100.f));
2018-12-08 05:30:43 +00:00
g_Renderer->SetClippingPlanes(frustum);
g_Renderer->SetPerspective(curCam->GetFov(), g_Viewport.x8_width, g_Viewport.xc_height, curCam->GetNearClipDistance(),
curCam->GetFarClipDistance());
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