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