OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bulletdebugdraw.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_MWRENDER_BULLETDEBUGDRAW_H
2 #define OPENMW_MWRENDER_BULLETDEBUGDRAW_H
3 
4 #include <osg/ref_ptr>
5 #include <osg/Array>
6 #include <osg/PrimitiveSet>
7 
8 #include <LinearMath/btIDebugDraw.h>
9 
10 class btCollisionWorld;
11 
12 namespace osg
13 {
14  class Group;
15  class Geometry;
16 }
17 
18 namespace MWRender
19 {
20 
21 class DebugDrawer : public btIDebugDraw
22 {
23 protected:
24  osg::ref_ptr<osg::Group> mParentNode;
25  btCollisionWorld *mWorld;
26  osg::ref_ptr<osg::Geometry> mGeometry;
27  osg::ref_ptr<osg::Vec3Array> mVertices;
28  osg::ref_ptr<osg::DrawArrays> mDrawArrays;
29 
30  bool mDebugOn;
31 
32  void createGeometry();
33  void destroyGeometry();
34 
35 public:
36 
37  DebugDrawer(osg::ref_ptr<osg::Group> parentNode, btCollisionWorld *world);
38  ~DebugDrawer();
39 
40  void step();
41 
42  void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
43 
44  void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color);
45 
46  void reportErrorWarning(const char* warningString);
47 
48  void draw3dText(const btVector3& location,const char* textString) {}
49 
50  //0 for off, anything else for on.
51  void setDebugMode(int isOn);
52 
53  //0 for off, anything else for on.
54  int getDebugMode() const;
55 
56 };
57 
58 
59 }
60 
61 #endif
void drawContactPoint(const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
Definition: bulletdebugdraw.cpp:86
void reportErrorWarning(const char *warningString)
Definition: bulletdebugdraw.cpp:92
void createGeometry()
Definition: bulletdebugdraw.cpp:32
void destroyGeometry()
Definition: bulletdebugdraw.cpp:52
void step()
Definition: bulletdebugdraw.cpp:68
void setDebugMode(int isOn)
Definition: bulletdebugdraw.cpp:97
Definition: bulletdebugdraw.hpp:21
osg::ref_ptr< osg::DrawArrays > mDrawArrays
Definition: bulletdebugdraw.hpp:28
osg::ref_ptr< osg::Vec3Array > mVertices
Definition: bulletdebugdraw.hpp:27
float distance(const ESM::Pathgrid::Point &point, float x, float y, float z)
Definition: pathfinding.cpp:69
DebugDrawer(osg::ref_ptr< osg::Group > parentNode, btCollisionWorld *world)
Definition: bulletdebugdraw.cpp:23
void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)
Definition: bulletdebugdraw.cpp:80
osg::ref_ptr< osg::Geometry > mGeometry
Definition: bulletdebugdraw.hpp:26
~DebugDrawer()
Definition: bulletdebugdraw.cpp:63
int getDebugMode() const
Definition: bulletdebugdraw.cpp:107
btCollisionWorld * mWorld
Definition: bulletdebugdraw.hpp:25
bool mDebugOn
Definition: bulletdebugdraw.hpp:30
void draw3dText(const btVector3 &location, const char *textString)
Definition: bulletdebugdraw.hpp:48
osg::ref_ptr< osg::Group > mParentNode
Definition: bulletdebugdraw.hpp:24