Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 708 was 708, checked in by rgrieder, 16 years ago
  • added Vector2, Vector3, Matrix3, ColourValue, Quaternion and String to the misc folder as header files (each of them contains #include <string> … typedef std::string String , etc.)
  • please use String from now on by including <misc/String.h"
  • removed #include <OgreVector3.h", etc. from "CoreIncludes.h" (adjusted all source files)
  • adjusted all the source files (except network, that keeps <string> for the moment) (what a mess..)
  • moved usleep hack to misc/Sleep.h
  • relative include paths for files from other root directories (like misc, network, etc.) (but it stills writes "../Orxonox.h" when in folder orxonox/objects)
  • "OgreSceneManager.h" —> <OgreSceneManager.h>
  • included OrxonoxPrereqs in every file in folder orxonox
  • moved HUD and ParticleInterface to namespace orxonox
  • removed some using namespace Ogre/std when appropriate
  • I hope I haven't forgotten important points..
File size: 6.6 KB
Line 
1#ifndef _WorldEntity_H__
2#define _WorldEntity_H__
3
4#include <OgreSceneManager.h>
5#include <OgreSceneNode.h>
6
7#include "../OrxonoxPrereqs.h"
8
9#include "misc/Vector3.h"
10#include "misc/Matrix3.h"
11#include "misc/Quaternion.h"
12#include "network/Synchronisable.h"
13#include "tinyxml/tinyxml.h"
14#include "../core/CoreIncludes.h"
15#include "BaseObject.h"
16#include "Tickable.h"
17#include "Mesh.h"
18
19namespace orxonox
20{
21  class WorldEntity : public BaseObject, public Tickable, public network::Synchronisable
22  {
23    public:
24      WorldEntity();
25      virtual ~WorldEntity();
26
27      virtual void tick(float dt);
28      virtual void loadParams(TiXmlElement* xmlElem);
29      bool create();
30
31      inline Ogre::SceneNode* getNode()
32          { return this->node_; }
33
34      inline void setNode(Ogre::SceneNode* node)
35          { this->node_ = node; }
36
37      inline void setPosition(const Vector3& pos)
38          { this->node_->setPosition(pos); }
39      inline void setPosition(Real x, Real y, Real z)
40          { this->node_->setPosition(x, y, z); }
41      inline const Vector3& getPosition() const
42          { return this->node_->getPosition(); }
43
44      inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
45          { this->node_->translate(d, relativeTo); }
46      inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
47          { this->node_->translate(x, y, z, relativeTo); }
48      inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
49          { this->node_->translate(axes, move, relativeTo); }
50      inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)
51          { this->node_->translate(axes, x, y, z, relativeTo); }
52
53      inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
54          { this->node_->yaw(angle, relativeTo); }
55      inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
56          { this->node_->pitch(angle, relativeTo); }
57      inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
58          { this->node_->roll(angle, relativeTo); }
59
60      inline const Ogre::Quaternion& getOrientation()
61        { return this->node_->getOrientation(); }
62      inline void setOrientation(const Ogre::Quaternion& quat)
63        { this->node_->setOrientation(quat); }
64      inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
65        { this->node_->rotate(axis, angle, relativeTo); }
66      inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
67        { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
68      inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
69        { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
70      inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
71        { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
72
73      inline void setScale(const Vector3 &scale)
74        { this->node_->setScale(scale); }
75      inline void setScale(Real x, Real y, Real z)
76        { this->node_->setScale(x, y, z); }
77      inline void setScale(Real scale)
78        { this->node_->setScale(scale, scale, scale); }
79      inline const Vector3& getScale(void) const
80        { return this->node_->getScale(); }
81      inline void scale(const Vector3 &scale)
82        { this->node_->scale(scale); }
83      inline void scale(Real x, Real y, Real z)
84        { this->node_->scale(x, y, z); }
85      inline void scale(Real scale)
86        { this->node_->scale(scale, scale, scale); }
87
88      inline void attachObject(Ogre::MovableObject *obj)
89        { this->node_->attachObject(obj); }
90      inline void attachObject(Mesh &mesh)
91        { this->node_->attachObject(mesh.getEntity()); }
92      inline void detachObject(Ogre::MovableObject *obj)
93        { this->node_->detachObject(obj); }
94      inline void detachAllObjects()
95        { this->node_->detachAllObjects(); }
96
97      inline void setVelocity(const Vector3& velocity)
98          { this->velocity_ = velocity; }
99      inline void setVelocity(Real x, Real y, Real z)
100          { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
101      inline const Vector3& getVelocity() const
102          { return this->velocity_; }
103
104      inline void setAcceleration(const Vector3& acceleration)
105          { this->acceleration_ = acceleration; }
106      inline void setAcceleration(Real x, Real y, Real z)
107          { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
108      inline const Vector3& getAcceleration() const
109          { return this->acceleration_; }
110
111      inline void setRotationAxis(const Vector3& axis)
112          { this->rotationAxis_ = axis; }
113      inline void setRotationAxis(Real x, Real y, Real z)
114          { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; }
115      inline const Vector3& getRotationAxis() const
116          { return this->rotationAxis_; }
117
118      inline void setRotationRate(const Radian& angle)
119          { this->rotationRate_ = angle; }
120      inline void setRotationRate(const Degree& angle)
121          { this->rotationRate_ = angle; }
122      inline const Radian& getRotationRate() const
123          { return this->rotationRate_; }
124
125      inline void setMomentum(const Radian& angle)
126          { this->momentum_ = angle; }
127      inline void setMomentum(const Degree& angle)
128          { this->momentum_ = angle; }
129      inline const Radian& getMomentum() const
130          { return this->momentum_; }
131
132      inline void setStatic(bool bStatic)
133          { this->bStatic_ = bStatic; }
134      inline bool isStatic()
135          { return this->bStatic_; }
136
137    protected:
138      void registerAllVariables();
139
140      Vector3 velocity_;
141      Vector3 acceleration_;
142      Vector3 rotationAxis_;
143      Radian rotationRate_;
144      Radian momentum_;
145
146    private:
147      static unsigned int worldEntityCounter_s;
148      Ogre::SceneNode* node_;
149      bool bStatic_;
150  };
151}
152
153#endif /* _WorldEntity_H__ */
Note: See TracBrowser for help on using the repository browser.