7 #include "RenderCamera.h"
8 #include "VectorMath.h"
13 namespace DebugRendering
16 static inline bool IsExpired(
const T& drawData)
18 return drawData.Lifetime <= 0.0f;
22 static void UpdateCommandLifetimes(std::vector<T>& drawDatas,
float dt)
24 for(
int i = 0; i < drawDatas.size(); ++i)
27 drawDatas[i].Lifetime -= dt;
32 static void RemoveExpiredCommands(std::vector<T>& drawData)
34 drawData.erase(std::remove_if(drawData.begin(), drawData.end(), IsExpired<T>), drawData.end());
38 inline bool IsInCamera(
const dv3& position,
const float sphereRadius,
const Camera::RenderCamera& renderCamera)
40 const Geometry::Frustum& frustum = renderCamera.GetFrustum();
41 Eegeo::dv3 cameraRelativePosition = position - renderCamera.GetEcefLocation();
45 for (
size_t i = 0; i < Eegeo::Geometry::Frustum::PLANES_COUNT; ++i)
48 double signedDist = p.a * cameraRelativePosition.GetX() + p.b * cameraRelativePosition.GetY() + p.c * cameraRelativePosition.GetZ() + p.d;
50 if (signedDist + sphereRadius < 0.0f)