From 9a965af52918ef3a19baa1bc282b9243222e651f Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 18 Jul 2019 17:34:40 +0200 Subject: move offset handlers to separate file --- source/blender/simulations/bparticles/forces.cpp | 34 ------------------------ 1 file changed, 34 deletions(-) (limited to 'source/blender/simulations/bparticles/forces.cpp') diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index 1d859a3adc4..28d00e9355d 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -44,38 +44,4 @@ void TurbulenceForce::add_force(ParticlesBlock &block, ArrayRef r_force) } } -void CreateTrailHandler::execute(OffsetHandlerInterface &interface) -{ - if (m_rate <= 0.0f) { - return; - } - - ParticleSet particles = interface.particles(); - auto positions = particles.attributes().get_float3("Position"); - auto position_offsets = interface.offsets().get_float3("Position"); - - float frequency = 1.0f / m_rate; - - SmallVector new_positions; - SmallVector new_birth_times; - for (uint pindex : particles.pindices()) { - float time_factor = interface.time_factors()[pindex]; - TimeSpan time_span = interface.time_span(pindex); - float current_time = frequency * (std::floor(time_span.start() / frequency) + 1.0f); - - float3 total_offset = position_offsets[pindex] * time_factor; - while (current_time < time_span.end()) { - float factor = time_span.get_factor_safe(current_time); - new_positions.append(positions[pindex] + total_offset * factor); - new_birth_times.append(current_time); - current_time += frequency; - } - } - - auto new_particles = interface.particle_allocator().request(m_particle_type_name, - new_positions.size()); - new_particles.set_float3("Position", new_positions); - new_particles.set_float("Birth Time", new_birth_times); -} - } // namespace BParticles -- cgit v1.2.3