metaforce/Runtime/GuiSys/CTargetingManager.cpp

39 lines
1.5 KiB
C++
Raw Normal View History

2017-04-02 03:03:37 +00:00
#include "CTargetingManager.hpp"
2017-10-29 06:21:52 +00:00
#include "Camera/CGameCamera.hpp"
#include "CStateManager.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GameGlobalObjects.hpp"
2017-04-02 03:03:37 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
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
2018-12-08 05:30:43 +00:00
bool CTargetingManager::CheckLoadComplete() {
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
}
2018-12-08 05:30:43 +00:00
void CTargetingManager::Draw(const CStateManager& mgr, bool hideLockon) const {
CGraphics::SetAmbientColor(zeus::CColor::skWhite);
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
2018-12-08 05:30:43 +00:00
} // namespace urde