Ocular Engine
DebugGraphics.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_GRAPHICS_DEBUG__H__
19 #define __H__OCULAR_GRAPHICS_DEBUG__H__
20 
21 #include "Math/Vector3.hpp"
22 #include "Math/Color.hpp"
23 #include "Math/Transform.hpp"
24 
25 #include <vector>
26 
27 //------------------------------------------------------------------------------------------
28 
33 namespace Ocular
34 {
39  namespace Graphics
40  {
41  class Mesh;
42  class Material;
43 
47  struct DebugShape
48  {
50 
52 
53  uint64_t creationTime;
54  uint64_t lifetime;
55  };
56 
61  class Debug
62  {
63  public:
64 
65  Debug();
66  ~Debug();
67 
68  //------------------------------------------------------------
69 
78  void addLine(Math::Vector3f const& start, Math::Vector3f const& stop, Core::Color const& color, uint64_t lifetime);
79 
90  void addCircle(Math::Vector3f const& center, float radius, Math::Vector3f const& normal, Core::Color const& color, uint32_t segments, uint64_t lifetime);
91 
95  void render();
96 
97  protected:
98 
99  bool fetchMaterial();
100  void removeDeadShapes();
101 
102  //------------------------------------------------------------
103 
105 
107 
108  std::vector<DebugShape> m_DebugShapes;
109 
110  private:
111  };
112  }
116 }
121 //------------------------------------------------------------------------------------------
122 
123 #endif
Mesh * mesh
Shape's mesh to render.
Definition: DebugGraphics.hpp:49
uint64_t creationTime
Time that the shape was created.
Definition: DebugGraphics.hpp:53
Math::Transform m_Transform
Default identity transform to render all debug shapes with.
Definition: DebugGraphics.hpp:106
uint64_t lifetime
Amount of time (in ms) that the shape should persist.
Definition: DebugGraphics.hpp:54
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
std::vector< DebugShape > m_DebugShapes
Container of all debug shapes to draw.
Definition: DebugGraphics.hpp:108
void render()
Definition: DebugGraphics.cpp:164
Definition: DebugGraphics.hpp:47
Definition: Color.hpp:40
Combination of a VertexBuffer and IndexBuffer.
Definition: Mesh.hpp:49
Draws debug graphics such as lines, points, bounding volumes, axis, etc.
Definition: DebugGraphics.hpp:61
Core::Color color
Color to render the shape with.
Definition: DebugGraphics.hpp:51
Material * m_Material
Flat shader material used to render all debug shapes.
Definition: DebugGraphics.hpp:104
Definition: Transform.hpp:45
void addLine(Math::Vector3f const &start, Math::Vector3f const &stop, Core::Color const &color, uint64_t lifetime)
Definition: DebugGraphics.cpp:54
void addCircle(Math::Vector3f const &center, float radius, Math::Vector3f const &normal, Core::Color const &color, uint32_t segments, uint64_t lifetime)
Definition: DebugGraphics.cpp:95
Definition: Material.hpp:62