Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

sync with notebook, there are some changes in the MultiTypes, XMLPort and the WorldEntity, but there's still a bug in some of the Converter-specializations

File size: 7.7 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 void setYaw(const Degree &angle)
60                { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); }
61            inline void setPitch(const Degree &angle)
62                { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); }
63            inline void setRoll(const Degree &angle)
64                { this->node_->roll(angle, Ogre::Node::TS_LOCAL); }
65
66            inline const Ogre::Quaternion& getOrientation()
67              { return this->node_->getOrientation(); }
68            inline void setOrientation(const Ogre::Quaternion& quat)
69              { this->node_->setOrientation(quat); }
70            inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)
71              { this->node_->rotate(axis, angle, relativeTo); }
72            inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
73              { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); }
74            inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
75              { this->node_->setDirection(vec, relativeTo, localDirectionVector); }
76            inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
77              { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); }
78
79            inline void setScale(const Vector3 &scale)
80              { this->node_->setScale(scale); }
81            inline void setScale(Real x, Real y, Real z)
82              { this->node_->setScale(x, y, z); }
83            inline void setScale(Real scale)
84              { this->node_->setScale(scale, scale, scale); }
85            inline void setTotalScale(Real scale)
86              { this->node_->setScale(scale, scale, scale); }
87            inline const Vector3& getScale(void) const
88              { return this->node_->getScale(); }
89            inline void scale(const Vector3 &scale)
90              { this->node_->scale(scale); }
91            inline void scale(Real x, Real y, Real z)
92              { this->node_->scale(x, y, z); }
93            inline void scale(Real scale)
94              { this->node_->scale(scale, scale, scale); }
95
96            inline void attachObject(Ogre::MovableObject *obj)
97              { this->node_->attachObject(obj); }
98            inline void attachObject(Mesh &mesh)
99              { this->node_->attachObject(mesh.getEntity()); }
100            inline void detachObject(Ogre::MovableObject *obj)
101              { this->node_->detachObject(obj); }
102            inline void detachAllObjects()
103              { this->node_->detachAllObjects(); }
104
105            inline void setVelocity(const Vector3& velocity)
106                { this->velocity_ = velocity; }
107            inline void setVelocity(Real x, Real y, Real z)
108                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
109            inline const Vector3& getVelocity() const
110                { return this->velocity_; }
111
112            inline void setAcceleration(const Vector3& acceleration)
113                { this->acceleration_ = acceleration; }
114            inline void setAcceleration(Real x, Real y, Real z)
115                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
116            inline const Vector3& getAcceleration() const
117                { return this->acceleration_; }
118
119            inline void setRotationAxis(const Vector3& axis)
120                { this->rotationAxis_ = axis; }
121//            inline void setRotationAxis(Real x, Real y, Real z)
122//                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; }
123            inline const Vector3& getRotationAxis() const
124                { return this->rotationAxis_; }
125
126//            inline void setRotationRate(const Radian& angle)
127//                { this->rotationRate_ = angle; }
128            inline void setRotationRate(const Degree& angle)
129                { this->rotationRate_ = angle; }
130            inline const Radian& getRotationRate() const
131                { return this->rotationRate_; }
132
133            inline void setMomentum(const Radian& angle)
134                { this->momentum_ = angle; }
135            inline void setMomentum(const Degree& angle)
136                { this->momentum_ = angle; }
137            inline const Radian& getMomentum() const
138                { return this->momentum_; }
139
140            inline void setStatic(bool bStatic)
141                { this->bStatic_ = bStatic; }
142            inline bool isStatic()
143                { return this->bStatic_; }
144
145        protected:
146            void registerAllVariables();
147
148            Vector3 velocity_;
149            Vector3 acceleration_;
150            Vector3 rotationAxis_;
151            Radian rotationRate_;
152            Radian momentum_;
153
154        private:
155            static unsigned int worldEntityCounter_s;
156            Ogre::SceneNode* node_;
157            bool bStatic_;
158    };
159}
160
161#endif /* _WorldEntity_H__ */
Note: See TracBrowser for help on using the repository browser.