Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3065


Ignore:
Timestamp:
May 25, 2009, 6:03:56 PM (15 years ago)
Author:
decapitb
Message:
 
Location:
code/branches/particles/src/orxonox/objects/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particles/src/orxonox/objects/worldentities/BigExplosion.cc

    r3054 r3065  
    3434#include <OgreParticleSystem.h>
    3535#include <OgreSceneNode.h>
     36#include <sstream>
    3637
    3738#include "core/Core.h"
    3839#include "core/CoreIncludes.h"
    3940#include "core/Executor.h"
     41#include "core/CommandExecutor.h"
    4042#include "objects/Scene.h"
    4143#include "tools/ParticleInterface.h"
     
    5355        if ( Core::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
    5456            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
    55 
     57/*
     58        this->cps_ = 1;
     59        this->firstTick_ = true;
     60*/
    5661        this->bStop_ = false;
    5762        this->LOD_ = LODParticle::normal;
     63
     64/*      this->stf_ = "setTimeFactor ";
     65        this->timeFactor_ =  1;
     66        std::ostringstream o;
     67        o << stf_ << this->timeFactor_;
     68        CommandExecutor::execute(o.str() ,false);
     69        this->timeFactor_ = 0.1;
     70*/
    5871
    5972        if ( Core::showsGraphics() )
     
    146159        this->debris2_->setMeshSource("WingDebris1.mesh");
    147160        this->debris3_->setMeshSource("BodyDebris1.mesh");
    148         this->debris4_->setMeshSource("WingDebris1.mesh");
     161        this->debris4_->setMeshSource("WingDebris2.mesh");
    149162
    150163        this->debrisEntity1_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
    151         this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
     164        this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
    152165        this->debrisEntity1_->setScale(4);
    153166
    154167        this->debrisEntity2_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
    155         this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
     168        this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
    156169        this->debrisEntity2_->setScale(4);
    157170
    158171        this->debrisEntity3_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
    159         this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
     172        this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
    160173        this->debrisEntity3_->setScale(4);
    161174
    162175        this->debrisEntity4_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
    163         this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
     176        this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
    164177        this->debrisEntity4_->setScale(4);
    165178
     
    189202
    190203
    191         for(int i=0;i<50;i++)
     204        for(int i=0;i<10;i++)
    192205        {
    193206            Identifier* idf1 = Class(Model);
     
    209222
    210223            partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
    211             partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
    212             partEntity1->setScale(2);
     224            partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
     225            partEntity1->setScale(rnd(1, 3));
    213226
    214227            partEntity2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 100));
    215             partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(1000).valueRadians());
    216             partEntity2->setScale(2);
     228            partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
     229            partEntity2->setScale(rnd(1, 3));
    217230
    218231            part1->setMeshSource("SmallPart1.mesh");
    219232            part2->setMeshSource("SmallPart2.mesh");
     233
    220234
    221235            partEntity1->attach(part1);
     
    245259    BigExplosion::~BigExplosion()
    246260    {
     261        CommandExecutor::execute("setTimeFactor 1", false);
     262
    247263        if (this->isInitialized())
    248264        {
     
    362378    }
    363379
     380/* TODO
     381
     382    void BigExplosion::setDebrisMeshes()
     383    {
     384
     385    }
     386    void BigExplosion::getDebrisMeshes()
     387    {
     388
     389    }
     390*/
     391
    364392     void BigExplosion::tick(float dt)
    365393    {
    366 
    367 
    368 //        static const unsigned int CHANGES_PER_SECOND = 5;
    369 //
    370 //        if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)
    371 //        {
    372 //            Vector3 velocity = this->object2_->getVelocity();
    373 //            velocity /= 1.5;
    374 //            this->object2_->setVelocity(velocity);
    375 //        }
     394//        static const unsigned int CHANGES_PER_SECOND = 10;
     395
     396
     397/*        if (Core::isMaster() && rnd() < dt*(this->cps_))
     398        {
     399
     400            if(this->timeFactor_ < 1 )
     401                this->timeFactor_ += 0.05;
     402
     403            if(this->firstTick_)
     404                this->cps_ = 256;
     405
     406            std::ostringstream o;
     407            o << this->stf_ << this->timeFactor_;
     408            CommandExecutor::execute(o.str() ,false);
     409            if(this->cps_>50)
     410                this->cps_/=2;
     411            this->firstTick_ = false;
     412            COUT(0) << timeFactor_ << std::endl;
     413        }
     414*/
    376415
    377416        SUPER(BigExplosion, tick, dt);
  • code/branches/particles/src/orxonox/objects/worldentities/BigExplosion.h

    r3054 r3065  
    3131
    3232#include "OrxonoxPrereqs.h"
     33#include <string>
     34
    3335
    3436#include "MovableEntity.h"
     
    6062            void initZero();
    6163
     64
    6265            bool                  bStop_;
     66            bool                  firstTick_;
     67
     68            std::string           stf_;
     69
     70            unsigned int          cps_;
     71
     72            double                timeFactor_;
    6373
    6474            StaticEntity*         explosion_;
     
    7383            Model*                debris3_;
    7484            Model*                debris4_;
     85
     86
    7587
    7688            ParticleInterface*    debrisSmoke1_;
Note: See TracChangeset for help on using the changeset viewer.