- Timestamp:
- Apr 23, 2005, 4:48:57 AM (20 years ago)
- Location:
- orxonox/branches/particleEngine/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/coord/p_node.cc
r3860 r3938 307 307 } 308 308 309 /** 310 \returns the Velocity of the PNode 311 */ 312 Vector PNode::getVelocity() const 313 { 314 return (*this->absCoordinate - *this->lastAbsCoordinate) / this->time; 315 } 309 316 310 317 /** -
orxonox/branches/particleEngine/src/lib/coord/p_node.h
r3813 r3938 70 70 71 71 float getSpeed() const; 72 Vector getVelocity() const; 72 73 73 74 void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE); -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
r3936 r3938 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: Patrick Boenzli 14 14 */ 15 15 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PARTICLE 17 17 18 18 #include "particle_emitter.h" … … 132 132 randDir.normalize(); 133 133 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 135 136 system->addParticle(this->getAbsCoor(), randDir* velocity); 136 137 } -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc
r3937 r3938 14 14 */ 15 15 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PARTICLE 17 17 18 18 #include "particle_engine.h" … … 145 145 } 146 146 delete tmpIt; 147 148 147 } 149 148 -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
r3936 r3938 42 42 this->setConserve(.8); 43 43 this->setLifeSpan(.1); 44 this->setInheritSpeed(0); 44 45 45 46 ParticleEngine::getInstance()->addSystem(this); … … 62 63 this->material = material; 63 64 } 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 */ 75 void 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 64 85 65 86 void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan) -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h
r3936 r3938 49 49 50 50 void setMaterial(Material* material); 51 void setInheritSpeed(float value); 51 52 void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0); 52 53 void setRadius(float startRadius, float endRadius, float randomRadius = 0.0); … … 66 67 float initialMass; 67 68 float randomInitialMass; 68 69 float inheritSpeed; 70 69 71 // particles 70 72 int maxCount; //!< The maximum count of Particles. -
orxonox/branches/particleEngine/src/story_entities/world.cc
r3937 r3938 379 379 ParticleEmitter* testEmitter,* testEmitter2; 380 380 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); 382 382 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); 385 384 testEmitter2->setParent(tn); 386 385 … … 388 387 testSystem->setLifeSpan(3); 389 388 testSystem->setConserve(.8); 389 testSystem->setInheritSpeed(1); 390 390 391 391 ParticleEngine::getInstance()->addConnection(testEmitter, testSystem);
Note: See TracChangeset
for help on using the changeset viewer.