[Orxonox-commit 5359] r10022 - code/branches/pickupsFS14/src/modules/jump

fvultier at orxonox.net fvultier at orxonox.net
Thu Apr 3 16:05:52 CEST 2014


Author: fvultier
Date: 2014-04-03 16:05:52 +0200 (Thu, 03 Apr 2014)
New Revision: 10022

Modified:
   code/branches/pickupsFS14/src/modules/jump/Jump.cc
   code/branches/pickupsFS14/src/modules/jump/Jump.h
   code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
   code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h
   code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
   code/branches/pickupsFS14/src/modules/jump/JumpShip.h
Log:
Anzeigen eines .mesh files funktioniert. Es wird nicht im Level-File geladen sondern dynamisch zur laufzeit, wenn die s-taste gedrueckt wird.

Modified: code/branches/pickupsFS14/src/modules/jump/Jump.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/Jump.cc	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/Jump.cc	2014-04-03 14:05:52 UTC (rev 10022)
@@ -45,7 +45,6 @@
 
 #include "JumpCenterPoint.h"
 #include "JumpShip.h"
-#include "JumpPlatform.h"
 /*
 #include "JumpEnemy.h"
 #include "JumpEnemyShooter.h"*/
@@ -64,6 +63,7 @@
         //this->center_ = 0;
        // init();
         //this->setHUDTemplate("JumpHUD");
+
     }
 
     void Jump::init()

Modified: code/branches/pickupsFS14/src/modules/jump/Jump.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/Jump.h	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/Jump.h	2014-04-03 14:05:52 UTC (rev 10022)
@@ -36,12 +36,10 @@
 #define _Jump_H__
 
 #include "jump/JumpPrereqs.h"
-
 #include "gametypes/Deathmatch.h"
-
 #include "JumpCenterPoint.h"
-
 #include "tools/Timer.h"
