Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/SuperOrxoBros_HS18/src/libraries/tools/BulletDebugDrawer.h @ 12175

Last change on this file since 12175 was 12175, checked in by siramesh, 5 years ago

Super Orxo Bros (Sidharth Ramesh, Nisa Balta, Jeff Ren)

File size: 3.1 KB
Line 
1#ifndef _BulletDebugDrawer_H__
2#define _BulletDebugDrawer_H__
3
4#include "tools/ToolsPrereqs.h"
5
6#include <btBulletCollisionCommon.h>
7#include <OgreFrameListener.h>
8#include <OgreVector3.h>
9#include <OgreColourValue.h>
10
11namespace orxonox
12{
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    */
19    class _ToolsExport BulletDebugDrawer : public btIDebugDraw, public Ogre::FrameListener
20    {
21        public:
22            BulletDebugDrawer(Ogre::SceneManager* sceneManager);
23            ~BulletDebugDrawer();
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;
33
34            virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color) override;
35
36            virtual void reportErrorWarning(const char* warningString) override;
37            virtual void draw3dText(const btVector3& location, const char* textString) override;
38
39            virtual void setDebugMode(int debugMode) override;
40            virtual int getDebugMode() const override;
41
42            void configure(bool bFill, float fillAlpha);
43
44        protected:
45            virtual bool frameStarted(const Ogre::FrameEvent& evt) override;
46            virtual bool frameEnded(const Ogre::FrameEvent& evt) override;
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__ */
Note: See TracBrowser for help on using the repository browser.