| [497] | 1 | #ifndef _WorldEntity_H__ | 
|---|
 | 2 | #define _WorldEntity_H__ | 
|---|
 | 3 |  | 
|---|
 | 4 | #include "BaseObject.h" | 
|---|
 | 5 | #include "Tickable.h" | 
|---|
 | 6 | #include "../core/CoreIncludes.h" | 
|---|
 | 7 | #include "OgreSceneManager.h" | 
|---|
 | 8 | #include "OgreSceneNode.h" | 
|---|
 | 9 |  | 
|---|
 | 10 | namespace orxonox | 
|---|
 | 11 | { | 
|---|
 | 12 |     class WorldEntity : public BaseObject, public Tickable | 
|---|
 | 13 |     { | 
|---|
 | 14 |         public: | 
|---|
 | 15 |             WorldEntity(); | 
|---|
 | 16 |             ~WorldEntity(); | 
|---|
 | 17 |  | 
|---|
 | 18 |             void tick(float dt); | 
|---|
 | 19 |  | 
|---|
 | 20 |             inline Ogre::SceneNode* getNode() | 
|---|
 | 21 |                 { return this->node_; } | 
|---|
 | 22 |  | 
|---|
 | 23 |             inline void setPosition(const Vector3& pos) | 
|---|
 | 24 |                 { this->node_->setPosition(pos); } | 
|---|
 | 25 |             inline void setPosition(Real x, Real y, Real z) | 
|---|
 | 26 |                 { this->node_->setPosition(x, y, z); } | 
|---|
 | 27 |             inline const Vector3& getPosition() const | 
|---|
 | 28 |                 { return this->node_->getPosition(); } | 
|---|
 | 29 |  | 
|---|
 | 30 |             inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) | 
|---|
 | 31 |                 { this->node_->translate(d, relativeTo); } | 
|---|
 | 32 |             inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) | 
|---|
 | 33 |                 { this->node_->translate(x, y, z, relativeTo); } | 
|---|
 | 34 |             inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) | 
|---|
 | 35 |                 { this->node_->translate(axes, move, relativeTo); } | 
|---|
 | 36 |             inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) | 
|---|
 | 37 |                 { this->node_->translate(axes, x, y, z, relativeTo); } | 
|---|
 | 38 |  | 
|---|
 | 39 |             inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) | 
|---|
 | 40 |                 { this->node_->yaw(angle, relativeTo); } | 
|---|
 | 41 |             inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) | 
|---|
 | 42 |                 { this->node_->pitch(angle, relativeTo); } | 
|---|
 | 43 |             inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) | 
|---|
 | 44 |                 { this->node_->roll(angle, relativeTo); } | 
|---|
 | 45 |  | 
|---|
 | 46 |             inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) | 
|---|
 | 47 |                 { this->node_->rotate(axis, angle, relativeTo); } | 
|---|
 | 48 |             inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) | 
|---|
 | 49 |                 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } | 
|---|
 | 50 |             inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) | 
|---|
 | 51 |                 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } | 
|---|
 | 52 |             inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) | 
|---|
 | 53 |                 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } | 
|---|
 | 54 |  | 
|---|
 | 55 |             inline void attachObject(Ogre::MovableObject *obj) | 
|---|
 | 56 |                 { this->node_->attachObject(obj); } | 
|---|
 | 57 |             inline void detachObject(Ogre::MovableObject *obj) | 
|---|
 | 58 |                 { this->node_->detachObject(obj); } | 
|---|
 | 59 |             inline void detachAllObjects() | 
|---|
 | 60 |                 { this->node_->detachAllObjects(); } | 
|---|
 | 61 |  | 
|---|
 | 62 |             inline void setVelocity(const Vector3& velocity) | 
|---|
 | 63 |                 { this->velocity_ = velocity; } | 
|---|
 | 64 |             inline void setVelocity(Real x, Real y, Real z) | 
|---|
 | 65 |                 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; } | 
|---|
 | 66 |             inline const Vector3& getVelocity() const | 
|---|
 | 67 |                 { return this->velocity_; } | 
|---|
 | 68 |  | 
|---|
 | 69 |             inline void setAcceleration(const Vector3& acceleration) | 
|---|
 | 70 |                 { this->acceleration_ = acceleration; } | 
|---|
 | 71 |             inline void setAcceleration(Real x, Real y, Real z) | 
|---|
 | 72 |                 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; } | 
|---|
 | 73 |             inline const Vector3& getAcceleration() const | 
|---|
 | 74 |                 { return this->acceleration_; } | 
|---|
 | 75 |  | 
|---|
 | 76 |             inline void setRotationAxis(const Vector3& axis) | 
|---|
 | 77 |                 { this->rotationAxis_ = axis; } | 
|---|
 | 78 |             inline void setRotationAxis(Real x, Real y, Real z) | 
|---|
 | 79 |                 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; } | 
|---|
 | 80 |             inline const Vector3& getRotationAxis() const | 
|---|
 | 81 |                 { return this->rotationAxis_; } | 
|---|
 | 82 |  | 
|---|
 | 83 |             inline void setRotationRate(const Radian& angle) | 
|---|
 | 84 |                 { this->rotationRate_ = angle; } | 
|---|
 | 85 |             inline void setRotationRate(const Degree& angle) | 
|---|
 | 86 |                 { this->rotationRate_ = angle; } | 
|---|
 | 87 |             inline const Radian& getRotationRate() const | 
|---|
 | 88 |                 { return this->rotationRate_; } | 
|---|
 | 89 |  | 
|---|
 | 90 |             inline void setMomentum(const Radian& angle) | 
|---|
 | 91 |                 { this->momentum_ = angle; } | 
|---|
 | 92 |             inline void setMomentum(const Degree& angle) | 
|---|
 | 93 |                 { this->momentum_ = angle; } | 
|---|
 | 94 |             inline const Radian& getMomentum() const | 
|---|
 | 95 |                 { return this->momentum_; } | 
|---|
 | 96 |  | 
|---|
 | 97 |  | 
|---|
 | 98 |             static Ogre::SceneManager* sceneManager_s; | 
|---|
 | 99 |             static int num_s; | 
|---|
 | 100 |  | 
|---|
 | 101 |         private: | 
|---|
 | 102 |             Ogre::SceneNode* node_; | 
|---|
 | 103 |             static unsigned int worldEntityCounter_s; | 
|---|
 | 104 |  | 
|---|
 | 105 |             bool bStatic_; | 
|---|
 | 106 |             Vector3 velocity_; | 
|---|
 | 107 |             Vector3 acceleration_; | 
|---|
 | 108 |             Vector3 rotationAxis_; | 
|---|
 | 109 |             Radian rotationRate_; | 
|---|
 | 110 |             Radian momentum_; | 
|---|
 | 111 |     }; | 
|---|
 | 112 | } | 
|---|
 | 113 |  | 
|---|
 | 114 | #endif | 
|---|