+#include "JumpPlatform.h"
 
 namespace orxonox
 {

Modified: code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/JumpPlatform.cc	2014-04-03 14:05:52 UTC (rev 10022)
@@ -35,7 +35,9 @@
 #include "Scene.h"
 #include "graphics/ParticleSpawner.h"
 #include "graphics/Model.h"
-#include "MovableEntity.h"
+#include "worldentities/MovableEntity.h"
+#include "chat/ChatManager.h"
+#include "OrxonoxPrereqs.h"
 
 namespace orxonox
 {
@@ -44,291 +46,23 @@
     JumpPlatform::JumpPlatform(Context* context) : MobileEntity(context)
     {
         RegisterObject(JumpPlatform);
-        /*
-        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
-            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
 
-        this->bStop_ = false;
-        this->LOD_ = LODParticle::Normal;
 
-        if ( GameMode::showsGraphics() )
-        {
-            try
-            {
-                this->init();
-            }
-            catch (const std::exception& ex)
-            {
-                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
-                this->initZero();
-            }
-        }
-        else
-        {
-            this->initZero();
-        }
+        model = new Model(getContext());
+        model->setSyncMode(0);
+        model->setMeshSource("drone.mesh");
 
-        if (GameMode::isMaster())
-        {
-            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
-        }
+        movableEntity = new MovableEntity(getContext());
+        movableEntity->attach(model);
 
-        this->registerVariables();
-        */
-    }
+        movableEntity->setScale(100);
+        //movableEntity->setPosition(Vector3(0,0,0));
+        //movableEntity->setVelocity(Vector3(0,0,1));
 
-    /*void BigExplosion::init()
-    {
-        this->debrisEntity1_ = new MovableEntity(this->getContext());
-        this->debrisEntity2_ = new MovableEntity(this->getContext());
-        this->debrisEntity3_ = new MovableEntity(this->getContext());
-        this->debrisEntity4_ = new MovableEntity(this->getContext());
 
-        this->debrisEntity1_->setSyncMode(0);
-        this->debrisEntity2_->setSyncMode(0);
-        this->debrisEntity3_->setSyncMode(0);
-        this->debrisEntity4_->setSyncMode(0);
-
-        this->debris1_ = new Model(this->getContext());
-        this->debris2_ = new Model(this->getContext());
-        this->debris3_ = new Model(this->getContext());
-        this->debris4_ = new Model(this->getContext());
-
-        this->debris1_->setSyncMode(0);
-        this->debris2_->setSyncMode(0);
-        this->debris3_->setSyncMode(0);
-        this->debris4_->setSyncMode(0);
-
-        this->explosion_ = new StaticEntity(this->getContext());
-        this->explosion_->setSyncMode(0);
-
-        this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
-        this->debrisSmoke2_ =  new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
-        this->debrisSmoke3_ =  new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
-        this->debrisSmoke4_ =  new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
-
-        this->debrisFire1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);
-        this->debrisFire2_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);
-        this->debrisFire3_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);
-        this->debrisFire4_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/fire4", this->LOD_);
-
-        this->debris1_->attachOgreObject(this->debrisSmoke1_->getParticleSystem());
-        this->debris1_->attachOgreObject(this->debrisFire1_->getParticleSystem());
-        this->debris2_->attachOgreObject(this->debrisSmoke2_->getParticleSystem());
-        this->debris2_->attachOgreObject(this->debrisFire2_->getParticleSystem());
-        this->debris3_->attachOgreObject(this->debrisSmoke3_->getParticleSystem());
-        this->debris3_->attachOgreObject(this->debrisFire3_->getParticleSystem());
-        this->debris4_->attachOgreObject(this->debrisSmoke4_->getParticleSystem());
-        this->debris4_->attachOgreObject(this->debrisFire4_->getParticleSystem());
-
-        this->debris1_->setMeshSource("CockpitDebris.mesh");
-        this->debris2_->setMeshSource("WingDebris1.mesh");
-        this->debris3_->setMeshSource("BodyDebris1.mesh");
-        this->debris4_->setMeshSource("WingDebris2.mesh");
-
-        this->debrisEntity1_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
-        this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-        this->debrisEntity1_->setScale(4);
-
-        this->debrisEntity2_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
-        this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-        this->debrisEntity2_->setScale(4);
-
-        this->debrisEntity3_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
-        this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-        this->debrisEntity3_->setScale(4);
-
-        this->debrisEntity4_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
-        this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-        this->debrisEntity4_->setScale(4);
-
-        this->debrisEntity1_->attach(debris1_);
-        this->debrisEntity2_->attach(debris2_);
-        this->debrisEntity3_->attach(debris3_);
-        this->debrisEntity4_->attach(debris4_);
-
-        ParticleSpawner* effect = new ParticleSpawner(this->getContext());
-        effect->setDestroyAfterLife(true);
-        effect->setSource("Orxonox/explosion2b");
-        effect->setLifetime(4.0f);
-        effect->setSyncMode(0);
-
-        ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());
-        effect2->setDestroyAfterLife(true);
-        effect2->setSource("Orxonox/smoke6");
-        effect2->setLifetime(4.0f);
-        effect2->setSyncMode(0);
-
-        this->explosion_->attach(effect);
-        this->explosion_->attach(effect2);
-
-        this->attach(explosion_);
-        this->attach(debrisEntity1_);
-        this->attach(debrisEntity2_);
-        this->attach(debrisEntity3_);
-        this->attach(debrisEntity4_);
-
-
-        for(int i=0;i<10;i++)
-        {
-            Model* part1 = new Model(this->getContext());
-            Model* part2 = new Model(this->getContext());
-
-            MovableEntity* partEntity1 = new MovableEntity(this->getContext());
-            MovableEntity* partEntity2 = new MovableEntity(this->getContext());
-
-            part1->setSyncMode(0);
-            part2->setSyncMode(0);
-            partEntity1->setSyncMode(0);
-            partEntity2->setSyncMode(0);
-
-            partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
-            partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-            partEntity1->setScale(rnd(1, 3));
-
-            partEntity2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 100));
-            partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
-            partEntity2->setScale(rnd(1, 3));
-
-            part1->setMeshSource("SmallPart1.mesh");
-            part2->setMeshSource("SmallPart2.mesh");
-
-            partEntity1->attach(part1);
-            partEntity2->attach(part2);
-
-            this->attach(partEntity1);
-            this->attach(partEntity2);
-        }
     }
 
-    void BigExplosion::initZero()
-    {
-        this->debrisFire1_ = 0;
-        this->debrisFire2_ = 0;
-        this->debrisFire3_ = 0;
-        this->debrisFire4_ = 0;
 
-        this->debrisSmoke1_ = 0;
-        this->debrisSmoke2_ = 0;
-        this->debrisSmoke3_ = 0;
-        this->debrisSmoke4_ = 0;
 
-        this->explosionSmoke_=0;
-        this->explosionFire_=0;
-    }
 
-    BigExplosion::~BigExplosion()
-    {
-        if (this->isInitialized())
-        {
-            if (this->debrisFire1_)
-            {
-                this->debris1_->detachOgreObject(this->debrisFire1_->getParticleSystem());
-                delete this->debrisFire1_;
-            }
-            if (this->debrisSmoke1_)
-            {
-                this->debris1_->detachOgreObject(this->debrisSmoke1_->getParticleSystem());
-                delete this->debrisSmoke1_;
-            }
-
-            if (this->debrisFire2_)
-            {
-                this->debris2_->detachOgreObject(this->debrisFire2_->getParticleSystem());
-                delete this->debrisFire2_;
-            }
-            if (this->debrisSmoke2_)
-            {
-                this->debris2_->detachOgreObject(this->debrisSmoke2_->getParticleSystem());
-                delete this->debrisSmoke2_;
-            }
-
-            if (this->debrisFire3_)
-            {
-                this->debris3_->detachOgreObject(this->debrisFire3_->getParticleSystem());
-                delete this->debrisFire3_;
-            }
-            if (this->debrisSmoke3_)
-            {
-                this->debris3_->detachOgreObject(this->debrisSmoke3_->getParticleSystem());
-                delete this->debrisSmoke3_;
-            }
-
-            if (this->debrisFire4_)
-            {
-                this->debris4_->detachOgreObject(this->debrisFire4_->getParticleSystem());
-                delete this->debrisFire4_;
-            }
-            if (this->debrisSmoke4_)
-            {
-                this->debris4_->detachOgreObject(this->debrisSmoke4_->getParticleSystem());
-                delete this->debrisSmoke4_;
-            }
-        }
-    }
-
-    void BigExplosion::registerVariables()
-    {
-        registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::LODchanged));
-        registerVariable(this->bStop_,       VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::checkStop));
-    }
-
-    void BigExplosion::LODchanged()
-    {
-        if (this->debrisFire1_)
-            this->debrisFire1_->setDetailLevel(this->LOD_);
-        if (this->debrisSmoke1_)
-            this->debrisSmoke1_->setDetailLevel(this->LOD_);
-
-        if (this->debrisFire2_)
-            this->debrisFire2_->setDetailLevel(this->LOD_);
-        if (this->debrisSmoke2_)
-            this->debrisSmoke2_->setDetailLevel(this->LOD_);
-
-        if (this->debrisFire3_)
-            this->debrisFire3_->setDetailLevel(this->LOD_);
-        if (this->debrisSmoke3_)
-            this->debrisSmoke3_->setDetailLevel(this->LOD_);
-
-        if (this->debrisFire4_)
-            this->debrisFire4_->setDetailLevel(this->LOD_);
-        if (this->debrisSmoke4_)
-            this->debrisSmoke4_->setDetailLevel(this->LOD_);
-    }
-
-    void BigExplosion::checkStop()
-    {
-        if (this->bStop_)
-            this->stop();
-    }
-
-    void BigExplosion::stop()
-    {
-        if (this->debrisFire1_)
-            this->debrisFire1_->setEnabled(false);
-        if (this->debrisSmoke1_)
-            this->debrisSmoke1_->setEnabled(false);
-
-        if (this->debrisFire2_)
-            this->debrisFire2_->setEnabled(false);
-        if (this->debrisSmoke2_)
-            this->debrisSmoke2_->setEnabled(false);
-
-        if (this->debrisFire3_)
-            this->debrisFire3_->setEnabled(false);
-        if (this->debrisSmoke3_)
-            this->debrisSmoke3_->setEnabled(false);
-
-        if (this->debrisFire4_)
-            this->debrisFire4_->setEnabled(false);
-        if (this->debrisSmoke4_)
-            this->debrisSmoke4_->setEnabled(false);
-
-        if (GameMode::isMaster())
-        {
-            this->bStop_ = true;
-            this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&BigExplosion::destroy, this)));
-        }
-    }*/
-
 }

Modified: code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/JumpPlatform.h	2014-04-03 14:05:52 UTC (rev 10022)
@@ -36,7 +36,7 @@
 
 #include "jump/JumpPrereqs.h"
 
-#include "MobileEntity.h"
+#include "worldentities/MobileEntity.h"
 
 namespace orxonox
 {
@@ -47,6 +47,8 @@
 
 
         private:
+            Model* model;
+            MovableEntity* movableEntity;
 
     };
 }

