Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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/lib/graphics/particles
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.
Note: See TracChangeset for help on using the changeset viewer.