Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 630 was 630, checked in by scheusso, 16 years ago

made Model and WorldEntity synchronisable

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