Modified: code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpShip.cc	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/JumpShip.cc	2014-04-03 14:05:52 UTC (rev 10022)
@@ -140,6 +140,11 @@
     	}
     	else if (downPressed == true)
     	{
+    		platform = new JumpPlatform(getContext());
+    		platform->setPosition(Vector3(0, 0, 0));
+    		platform->setVelocity(Vector3(0, 0, 0));
+    		platform->setScale(100);
+
     		movement -= Vector3(0, 0, 0);
     		downPressed = false;
     	}

Modified: code/branches/pickupsFS14/src/modules/jump/JumpShip.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpShip.h	2014-04-03 14:04:32 UTC (rev 10021)
+++ code/branches/pickupsFS14/src/modules/jump/JumpShip.h	2014-04-03 14:05:52 UTC (rev 10022)
@@ -39,6 +39,7 @@
 #include "worldentities/pawns/SpaceShip.h"
 #include "graphics/Camera.h"
 #include "weapons/projectiles/Projectile.h"
+#include "JumpPlatform.h"
 
 namespace orxonox
 {
@@ -102,6 +103,8 @@
             float yVelocity;
             const float yAcceleration = 10.0f;
             const float ySpeedAfterJump = 300.0f;
+
+            JumpPlatform* platform;
     };
 }
 




More information about the Orxonox-commit mailing list