[Bf-blender-cvs] [a0fcdb0f98d] functions: extract method to compute current time per particle
Jacques Lucke
noreply at git.blender.org
Fri Jun 28 16:04:32 CEST 2019
Commit: a0fcdb0f98d714869a42904aa15c4cfb91fd7452
Author: Jacques Lucke
Date: Fri Jun 28 14:29:16 2019 +0200
Branches: functions
https://developer.blender.org/rBa0fcdb0f98d714869a42904aa15c4cfb91fd7452
extract method to compute current time per particle
===================================================================
M source/blender/simulations/bparticles/simulate.cpp
===================================================================
diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp
index 5154dc6ba55..28cc3c85421 100644
--- a/source/blender/simulations/bparticles/simulate.cpp
+++ b/source/blender/simulations/bparticles/simulate.cpp
@@ -98,6 +98,22 @@ BLI_NOINLINE static void find_particles_per_event(
}
}
+BLI_NOINLINE static void compute_current_time_per_particle(
+ ArrayRef<float> durations,
+ float end_time,
+ ArrayRef<int> next_event_indices,
+ ArrayRef<float> time_factors_to_next_event,
+ ArrayRef<SmallVector<float>> r_current_time_per_particle)
+{
+ for (uint i = 0; i < next_event_indices.size(); i++) {
+ int event_index = next_event_indices[i];
+ if (event_index != -1) {
+ r_current_time_per_particle[event_index].append(
+ end_time - durations[i] * (1.0f - time_factors_to_next_event[i]));
+ }
+ }
+}
+
BLI_NOINLINE static void find_unfinished_particles(
ArrayRef<uint> particle_indices,
ArrayRef<int> next_event_indices,
@@ -215,13 +231,11 @@ BLI_NOINLINE static void simulate_to_next_event(BlockAllocator &block_allocator,
find_particles_per_event(particles.indices(), next_event_indices, particles_per_event);
SmallVector<SmallVector<float>> current_time_per_particle(particle_type.events().size());
- for (uint i : particles.range()) {
- int event_index = next_event_indices[i];
- if (event_index != -1) {
- current_time_per_particle[event_index].append(
- end_time - durations[i] * (1.0f - time_factors_to_next_event[i]));
- }
- }
+ compute_current_time_per_particle(durations,
+ end_time,
+ next_event_indices,
+ time_factors_to_next_event,
+ current_time_per_particle);
run_actions(block_allocator,
particles.block(),
More information about the Bf-blender-cvs
mailing list