| 1485 | } |
| 1486 | |
| 1487 | void ParticleSystem::simulate(float seconds, float frameRate) |
| 1488 | { |
| 1489 | seconds = seconds == static_cast<float>(SIMULATION_USE_PARTICLE_LIFETIME) ? getLife() + getLifeVar() : seconds; |
| 1490 | frameRate = frameRate == static_cast<float>(SIMULATION_USE_GAME_ANIMATION_INTERVAL) |
| 1491 | ? 1.0F / Director::getInstance()->getAnimationInterval() |
| 1492 | : frameRate; |
| 1493 | auto delta = 1.0F / frameRate; |
| 1494 | if (seconds > delta) |
| 1495 | { |
| 1496 | while (seconds > 0.0F) |
| 1497 | { |
| 1498 | this->update(delta); |
| 1499 | seconds -= delta; |
| 1500 | } |
| 1501 | this->update(seconds); |
| 1502 | } |
| 1503 | else |
| 1504 | this->update(seconds); |
| 1505 | } |
| 1506 | |
| 1507 | void ParticleSystem::resimulate(float seconds, float frameRate) |
| 1508 | { |