metaforce/Runtime/GuiSys/CTargetingManager.cpp

47 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
namespace urde
{
2017-10-29 06:21:52 +00:00
CTargetingManager::CTargetingManager(const CStateManager& mgr)
: x0_targetReticule(mgr) {}
2017-04-02 03:03:37 +00:00
2017-04-03 01:39:23 +00:00
bool CTargetingManager::CheckLoadComplete()
{
2017-10-29 06:21:52 +00:00
return (x0_targetReticule.CheckLoadComplete() && x21c_orbitPointMarker.CheckLoadComplete());
2017-04-03 01:39:23 +00:00
}
void CTargetingManager::Update(float dt, const CStateManager& stateMgr)
{
2017-10-29 06:21:52 +00:00
x0_targetReticule.Update(dt, stateMgr);
x21c_orbitPointMarker.Update(dt, stateMgr);
2017-04-03 01:39:23 +00:00
}
2017-10-29 06:21:52 +00:00
void CTargetingManager::Draw(const CStateManager& mgr, bool hideLockon) const
2017-05-18 19:27:21 +00:00
{
2017-10-29 06:21:52 +00:00
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()),
2018-02-05 06:56:09 +00:00
g_Viewport.x8_width / float(g_Viewport.xc_height), 1.f, 100.f));
2017-10-29 06:21:52 +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
}
2017-10-29 06:21:52 +00:00
void CTargetingManager::Touch()
2017-05-18 19:27:21 +00:00
{
2017-10-29 06:21:52 +00:00
x0_targetReticule.Touch();
2017-05-18 19:27:21 +00:00
}
2017-04-02 03:03:37 +00:00
}