Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/cpp11_v2/src/libraries/tools/BulletDebugDrawer.h @ 10846

Last change on this file since 10846 was 10845, checked in by landauf, 10 years ago

always use 'virtual' in the declaration of virtual functions even if they are inherited

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