| [10262] | 1 | #ifndef _BulletDebugDrawer_H__ | 
|---|
|  | 2 | #define _BulletDebugDrawer_H__ | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #include "tools/ToolsPrereqs.h" | 
|---|
|  | 5 |  | 
|---|
|  | 6 | #include <btBulletCollisionCommon.h> | 
|---|
| [10277] | 7 | #include <OgreFrameListener.h> | 
|---|
| [11071] | 8 | #include <OgreVector3.h> | 
|---|
|  | 9 | #include <OgreColourValue.h> | 
|---|
| [10262] | 10 |  | 
|---|
|  | 11 | namespace orxonox | 
|---|
|  | 12 | { | 
|---|
| [11099] | 13 | /** | 
|---|
|  | 14 | * Originally from http://www.ogre3d.org/tikiwiki/BulletDebugDrawer&structure=Cookbook | 
|---|
|  | 15 | * This source code is released into the Public Domain. | 
|---|
|  | 16 | * | 
|---|
|  | 17 | * Modified by Fabian 'x3n' Landau by using DebugDrawer and Orxonox specific utilities (e.g. output). | 
|---|
|  | 18 | */ | 
|---|
| [10262] | 19 | class _ToolsExport BulletDebugDrawer : public btIDebugDraw, public Ogre::FrameListener | 
|---|
|  | 20 | { | 
|---|
|  | 21 | public: | 
|---|
|  | 22 | BulletDebugDrawer(Ogre::SceneManager* sceneManager); | 
|---|
|  | 23 | ~BulletDebugDrawer(); | 
|---|
| [11071] | 24 | virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color) override; | 
|---|
|  | 25 | //            virtual void drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar) override; | 
|---|
|  | 26 | virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color) override; | 
|---|
|  | 27 | virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color) override; | 
|---|
|  | 28 | virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color) override; | 
|---|
|  | 29 | virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color) override; | 
|---|
|  | 30 | virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color) override; | 
|---|
|  | 31 | virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color) override; | 
|---|
|  | 32 | //            virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color) override; | 
|---|
| [10262] | 33 |  | 
|---|
| [11071] | 34 | virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color) override; | 
|---|
| [10262] | 35 |  | 
|---|
| [11071] | 36 | virtual void reportErrorWarning(const char* warningString) override; | 
|---|
|  | 37 | virtual void draw3dText(const btVector3& location, const char* textString) override; | 
|---|
| [10262] | 38 |  | 
|---|
| [11071] | 39 | virtual void setDebugMode(int debugMode) override; | 
|---|
|  | 40 | virtual int getDebugMode() const override; | 
|---|
| [10262] | 41 |  | 
|---|
|  | 42 | void configure(bool bFill, float fillAlpha); | 
|---|
|  | 43 |  | 
|---|
|  | 44 | protected: | 
|---|
| [11071] | 45 | virtual bool frameStarted(const Ogre::FrameEvent& evt) override; | 
|---|
|  | 46 | virtual bool frameEnded(const Ogre::FrameEvent& evt) override; | 
|---|
| [10262] | 47 |  | 
|---|
|  | 48 | private: | 
|---|
|  | 49 | struct ContactPoint | 
|---|
|  | 50 | { | 
|---|
|  | 51 | Ogre::Vector3 from; | 
|---|
|  | 52 | Ogre::Vector3 to; | 
|---|
|  | 53 | Ogre::ColourValue color; | 
|---|
|  | 54 | size_t dieTime; | 
|---|
|  | 55 | }; | 
|---|
|  | 56 |  | 
|---|
|  | 57 | bool bFill_; | 
|---|
|  | 58 | DebugDrawer* drawer_; | 
|---|
|  | 59 |  | 
|---|
|  | 60 | DebugDrawModes mDebugMode; | 
|---|
|  | 61 | std::vector<ContactPoint>* mContactPoints; | 
|---|
|  | 62 | std::vector<ContactPoint> mContactPoints1; | 
|---|
|  | 63 | std::vector<ContactPoint> mContactPoints2; | 
|---|
|  | 64 | }; | 
|---|
|  | 65 | } | 
|---|
|  | 66 |  | 
|---|
|  | 67 | #endif /* _BulletDebugDrawer_H__ */ | 
|---|