- Timestamp:
- Feb 3, 2006, 8:27:36 PM (19 years ago)
- Location:
- trunk/src/lib/particles
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/particles/particle_emitter.cc
r6825 r7027 186 186 this->saveTime = modff(count, &count) / this->emissionRate; 187 187 PRINTF(5)("emitting %f particles, saving %f seconds for the next timestep\n", count, this->saveTime); 188 188 if (count + this->system->getCount() > this->system->getMaxCount()) 189 count = this->system->getMaxCount() - this->system->getCount(); 189 190 if (likely(count > 0.0f)) 190 {191 191 this->emitParticles((unsigned int)count); 192 193 /* Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;194 for (int i = 0; i < (int)count; i++)195 {196 Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);197 randDir.normalize();198 randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction);199 Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;200 201 // this should spread the Particles evenly. if the Emitter is moved around quickly202 Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt;203 Vector extension; // the Vector for different fields.204 205 // if (this->type & EMITTER_PLANE)206 // {207 // extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));208 // extension = this->getAbsDir().apply(extension);209 // }210 // else if (this->type & EMITTER_CUBE)211 // {212 // extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;213 // }214 215 216 // ROTATIONAL CALCULATION (this must not be done for all types of particles.)217 randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);218 randDir.normalize();219 Quaternion orient = Quaternion(M_PI, randDir);220 Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);221 222 this->system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV, orient, moment);223 } */224 }225 192 } 226 193 } -
trunk/src/lib/particles/particle_system.cc
r6823 r7027 311 311 // rendering new position. 312 312 tickPart->position += tickPart->velocity * dt; 313 tickPart->orientation += tickPart->momentum *dt;313 tickPart->orientation *= tickPart->momentum *dt; 314 314 315 315 // many more to come -
trunk/src/lib/particles/particle_system.h
r6629 r7027 84 84 inline float getMass() const { return this->initialMass; }; 85 85 86 /** @returns the count of particles in this System */ 87 inline unsigned int getCount() const { return this->count; }; 88 /** @returns the maximum count of particles that can be contained by this System */ 89 inline unsigned int getMaxCount() const { return this->maxCount; }; 90 86 91 virtual unsigned int getFaceCount() const; 87 92
Note: See TracChangeset
for help on using the changeset viewer.