Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/ogreode/OgreOdeDebugContact.h @ 1919

Last change on this file since 1919 was 1919, checked in by rgrieder, 16 years ago

Added OgreODE to our source repository because already we really need the newest version. And there is no hope to find any packages under linux.
The files included should compile and link with Ogre 1.4/1.6 and ODE 0.9/0.10. I was only able to test Ogre 1.4 and ODE 0.9/.10 under msvc until now.

  • Property svn:eol-style set to native
File size: 5.9 KB
Line 
1/**
2* File: OgreOdeDebugContact.h
3*
4* description: This create create a billboarding object that display a text.
5* derived from Movable Text
6* @author  2003 by cTh see gavocanov@rambler.ru
7* @update  2006 by barraq see nospam@barraquand.com
8*/
9
10#ifndef __include_OgreOdeDebugContact_H__
11#define __include_OgreOdeDebugContact_H__
12
13#include "OgreOdePreReqs.h"
14#include "OgreOdeDebugObject.h"
15
16namespace OgreOde
17{
18    class DebugContact
19    {
20    public:
21        DebugContact(const Ogre::String &name, World *world);
22         ~DebugContact();
23
24         bool isEnabled () const;
25         void setEnabled (bool enable);
26
27        void update(Contact * const contact);
28
29    private:
30        DebugNormal         *_normal;
31        DebugContactText    *_text;
32        Ogre::Entity        *_point;
33        bool                _enabled;
34        Ogre::String        _name;
35        Ogre::SceneNode     *_node;
36        Ogre::SceneNode     *_point_node;
37        World               *_world;
38    };
39
40    class DebugNormal : public DebugLines
41    {
42    public:
43        DebugNormal() : DebugLines(){};
44        ~DebugNormal(){};
45
46        void update (Contact * const contact);
47    };
48
49    class DebugContactText : public Ogre::MovableObject, public Ogre::Renderable
50    {
51    public:
52        enum HorizontalAlignment    {H_LEFT, H_CENTER};
53        enum VerticalAlignment      {V_BELOW, V_ABOVE};
54        /******************************** public methods ******************************/
55    public:
56        DebugContactText(const Ogre::String &name, 
57                         Ogre::SceneNode *node,
58                         const Ogre::String &caption = "", 
59                         const Ogre::String &fontName = "BlueHighway", 
60                         int charHeight = 32, 
61                         const Ogre::ColourValue &color = Ogre::ColourValue::White);
62
63
64         ~DebugContactText();
65
66        // Set settings
67        void    setPosition(const Ogre::Vector3 &pos);
68
69        void    setFontName(const Ogre::String &fontName);
70        void    setCaption(const Ogre::String &caption);
71        void    setColor(const Ogre::ColourValue &color);
72        void    setCharacterHeight(unsigned int height);
73        void    setSpaceWidth(unsigned int width);
74        void    setTextAlignment(const HorizontalAlignment& horizontalAlignment, 
75                                const VerticalAlignment& verticalAlignment);
76        void    setAdditionalHeight( Ogre::Real height );
77        void    showOnTop(bool show=true);
78
79        // Get settings
80        const   Ogre::String          &getFontName() const {return mFontName;}
81        const   Ogre::String          &getCaption() const {return mCaption;}
82        const   Ogre::ColourValue     &getColor() const {return mColor;}
83
84
85        unsigned int    getCharacterHeight() const {return mCharHeight;}
86        unsigned int    getSpaceWidth() const {return mSpaceWidth;}
87        Ogre::Real                  getAdditionalHeight() const {return mAdditionalHeight;}
88        bool                    getShowOnTop() const {return mOnTop;}
89        Ogre::AxisAlignedBox            GetAABB(void) { return mAABB; }
90               
91#if OGRE_VERSION >= ((1 << 16) | (5 << 8))
92                virtual void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables = false){}
93#endif
94
95        /******************************** protected methods and overload **************/
96    protected:
97
98        // from OgreOdeDebugContact, create the object
99        void    _setupGeometry();
100        void    _updateColors();
101
102        // from MovableObject
103        void                            getWorldTransforms(Ogre::Matrix4 *xform) const;
104        Ogre::Real                      getBoundingRadius(void) const {return mRadius;};
105        Ogre::Real                      getSquaredViewDepth(const Ogre::Camera *cam) const {return 0;};
106#if OGRE_VERSION < ((1 << 16) | (5 << 8))
107        const   Ogre::Quaternion        &getWorldOrientation() const;
108        const   Ogre::Vector3           &getWorldPosition() const;
109#else
110        const   Ogre::Quaternion        &_getDerivedOrientation(void) const;
111        const   Ogre::Vector3           &_getDerivedPosition(void) const;
112#endif
113        const   Ogre::AxisAlignedBox    &getBoundingBox(void) const {return mAABB;};
114        const   Ogre::String            &getName(void) const {return mName;};
115        const   Ogre::String            &getMovableType(void) const {static Ogre::String movType = "MovableText"; return movType;};
116
117        void                            _notifyCurrentCamera(Ogre::Camera *cam);
118        void                            _updateRenderQueue(Ogre::RenderQueue* queue);
119
120        // from renderable
121        void                            getRenderOperation(Ogre::RenderOperation &op);
122        const   Ogre::MaterialPtr       &getMaterial(void) const {assert(!mpMaterial.isNull());return mpMaterial;};
123        const   Ogre::LightList         &getLights(void) const {return mLList;};
124
125        /******************************** OgreOdeDebugContact data ****************************/
126 
127
128    protected:
129        Ogre::String                    mFontName;
130        Ogre::String                    mType;
131        Ogre::String                    mName;
132        Ogre::String                    mCaption;
133        HorizontalAlignment         mHorizontalAlignment;
134        VerticalAlignment           mVerticalAlignment;
135
136        Ogre::ColourValue               mColor;
137        Ogre::RenderOperation   mRenderOp;
138        Ogre::AxisAlignedBox    mAABB;
139        Ogre::LightList             mLList;
140
141        unsigned int                    mCharHeight;
142        unsigned int                    mSpaceWidth;
143
144        bool                            mNeedUpdate;
145        bool                            mUpdateColors;
146        bool                            mOnTop;
147
148        Ogre::Real                          mTimeUntilNextToggle;
149        Ogre::Real                          mRadius;
150        Ogre::Real              mAdditionalHeight;
151
152        Ogre::Camera                    *mpCam;
153        Ogre::RenderWindow          *mpWin;
154        Ogre::Font                          *mpFont;
155        Ogre::MaterialPtr               mpMaterial;
156        Ogre::MaterialPtr               mpBackgroundMaterial;
157
158        Ogre::SceneNode         *mNode;
159    };
160}
161
162#endif
Note: See TracBrowser for help on using the repository browser.