[Orxonox-commit 1007] r5728 - in code/branches/libraries2/src: modules modules/objects modules/objects/collisionshapes modules/objects/eventsystem modules/objects/triggers orxonox/objects orxonox/objects/collisionshapes orxonox/objects/worldentities
landauf at orxonox.net
landauf at orxonox.net
Mon Aug 31 21:30:56 CEST 2009
Author: landauf
Date: 2009-08-31 21:30:55 +0200 (Mon, 31 Aug 2009)
New Revision: 5728
Added:
code/branches/libraries2/src/modules/objects/
code/branches/libraries2/src/modules/objects/Attacher.cc
code/branches/libraries2/src/modules/objects/Attacher.h
code/branches/libraries2/src/modules/objects/ForceField.cc
code/branches/libraries2/src/modules/objects/ForceField.h
code/branches/libraries2/src/modules/objects/Planet.cc
code/branches/libraries2/src/modules/objects/Planet.h
code/branches/libraries2/src/modules/objects/Script.cc
code/branches/libraries2/src/modules/objects/Script.h
code/branches/libraries2/src/modules/objects/collisionshapes/
code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.cc
code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.h
code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.cc
code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.h
code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.h
code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.cc
code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.h
code/branches/libraries2/src/modules/objects/eventsystem/
code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.cc
code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.h
code/branches/libraries2/src/modules/objects/eventsystem/EventListener.cc
code/branches/libraries2/src/modules/objects/eventsystem/EventListener.h
code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.cc
code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.h
code/branches/libraries2/src/modules/objects/triggers/
code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt
code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc
code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h
Removed:
code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt
code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc
code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h
code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.cc
code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.h
code/branches/libraries2/src/orxonox/objects/EventDispatcher.cc
code/branches/libraries2/src/orxonox/objects/EventDispatcher.h
code/branches/libraries2/src/orxonox/objects/EventListener.cc
code/branches/libraries2/src/orxonox/objects/EventListener.h
code/branches/libraries2/src/orxonox/objects/EventTarget.cc
code/branches/libraries2/src/orxonox/objects/EventTarget.h
code/branches/libraries2/src/orxonox/objects/Script.cc
code/branches/libraries2/src/orxonox/objects/Script.h
code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc
code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.h
code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc
code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.h
code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc
code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h
code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc
code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.h
code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.cc
code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.h
code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.cc
code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.h
code/branches/libraries2/src/orxonox/objects/worldentities/Planet.cc
code/branches/libraries2/src/orxonox/objects/worldentities/Planet.h
code/branches/libraries2/src/orxonox/objects/worldentities/triggers/
Modified:
code/branches/libraries2/src/orxonox/objects/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/collisionshapes/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt
Log:
Added a new module for unconnected object classes and/or specializations of basisclasses in the orxonox library. All classes are only created and used in XML and therefore aren't needed in the orxonox library itself.
Doesn't compile atm.
Copied: code/branches/libraries2/src/modules/objects/Attacher.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/Attacher.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/Attacher.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,120 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Attacher.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(Attacher);
+
+ Attacher::Attacher(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Attacher);
+
+ this->target_ = 0;
+ }
+
+ void Attacher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Attacher, XMLPort, xmlelement, mode);
+
+ XMLPortParam(Attacher, "target", setTarget, getTarget, xmlelement, mode);
+ XMLPortObject(Attacher, WorldEntity, "", addObject, getObject, xmlelement, mode);
+ }
+
+ void Attacher::processEvent(Event& event)
+ {
+ for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+ (*it)->fireEvent(event);
+ }
+
+ void Attacher::changedActivity()
+ {
+ SUPER(Attacher, changedActivity);
+
+ for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+ (*it)->setActive(this->isActive());
+ }
+
+ void Attacher::changedVisibility()
+ {
+ SUPER(Attacher, changedVisibility);
+
+ for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+ (*it)->setVisible(this->isVisible());
+ }
+
+ void Attacher::addObject(WorldEntity* object)
+ {
+ this->objects_.push_back(object);
+
+ this->attach(object);
+ }
+
+ WorldEntity* Attacher::getObject(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+ {
+ if (i == index)
+ return (*it);
+
+ ++i;
+ }
+ return 0;
+ }
+
+ void Attacher::setTarget(const std::string& target)
+ {
+ this->targetname_ = target;
+ this->target_ = 0;
+
+ if (this->targetname_ == "")
+ return;
+
+ for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
+ if (it->getName() == this->targetname_)
+ this->attachToParent(*it);
+ }
+
+ void Attacher::loadedNewXMLName(BaseObject* object)
+ {
+ if (this->target_ || this->targetname_ == "")
+ return;
+
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(object);
+ if (entity && entity->getName() == this->targetname_)
+ {
+ this->target_ = entity;
+ this->attachToParent(entity);
+ }
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/Attacher.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/Attacher.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/Attacher.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,69 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Attacher_H__
+#define _Attacher_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include <string>
+#include "core/XMLNameListener.h"
+#include "objects/worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Attacher : public StaticEntity, public XMLNameListener
+ {
+ public:
+ Attacher(BaseObject* creator);
+ virtual ~Attacher() {}
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void processEvent(Event& event);
+ virtual void changedActivity();
+ virtual void changedVisibility();
+
+ void addObject(WorldEntity* object);
+ WorldEntity* getObject(unsigned int index) const;
+
+ void setTarget(const std::string& target);
+ inline const std::string& getTarget() const
+ { return this->targetname_; }
+
+ void loadedNewXMLName(BaseObject* object);
+
+ private:
+ WorldEntity* target_;
+ std::string targetname_;
+ std::list<WorldEntity*> objects_;
+ };
+}
+
+#endif /* _Attacher_H__ */
Copied: code/branches/libraries2/src/modules/objects/ForceField.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/ForceField.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/ForceField.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,87 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Aurelian Jaggi
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ForceField.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/worldentities/MobileEntity.h"
+
+namespace orxonox
+{
+ CreateFactory(ForceField);
+
+ ForceField::ForceField(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(ForceField);
+
+ //Standard Values
+ this->setDirection(Vector3::ZERO);
+ velocity_ = 100;
+ diameter_ = 500;
+ length_ = 5000;
+ }
+
+ ForceField::~ForceField() {}
+
+ void ForceField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ForceField, XMLPort, xmlelement, mode);
+
+ //For correct xml import use: position, direction, velocity, scale
+ XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
+ XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
+ XMLPortParam(ForceField, "length" , setLength , getLength , xmlelement, mode).defaultValues(2000);
+ }
+
+ void ForceField::tick(float dt)
+ {
+ for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
+ {
+ //calculate from
+ Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT;
+ directionVec.normalise();
+
+ Vector3 distanceVec = it->getWorldPosition() - (this->getWorldPosition() + (this->length_ / 2 * directionVec));
+
+ //distance from centervector of the field (
+ float distFromCenterVec = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(directionVec)).length();
+
+ if (distanceVec.length() < this->length_ / 2 && distFromCenterVec < diameter_ / 2)
+ {
+ //normalize distance from center
+ it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_);
+ }
+ }
+ }
+}
+
+
+
+
+
Copied: code/branches/libraries2/src/modules/objects/ForceField.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/ForceField.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/ForceField.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Aurelian Jaggi
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _ForceField_H__
+#define _ForceField_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ForceField : public StaticEntity, public Tickable
+ {
+ public:
+ ForceField(BaseObject* creator);
+ virtual ~ForceField();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+
+ inline void setVelocity(float vel)
+ { this->velocity_ = vel; }
+
+ inline float getVelocity()
+ { return velocity_; }
+
+ inline void setDiameter(float diam)
+ { this->diameter_ = diam; }
+
+ inline float getDiameter()
+ { return diameter_; }
+
+ inline void setLength(float l)
+ { this->length_ = l; }
+
+ inline float getLength()
+ { return length_; }
+
+ private:
+ float velocity_;
+ float diameter_;
+ float length_;
+ };
+}
+
+#endif
+
Copied: code/branches/libraries2/src/modules/objects/Planet.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/Planet.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/Planet.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/Planet.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,175 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Marian Runo
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Planet.h"
+
+#include <OgreEntity.h>
+#include <OgreBillboardSet.h>
+#include <OgreProgressiveMesh.h>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
+#include "Camera.h"
+#include "CameraManager.h"
+
+namespace orxonox
+{
+ CreateFactory(Planet);
+
+ /**
+ * @brief Constructor
+ */
+ Planet::Planet(BaseObject* creator): MovableEntity(creator)
+ {
+ RegisterObject(Planet);
+ this->registerVariables();
+ }
+
+ /**
+ * @brief Destructor
+ */
+ Planet::~Planet()
+ {
+ if (this->isInitialized() && this->mesh_.getEntity())
+ this->detachOgreObject(this->mesh_.getEntity());
+ }
+
+ void Planet::tick(float dt)
+ {
+ if(!this->isVisible())
+ return;
+
+ if (GameMode::showsGraphics())
+ {
+ Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
+ if(activeCamera)
+ {
+ float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
+ // COUT(2) << distance << std::endl;
+ float planetRadius = this->getScale();
+
+ float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
+ float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize));
+ newScale = tempTest;
+
+ this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
+ }
+ }
+
+ SUPER(Planet, tick, dt);
+ }
+
+ void Planet::init()
+ {
+ float scaleFactor = this->getScale();
+
+ this->distList.push_back(10.0f*scaleFactor);
+ this->distList.push_back(19.0f*scaleFactor);
+ this->distList.push_back(27.0f*scaleFactor);
+ this->distList.push_back(34.0f*scaleFactor);
+ this->distList.push_back(40.0f*scaleFactor);
+ this->distList.push_back(45.0f*scaleFactor);
+ this->distList.push_back(49.0f*scaleFactor);
+ this->distList.push_back(52.0f*scaleFactor);
+ this->distList.push_back(54.0f*scaleFactor);
+ this->distList.push_back(55.0f*scaleFactor);
+
+ float reductionValue = 0.2f;
+
+ this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+ billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
+
+ this->attachOgreObject(this->billboard_.getBillboardSet());
+ this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
+ this->setCastShadows(true);
+ this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
+ this->mesh_.setCastShadows(true);
+ }
+
+ void Planet::changedMesh()
+ {
+ if (this->mesh_.getEntity())
+ this->detachOgreObject(this->mesh_.getEntity());
+
+ this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+
+ if (this->mesh_.getEntity())
+ {
+ this->attachOgreObject(this->mesh_.getEntity());
+ this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+ this->mesh_.setVisible(this->isVisible());
+ }
+ this->init();
+ }
+
+ void Planet::changedShadows()
+ {
+ this->mesh_.setCastShadows(this->bCastShadows_);
+ }
+
+ /**
+ @brief XML loading and saving.
+ @param xmlelement The XML-element
+ @param loading Loading (true) or saving (false)
+ @return The XML-element
+ */
+ void Planet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Planet, XMLPort, xmlelement, mode);
+
+ if (GameMode::showsGraphics())
+ {
+ XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
+ XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
+ XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
+ XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+ XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
+ }
+ }
+
+ void Planet::registerVariables()
+ {
+ registerVariable(this->atmosphere_, VariableDirection::ToClient);
+ registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
+ registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
+ registerVariable(this->atmosphereSize, VariableDirection::ToClient);
+ registerVariable(this->imageSize, VariableDirection::ToClient);
+ }
+
+ void Planet::changedVisibility()
+ {
+ SUPER(Planet, changedVisibility);
+ if (this->isInitialized())
+ {
+ this->mesh_.setVisible(this->isVisible());
+ this->billboard_.setVisible(this->isVisible());
+ }
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/Planet.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/Planet.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/Planet.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/Planet.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,116 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Marian Runo
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Planet_H__
+#define _Planet_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/BillboardSet.h"
+#include "tools/Mesh.h"
+#include "MovableEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Planet : public MovableEntity
+ {
+ public:
+ Planet(BaseObject* creator);
+
+ virtual ~Planet();
+
+ void init();
+ virtual void tick(float dt);
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedVisibility();
+
+ inline void setMeshSource(const std::string& meshname)
+ { this->meshSrc_ = meshname; this->changedMesh(); }
+
+ inline const std::string& getMeshSource() const
+ { return this->meshSrc_; }
+
+ inline void setCastShadows(bool bCastShadows)
+ { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
+
+ inline bool getCastShadows() const
+ { return this->bCastShadows_; }
+
+ inline const std::string& getMesh() const{
+ return this->meshSrc_;
+ }
+
+ inline void setAtmosphereSize(float size){
+ this->atmosphereSize = size;
+ }
+
+ inline float getAtmosphereSize(){
+ return this->atmosphereSize;
+ }
+
+ inline void setAtmosphere(const std::string& atmosphere){
+ this->atmosphere_ = atmosphere;
+ }
+
+ inline const std::string& getAtmosphere(){
+ return this->atmosphere_;
+ }
+
+ inline void setImageSize(float size){
+ this->imageSize = size;
+ }
+
+ inline float getImageSize(){
+ return this->imageSize;
+ }
+
+ protected:
+ void registerVariables();
+
+ private:
+
+ void changedMesh();
+ void changedShadows();
+
+ std::string meshSrc_;
+ std::string atmosphere_;
+ Mesh mesh_;
+ float atmosphereSize;
+ float imageSize;
+ std::vector<float> distList;
+ BillboardSet billboard_;
+ bool bCastShadows_;
+
+ };
+}
+
+#endif
+
Copied: code/branches/libraries2/src/modules/objects/Script.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/Script.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/Script.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/Script.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,64 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Script.h"
+
+#include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(Script);
+
+ Script::Script(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(Script);
+
+ // Get a new LuaState
+ luaState_ = new LuaState();
+ }
+
+ Script::~Script()
+ {
+ if (this->isInitialized())
+ delete luaState_;
+ }
+
+ void Script::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ BaseObject::XMLPort(xmlelement, mode);
+
+ XMLPortParam(Script, "code", setCode, getCode, xmlelement, mode);
+ }
+
+ void Script::execute()
+ {
+ luaState_->doString(code_);
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/Script.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/Script.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/Script.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/Script.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,56 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Script_H__
+#define _Script_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Script : public BaseObject
+ {
+ public:
+ Script(BaseObject* creator);
+ ~Script();
+ void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void execute();
+
+ void setCode(const std::string& code) { code_ = code; }
+ const std::string& getCode() const { return code_; }
+
+ private:
+ std::string code_;
+ LuaState* luaState_;
+ };
+}
+
+#endif /* _Script_H__ */
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "BoxCollisionShape.h"
+
+#include <BulletCollision/CollisionShapes/btBoxShape.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+ CreateFactory(BoxCollisionShape);
+
+ BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ {
+ RegisterObject(BoxCollisionShape);
+
+ this->halfExtents_ = Vector3(1, 1, 1);
+ updateShape();
+
+ this->registerVariables();
+ }
+
+ BoxCollisionShape::~BoxCollisionShape()
+ {
+ if (this->isInitialized())
+ delete this->collisionShape_;
+ }
+
+ void BoxCollisionShape::registerVariables()
+ {
+ registerVariable(this->halfExtents_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ }
+
+ void BoxCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(BoxCollisionShape, XMLPort, xmlelement, mode);
+
+ XMLPortParam(BoxCollisionShape, "halfExtents", setHalfExtents, getHalfExtents, xmlelement, mode);
+ XMLPortParamLoadOnly(BoxCollisionShape, "width", setWidth, xmlelement, mode);
+ XMLPortParamLoadOnly(BoxCollisionShape, "height", setHeight, xmlelement, mode);
+ XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode);
+ }
+
+ btCollisionShape* BoxCollisionShape::createNewShape() const
+ {
+ return new btBoxShape(multi_cast<btVector3>(this->halfExtents_));
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/BoxCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _BoxCollisionShape_H__
+#define _BoxCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport BoxCollisionShape : public CollisionShape
+ {
+ public:
+ BoxCollisionShape(BaseObject* creator);
+ virtual ~BoxCollisionShape();
+
+ void registerVariables();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setHalfExtents(const Vector3& extents)
+ { this->halfExtents_ = extents; updateShape(); }
+ inline const Vector3& getHalfExtents() const
+ { return halfExtents_;}
+
+ inline void setWidth(float value)
+ { this->halfExtents_.z = value / 2; updateShape(); }
+ inline float getWidth() const
+ { return this->halfExtents_.z * 2; }
+
+ inline void setHeight(float value)
+ { this->halfExtents_.y = value / 2; updateShape(); }
+ inline float getHeight() const
+ { return this->halfExtents_.y * 2; }
+
+ inline void setLength(float value)
+ { this->halfExtents_.x = value / 2; updateShape(); }
+ inline float getLength() const
+ { return this->halfExtents_.x * 2; }
+
+ private:
+ btCollisionShape* createNewShape() const;
+
+ Vector3 halfExtents_;
+ };
+}
+
+#endif /* _BoxCollisionShape_H__ */
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ConeCollisionShape.h"
+
+#include <BulletCollision/CollisionShapes/btConeShape.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(ConeCollisionShape);
+
+ ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ {
+ RegisterObject(ConeCollisionShape);
+
+ this->radius_ = 1.0f;
+ this->height_ = 1.0f;
+ updateShape();
+
+ this->registerVariables();
+ }
+
+ ConeCollisionShape::~ConeCollisionShape()
+ {
+ if (this->isInitialized())
+ delete this->collisionShape_;
+ }
+
+ void ConeCollisionShape::registerVariables()
+ {
+ registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ registerVariable(this->height_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ }
+
+ void ConeCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ConeCollisionShape, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ConeCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
+ XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);
+ }
+
+ btCollisionShape* ConeCollisionShape::createNewShape() const
+ {
+ return new btConeShape(this->radius_, this->height_);
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/ConeCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,64 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ConeCollisionShape_H__
+#define _ConeCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ConeCollisionShape : public CollisionShape
+ {
+ public:
+ ConeCollisionShape(BaseObject* creator);
+ virtual ~ConeCollisionShape();
+
+ void registerVariables();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setRadius(float value)
+ { this->radius_ = value; updateShape(); }
+ inline float getRadius() const
+ { return radius_; }
+
+ inline void setHeight(float value)
+ { this->height_ = value; updateShape(); }
+ inline float getHeight() const
+ { return this->height_; }
+
+ private:
+ btCollisionShape* createNewShape() const;
+
+ float radius_;
+ float height_;
+ };
+}
+
+#endif /* _ConeCollisionShape_H__ */
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Martin Stypinski
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PlaneCollisionShape.h"
+
+#include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+ CreateFactory(PlaneCollisionShape);
+
+ PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ {
+ RegisterObject(PlaneCollisionShape);
+
+ this->normal_ = Vector3(0, 1, 0);
+ this->offset_ = 0.0f;
+ updateShape();
+
+ this->registerVariables();
+ }
+
+ PlaneCollisionShape::~PlaneCollisionShape()
+ {
+ if (this->isInitialized())
+ delete this->collisionShape_;
+ }
+
+ void PlaneCollisionShape::registerVariables()
+ {
+ registerVariable(this->normal_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ registerVariable(this->offset_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ }
+
+ void PlaneCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PlaneCollisionShape, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode);
+ XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);
+ }
+
+ btCollisionShape* PlaneCollisionShape::createNewShape() const
+ {
+ return new btStaticPlaneShape(multi_cast<btVector3>(this->normal_), this->offset_);
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,66 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Martin Stypinski
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PlaneCollisionShape_H__
+#define _PlaneCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport PlaneCollisionShape : public CollisionShape
+ {
+ public:
+ PlaneCollisionShape(BaseObject* creator);
+ virtual ~PlaneCollisionShape();
+
+ void registerVariables();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setNormal(const Vector3& normal)
+ { this->normal_ = normal; updateShape(); }
+ inline const Vector3& getNormal()
+ { return normal_;}
+
+ inline void setOffset(float offset)
+ { this->offset_ = offset; updateShape(); }
+ inline float getOffset()
+ { return this->offset_;}
+
+ private:
+ btCollisionShape* createNewShape()const;
+
+ Vector3 normal_;
+ float offset_;
+ };
+}
+
+#endif /* _PlaneCollisionShape_H__ */
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "SphereCollisionShape.h"
+
+#include <BulletCollision/CollisionShapes/btSphereShape.h>
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(SphereCollisionShape);
+
+ SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ {
+ RegisterObject(SphereCollisionShape);
+
+ this->radius_ = 1.0f;
+ updateShape();
+
+ this->registerVariables();
+ }
+
+ SphereCollisionShape::~SphereCollisionShape()
+ {
+ if (this->isInitialized())
+ delete this->collisionShape_;
+ }
+
+ void SphereCollisionShape::registerVariables()
+ {
+ registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+ }
+
+ void SphereCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SphereCollisionShape, XMLPort, xmlelement, mode);
+
+ XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
+ }
+
+ btCollisionShape* SphereCollisionShape::createNewShape() const
+ {
+ return new btSphereShape(this->radius_);
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/collisionshapes/SphereCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,58 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SphereCollisionShape_H__
+#define _SphereCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport SphereCollisionShape : public CollisionShape
+ {
+ public:
+ SphereCollisionShape(BaseObject* creator);
+ virtual ~SphereCollisionShape();
+
+ void registerVariables();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setRadius(float radius)
+ { this->radius_ = radius; updateShape(); }
+ inline float getRadius() const
+ { return this->radius_; }
+
+ private:
+ btCollisionShape* createNewShape() const;
+
+ float radius_;
+ };
+}
+
+#endif /* _SphereCollisionShape_H__ */
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventDispatcher.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,81 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "EventDispatcher.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+#include "EventTarget.h"
+
+namespace orxonox
+{
+ CreateFactory(EventDispatcher);
+
+ EventDispatcher::EventDispatcher(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(EventDispatcher);
+ }
+
+ EventDispatcher::~EventDispatcher()
+ {
+ if (this->isInitialized())
+ for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+ delete (*it);
+ }
+
+ void EventDispatcher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(EventDispatcher, XMLPort, xmlelement, mode);
+
+ XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode);
+ }
+
+ void EventDispatcher::processEvent(Event& event)
+ {
+ for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+ (*it)->fireEvent(event);
+ }
+
+ void EventDispatcher::addTarget(EventTarget* target)
+ {
+ this->targets_.push_back(target);
+ }
+
+ EventTarget* EventDispatcher::getTarget(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::list<EventTarget*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
+ {
+ if (i == index)
+ return (*it);
+ ++i;
+ }
+ return 0;
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventDispatcher.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventDispatcher.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,57 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _EventDispatcher_H__
+#define _EventDispatcher_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport EventDispatcher : public BaseObject
+ {
+ public:
+ EventDispatcher(BaseObject* creator);
+ virtual ~EventDispatcher();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void processEvent(Event& event);
+
+ void addTarget(EventTarget* target);
+ EventTarget* getTarget(unsigned int index) const;
+
+ private:
+ std::list<EventTarget*> targets_;
+ };
+}
+
+#endif /* _EventDispatcher_H__ */
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventListener.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventListener.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventListener.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventListener.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,96 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "EventListener.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(EventListener);
+
+ EventListener::EventListener(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(EventListener);
+
+ this->bActive_ = false;
+ }
+
+ EventListener::~EventListener()
+ {
+ }
+
+ void EventListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(EventListener, XMLPort, xmlelement, mode);
+
+ XMLPortParam(EventListener, "event", setEventName, getEventName, xmlelement, mode);
+ }
+
+ void EventListener::processEvent(Event& event)
+ {
+ if (this->bActive_)
+ {
+ COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\"" << std::endl;
+ return;
+ }
+
+ this->bActive_ = true;
+
+ this->fireEvent(event.activate_, event.originator_);
+
+ this->bActive_ = false;
+ }
+
+ void EventListener::setEventName(const std::string& eventname)
+ {
+ this->eventName_ = eventname;
+
+ if (this->eventName_ == "")
+ return;
+
+ for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+ if (it->getName() == this->eventName_)
+ this->registerAsListener(*it);
+ }
+
+ void EventListener::loadedNewXMLName(BaseObject* object)
+ {
+ if (this->eventName_ == "")
+ return;
+
+ if (object->getName() == this->eventName_)
+ this->registerAsListener(object);
+ }
+
+ void EventListener::registerAsListener(BaseObject* object)
+ {
+ object->registerEventListener(this, "");
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventListener.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventListener.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventListener.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventListener.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,63 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _EventListener_H__
+#define _EventListener_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport EventListener : public BaseObject, public XMLNameListener
+ {
+ public:
+ EventListener(BaseObject* creator);
+ virtual ~EventListener();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void processEvent(Event& event);
+
+ void setEventName(const std::string& eventname);
+ inline const std::string& getEventName() const
+ { return this->eventName_; }
+
+ private:
+ virtual void loadedNewXMLName(BaseObject* object);
+ void registerAsListener(BaseObject* object);
+
+ std::string eventName_;
+ bool bActive_;
+ };
+}
+
+#endif /* _EventListener_H__ */
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventTarget.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,68 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "EventTarget.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(EventTarget);
+
+ EventTarget::EventTarget(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(EventTarget);
+ }
+
+ EventTarget::~EventTarget()
+ {
+ }
+
+ void EventTarget::changedName()
+ {
+ SUPER(EventTarget, changedName);
+
+ for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
+ if (it->getName() == this->getName())
+ this->addAsEvent(*it);
+ }
+
+ void EventTarget::loadedNewXMLName(BaseObject* object)
+ {
+ if (this->getName() == "")
+ return;
+
+ if (object->getName() == this->getName())
+ this->addAsEvent(object);
+ }
+
+ void EventTarget::addAsEvent(BaseObject* object)
+ {
+ if (object != static_cast<BaseObject*>(this))
+ object->addEvent(this, "");
+ }
+}
Copied: code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/EventTarget.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/eventsystem/EventTarget.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,53 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _EventTarget_H__
+#define _EventTarget_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport EventTarget : public BaseObject, public XMLNameListener
+ {
+ public:
+ EventTarget(BaseObject* creator);
+ virtual ~EventTarget();
+
+ virtual void changedName();
+
+ private:
+ virtual void loadedNewXMLName(BaseObject* object);
+ void addAsEvent(BaseObject* object);
+ };
+}
+
+#endif /* _EventTarget_H__ */
Deleted: code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/CMakeLists.txt 2009-08-31 15:37:33 UTC (rev 5722)
+++ code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,7 +0,0 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- Trigger.cc
- DistanceTrigger.cc
- EventTrigger.cc
- PlayerTrigger.cc
- CheckPoint.cc
-)
Copied: code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt (from rev 5727, code/branches/libraries2/src/orxonox/objects/worldentities/triggers/CMakeLists.txt)
===================================================================
--- code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt (rev 0)
+++ code/branches/libraries2/src/modules/objects/triggers/CMakeLists.txt 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,6 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ Trigger.cc
+ DistanceTrigger.cc
+ EventTrigger.cc
+ CheckPoint.cc
+)
Deleted: code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc 2009-08-31 15:37:33 UTC (rev 5722)
+++ code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,152 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Benjamin Knecht
- * Co-authors:
- * ...
- *
- */
-
-#include "DistanceTrigger.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/worldentities/pawns/Pawn.h"
-
-namespace orxonox
-{
- CreateFactory(DistanceTrigger);
-
- DistanceTrigger::DistanceTrigger(BaseObject* creator) : PlayerTrigger(creator)
- {
- RegisterObject(DistanceTrigger);
-
- this->distance_ = 100;
- this->targetMask_.exclude(Class(BaseObject));
- this->setForPlayer(false); //!< Normally hasn't just ControllableEntities as targets.
- }
-
- DistanceTrigger::~DistanceTrigger()
- {
- }
-
- void DistanceTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(DistanceTrigger, XMLPort, xmlelement, mode);
-
- XMLPortParam(DistanceTrigger, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(100.0f);
- XMLPortParamLoadOnly(DistanceTrigger, "target", addTargets, xmlelement, mode).defaultValues("ControllableEntity");
- }
-
- void DistanceTrigger::addTarget(Ogre::Node* targetNode)
- {
- this->targetSet_.insert(targetNode);
- }
-
- void DistanceTrigger::removeTarget(Ogre::Node* targetNode)
- {
- int returnval = this->targetSet_.erase(targetNode);
- if (returnval == 0)
- {
- COUT(2) << "Warning: Node " << targetNode << " did not exist in targetSet of trigger " << this << " !" << std::endl;
- COUT(4) << "Content of targetSet of trigger " << this << " :" << std::endl;
- std::set<Ogre::Node*>::iterator it;
- for (it = this->targetSet_.begin(); it != this->targetSet_.end(); ++it)
- {
- COUT(4) << *it << std::endl;
- }
- COUT(4) << "End of targetSet of trigger " << this << std::endl;
- }
- }
-
- void DistanceTrigger::addTargets(const std::string& targets)
- {
- Identifier* targetId = ClassByString(targets);
-
- //! Checks whether the target is (or is derived from) a ControllableEntity.
- Identifier* controllableEntityId = Class(ControllableEntity);
- if(targetId->isA(controllableEntityId))
- {
- this->setForPlayer(true);
- }
-
- if (!targetId)
- {
- COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
- return;
- }
-
- this->targetMask_.include(targetId);
-
- // trigger shouldn't react on itself or other triggers
- this->targetMask_.exclude(Class(Trigger), true);
-
- // we only want WorldEntities
- ClassTreeMask WEMask;
- WEMask.include(Class(WorldEntity));
- this->targetMask_ *= WEMask;
-
- this->notifyMaskUpdate();
- }
-
- void DistanceTrigger::removeTargets(const std::string& targets)
- {
- Identifier* targetId = ClassByString(targets);
- this->targetMask_.exclude(targetId);
- }
-
- bool DistanceTrigger::checkDistance()
- {
- // Iterate through all objects
- for (ClassTreeMaskObjectIterator it = this->targetMask_.begin(); it != this->targetMask_.end(); ++it)
- {
- WorldEntity* entity = orxonox_cast<WorldEntity*>(*it);
- if (!entity)
- continue;
-
- Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
- if (distanceVec.length() < this->distance_)
- {
-
- // If the target is a player (resp. is a, or is derived from a, ControllableEntity) the triggeringPlayer is set to the target entity.
- if(this->isForPlayer())
- {
- Pawn* player = orxonox_cast<Pawn*>(entity);
- this->setTriggeringPlayer(player);
- }
-
- return true;
- }
- }
- return false;
- }
-
- bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
- {
- if (Trigger::isTriggered(mode))
- {
- return checkDistance();
- }
- else
- return false;
- }
-}
Copied: code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc (from rev 5727, code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc)
===================================================================
--- code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc (rev 0)
+++ code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,152 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "DistanceTrigger.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ CreateFactory(DistanceTrigger);
+
+ DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
+ {
+ RegisterObject(DistanceTrigger);
+
+ this->distance_ = 100;
+ this->targetMask_.exclude(Class(BaseObject));
+ this->setForPlayer(false); //!< Normally hasn't just ControllableEntities as targets.
+ }
+
+ DistanceTrigger::~DistanceTrigger()
+ {
+ }
+
+ void DistanceTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(DistanceTrigger, XMLPort, xmlelement, mode);
+
+ XMLPortParam(DistanceTrigger, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(100.0f);
+ XMLPortParamLoadOnly(DistanceTrigger, "target", addTargets, xmlelement, mode).defaultValues("ControllableEntity");
+ }
+
+ void DistanceTrigger::addTarget(Ogre::Node* targetNode)
+ {
+ this->targetSet_.insert(targetNode);
+ }
+
+ void DistanceTrigger::removeTarget(Ogre::Node* targetNode)
+ {
+ int returnval = this->targetSet_.erase(targetNode);
+ if (returnval == 0)
+ {
+ COUT(2) << "Warning: Node " << targetNode << " did not exist in targetSet of trigger " << this << " !" << std::endl;
+ COUT(4) << "Content of targetSet of trigger " << this << " :" << std::endl;
+ std::set<Ogre::Node*>::iterator it;
+ for (it = this->targetSet_.begin(); it != this->targetSet_.end(); ++it)
+ {
+ COUT(4) << *it << std::endl;
+ }
+ COUT(4) << "End of targetSet of trigger " << this << std::endl;
+ }
+ }
+
+ void DistanceTrigger::addTargets(const std::string& targets)
+ {
+ Identifier* targetId = ClassByString(targets);
+
+ //! Checks whether the target is (or is derived from) a ControllableEntity.
+ Identifier* controllableEntityId = Class(ControllableEntity);
+ if(targetId->isA(controllableEntityId))
+ {
+ this->setForPlayer(true);
+ }
+
+ if (!targetId)
+ {
+ COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << std::endl;
+ return;
+ }
+
+ this->targetMask_.include(targetId);
+
+ // trigger shouldn't react on itself or other triggers
+ this->targetMask_.exclude(Class(Trigger), true);
+
+ // we only want WorldEntities
+ ClassTreeMask WEMask;
+ WEMask.include(Class(WorldEntity));
+ this->targetMask_ *= WEMask;
+
+ this->notifyMaskUpdate();
+ }
+
+ void DistanceTrigger::removeTargets(const std::string& targets)
+ {
+ Identifier* targetId = ClassByString(targets);
+ this->targetMask_.exclude(targetId);
+ }
+
+ bool DistanceTrigger::checkDistance()
+ {
+ // Iterate through all objects
+ for (ClassTreeMaskObjectIterator it = this->targetMask_.begin(); it != this->targetMask_.end(); ++it)
+ {
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(*it);
+ if (!entity)
+ continue;
+
+ Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
+ if (distanceVec.length() < this->distance_)
+ {
+
+ // If the target is a player (resp. is a, or is derived from a, ControllableEntity) the triggeringPlayer is set to the target entity.
+ if(this->isForPlayer())
+ {
+ Pawn* player = orxonox_cast<Pawn*>(entity);
+ this->setTriggeringPlayer(player);
+ }
+
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
+ {
+ if (Trigger::isTriggered(mode))
+ {
+ return checkDistance();
+ }
+ else
+ return false;
+ }
+}
Deleted: code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h 2009-08-31 15:37:33 UTC (rev 5722)
+++ code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,73 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Benjamin Knecht
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _DistanceTrigger_H__
-#define _DistanceTrigger_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <set>
-#include "core/ClassTreeMask.h"
-#include "PlayerTrigger.h"
-
-namespace orxonox
-{
- class _OrxonoxExport DistanceTrigger : public PlayerTrigger
- {
- public:
- DistanceTrigger(BaseObject* creator);
- virtual ~DistanceTrigger();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void addTarget(Ogre::Node* targetNode);
- void addTargets(const std::string& targets);
- void removeTarget(Ogre::Node* targetNode);
- void removeTargets(const std::string& targets);
-
- inline void setDistance(float distance)
- { this->distance_ = distance; }
- inline float getDistance() const
- { return this->distance_; }
-
- bool checkDistance();
-
- protected:
- virtual bool isTriggered(TriggerMode::Value mode);
- virtual void notifyMaskUpdate() {}
-
- ClassTreeMask targetMask_;
-
- private:
- std::set<Ogre::Node*> targetSet_;
- float distance_;
-
- };
-}
-
-#endif /* _DistanceTrigger_H__ */
Copied: code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h (from rev 5727, code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h)
===================================================================
--- code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h (rev 0)
+++ code/branches/libraries2/src/modules/objects/triggers/DistanceTrigger.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _DistanceTrigger_H__
+#define _DistanceTrigger_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <set>
+#include "core/ClassTreeMask.h"
+#include "Trigger.h"
+#include "interfaces/PlayerTrigger.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport DistanceTrigger : public Trigger, public PlayerTrigger
+ {
+ public:
+ DistanceTrigger(BaseObject* creator);
+ virtual ~DistanceTrigger();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void addTarget(Ogre::Node* targetNode);
+ void addTargets(const std::string& targets);
+ void removeTarget(Ogre::Node* targetNode);
+ void removeTargets(const std::string& targets);
+
+ inline void setDistance(float distance)
+ { this->distance_ = distance; }
+ inline float getDistance() const
+ { return this->distance_; }
+
+ bool checkDistance();
+
+ protected:
+ virtual bool isTriggered(TriggerMode::Value mode);
+ virtual void notifyMaskUpdate() {}
+
+ ClassTreeMask targetMask_;
+
+ private:
+ std::set<Ogre::Node*> targetSet_;
+ float distance_;
+
+ };
+}
+
+#endif /* _DistanceTrigger_H__ */
Deleted: code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/PlayerTrigger.cc 2009-08-31 15:37:33 UTC (rev 5722)
+++ code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,68 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief
- Implementation of the PlayerTrigger class.
-*/
-
-#include "PlayerTrigger.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- /**
- @brief
- Constructor. Registers the object and initializes defaults.
- */
- PlayerTrigger::PlayerTrigger(BaseObject* creator) : Trigger(creator)
- {
- RegisterObject(PlayerTrigger);
-
- this->player_ = NULL;
- this->isForPlayer_ = true;
- }
-
- /**
- @brief
- Destructor.
- */
- PlayerTrigger::~PlayerTrigger()
- {
- }
-
- /**
- @brief
- Method for creating a QuestEffectBeacon object through XML.
- */
- void PlayerTrigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PlayerTrigger, XMLPort, xmlelement, mode);
- }
-}
Deleted: code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h 2009-08-31 15:37:33 UTC (rev 5722)
+++ code/branches/libraries2/src/modules/objects/triggers/PlayerTrigger.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,96 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief
- Definition of the PlayerTrigger class.
-*/
-
-#ifndef _PlayerTrigger_H__
-#define _PlayerTrigger_H__
-
-#include "OrxonoxPrereqs.h"
-#include "Trigger.h"
-
-namespace orxonox
-{
- /**
- @brief
- A PlayerTrigger is a trigger which is normally triggered by ControllableEntities and can as such return a pointer to the ControllableEntity which triggered it.
- @author
- Damian 'Mozork' Frick
- */
- class _OrxonoxExport PlayerTrigger : public Trigger
- {
- public:
- PlayerTrigger(BaseObject* creator);
- virtual ~PlayerTrigger();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PlayerTrigger object through XML.
-
- /**
- @brief Returns the player that triggered the PlayerTrigger.
- @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger.
- */
- inline Pawn* getTriggeringPlayer(void) const
- { return this->player_; }
-
- /**
- @brief Checks whether the PlayerTrigger normally returns a ControllableEntity.
- @return Returns true if the PlayerTrigger normally returns a ControllableEntity.
- */
- inline bool isForPlayer(void) const
- { return this->isForPlayer_; }
-
- protected:
- virtual bool isTriggered(TriggerMode::Value mode) = 0;
-
- /**
- @brief Set the player that triggered the PlayerTrigger. This is normally done by classes inheriting vom PlayerTrigger.
- @param player A pointer to the ControllableEntity that triggered the PlayerTrigger.
- */
- inline void setTriggeringPlayer(Pawn* player)
- { this->player_ = player; }
-
- /**
- @brief Set whether the PlayerTrigger normally is triggered by ControllableEntities.
- @param isForPlayer Should be true when the PlayerTrigger should be set to normally be triggered by ControllableEntities, false if not.
- */
- inline void setForPlayer(bool isForPlayer)
- { this->isForPlayer_ = isForPlayer; }
-
- private:
- Pawn* player_; //!< The player that triggered the PlayerTrigger.
- bool isForPlayer_; //!< Is true when the PlayerTrigger should be set to normally be triggered by ControllableEntities.
-
- };
-
-}
-
-#endif /* _PlayerTrigger_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/CMakeLists.txt 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/CMakeLists.txt 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,12 +1,8 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- EventListener.cc
- EventDispatcher.cc
- EventTarget.cc
GlobalShader.cc
Level.cc
Radar.cc
Scene.cc
- Script.cc
)
ADD_SUBDIRECTORY(collisionshapes)
Deleted: code/branches/libraries2/src/orxonox/objects/EventDispatcher.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventDispatcher.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventDispatcher.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,81 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "EventDispatcher.h"
-
-#include "core/CoreIncludes.h"
-#include "core/EventIncludes.h"
-#include "core/XMLPort.h"
-#include "EventTarget.h"
-
-namespace orxonox
-{
- CreateFactory(EventDispatcher);
-
- EventDispatcher::EventDispatcher(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(EventDispatcher);
- }
-
- EventDispatcher::~EventDispatcher()
- {
- if (this->isInitialized())
- for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
- delete (*it);
- }
-
- void EventDispatcher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(EventDispatcher, XMLPort, xmlelement, mode);
-
- XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode);
- }
-
- void EventDispatcher::processEvent(Event& event)
- {
- for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
- (*it)->fireEvent(event);
- }
-
- void EventDispatcher::addTarget(EventTarget* target)
- {
- this->targets_.push_back(target);
- }
-
- EventTarget* EventDispatcher::getTarget(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::list<EventTarget*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
- {
- if (i == index)
- return (*it);
- ++i;
- }
- return 0;
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/EventDispatcher.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventDispatcher.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventDispatcher.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,57 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _EventDispatcher_H__
-#define _EventDispatcher_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <list>
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport EventDispatcher : public BaseObject
- {
- public:
- EventDispatcher(BaseObject* creator);
- virtual ~EventDispatcher();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void processEvent(Event& event);
-
- void addTarget(EventTarget* target);
- EventTarget* getTarget(unsigned int index) const;
-
- private:
- std::list<EventTarget*> targets_;
- };
-}
-
-#endif /* _EventDispatcher_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/EventListener.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventListener.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventListener.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,96 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "EventListener.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(EventListener);
-
- EventListener::EventListener(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(EventListener);
-
- this->bActive_ = false;
- }
-
- EventListener::~EventListener()
- {
- }
-
- void EventListener::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(EventListener, XMLPort, xmlelement, mode);
-
- XMLPortParam(EventListener, "event", setEventName, getEventName, xmlelement, mode);
- }
-
- void EventListener::processEvent(Event& event)
- {
- if (this->bActive_)
- {
- COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\"" << std::endl;
- return;
- }
-
- this->bActive_ = true;
-
- this->fireEvent(event.activate_, event.originator_);
-
- this->bActive_ = false;
- }
-
- void EventListener::setEventName(const std::string& eventname)
- {
- this->eventName_ = eventname;
-
- if (this->eventName_ == "")
- return;
-
- for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
- if (it->getName() == this->eventName_)
- this->registerAsListener(*it);
- }
-
- void EventListener::loadedNewXMLName(BaseObject* object)
- {
- if (this->eventName_ == "")
- return;
-
- if (object->getName() == this->eventName_)
- this->registerAsListener(object);
- }
-
- void EventListener::registerAsListener(BaseObject* object)
- {
- object->registerEventListener(this, "");
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/EventListener.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventListener.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventListener.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,63 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _EventListener_H__
-#define _EventListener_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "core/BaseObject.h"
-#include "core/XMLNameListener.h"
-
-namespace orxonox
-{
- class _OrxonoxExport EventListener : public BaseObject, public XMLNameListener
- {
- public:
- EventListener(BaseObject* creator);
- virtual ~EventListener();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void processEvent(Event& event);
-
- void setEventName(const std::string& eventname);
- inline const std::string& getEventName() const
- { return this->eventName_; }
-
- private:
- virtual void loadedNewXMLName(BaseObject* object);
- void registerAsListener(BaseObject* object);
-
- std::string eventName_;
- bool bActive_;
- };
-}
-
-#endif /* _EventListener_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/EventTarget.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventTarget.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventTarget.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,68 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "EventTarget.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(EventTarget);
-
- EventTarget::EventTarget(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(EventTarget);
- }
-
- EventTarget::~EventTarget()
- {
- }
-
- void EventTarget::changedName()
- {
- SUPER(EventTarget, changedName);
-
- for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
- if (it->getName() == this->getName())
- this->addAsEvent(*it);
- }
-
- void EventTarget::loadedNewXMLName(BaseObject* object)
- {
- if (this->getName() == "")
- return;
-
- if (object->getName() == this->getName())
- this->addAsEvent(object);
- }
-
- void EventTarget::addAsEvent(BaseObject* object)
- {
- if (object != static_cast<BaseObject*>(this))
- object->addEvent(this, "");
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/EventTarget.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/EventTarget.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/EventTarget.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,53 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _EventTarget_H__
-#define _EventTarget_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/BaseObject.h"
-#include "core/XMLNameListener.h"
-
-namespace orxonox
-{
- class _OrxonoxExport EventTarget : public BaseObject, public XMLNameListener
- {
- public:
- EventTarget(BaseObject* creator);
- virtual ~EventTarget();
-
- virtual void changedName();
-
- private:
- virtual void loadedNewXMLName(BaseObject* object);
- void addAsEvent(BaseObject* object);
- };
-}
-
-#endif /* _EventTarget_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/Script.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/Script.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/Script.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,64 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Benjamin Knecht
- * Co-authors:
- * ...
- *
- */
-
-#include "Script.h"
-
-#include "core/CoreIncludes.h"
-#include "core/LuaState.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(Script);
-
- Script::Script(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(Script);
-
- // Get a new LuaState
- luaState_ = new LuaState();
- }
-
- Script::~Script()
- {
- if (this->isInitialized())
- delete luaState_;
- }
-
- void Script::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- BaseObject::XMLPort(xmlelement, mode);
-
- XMLPortParam(Script, "code", setCode, getCode, xmlelement, mode);
- }
-
- void Script::execute()
- {
- luaState_->doString(code_);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/Script.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/Script.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/Script.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,56 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Benjamin Knecht
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Script_H__
-#define _Script_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Script : public BaseObject
- {
- public:
- Script(BaseObject* creator);
- ~Script();
- void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void execute();
-
- void setCode(const std::string& code) { code_ = code; }
- const std::string& getCode() const { return code_; }
-
- private:
- std::string code_;
- LuaState* luaState_;
- };
-}
-
-#endif /* _Script_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "BoxCollisionShape.h"
-
-#include <BulletCollision/CollisionShapes/btBoxShape.h>
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "tools/BulletConversions.h"
-
-namespace orxonox
-{
- CreateFactory(BoxCollisionShape);
-
- BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
- {
- RegisterObject(BoxCollisionShape);
-
- this->halfExtents_ = Vector3(1, 1, 1);
- updateShape();
-
- this->registerVariables();
- }
-
- BoxCollisionShape::~BoxCollisionShape()
- {
- if (this->isInitialized())
- delete this->collisionShape_;
- }
-
- void BoxCollisionShape::registerVariables()
- {
- registerVariable(this->halfExtents_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- }
-
- void BoxCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(BoxCollisionShape, XMLPort, xmlelement, mode);
-
- XMLPortParam(BoxCollisionShape, "halfExtents", setHalfExtents, getHalfExtents, xmlelement, mode);
- XMLPortParamLoadOnly(BoxCollisionShape, "width", setWidth, xmlelement, mode);
- XMLPortParamLoadOnly(BoxCollisionShape, "height", setHeight, xmlelement, mode);
- XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode);
- }
-
- btCollisionShape* BoxCollisionShape::createNewShape() const
- {
- return new btBoxShape(multi_cast<btVector3>(this->halfExtents_));
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/BoxCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,75 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _BoxCollisionShape_H__
-#define _BoxCollisionShape_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "CollisionShape.h"
-
-namespace orxonox
-{
- class _OrxonoxExport BoxCollisionShape : public CollisionShape
- {
- public:
- BoxCollisionShape(BaseObject* creator);
- virtual ~BoxCollisionShape();
-
- void registerVariables();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- inline void setHalfExtents(const Vector3& extents)
- { this->halfExtents_ = extents; updateShape(); }
- inline const Vector3& getHalfExtents() const
- { return halfExtents_;}
-
- inline void setWidth(float value)
- { this->halfExtents_.z = value / 2; updateShape(); }
- inline float getWidth() const
- { return this->halfExtents_.z * 2; }
-
- inline void setHeight(float value)
- { this->halfExtents_.y = value / 2; updateShape(); }
- inline float getHeight() const
- { return this->halfExtents_.y * 2; }
-
- inline void setLength(float value)
- { this->halfExtents_.x = value / 2; updateShape(); }
- inline float getLength() const
- { return this->halfExtents_.x * 2; }
-
- private:
- btCollisionShape* createNewShape() const;
-
- Vector3 halfExtents_;
- };
-}
-
-#endif /* _BoxCollisionShape_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/collisionshapes/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/CMakeLists.txt 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/CMakeLists.txt 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,9 +1,5 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- BoxCollisionShape.cc
CollisionShape.cc
CompoundCollisionShape.cc
- ConeCollisionShape.cc
- PlaneCollisionShape.cc
- SphereCollisionShape.cc
WorldEntityCollisionShape.cc
)
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,75 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "ConeCollisionShape.h"
-
-#include <BulletCollision/CollisionShapes/btConeShape.h>
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(ConeCollisionShape);
-
- ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
- {
- RegisterObject(ConeCollisionShape);
-
- this->radius_ = 1.0f;
- this->height_ = 1.0f;
- updateShape();
-
- this->registerVariables();
- }
-
- ConeCollisionShape::~ConeCollisionShape()
- {
- if (this->isInitialized())
- delete this->collisionShape_;
- }
-
- void ConeCollisionShape::registerVariables()
- {
- registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- registerVariable(this->height_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- }
-
- void ConeCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ConeCollisionShape, XMLPort, xmlelement, mode);
-
- XMLPortParam(ConeCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
- XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);
- }
-
- btCollisionShape* ConeCollisionShape::createNewShape() const
- {
- return new btConeShape(this->radius_, this->height_);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/ConeCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,64 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ConeCollisionShape_H__
-#define _ConeCollisionShape_H__
-
-#include "OrxonoxPrereqs.h"
-#include "CollisionShape.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ConeCollisionShape : public CollisionShape
- {
- public:
- ConeCollisionShape(BaseObject* creator);
- virtual ~ConeCollisionShape();
-
- void registerVariables();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- inline void setRadius(float value)
- { this->radius_ = value; updateShape(); }
- inline float getRadius() const
- { return radius_; }
-
- inline void setHeight(float value)
- { this->height_ = value; updateShape(); }
- inline float getHeight() const
- { return this->height_; }
-
- private:
- btCollisionShape* createNewShape() const;
-
- float radius_;
- float height_;
- };
-}
-
-#endif /* _ConeCollisionShape_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Martin Stypinski
- * Co-authors:
- * ...
- *
- */
-
-#include "PlaneCollisionShape.h"
-
-#include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "tools/BulletConversions.h"
-
-namespace orxonox
-{
- CreateFactory(PlaneCollisionShape);
-
- PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
- {
- RegisterObject(PlaneCollisionShape);
-
- this->normal_ = Vector3(0, 1, 0);
- this->offset_ = 0.0f;
- updateShape();
-
- this->registerVariables();
- }
-
- PlaneCollisionShape::~PlaneCollisionShape()
- {
- if (this->isInitialized())
- delete this->collisionShape_;
- }
-
- void PlaneCollisionShape::registerVariables()
- {
- registerVariable(this->normal_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- registerVariable(this->offset_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- }
-
- void PlaneCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PlaneCollisionShape, XMLPort, xmlelement, mode);
-
- XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode);
- XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);
- }
-
- btCollisionShape* PlaneCollisionShape::createNewShape() const
- {
- return new btStaticPlaneShape(multi_cast<btVector3>(this->normal_), this->offset_);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/PlaneCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,66 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Martin Stypinski
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PlaneCollisionShape_H__
-#define _PlaneCollisionShape_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "CollisionShape.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PlaneCollisionShape : public CollisionShape
- {
- public:
- PlaneCollisionShape(BaseObject* creator);
- virtual ~PlaneCollisionShape();
-
- void registerVariables();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- inline void setNormal(const Vector3& normal)
- { this->normal_ = normal; updateShape(); }
- inline const Vector3& getNormal()
- { return normal_;}
-
- inline void setOffset(float offset)
- { this->offset_ = offset; updateShape(); }
- inline float getOffset()
- { return this->offset_;}
-
- private:
- btCollisionShape* createNewShape()const;
-
- Vector3 normal_;
- float offset_;
- };
-}
-
-#endif /* _PlaneCollisionShape_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,72 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "SphereCollisionShape.h"
-
-#include <BulletCollision/CollisionShapes/btSphereShape.h>
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(SphereCollisionShape);
-
- SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
- {
- RegisterObject(SphereCollisionShape);
-
- this->radius_ = 1.0f;
- updateShape();
-
- this->registerVariables();
- }
-
- SphereCollisionShape::~SphereCollisionShape()
- {
- if (this->isInitialized())
- delete this->collisionShape_;
- }
-
- void SphereCollisionShape::registerVariables()
- {
- registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
- }
-
- void SphereCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(SphereCollisionShape, XMLPort, xmlelement, mode);
-
- XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
- }
-
- btCollisionShape* SphereCollisionShape::createNewShape() const
- {
- return new btSphereShape(this->radius_);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/collisionshapes/SphereCollisionShape.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,58 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _SphereCollisionShape_H__
-#define _SphereCollisionShape_H__
-
-#include "OrxonoxPrereqs.h"
-#include "CollisionShape.h"
-
-namespace orxonox
-{
- class _OrxonoxExport SphereCollisionShape : public CollisionShape
- {
- public:
- SphereCollisionShape(BaseObject* creator);
- virtual ~SphereCollisionShape();
-
- void registerVariables();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- inline void setRadius(float radius)
- { this->radius_ = radius; updateShape(); }
- inline float getRadius() const
- { return this->radius_; }
-
- private:
- btCollisionShape* createNewShape() const;
-
- float radius_;
- };
-}
-
-#endif /* _SphereCollisionShape_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,120 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Attacher.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(Attacher);
-
- Attacher::Attacher(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Attacher);
-
- this->target_ = 0;
- }
-
- void Attacher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Attacher, XMLPort, xmlelement, mode);
-
- XMLPortParam(Attacher, "target", setTarget, getTarget, xmlelement, mode);
- XMLPortObject(Attacher, WorldEntity, "", addObject, getObject, xmlelement, mode);
- }
-
- void Attacher::processEvent(Event& event)
- {
- for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
- (*it)->fireEvent(event);
- }
-
- void Attacher::changedActivity()
- {
- SUPER(Attacher, changedActivity);
-
- for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
- (*it)->setActive(this->isActive());
- }
-
- void Attacher::changedVisibility()
- {
- SUPER(Attacher, changedVisibility);
-
- for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
- (*it)->setVisible(this->isVisible());
- }
-
- void Attacher::addObject(WorldEntity* object)
- {
- this->objects_.push_back(object);
-
- this->attach(object);
- }
-
- WorldEntity* Attacher::getObject(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
- {
- if (i == index)
- return (*it);
-
- ++i;
- }
- return 0;
- }
-
- void Attacher::setTarget(const std::string& target)
- {
- this->targetname_ = target;
- this->target_ = 0;
-
- if (this->targetname_ == "")
- return;
-
- for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
- if (it->getName() == this->targetname_)
- this->attachToParent(*it);
- }
-
- void Attacher::loadedNewXMLName(BaseObject* object)
- {
- if (this->target_ || this->targetname_ == "")
- return;
-
- WorldEntity* entity = orxonox_cast<WorldEntity*>(object);
- if (entity && entity->getName() == this->targetname_)
- {
- this->target_ = entity;
- this->attachToParent(entity);
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/Attacher.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,69 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Attacher_H__
-#define _Attacher_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <list>
-#include <string>
-#include "core/XMLNameListener.h"
-#include "objects/worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Attacher : public StaticEntity, public XMLNameListener
- {
- public:
- Attacher(BaseObject* creator);
- virtual ~Attacher() {}
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void processEvent(Event& event);
- virtual void changedActivity();
- virtual void changedVisibility();
-
- void addObject(WorldEntity* object);
- WorldEntity* getObject(unsigned int index) const;
-
- void setTarget(const std::string& target);
- inline const std::string& getTarget() const
- { return this->targetname_; }
-
- void loadedNewXMLName(BaseObject* object);
-
- private:
- WorldEntity* target_;
- std::string targetname_;
- std::list<WorldEntity*> objects_;
- };
-}
-
-#endif /* _Attacher_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt 2009-08-31 19:30:55 UTC (rev 5728)
@@ -5,7 +5,6 @@
MobileEntity.cc
ControllableEntity.cc
- Attacher.cc
Backlight.cc
Billboard.cc
BlinkingBillboard.cc
@@ -18,11 +17,8 @@
Model.cc
ParticleEmitter.cc
ParticleSpawner.cc
- Planet.cc
SpawnPoint.cc
TeamSpawnPoint.cc
- ForceField.cc
)
ADD_SUBDIRECTORY(pawns)
-ADD_SUBDIRECTORY(triggers)
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,87 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Aurelian Jaggi
- * Co-authors:
- * ...
- *
- */
-
-#include "ForceField.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/worldentities/MobileEntity.h"
-
-namespace orxonox
-{
- CreateFactory(ForceField);
-
- ForceField::ForceField(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(ForceField);
-
- //Standard Values
- this->setDirection(Vector3::ZERO);
- velocity_ = 100;
- diameter_ = 500;
- length_ = 5000;
- }
-
- ForceField::~ForceField() {}
-
- void ForceField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ForceField, XMLPort, xmlelement, mode);
-
- //For correct xml import use: position, direction, velocity, scale
- XMLPortParam(ForceField, "velocity", setVelocity, getVelocity, xmlelement, mode).defaultValues(100);
- XMLPortParam(ForceField, "diameter", setDiameter, getDiameter, xmlelement, mode).defaultValues(500);
- XMLPortParam(ForceField, "length" , setLength , getLength , xmlelement, mode).defaultValues(2000);
- }
-
- void ForceField::tick(float dt)
- {
- for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)
- {
- //calculate from
- Vector3 directionVec = this->getOrientation() * WorldEntity::FRONT;
- directionVec.normalise();
-
- Vector3 distanceVec = it->getWorldPosition() - (this->getWorldPosition() + (this->length_ / 2 * directionVec));
-
- //distance from centervector of the field (
- float distFromCenterVec = ((it->getWorldPosition() - this->getWorldPosition()).crossProduct(directionVec)).length();
-
- if (distanceVec.length() < this->length_ / 2 && distFromCenterVec < diameter_ / 2)
- {
- //normalize distance from center
- it->applyCentralForce(((diameter_ / 2 - distFromCenterVec) / (diameter_ / 2)) * directionVec * velocity_);
- }
- }
- }
-}
-
-
-
-
-
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/ForceField.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Aurelian Jaggi
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef _ForceField_H__
-#define _ForceField_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "tools/interfaces/Tickable.h"
-#include "StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ForceField : public StaticEntity, public Tickable
- {
- public:
- ForceField(BaseObject* creator);
- virtual ~ForceField();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void tick(float dt);
-
- inline void setVelocity(float vel)
- { this->velocity_ = vel; }
-
- inline float getVelocity()
- { return velocity_; }
-
- inline void setDiameter(float diam)
- { this->diameter_ = diam; }
-
- inline float getDiameter()
- { return diameter_; }
-
- inline void setLength(float l)
- { this->length_ = l; }
-
- inline float getLength()
- { return length_; }
-
- private:
- float velocity_;
- float diameter_;
- float length_;
- };
-}
-
-#endif
-
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/Planet.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/Planet.cc 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/Planet.cc 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,175 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Marian Runo
- * Co-authors:
- * ...
- *
- */
-
-#include "Planet.h"
-
-#include <OgreEntity.h>
-#include <OgreBillboardSet.h>
-#include <OgreProgressiveMesh.h>
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "objects/Scene.h"
-#include "Camera.h"
-#include "CameraManager.h"
-
-namespace orxonox
-{
- CreateFactory(Planet);
-
- /**
- * @brief Constructor
- */
- Planet::Planet(BaseObject* creator): MovableEntity(creator)
- {
- RegisterObject(Planet);
- this->registerVariables();
- }
-
- /**
- * @brief Destructor
- */
- Planet::~Planet()
- {
- if (this->isInitialized() && this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
- }
-
- void Planet::tick(float dt)
- {
- if(!this->isVisible())
- return;
-
- if (GameMode::showsGraphics())
- {
- Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
- if(activeCamera)
- {
- float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
- // COUT(2) << distance << std::endl;
- float planetRadius = this->getScale();
-
- float newScale = 2 * distance / sqrt(distance*distance - planetRadius*planetRadius);
- float tempTest = newScale*(1+float(this->atmosphereSize)/float(this->imageSize));
- newScale = tempTest;
-
- this->billboard_.getBillboardSet()->setDefaultDimensions(newScale, newScale);
- }
- }
-
- SUPER(Planet, tick, dt);
- }
-
- void Planet::init()
- {
- float scaleFactor = this->getScale();
-
- this->distList.push_back(10.0f*scaleFactor);
- this->distList.push_back(19.0f*scaleFactor);
- this->distList.push_back(27.0f*scaleFactor);
- this->distList.push_back(34.0f*scaleFactor);
- this->distList.push_back(40.0f*scaleFactor);
- this->distList.push_back(45.0f*scaleFactor);
- this->distList.push_back(49.0f*scaleFactor);
- this->distList.push_back(52.0f*scaleFactor);
- this->distList.push_back(54.0f*scaleFactor);
- this->distList.push_back(55.0f*scaleFactor);
-
- float reductionValue = 0.2f;
-
- this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
- billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
-
- this->attachOgreObject(this->billboard_.getBillboardSet());
- this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
- this->setCastShadows(true);
- this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
- this->mesh_.setCastShadows(true);
- }
-
- void Planet::changedMesh()
- {
- if (this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
-
- this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
-
- if (this->mesh_.getEntity())
- {
- this->attachOgreObject(this->mesh_.getEntity());
- this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
- this->mesh_.setVisible(this->isVisible());
- }
- this->init();
- }
-
- void Planet::changedShadows()
- {
- this->mesh_.setCastShadows(this->bCastShadows_);
- }
-
- /**
- @brief XML loading and saving.
- @param xmlelement The XML-element
- @param loading Loading (true) or saving (false)
- @return The XML-element
- */
- void Planet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Planet, XMLPort, xmlelement, mode);
-
- if (GameMode::showsGraphics())
- {
- XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
- XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
- XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
- XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
- XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
- }
- }
-
- void Planet::registerVariables()
- {
- registerVariable(this->atmosphere_, VariableDirection::ToClient);
- registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
- registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
- registerVariable(this->atmosphereSize, VariableDirection::ToClient);
- registerVariable(this->imageSize, VariableDirection::ToClient);
- }
-
- void Planet::changedVisibility()
- {
- SUPER(Planet, changedVisibility);
- if (this->isInitialized())
- {
- this->mesh_.setVisible(this->isVisible());
- this->billboard_.setVisible(this->isVisible());
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/Planet.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/Planet.h 2009-08-31 19:18:17 UTC (rev 5727)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/Planet.h 2009-08-31 19:30:55 UTC (rev 5728)
@@ -1,116 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Marian Runo
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Planet_H__
-#define _Planet_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "tools/BillboardSet.h"
-#include "tools/Mesh.h"
-#include "MovableEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Planet : public MovableEntity
- {
- public:
- Planet(BaseObject* creator);
-
- virtual ~Planet();
-
- void init();
- virtual void tick(float dt);
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void changedVisibility();
-
- inline void setMeshSource(const std::string& meshname)
- { this->meshSrc_ = meshname; this->changedMesh(); }
-
- inline const std::string& getMeshSource() const
- { return this->meshSrc_; }
-
- inline void setCastShadows(bool bCastShadows)
- { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
-
- inline bool getCastShadows() const
- { return this->bCastShadows_; }
-
- inline const std::string& getMesh() const{
- return this->meshSrc_;
- }
-
- inline void setAtmosphereSize(float size){
- this->atmosphereSize = size;
- }
-
- inline float getAtmosphereSize(){
- return this->atmosphereSize;
- }
-
- inline void setAtmosphere(const std::string& atmosphere){
- this->atmosphere_ = atmosphere;
- }
-
- inline const std::string& getAtmosphere(){
- return this->atmosphere_;
- }
-
- inline void setImageSize(float size){
- this->imageSize = size;
- }
-
- inline float getImageSize(){
- return this->imageSize;
- }
-
- protected:
- void registerVariables();
-
- private:
-
- void changedMesh();
- void changedShadows();
-
- std::string meshSrc_;
- std::string atmosphere_;
- Mesh mesh_;
- float atmosphereSize;
- float imageSize;
- std::vector<float> distList;
- BillboardSet billboard_;
- bool bCastShadows_;
-
- };
-}
-
-#endif
-
More information about the Orxonox-commit
mailing list