Thrive
debug_drawing.h
1 #pragma once
2 
3 #include "engine/system.h"
4 
5 #include <LinearMath/btIDebugDraw.h>
6 #include <memory>
7 
8 namespace Ogre {
9 class SceneManager;
10 }
11 
12 namespace thrive {
13 
17 class BulletDebugDrawer: public btIDebugDraw {
18 public:
19 
27  Ogre::SceneManager* sceneManager
28  );
29 
34 
43  void
44  drawLine(
45  const btVector3& from,
46  const btVector3& to,
47  const btVector3& fromColour,
48  const btVector3& toColour
49  ) override;
50 
58  void
59  drawLine(
60  const btVector3& from,
61  const btVector3& to,
62  const btVector3& colour
63  ) override;
64 
65 
80  void
82  const btVector3& v0,
83  const btVector3& v1,
84  const btVector3& v2,
85  const btVector3& n0,
86  const btVector3& n1,
87  const btVector3& n2,
88  const btVector3& colour,
89  btScalar alpha
90  ) override;
91 
101  void
102  drawTriangle(
103  const btVector3& v0,
104  const btVector3& v1,
105  const btVector3& v2,
106  const btVector3& colour,
107  btScalar alpha
108  ) override;
109 
119  void
121  const btVector3& PointOnB,
122  const btVector3& normalOnB,
123  btScalar distance,
124  int lifeTime,
125  const btVector3& colour
126  ) override;
127 
133  void
135  const char *warningString
136  ) override;
137 
144  void
145  draw3dText(
146  const btVector3& location,
147  const char *textString
148  ) override;
149 
155  void
156  setDebugMode(
157  int debugMode
158  ) override;
159 
164  int
165  getDebugMode() const override;
166 
167 private:
168 
169  struct Implementation;
170  std::unique_ptr<Implementation> m_impl;
171 
172 };
173 
178 
179 public:
180 
189  static luabind::scope
190  luaBindings();
191 
196 
201 
206  void init(GameState* gameState) override;
207 
211  void shutdown() override;
212 
216  void update(int, int) override;
217 
218 private:
219 
220  struct Implementation;
221  std::unique_ptr<Implementation> m_impl;
222 };
223 
224 }
void init(GameState *gameState) override
Initializes the system.
Definition: debug_drawing.cpp:309
BulletDebugDrawSystem()
Constructor.
Definition: debug_drawing.cpp:299
void draw3dText(const btVector3 &location, const char *textString) override
Overridden from btIDebugDraw::draw3dText.
Definition: debug_drawing.cpp:254
void shutdown() override
Shuts the system down.
Definition: debug_drawing.cpp:325
int getDebugMode() const override
Overridden from btIDebugDraw::getDebugMode.
Definition: debug_drawing.cpp:270
Implementation of Bullet's debug drawing interface.
Definition: debug_drawing.h:17
~BulletDebugDrawer()
Destructor.
Definition: debug_drawing.cpp:166
A system handles one specific part of the game.
Definition: system.h:23
void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &colour) override
Overridden from btIDebugDraw::drawTriangle.
Definition: debug_drawing.cpp:227
void reportErrorWarning(const char *warningString) override
Overridden from btIDebugDraw::reportErrorWarning.
Definition: debug_drawing.cpp:245
Definition: bullet_ogre_conversion.h:6
static luabind::scope luaBindings()
Lua bindings.
Definition: debug_drawing.cpp:282
GameState * gameState() const
Returns the system's game state.
Definition: system.cpp:183
void setDebugMode(int debugMode) override
Overridden from btIDebugDraw::setDebugMode.
Definition: debug_drawing.cpp:263
Represents a distinct set of active systems and entities.
Definition: game_state.h:41
void drawTriangle(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &n0, const btVector3 &n1, const btVector3 &n2, const btVector3 &colour, btScalar alpha) override
Overridden from btIDebugDraw::drawTriangle.
Definition: debug_drawing.cpp:210
Definition: debug_drawing.h:8
Renders physics debug information.
Definition: debug_drawing.h:177
void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &fromColour, const btVector3 &toColour) override
Overridden from btIDebugDraw::drawLine.
Definition: debug_drawing.cpp:170
~BulletDebugDrawSystem()
Destructor.
Definition: debug_drawing.cpp:305
void update(int, int) override
Updates the system.
Definition: debug_drawing.cpp:334
BulletDebugDrawer(Ogre::SceneManager *sceneManager)
Constructor.
Definition: debug_drawing.cpp:158