#pragma once #ifndef AI_DEBUGRENDERER_HPP #define AI_DEBUGRENDERER_HPP #include #include #pragma warning (push) #include #include #pragma warning (pop) namespace MW4AI { class DebugRenderer { public: DebugRenderer(); ~DebugRenderer(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Instance // static DebugRenderer* GetInstance(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Drawing // void Execute(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // AI Statistics // enum STATS_RENDERING { STATS_NONE, STATS_ALL, STATS_CURRENT_VEHICLE }; STATS_RENDERING GetAIStatsRendering() const; void SetAIStatsRendering(STATS_RENDERING fDrawStats); bool GetDamageInfoRendering() const; void SetDamageInfoRendering(bool fDrawDamageInfo); bool GetMovementLineRendering() const; void SetMovementLineRendering(bool fDrawMovementLines); bool GetMovementPathRendering() const; void SetMovementPathRendering(bool fDrawMovementPaths); bool GetDeadReckoningRendering() const; void SetDeadReckoningRenderTime(Stuff::Time time = 0); Stuff::Time GetDeadReckoningRenderTime() const; bool GetShowNumPathRequests() const; void SetShowNumPathRequests(bool fShow); bool GetDiagnosticsRendering() const; private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Helper functions // bool WorldToScreenCoords(const Stuff::Point3D& world_coords, Stuff::Vector2DOf& screen_coords) const; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Rendering functions // void DrawLines(); void DrawMovementPaths(); void DrawAIStatsAndDamageInfo(); void DrawNumPathRequests(); void DrawLineCloud(); void DrawDiagnostics(); bool PositionIsInFrontOfCamera(const Stuff::Point3D& pos) const; Stuff::Scalar DistanceFromCamera(const Stuff::Point3D& pos) const; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Line-drawing functions // void ResetLinesToDraw(); void AddPointsToLinesToDraw(const std::vector& points, const Stuff::RGBAColor& color); private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Data members // static DebugRenderer* m_Instance; STATS_RENDERING m_AIStatsRendering; bool m_DamageInfoRendering; bool m_DrawingMovementLines; bool m_DrawingMovementPaths; enum { MAX_LINE_POINTS = 400 }; Stuff::Point3D m_PointData[MAX_LINE_POINTS]; Stuff::RGBAColor m_ColorData[MAX_LINE_POINTS]; unsigned m_PointCount; ElementRenderer::LineCloudElement* m_LineCloud; Stuff::Time m_DeadReckoningRenderTime; bool m_ShowNumPathRequests; unsigned int m_LastDiagnosticSpewFileIndex; std::string m_LastDiagnosticSpew; int m_WheelDelta; }; }; #endif // AI_DEBUGRENDERER_HPP