Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

bump

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