GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PhysicsDebugDraw.hpp
Go to the documentation of this file.
1 #ifndef RADIX_PHYSICS_DEBUG_DRAW_HPP
2 #define RADIX_PHYSICS_DEBUG_DRAW_HPP
3 
4 #include <memory>
5 #include <vector>
6 
7 #include <epoxy/gl.h>
8 
9 #include <bullet/LinearMath/btIDebugDraw.h>
10 
11 #include <radix/core/gl/VBO.hpp>
12 #include <radix/Camera.hpp>
13 
14 namespace radix {
15 
16 class PhysicsDebugDraw : public btIDebugDraw {
17 private:
18  int dbgMode;
19  std::unique_ptr<VBO> vbo;
20  struct PtData {
21  float x, y, z, r, g, b;
22  };
23  std::vector<PtData> points;
24 
25 public:
27 
28  void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color);
29  void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &fromColor,
30  const btVector3 &toColor);
31  void reportErrorWarning(const char *warningString);
32  void draw3dText(const btVector3 &location, const char *textString);
33  void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB,
34  btScalar distance, int lifeTime, const btVector3 &color);
35  void setDebugMode(int debugMode);
36  int getDebugMode() const;
37 
38  void render(const Camera &cam);
39 };
40 
41 } /* namespace radix */
42 
43 #endif /* RADIX_PHYSICS_DEBUG_DRAW_HPP */
Definition: GameController.hpp:7
PhysicsDebugDraw()
Definition: PhysicsDebugDraw.cpp:9
Definition: PhysicsDebugDraw.hpp:16
void reportErrorWarning(const char *warningString)
Definition: PhysicsDebugDraw.cpp:25
void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)
Definition: PhysicsDebugDraw.cpp:29
float b
Definition: PhysicsDebugDraw.hpp:21
int getDebugMode() const
Definition: PhysicsDebugDraw.cpp:17
void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
Definition: PhysicsDebugDraw.cpp:43
std::vector< PtData > points
Definition: PhysicsDebugDraw.hpp:23
void setDebugMode(int debugMode)
Definition: PhysicsDebugDraw.cpp:21
std::unique_ptr< VBO > vbo
Definition: PhysicsDebugDraw.hpp:19
float x
Definition: PhysicsDebugDraw.hpp:21
float r
Definition: PhysicsDebugDraw.hpp:21
Definition: PhysicsDebugDraw.hpp:20
int dbgMode
Definition: PhysicsDebugDraw.hpp:18
Definition: Camera.hpp:11
void draw3dText(const btVector3 &location, const char *textString)
Definition: PhysicsDebugDraw.cpp:13
float y
Definition: PhysicsDebugDraw.hpp:21
float z
Definition: PhysicsDebugDraw.hpp:21
float g
Definition: PhysicsDebugDraw.hpp:21
void render(const Camera &cam)
Definition: PhysicsDebugDraw.cpp:49