Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added Mesh and Model (doesn't work yet, but i don't want to have merge conflicts all the time :P)

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