[Orxonox-commit 3491] r8177 - in code/branches/portals: data/levels src/orxonox/worldentities

anbueche at orxonox.net anbueche at orxonox.net
Sun Apr 3 18:51:03 CEST 2011


Author: anbueche
Date: 2011-04-03 18:51:03 +0200 (Sun, 03 Apr 2011)
New Revision: 8177

Added:
   code/branches/portals/data/levels/portals.oxw
   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:
added PortalEndPoint and PortalLink, billboard for endpoint implemented

Added: code/branches/portals/data/levels/portals.oxw
===================================================================
--- code/branches/portals/data/levels/portals.oxw	                        (rev 0)
+++ code/branches/portals/data/levels/portals.oxw	2011-04-03 16:51:03 UTC (rev 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>

Modified: code/branches/portals/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/portals/src/orxonox/worldentities/CMakeLists.txt	2011-04-03 16:44:48 UTC (rev 8176)
+++ code/branches/portals/src/orxonox/worldentities/CMakeLists.txt	2011-04-03 16:51:03 UTC (rev 8177)
@@ -11,6 +11,8 @@
   CameraPosition.cc
   SpawnPoint.cc
   TeamSpawnPoint.cc
+  PortalEndPoint.cc
+  PortalLink.cc
 )
 
 ADD_SUBDIRECTORY(pawns)

Added: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc	                        (rev 0)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc	2011-04-03 16:51:03 UTC (rev 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;
+        }
+    }
+}


Property changes on: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.cc
___________________________________________________________________
Added: svn:executable
   + *

Added: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h	                        (rev 0)
+++ code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h	2011-04-03 16:51:03 UTC (rev 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__ */


Property changes on: code/branches/portals/src/orxonox/worldentities/PortalEndPoint.h
___________________________________________________________________
Added: svn:executable
   + *

Added: code/branches/portals/src/orxonox/worldentities/PortalLink.cc
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.cc	                        (rev 0)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.cc	2011-04-03 16:51:03 UTC (rev 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)
+    {
+        
+    }
+}
\ No newline at end of file


Property changes on: code/branches/portals/src/orxonox/worldentities/PortalLink.cc
___________________________________________________________________
Added: svn:executable
   + *

Added: code/branches/portals/src/orxonox/worldentities/PortalLink.h
===================================================================
--- code/branches/portals/src/orxonox/worldentities/PortalLink.h	                        (rev 0)
+++ code/branches/portals/src/orxonox/worldentities/PortalLink.h	2011-04-03 16:51:03 UTC (rev 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__ */
\ No newline at end of file


Property changes on: code/branches/portals/src/orxonox/worldentities/PortalLink.h
___________________________________________________________________
Added: svn:executable
   + *




More information about the Orxonox-commit mailing list