MCPcopy Create free account
hub / github.com/defold/defold / UpdateParticles

Function UpdateParticles

engine/particle/src/particle.cpp:833–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831 }
832
833 static void UpdateParticles(Instance* instance, Emitter* emitter, dmParticleDDF::Emitter* emitter_ddf, float dt)
834 {
835 DM_PROFILE(__FUNCTION__);
836
837 // Step particle life, prune dead particles
838 uint32_t particle_count = emitter->m_Particles.Size();
839 uint32_t j = 0;
840 while (j < particle_count)
841 {
842 Particle* p = &emitter->m_Particles[j];
843 p->SetTimeLeft(p->GetTimeLeft() - dt);
844 if (p->GetTimeLeft() < 0.0f)
845 {
846 // TODO Handle death-action
847 emitter->m_Particles.EraseSwap(j);
848 --particle_count;
849 } else {
850 ++j;
851 }
852 }
853 }
854
855 static void SpawnParticle(dmArray<Particle>& particles, uint32_t* seed, dmParticleDDF::Emitter* ddf, const dmTransform::TransformS1& emitter_transform, Vector3 emitter_velocity, float emitter_properties[EMITTER_KEY_COUNT], float dt);
856

Callers 1

UpdateEmitterFunction · 0.85

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected