[Orxonox-commit 6635] r11274 - in code/branches/QuestGuide_HS16/src/modules: . waypoints

ooguz at orxonox.net ooguz at orxonox.net
Mon Nov 7 16:02:04 CET 2016


Author: ooguz
Date: 2016-11-07 16:02:03 +0100 (Mon, 07 Nov 2016)
New Revision: 11274

Added:
   code/branches/QuestGuide_HS16/src/modules/waypoints/
   code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt
   code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
   code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
   code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
   code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
   code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
   code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h
Log:
waypoints to modules

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/CMakeLists.txt	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,7 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+
+  Waypointarrow.cc
+  Waypoint.cc
+  WaypointGroup.cc
+)
+

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.cc	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,44 @@
+#include "Waypoint.h"
+
+#include <OgreSceneNode.h>
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+#include "util/OrxAssert.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    RegisterClass(Waypoint);
+
+    Waypoint::Waypoint(Context* context) : StaticEntity(context)
+    {
+        RegisterObject(Waypoint);
+        model = new Model(this->getContext());
+        model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
+        this->attach(model);
+        model->setScale(3);
+        //model->setOrientation(Vector3(0,0,-1));
+        model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
+        waypoint_actived = false;
+        distancetrigger = new DistanceTrigger(this->getContext());   
+        distancetrigger->setDistance(100);
+        this->attach(distancetrigger);
+    }
+
+    Waypoint::~Waypoint()
+    {
+    }
+
+
+     //WorldEntity::setDirection
+     //WorldEntity::getPosition()
+     //setOrientation()
+
+
+    void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+        SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+        XMLPortParam(Waypoint, "order", getOrder, setOrder, xmlelement, mode);
+
+    }
+
+
+}

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypoint.h	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,65 @@
+
+
+#ifndef _Waypoint_H__
+#define _Waypoint_H__
+
+#include "OrxonoxPrereqs.h"
+#include "StaticEntity.h"
+#include "graphics/Model.h"
+#include "modules/objects/triggers/DistanceTrigger.h"
+
+#include <map>
+#include <string>
+
+#include "util/OgreForwardRefs.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The StaticEntity is the simplest derivative of the @ref orxonox::WorldEntity class. This means all StaticEntity instances also have
+        a position in space, a mass, a scale, a frication, ... because every StaticEntity is a WorldEntity. You can attach StaticEntities to eachother ike @ref orxonox::WorldEntity WorldEntities.
+
+        In contrast to the MobileEntity the StaticEntity cannot move with respect to the parent to which it is attached. That's why
+        it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the
+        function @see setPosition to changee it.
+
+        A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
+    */
+
+    class _OrxonoxExport Waypoint : public StaticEntity {
+        
+        public:
+
+            Waypoint(Context* context);
+            virtual ~Waypoint();
+
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+            inline void enable_waypoint(){
+                this->waypoint_actived = true;
+            }
+
+
+            inline int getOrder(){
+                return order;
+            }
+
+            
+
+
+        private:
+    
+            //virtual bool isCollisionTypeLegal(CollisionType type) const override;
+            Model* model;
+            DistanceTrigger* distancetrigger;
+            bool waypoint_actived;
+            int order;
+            
+            // network callbacks
+    };
+}
+
+#endif /* _Waypoint_H__ */

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.cc	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,74 @@
+#include "Waypoint.h"
+
+#include <OgreSceneNode.h>
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+#include "util/OrxAssert.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    RegisterClass(WaypointGroup);
+
+    WaypointGroup::WaypointGroup(Context* context) : StaticEntity(context)
+    {
+        /*RegisterObject(Waypoint);
+        model = new Model(this->getContext());
+        model->setMeshSource("cube.mesh");  // Name of the arrow file for now bottle
+        this->attach(model);
+        model->setScale(3);
+        //model->setOrientation(Vector3(0,0,-1));
+        model->setPosition(Vector3(0.0,0.0,0.0));        // this is wrong, it has to be triggered
+        waypoint_active = false;
+        distancetrigger = new DistanceTrigger(this->getContext());   
+        distancetrigger->setDistance(100);
+        this->attach(distancetrigger);
+        */
+    }
+
+    WaypointGroup::~WaypointGroup()
+    {
+    }
+
+
+     //WorldEntity::setDirection
+     //WorldEntity::getPosition()
+     //setOrientation()
+
+    Waypoint* WaypointGroup::getWaypoint(){
+        for (Waypoint* waypoint : this->waypoints_){
+            if(!(waypoint->waypoint_actived)){
+                waypoint->enable_waypoint();
+                return waypoint;
+            }
+        }
+    }
+
+
+    Waypoint* WaypointGroup::getWaypoint(unsigned int index)
+    {
+        unsigned int i = 0;
+        for (Waypoint* waypoint : this->waypoints_)
+        {
+   
+            if (i == index)
+                return waypoint;
+            ++i;
+        }
+        return nullptr;
+    }
+
+    void WaypointGroup::addWaypoint(Waypoint* object)
+    {
+        this->waypoints_.insert(object);
+    }
+
+
+
+    void Waypoint::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+        SUPER(Waypoint, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+        XMLPortObject(WaypointGroup, Waypoint, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);
+
+    }
+
+
+}

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/WaypointGroup.h	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,62 @@
+
+
+#ifndef _Waypoint_H__
+#define _Waypoint_H__
+
+#include "OrxonoxPrereqs.h"
+#include "StaticEntity.h"
+#include "graphics/Model.h"
+#include "modules/objects/triggers/DistanceTrigger.h"
+
+#include <map>
+#include <string>
+
+#include "util/OgreForwardRefs.h"
+#include "tools/interfaces/Tickable.h"
+#include "Waypoints.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The StaticEntity is the simplest derivative of the @ref orxonox::WorldEntity class. This means all StaticEntity instances also have
+        a position in space, a mass, a scale, a frication, ... because every StaticEntity is a WorldEntity. You can attach StaticEntities to eachother ike @ref orxonox::WorldEntity WorldEntities.
+
+        In contrast to the MobileEntity the StaticEntity cannot move with respect to the parent to which it is attached. That's why
+        it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the
+        function @see setPosition to changee it.
+
+        A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
+    */
+
+    class _OrxonoxExport WaypointGroup : public StaticEntity {
+        
+        public:
+
+            WaypointGroup(Context* context);
+            virtual ~WaypointGroup();
+
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+        Waypoint* getWaypoint(unsigned int index);
+
+        Way
+
+
+           
+
+            
+
+
+        private:
+    
+            //virtual bool isCollisionTypeLegal(CollisionType type) const override;
+         
+        std::set<Waypoint*> waypoints;
+
+            // network callbacks
+    };
+}
+
+#endif /* _Waypoint_H__ */

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.cc	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,40 @@
+#include "Waypointarrow.h"
+
+#include <OgreSceneNode.h>
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+#include "util/OrxAssert.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    RegisterClass(Waypointarrow);
+
+    Waypointarrow::Waypointarrow(Context* context) : StaticEntity(context)
+    {
+        RegisterObject(Waypointarrow);
+        model = new Model(this->getContext());
+        model->setMeshSource("Arrow.mesh");  // Name of the arrow file for now bottle
+        this->attach(model);
+        model->setScale(3);
+        model->setOrientation(Vector3(0,0,-1));
+        model->setPosition(Vector3(0,15,0));
+    }
+
+    Waypointarrow::~Waypointarrow()
+    {
+    }
+
+     
+
+
+    void Waypointarrow::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+        SUPER(Waypointarrow, XMLPort, xmlelement, mode); // From the SpaceShip.cc file
+        //XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, Vector3)
+
+        //XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode); // TRY ADDING THE WAYPOINT ARROW LIKE AN ENGINE
+ 
+
+    }
+
+
+}

Added: code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h
===================================================================
--- code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h	                        (rev 0)
+++ code/branches/QuestGuide_HS16/src/modules/waypoints/Waypointarrow.h	2016-11-07 15:02:03 UTC (rev 11274)
@@ -0,0 +1,54 @@
+
+
+#ifndef _Waypoint_H__
+#define _Waypoint_H__
+
+#include "OrxonoxPrereqs.h"
+#include "StaticEntity.h"
+#include "graphics/Model.h"
+
+#include <map>
+#include <string>
+
+#include "util/OgreForwardRefs.h"
+#include "tools/interfaces/Tickable.h"
+#include "interfaces/RadarListener.h"
+#include "WaypointGroup.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        The StaticEntity is the simplest derivative of the @ref orxonox::WorldEntity class. This means all StaticEntity instances also have
+        a position in space, a mass, a scale, a frication, ... because every StaticEntity is a WorldEntity. You can attach StaticEntities to eachother ike @ref orxonox::WorldEntity WorldEntities.
+
+        In contrast to the MobileEntity the StaticEntity cannot move with respect to the parent to which it is attached. That's why
+        it is called StaticEntity. It will keep the same position (always with respect to its parent) forever unless you call the
+        function @see setPosition to changee it.
+
+        A StaticEntity can only have the collisition type WorldEntity::None or WorldEntity::Static. The collsion types WorldEntity::Dynamic and WorldEntity::Kinematic are illegal.
+    */
+
+    class _OrxonoxExport Waypointarrow : public StaticEntity {
+        
+        public:
+
+            Waypointarrow(Context* context);
+            virtual ~Waypointarrow();
+
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+
+
+
+        private:
+    
+            //virtual bool isCollisionTypeLegal(CollisionType type) const override;
+            Model* model;
+            //Waypoint* waypoint;
+            // network callbacks
+    };
+}
+
+#endif /* _Waypoint_H__ */




More information about the Orxonox-commit mailing list