[Orxonox-commit 3513] r8199 - in code/branches/portals/src: modules modules/portals orxonox/worldentities
FelixSchulthess at orxonox.net
FelixSchulthess at orxonox.net
Thu Apr 7 12:13:20 CEST 2011
Author: FelixSchulthess
Date: 2011-04-07 12:13:19 +0200 (Thu, 07 Apr 2011)
New Revision: 8199
Added:
code/branches/portals/src/modules/portals/
code/branches/portals/src/modules/portals/CMakeLists.txt
code/branches/portals/src/modules/portals/PortalEndPoint.cc
code/branches/portals/src/modules/portals/PortalEndPoint.h
code/branches/portals/src/modules/portals/PortalLink.cc
code/branches/portals/src/modules/portals/PortalLink.h
code/branches/portals/src/modules/portals/PortalPrecompiledHeaders.h
code/branches/portals/src/modules/portals/PortalPrereqs.h
Removed:
code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc
code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h
code/branches/portals/src/orxonox/worldentities/PortalLink.cc
code/branches/portals/src/orxonox/worldentities/PortalLink.h
Modified:
code/branches/portals/src/orxonox/worldentities/CMakeLists.txt
Log:
moved portals to modules
Added: code/branches/portals/src/modules/portals/CMakeLists.txt
===================================================================
--- code/branches/portals/src/modules/portals/CMakeLists.txt (rev 0)
+++ code/branches/portals/src/modules/portals/CMakeLists.txt 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,16 @@
+SET_SOURCE_FILES(PORTALS_SRC_FILES
+ PortalEndPoint.cc
+ PortalLink.cc
+)
+
+ORXONOX_ADD_LIBRARY(portals
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+ PCH_FILE
+ PickupPrecompiledHeaders.h
+ LINK_LIBRARIES
+ orxonox
+ objects
+ SOURCE_FILES ${PORTALS_SRC_FILES}
+)
Copied: code/branches/portals/src/modules/portals/PortalEndPoint.cc (from rev 8198, code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc)
===================================================================
--- code/branches/portals/src/modules/portals/PortalEndPoint.cc (rev 0)
+++ code/branches/portals/src/modules/portals/PortalEndPoint.cc 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,54 @@
+#include "PortalEndPoint.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(PortalEndPoint);
+
+ std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
+
+ PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), material_(""), billboard_(0)
+ {
+ RegisterObject(PortalEndPoint);
+ }
+
+ PortalEndPoint::~PortalEndPoint()
+ {
+
+ }
+
+ void PortalEndPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PortalEndPoint, XMLPort, xmlelement, mode);
+ XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
+ XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "material", setMaterial, getMaterial, xmlelement, mode);
+ XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
+
+ if(mode == XMLPort::LoadObject)
+ {
+ PortalEndPoint::idMap_s[this->id_] = this;
+ }
+ }
+
+ void PortalEndPoint::tick(float dt)
+ {
+ SUPER(PortalEndPoint, tick);
+ }
+
+ void PortalEndPoint::jumpOut(WorldEntity* entity)
+ {
+ this->recentlyJumpedOut_.insert(entity);
+ entity->setPosition(this->getPosition());
+ }
+
+ bool PortalEndPoint::hasRecentlyJumpedOut(WorldEntity* entity)
+ {
+ if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())
+ {
+ return false;
+ }
+ else
+ return true;
+ }
+
+}
Copied: code/branches/portals/src/modules/portals/PortalEndPoint.h (from rev 8198, code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h)
===================================================================
--- code/branches/portals/src/modules/portals/PortalEndPoint.h (rev 0)
+++ code/branches/portals/src/modules/portals/PortalEndPoint.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,43 @@
+#ifndef _PortalEndPoint_H__
+#define _PortalEndPoint_H__
+
+#include <set>
+#include <string>
+#include <map>
+
+#include "StaticEntity.h"
+#include "graphics/Billboard.h"
+#include "modules/objects/triggers/DistanceMultiTrigger.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport PortalEndPoint : public DistanceMultiTrigger
+ {
+ public:
+ PortalEndPoint(BaseObject* creator);
+ virtual ~PortalEndPoint();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ //virtual void tick(float dt);
+ static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< maps integer id values to portalendpoints
+ inline void setID(unsigned int id)
+ {
+ this->id_ = id;
+ }
+
+ inline unsigned int getID() const
+ {
+ return this->id_;
+ }
+ void jumpOut(WorldEntity * entity); //!< relocate an entity to the position of the endpoint and add it to the set of recentlyPortedOut entities
+ void tick(float dt);
+ bool hasRecentlyJumpedOut(WorldEntity * entity); //!< check if a certain entity recently jumped out of this endpoint
+ protected:
+ private:
+ unsigned int id_;
+ std::set<WorldEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
+ Billboard billboard_;
+ };
+
+}
+
+#endif /* _Portals_H__ */
Copied: code/branches/portals/src/modules/portals/PortalLink.cc (from rev 8198, code/branches/portals/src/orxonox/worldentities/PortalLink.cc)
===================================================================
--- code/branches/portals/src/modules/portals/PortalLink.cc (rev 0)
+++ code/branches/portals/src/modules/portals/PortalLink.cc 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,58 @@
+#include "PortalLink.h"
+#include "core/XMLPort.h"
+#include "objects/triggers/MultiTriggerContainer.h"
+
+namespace orxonox
+{
+ CreateFactory(PortalLink);
+
+ PortalLink::PortalLink(BaseObject* creator) : BaseObject(creator), fromID_(0), toID_(0), from_(0), to_(0), activationRadius_(20)
+ {
+ RegisterObject(PortalLink);
+ }
+
+ PortalLink::~PortalLink()
+ {
+ }
+
+ void PortalLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PortalLink, XMLPort, xmlelement, mode);
+ XMLPortParam(PortalLink, "fromID", setFromID, getFromID, xmlelement, mode);
+ XMLPortParam(PortalLink, "toID", setToID, getToID, xmlelement, mode);
+
+ if(mode == XMLPort::LoadObject)
+ {
+ this->from_ = PortalEndPoint::idMap_s[this->fromID_];
+ this->to_ = PortalEndPoint::idMap_s[this->toID_];
+ recentlyPorted.clear();
+ }
+ }
+
+ void PortalLink::tick(float dt)
+ {
+ SUPER(PortalLink, tick)
+ }
+
+ void PortalLink::processEvent(Event& event)
+ {
+ SUPER(PortalLink, processEvent);
+ if(!event.activate_)
+ {
+ return;
+ }
+ MultiTriggerContainer * origin = dynamic_cast<MultiTriggerContainer *>(event.originator_);
+ if(!origin)
+ {
+ return;
+ }
+ PortalEndPoint * eventFrom = dynamic_cast<PortalEndPoint *>(origin->getOriginator());
+ WorldEntity * eventEntity = dynamic_cast<WorldEntity *>(origin->getData());
+ if(eventFrom != this->from_ || !eventEntity || eventFrom->hasRecentlyJumpedOut(eventEntity) == true)
+ {
+ return;
+ }
+ to_->jumpOut(entity);
+ }
+
+}
\ No newline at end of file
Copied: code/branches/portals/src/modules/portals/PortalLink.h (from rev 8198, code/branches/portals/src/orxonox/worldentities/PortalLink.h)
===================================================================
--- code/branches/portals/src/modules/portals/PortalLink.h (rev 0)
+++ code/branches/portals/src/modules/portals/PortalLink.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,54 @@
+#ifndef _PortalLink_H__
+#define _PortalLink_H__
+
+#include "OrxonoxPrereqs.h"
+#include "tools/interfaces/Tickable.h"
+#include "core/BaseObject.h"
+#include "PortalEndPoint.h"
+#include "objects/eventsystem/EventListener.h"
+
+#include <set>
+
+namespace orxonox
+{
+ class _OrxonoxExport PortalLink : public EventListener
+ {
+ public:
+ PortalLink(BaseObject* creator);
+ virtual ~PortalLink();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+ inline void setFromID(unsigned int from)
+ {
+ this->fromID_ = from;
+ }
+ inline unsigned int getFromID(unsigned int) const
+ {
+ return this->fromID_;
+ }
+ inline void setToID(unsigned int to)
+ {
+ this->toID_ = to;
+ }
+ inline unsigned int getToID(unsigned int) const
+ {
+ return this->toID_;
+ }
+ void use(WorldEntity * entity);
+ virtual void processEvent(Event& event);
+ protected:
+ private:
+ unsigned int fromID_;
+ unsigned int toID_;
+ PortalEndPoint* from_;
+ PortalEndPoint* to_;
+ float activationRadius_;
+ std::set<WorldEntity *> recentlyPorted;
+ ObjectList<WorldEntity>::iterator it_;
+ bool isNowPortable(WorldEntity * ent);
+ };
+
+}
+
+#endif /* _Portals_H__ */
\ No newline at end of file
Added: code/branches/portals/src/modules/portals/PortalPrecompiledHeaders.h
===================================================================
--- code/branches/portals/src/modules/portals/PortalPrecompiledHeaders.h (rev 0)
+++ code/branches/portals/src/modules/portals/PortalPrecompiledHeaders.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -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:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+///// Stable Headers /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+///// All Rebuild Headers /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Added: code/branches/portals/src/modules/portals/PortalPrereqs.h
===================================================================
--- code/branches/portals/src/modules/portals/PortalPrereqs.h (rev 0)
+++ code/branches/portals/src/modules/portals/PortalPrereqs.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -0,0 +1,73 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _PortalsPrereqs_H__
+#define _PortalsPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Portals_STATIC_BUILD)
+# ifdef Portals_SHARED_BUILD
+# define _PortalsExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _PortalsExport
+# else
+# define _PortalsExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _PortalsExport __attribute__ ((visibility("default")))
+#else
+# define _PortalsExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+
+ class PortalEndPoint;
+ class PortalLink;
+
+}
+
+#endif /* _PortalsPrereqs_H__ */
Modified: code/branches/portals/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/portals/src/orxonox/worldentities/CMakeLists.txt 2011-04-06 21:06:45 UTC (rev 8198)
+++ code/branches/portals/src/orxonox/worldentities/CMakeLists.txt 2011-04-07 10:13:19 UTC (rev 8199)
@@ -11,8 +11,6 @@
CameraPosition.cc
SpawnPoint.cc
TeamSpawnPoint.cc
- PortalEndPoint.cc
- PortalLink.cc
)
ADD_SUBDIRECTORY(pawns)
Deleted: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc 2011-04-06 21:06:45 UTC (rev 8198)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc 2011-04-07 10:13:19 UTC (rev 8199)
@@ -1,54 +0,0 @@
-#include "PortalEndPoint.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(PortalEndPoint);
-
- std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
-
- PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), material_(""), billboard_(0)
- {
- RegisterObject(PortalEndPoint);
- }
-
- PortalEndPoint::~PortalEndPoint()
- {
-
- }
-
- void PortalEndPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PortalEndPoint, XMLPort, xmlelement, mode);
- XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
- XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "material", setMaterial, getMaterial, xmlelement, mode);
- XMLPortParamExtern(PortalEndPoint, Billboard, this->billboard_, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
-
- if(mode == XMLPort::LoadObject)
- {
- PortalEndPoint::idMap_s[this->id_] = this;
- }
- }
-
- void PortalEndPoint::tick(float dt)
- {
- SUPER(PortalEndPoint, tick);
- }
-
- void PortalEndPoint::jumpOut(WorldEntity* entity)
- {
- this->recentlyJumpedOut_.insert(entity);
- entity->setPosition(this->getPosition());
- }
-
- bool PortalEndPoint::hasRecentlyJumpedOut(WorldEntity* entity)
- {
- if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())
- {
- return false;
- }
- else
- return true;
- }
-
-}
Deleted: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h 2011-04-06 21:06:45 UTC (rev 8198)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -1,43 +0,0 @@
-#ifndef _PortalEndPoint_H__
-#define _PortalEndPoint_H__
-
-#include <set>
-#include <string>
-#include <map>
-
-#include "StaticEntity.h"
-#include "graphics/Billboard.h"
-#include "../../modules/objects/triggers/DistanceMultiTrigger.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PortalEndPoint : public DistanceMultiTrigger
- {
- public:
- PortalEndPoint(BaseObject* creator);
- virtual ~PortalEndPoint();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- //virtual void tick(float dt);
- static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< maps integer id values to portalendpoints
- inline void setID(unsigned int id)
- {
- this->id_ = id;
- }
-
- inline unsigned int getID() const
- {
- return this->id_;
- }
- void jumpOut(WorldEntity * entity); //!< relocate an entity to the position of the endpoint and add it to the set of recentlyPortedOut entities
- void tick(float dt);
- bool hasRecentlyJumpedOut(WorldEntity * entity); //!< check if a certain entity recently jumped out of this endpoint
- protected:
- private:
- unsigned int id_;
- std::set<WorldEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
- Billboard billboard_;
- };
-
-}
-
-#endif /* _Portals_H__ */
Deleted: code/branches/portals/src/orxonox/worldentities/PortalLink.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.cc 2011-04-06 21:06:45 UTC (rev 8198)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.cc 2011-04-07 10:13:19 UTC (rev 8199)
@@ -1,58 +0,0 @@
-#include "PortalLink.h"
-#include "core/XMLPort.h"
-#include "objects/triggers/MultiTriggerContainer.h"
-
-namespace orxonox
-{
- CreateFactory(PortalLink);
-
- PortalLink::PortalLink(BaseObject* creator) : BaseObject(creator), fromID_(0), toID_(0), from_(0), to_(0), activationRadius_(20)
- {
- RegisterObject(PortalLink);
- }
-
- PortalLink::~PortalLink()
- {
- }
-
- void PortalLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PortalLink, XMLPort, xmlelement, mode);
- XMLPortParam(PortalLink, "fromID", setFromID, getFromID, xmlelement, mode);
- XMLPortParam(PortalLink, "toID", setToID, getToID, xmlelement, mode);
-
- if(mode == XMLPort::LoadObject)
- {
- this->from_ = PortalEndPoint::idMap_s[this->fromID_];
- this->to_ = PortalEndPoint::idMap_s[this->toID_];
- recentlyPorted.clear();
- }
- }
-
- void PortalLink::tick(float dt)
- {
- SUPER(PortalLink, tick)
- }
-
- void PortalLink::processEvent(Event& event)
- {
- SUPER(PortalLink, processEvent);
- if(!event.activate_)
- {
- return;
- }
- MultiTriggerContainer * origin = dynamic_cast<MultiTriggerContainer *>(event.originator_);
- if(!origin)
- {
- return;
- }
- PortalEndPoint * eventFrom = dynamic_cast<PortalEndPoint *>(origin->getOriginator());
- WorldEntity * eventEntity = dynamic_cast<WorldEntity *>(origin->getData());
- if(eventFrom != this->from_ || !eventEntity || eventFrom->hasRecentlyJumpedOut(eventEntity) == true)
- {
- return;
- }
- to_->jumpOut(entity);
- }
-
-}
\ No newline at end of file
Deleted: code/branches/portals/src/orxonox/worldentities/PortalLink.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.h 2011-04-06 21:06:45 UTC (rev 8198)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.h 2011-04-07 10:13:19 UTC (rev 8199)
@@ -1,54 +0,0 @@
-#ifndef _PortalLink_H__
-#define _PortalLink_H__
-
-#include "OrxonoxPrereqs.h"
-#include "tools/interfaces/Tickable.h"
-#include "core/BaseObject.h"
-#include "PortalEndPoint.h"
-#include "objects/eventsystem/EventListener.h"
-
-#include <set>
-
-namespace orxonox
-{
- class _OrxonoxExport PortalLink : public EventListener
- {
- public:
- PortalLink(BaseObject* creator);
- virtual ~PortalLink();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void tick(float dt);
- inline void setFromID(unsigned int from)
- {
- this->fromID_ = from;
- }
- inline unsigned int getFromID(unsigned int) const
- {
- return this->fromID_;
- }
- inline void setToID(unsigned int to)
- {
- this->toID_ = to;
- }
- inline unsigned int getToID(unsigned int) const
- {
- return this->toID_;
- }
- void use(WorldEntity * entity);
- virtual void processEvent(Event& event);
- protected:
- private:
- unsigned int fromID_;
- unsigned int toID_;
- PortalEndPoint* from_;
- PortalEndPoint* to_;
- float activationRadius_;
- std::set<WorldEntity *> recentlyPorted;
- ObjectList<WorldEntity>::iterator it_;
- bool isNowPortable(WorldEntity * ent);
- };
-
-}
-
-#endif /* _Portals_H__ */
\ No newline at end of file
More information about the Orxonox-commit
mailing list