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