Index: code/branches/portals/data/levels/portals.oxw
===================================================================
--- code/branches/portals/data/levels/portals.oxw	(revision 8177)
+++ code/branches/portals/data/levels/portals.oxw	(revision 8177)
@@ -0,0 +1,96 @@
+ 
+<LevelInfo
+ name = "Portals"
+ description = "Level for testing portals"
+ tags = "tutorial"
+/>
+
+<?lua
+  include("HUDTemplates3.oxo")
+  include("stats.oxo")
+  include("templates/spaceshipAssff.oxt")
+  include("templates/lodInformation.oxt")
+?>
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+
+
+   <PortalEndPoint position="0,0,0" material="Examples/Flare" id="1"/>
+   <PortalEndPoint position="-100,0,0" material="Examples/Flare" id="2"/>
+   <PortalLink fromID="1" toID="2" />
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+    <SpawnPoint position="200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+    <GlobalShader compositor="Bloom" visible=false>
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+        </visibility>
+      </events>
+    </GlobalShader>
+
+
+<!--
+    <Model position="0,0,0" scale=8 mesh="ast1.mesh" />
+    <StaticEntity position="0,0,0" collisionType=static>
+      <collisionShapes>
+        <SphereCollisionShape radius="20" />
+      </collisionShapes>
+    </StaticEntity>
+-->
+
+
+<!--
+    <?lua
+      for i = 1, 70, 1 do
+    ?>
+      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 1000 + 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * -1000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+
+      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 1000 + 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * -1000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+
+      <MovableEntity position="<?lua print(math.random() * 1000 + 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+      <MovableEntity position="<?lua print(math.random() * -1000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+        <attached>
+          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+        </attached>
+      </MovableEntity>
+    <?lua end ?>
+-->
+
+  </Scene>
+</Level>
Index: code/branches/portals/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/portals/src/orxonox/worldentities/CMakeLists.txt	(revision 8086)
+++ code/branches/portals/src/orxonox/worldentities/CMakeLists.txt	(revision 8177)
@@ -12,4 +12,6 @@
   SpawnPoint.cc
   TeamSpawnPoint.cc
+  PortalEndPoint.cc
+  PortalLink.cc
 )
 
Index: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc	(revision 8177)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc	(revision 8177)
@@ -0,0 +1,34 @@
+#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);
+        trigger_.setDistance(10);
+        trigger_.setStayActive(true);
+    }
+    
+    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)
+        {
+            idMap_s[this->id_] = this;
+        }
+    }
+}
Index: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h	(revision 8177)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h	(revision 8177)
@@ -0,0 +1,43 @@
+#ifndef _PortalEndPoint_H__
+#define _PortalEndPoint_H__
+
+#include <set>
+#include <string>
+#include <map>
+
+#include "StaticEntity.h"
+#include "graphics/Billboard.h"
+#include "objects/triggers/DistanceMultiTrigger.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport PortalEndPoint : public StaticEntity
+    {
+        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;
+            inline void setID(unsigned int id)
+            {
+                this->id_ = id;
+            }
+            
+            inline unsigned int getID() const
+            {
+                return this->id_;
+            }
+        protected:
+        private:
+            unsigned int id_;
+            std::set<WorldEntity *> recentlyJumpedOut_;
+            std::string material_;
+            Billboard billboard_;
+            DistanceMultiTrigger trigger_;
+    };
+
+}
+
+#endif /* _Portals_H__ */
Index: code/branches/portals/src/orxonox/worldentities/PortalLink.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.cc	(revision 8177)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.cc	(revision 8177)
@@ -0,0 +1,39 @@
+#include "PortalLink.h"
+#include "core/XMLPort.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::use(WorldEntity * entity)
+    {
+        
+    }
+    void PortalLink::tick(float dt)
+    {
+        
+    }
+}
Index: code/branches/portals/src/orxonox/worldentities/PortalLink.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.h	(revision 8177)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.h	(revision 8177)
@@ -0,0 +1,51 @@
+#ifndef _PortalLink_H__
+#define _PortalLink_H__
+
+#include "OrxonoxPrereqs.h"
+#include "tools/interfaces/Tickable.h"
+#include "core/BaseObject.h"
+#include "PortalEndPoint.h"
+
+#include <set>
+
+namespace orxonox
+{
+    class _OrxonoxExport PortalLink : public BaseObject
+    {
+        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);
+        protected:
+        private:
+            unsigned int fromID_;
+            unsigned int toID_;
+            PortalEndPoint* from_;
+            PortalEndPoint* to_;
+            float activationRadius_;
+            std::set<WorldEntity *> recentlyPorted;
+            bool isNowPortable(WorldEntity * ent);
+    };
+
+}
+
+#endif /* _Portals_H__ */
