Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/WorldEntity.h @ 589

Last change on this file since 589 was 589, checked in by landauf, 16 years ago

finally found the damn fkng bug.

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