00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _OGREBULLETCOLLISIONS_CollisionObject_H
00032 #define _OGREBULLETCOLLISIONS_CollisionObject_H
00033
00034 #include "OgreBulletCollisionsPreRequisites.h"
00035
00036 #include "OgreBulletCollisionsWorld.h"
00037
00038 namespace OgreBulletCollisions
00039 {
00040
00053 class Object : public Ogre::MovableObject
00054 {
00055 public:
00056 Object(const Ogre::String &name, CollisionsWorld *world, bool init);
00057
00058 virtual ~Object();
00059
00060
00061 #if (OGRE_VERSION >= ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
00062 void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables);
00063 #endif
00064 virtual const Ogre::String& getMovableType() const;
00065 virtual void _notifyAttached(Ogre::Node* parent,bool isTagPoint = false);
00066
00067 virtual void _notifyCurrentCamera(Ogre::Camera* camera);
00068 virtual const Ogre::AxisAlignedBox& getBoundingBox(void) const;
00069 virtual Ogre::Real getBoundingRadius(void) const;
00070 virtual void _updateRenderQueue(Ogre::RenderQueue* queue);
00071
00072
00073 inline const Ogre::Vector3 &getWorldPosition() const {return mRootNode->_getDerivedPosition();};
00074 inline const Ogre::Quaternion &getWorldOrientation() const {return mRootNode->_getDerivedOrientation();};
00075
00076 inline void setPosition(const Ogre::Vector3 &p) {mRootNode->setPosition (p);};
00077 inline void setOrientation(const Ogre::Quaternion &q) {return mRootNode->setOrientation (q);};
00078
00079 inline void setPosition(const Ogre::Real x, const Ogre::Real y, const Ogre::Real z) {mRootNode->setPosition (x,y,z);};
00080 inline void setOrientation(const Ogre::Real x, const Ogre::Real y, const Ogre::Real z, const Ogre::Real w) {return mRootNode->setOrientation (x,y,z,w);};
00081
00082 virtual void setPosition(const btVector3 &pos);
00083 virtual void setOrientation(const btQuaternion &quat);
00084 virtual void setTransform(const btVector3 &pos, const btQuaternion &quat);
00085 virtual void setTransform(const btTransform& worldTrans);
00086
00087 inline btCollisionObject* getBulletObject() const { return mObject;};
00088 inline btCollisionWorld* getBulletCollisionWorld() const { return mWorld->getBulletCollisionWorld ();};
00089 inline CollisionsWorld* getCollisionWorld() const { return mWorld;};
00090
00091 inline CollisionShape *getShape() const{ return mShape;};
00092 inline DebugCollisionShape* getDebugShape() const{ return mDebugShape;};
00093
00094 void setShape(CollisionShape *shape,
00095 const Ogre::Vector3 &pos,
00096 const Ogre::Quaternion &quat);
00097 void showDebugShape(bool show);
00098
00099 Ogre::SceneNode *getRootNode() { return mRootNode; }
00100
00101 protected:
00102
00103 Ogre::SceneNode* mRootNode;
00104 Ogre::SceneNode* mShapeNode;
00105 Ogre::SceneNode* mDebugNode;
00106
00107 ObjectState * mState;
00108 CollisionsWorld* mWorld;
00109
00110 btCollisionObject* mObject;
00111
00112 Ogre::AxisAlignedBox mBounds;
00113
00114 CollisionShape* mShape;
00115 DebugCollisionShape * mDebugShape;
00116
00117 public:
00118 static const Ogre::String mMovableType;
00119 };
00120
00121 }
00122 #endif //_OGREBULLETCOLLISIONS_CollisionObject_H
00123