Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3938 in orxonox.OLD


Ignore:
Timestamp:
Apr 23, 2005, 4:48:57 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: inherit speed from emitter is now also an option
for this i had to write a new PNode function, getVelocity (patrick: you could also use this one in the shoot-class, maybe).

Location:
orxonox/branches/particleEngine/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/particleEngine/src/lib/coord/p_node.cc

    r3860 r3938  
    307307}
    308308
     309/**
     310   \returns the Velocity of the PNode
     311*/
     312Vector PNode::getVelocity() const
     313{
     314  return (*this->absCoordinate - *this->lastAbsCoordinate) / this->time;
     315}
    309316
    310317/**
  • orxonox/branches/particleEngine/src/lib/coord/p_node.h

    r3813 r3938  
    7070
    7171  float getSpeed() const;
     72  Vector getVelocity() const;
    7273
    7374  void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE);
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc

    r3936 r3938  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: Patrick Boenzli
    1414*/
    1515
    16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PARTICLE
    1717
    1818#include "particle_emitter.h"
     
    132132      randDir.normalize();
    133133      randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)random()/RAND_MAX -.5), randDir)).apply(this->direction);
    134       randDir.normalize();
     134      randDir = *randDir.getNormalized() + (this->getVelocity() * system->inheritSpeed);
     135
    135136      system->addParticle(this->getAbsCoor(), randDir* velocity);
    136137    }
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc

    r3937 r3938  
    1414*/
    1515
    16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PARTICLE
    1717
    1818#include "particle_engine.h"
     
    145145    }
    146146  delete tmpIt;
    147 
    148147}
    149148
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3936 r3938  
    4242   this->setConserve(.8);
    4343   this->setLifeSpan(.1);
     44   this->setInheritSpeed(0);
    4445
    4546   ParticleEngine::getInstance()->addSystem(this);
     
    6263  this->material = material;
    6364}
     65
     66
     67/**
     68   \brief how much of the speed from the ParticleEmitter should flow onto the ParticleSystem
     69   \param value a Value between zero and one
     70
     71   
     72   if you want to change the value of this variable during emission time (to make it more dynamic)
     73   you may want to use the animation class
     74*/
     75void ParticleSystem::setInheritSpeed(float value)
     76{
     77  if (unlikely(value > 1.0))
     78    this->inheritSpeed = 1;
     79  else if (unlikely(value < 0.0))
     80    this->inheritSpeed = 0;
     81  else
     82    this->inheritSpeed = value;
     83}
     84
    6485
    6586void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan)
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h

    r3936 r3938  
    4949
    5050  void setMaterial(Material* material);
     51  void setInheritSpeed(float value);
    5152  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
    5253  void setRadius(float startRadius, float endRadius, float randomRadius = 0.0);
     
    6667  float initialMass;
    6768  float randomInitialMass;
    68  
     69  float inheritSpeed;
     70
    6971  // particles
    7072  int maxCount;              //!< The maximum count of Particles.
  • orxonox/branches/particleEngine/src/story_entities/world.cc

    r3937 r3938  
    379379            ParticleEmitter* testEmitter,* testEmitter2;
    380380            ParticleSystem* testSystem;
    381             testEmitter = new ParticleEmitter(Vector(-1,0,0), .1, 1200.0, .5);
     381            testEmitter = new ParticleEmitter(Vector(-1,0,0), M_PI_2, 1200.0, 1);
    382382            testEmitter->setParent(localPlayer);
    383             testEmitter->setSpread(M_PI_4, .1);
    384             testEmitter2 = new ParticleEmitter(Vector(-1,0,0), .1, 1200, .5);
     383            testEmitter2 = new ParticleEmitter(Vector(-1,0,0), .1, 1200, 1);
    385384            testEmitter2->setParent(tn);
    386385
     
    388387            testSystem->setLifeSpan(3);
    389388            testSystem->setConserve(.8);
     389            testSystem->setInheritSpeed(1);
    390390
    391391            ParticleEngine::getInstance()->addConnection(testEmitter, testSystem);
Note: See TracChangeset for help on using the changeset viewer.