Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core/src/orxonox/objects/WorldEntity.h @ 852

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

removed some includes of CoreIncludes.h from other .h files (included in .cc only)

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