Changeset 4182 in orxonox.OLD for orxonox/branches/physics/src/lib/graphics
- Timestamp:
- May 14, 2005, 1:15:25 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/lib/graphics/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/lib/graphics/particles/particle_system.cc
r4178 r4182 23 23 #include "material.h" 24 24 25 #include "field.h" 26 25 27 using namespace std; 26 28 … … 34 36 ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) 35 37 { 36 37 38 39 40 41 42 43 44 45 46 47 48 49 38 this->setClassName ("ParticleSystem"); 39 this->material = NULL; 40 this->name = NULL; 41 this->maxCount = maxCount; 42 this->count = 0; 43 this->particles = NULL; 44 this->deadList = NULL; 45 this->setConserve(1); 46 this->setLifeSpan(1); 47 this->setInheritSpeed(0); 48 this->glID = NULL; 49 this->setRadius(1.0, 1.0, 0.0); 50 this->setType(type, 1); 51 ParticleEngine::getInstance()->addSystem(this); 50 52 } 51 53 … … 207 209 tickPart->radius += tickPart->radiusIt * dt; 208 210 211 // applying force to the System. 212 tickPart->velocity += tickPart->extForce * tickPart->mass; 213 tickPart->extForce = Vector(0,0,0); 214 209 215 // many more to come 210 211 216 212 217 if (this->conserve < 1.0) … … 240 245 } 241 246 } 247 248 /** 249 \brief applies some force to a Particle. 250 */ 251 void ParticleSystem::applyField(Field* field) 252 { 253 Particle* tickPart = particles; 254 while (tickPart) 255 { 256 tickPart->extForce += field->calcForce(tickPart->position); 257 tickPart = tickPart->next; 258 } 259 } 260 242 261 243 262 /** -
orxonox/branches/physics/src/lib/graphics/particles/particle_system.h
r4178 r4182 31 31 class Material; 32 32 class ParticleEmitter; 33 33 class Field; 34 34 35 35 //! A struct for one Particle … … 39 39 Vector position; //!< The current position of this particle. 40 40 Vector velocity; //!< The current velocity of this particle. 41 Vector extForce; //!< The external Force that influences this Particle. 41 42 Quaternion rotation; //!< The current rotation of this particle. 42 43 float mass; //!< The mass of this particle. … … 68 69 void setConserve(float conserve); 69 70 void setMass(float mass, float randomMass); 71 72 void applyField(Field* field); 70 73 71 74 void tick(float dt);
Note: See TracChangeset
for help on using the changeset viewer.