void ParticleEmitter::update(float time_delta) { spawnParticles(time_delta); updateLives(time_delta); updatePositions(time_delta); updateRotations(time_delta); for (auto* module : m_modules) { module->update(time_delta); } }
void Particles::update(float delta) { numParticles = particles.size(); int numSpawn = ceil(spawnRate * delta); spawnParticles(numSpawn); std::vector<Vector3> positions; positions.reserve( numParticles ); std::vector<Color> colors; colors.reserve( numParticles ); // Update the particles. for(size_t i = 0; i < numParticles; i++) { Particle& particle = particles[i]; if( !particle.alive ) continue; if( particle.life <= 0 ) { particle.alive = false; continue; } particle.position += particle.velocity; particle.life -= float(delta); particle.color.a = particle.life / maxLife; positions.push_back( particle.position ); colors.push_back( particle.color ); } gb->declarations.reset(); gb->clear(); gb->set(VertexAttribute::Position, positions); gb->set(VertexAttribute::Color, colors); gb->forceRebuild(); //updateDebugRenderable(); }
void SampleModel::drawRightHand() { // Undo transformations glTranslated(0, 0, 0.6); glRotated(-90, 1.0, 0.0, 0.0); glTranslated(0, 0.7, 0); glTranslated(-UPPER_TORSO_RADIUS - 0.7, 0.3, 0); glTranslated(UPPER_TORSO_RADIUS + 0.7, -1.7, 0); glRotated(90, 1.0, 0.0, 0.0); glTranslated(0, 0, -0.1); glRotated(VAL(RIGHTHANDX), -1.0, 0, 0); if (VAL(TEXTURESKIN)) drawTextureCylinder(0.4, 0.10, 0.05); else drawCylinder(0.4, 0.10, 0.05); glPushMatrix(); glTranslated(0.0, 0.0, 0.8); spawnParticles(cameraMatrix); glPopMatrix(); glPopMatrix(); }
void ParticleField::Update() { updateForces(); updateParticles(); killParticles(); spawnParticles(); }