[Bf-blender-cvs] [fe8cace9933] functions: use block step data in more places

Jacques Lucke noreply at git.blender.org
Thu Jul 18 18:19:10 CEST 2019


Commit: fe8cace99331a96b9aa2743a2dea5b2238ccc271
Author: Jacques Lucke
Date:   Thu Jul 18 12:56:22 2019 +0200
Branches: functions
https://developer.blender.org/rBfe8cace99331a96b9aa2743a2dea5b2238ccc271

use block step data in more places

===================================================================

M	source/blender/simulations/bparticles/action_interface.hpp
M	source/blender/simulations/bparticles/core.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/simulate.cpp

===================================================================

diff --git a/source/blender/simulations/bparticles/action_interface.hpp b/source/blender/simulations/bparticles/action_interface.hpp
index fd1ae94e69c..4f425365d71 100644
--- a/source/blender/simulations/bparticles/action_interface.hpp
+++ b/source/blender/simulations/bparticles/action_interface.hpp
@@ -68,7 +68,7 @@ class ActionInterface {
   ParticleSet m_particles;
   AttributeArrays m_attribute_offsets;
   ArrayRef<float> m_current_times;
-  ArrayRef<float> m_remaining_times;
+  ArrayRef<float> m_remaining_durations;
   EventInfo &m_event_info;
 
  public:
@@ -77,7 +77,7 @@ class ActionInterface {
                   ParticleSet particles,
                   AttributeArrays attribute_offsets,
                   ArrayRef<float> current_times,
-                  ArrayRef<float> remaining_times,
+                  ArrayRef<float> remaining_durations,
                   EventInfo &event_info);
 
   static void RunFromEmitter(std::unique_ptr<Action> &action,
@@ -117,14 +117,14 @@ inline ActionInterface::ActionInterface(ParticleAllocator &particle_allocator,
                                         ParticleSet particles,
                                         AttributeArrays attribute_offsets,
                                         ArrayRef<float> current_times,
-                                        ArrayRef<float> remaining_times,
+                                        ArrayRef<float> remaining_durations,
                                         EventInfo &event_info)
     : m_particle_allocator(particle_allocator),
       m_array_allocator(array_allocator),
       m_particles(particles),
       m_attribute_offsets(attribute_offsets),
       m_current_times(current_times),
-      m_remaining_times(remaining_times),
+      m_remaining_durations(remaining_durations),
       m_event_info(event_info)
 {
 }
@@ -174,7 +174,7 @@ inline void ActionInterface::RunFromEvent(std::unique_ptr<Action> &action,
                                    event_interface.particles(),
                                    event_interface.attribute_offsets(),
                                    event_interface.current_times(),
-                                   event_interface.remaining_times(),
+                                   event_interface.remaining_durations(),
                                    used_event_info);
   action->execute(action_interface);
 }
@@ -188,7 +188,7 @@ inline void ActionInterface::RunForSubset(std::unique_ptr<Action> &action,
                                 ParticleSet(action_interface.m_particles.block(), pindices),
                                 action_interface.m_attribute_offsets,
                                 action_interface.m_current_times,
-                                action_interface.m_remaining_times,
+                                action_interface.m_remaining_durations,
                                 action_interface.m_event_info);
   action->execute(sub_interface);
 }
@@ -210,7 +210,7 @@ inline AttributeArrays ActionInterface::attribute_offsets()
 
 inline float ActionInterface::remaining_time_in_step(uint pindex)
 {
-  return m_remaining_times[pindex];
+  return m_remaining_durations[pindex];
 }
 
 inline ArrayRef<float> ActionInterface::current_times()
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index de3626a44bd..03321e3dfa4 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -318,18 +318,14 @@ void ParticleSets::fill_float3(StringRef name, float3 value)
 /* EventFilterInterface
  *****************************************/
 
-EventFilterInterface::EventFilterInterface(ParticleSet particles,
-                                           AttributeArrays &attribute_offsets,
-                                           ArrayRef<float> durations,
-                                           float end_time,
+EventFilterInterface::EventFilterInterface(BlockStepData &step_data,
+                                           ParticleSet particles,
                                            ArrayRef<float> known_min_time_factors,
                                            EventStorage &r_event_storage,
                                            SmallVector<uint> &r_filtered_pindices,
                                            SmallVector<float> &r_filtered_time_factors)
-    : m_particles(particles),
-      m_attribute_offsets(attribute_offsets),
-      m_durations(durations),
-      m_end_time(end_time),
+    : m_step_data(step_data),
+      m_particles(particles),
       m_known_min_time_factors(known_min_time_factors),
       m_event_storage(r_event_storage),
       m_filtered_pindices(r_filtered_pindices),
@@ -340,20 +336,14 @@ EventFilterInterface::EventFilterInterface(ParticleSet particles,
 /* EventExecuteInterface
  *************************************************/
 
-EventExecuteInterface::EventExecuteInterface(ParticleSet particles,
-                                             ParticleAllocator &particle_allocator,
-                                             ArrayAllocator &array_allocator,
+EventExecuteInterface::EventExecuteInterface(BlockStepData &step_data,
+                                             ParticleSet particles,
                                              ArrayRef<float> current_times,
-                                             ArrayRef<float> remaining_times,
-                                             EventStorage &event_storage,
-                                             AttributeArrays attribute_offsets)
-    : m_particles(particles),
-      m_particle_allocator(particle_allocator),
-      m_array_allocator(array_allocator),
+                                             EventStorage &event_storage)
+    : m_step_data(step_data),
+      m_particles(particles),
       m_current_times(current_times),
-      m_remaining_times(remaining_times),
-      m_event_storage(event_storage),
-      m_attribute_offsets(attribute_offsets)
+      m_event_storage(event_storage)
 {
 }
 
@@ -374,18 +364,10 @@ IntegratorInterface::IntegratorInterface(ParticlesBlock &block,
 /* ForwardingListenerInterface
  ****************************************************/
 
-ForwardingListenerInterface::ForwardingListenerInterface(ParticleSet &particles,
-                                                         ParticleAllocator &particle_allocator,
-                                                         AttributeArrays offsets,
-                                                         float step_end_time,
-                                                         ArrayRef<float> durations,
+ForwardingListenerInterface::ForwardingListenerInterface(BlockStepData &step_data,
+                                                         ParticleSet &particles,
                                                          ArrayRef<float> time_factors)
-    : m_particles(particles),
-      m_particle_allocator(particle_allocator),
-      m_offsets(offsets),
-      m_step_end_time(step_end_time),
-      m_durations(durations),
-      m_time_factors(time_factors)
+    : m_step_data(step_data), m_particles(particles), m_time_factors(time_factors)
 {
 }
 
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 0b12545b1b7..10fa06aac46 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -397,6 +397,16 @@ class EmitterInterface {
   bool is_first_step();
 };
 
+struct BlockStepData {
+  ArrayAllocator &array_allocator;
+  ParticleAllocator &particle_allocator;
+  ParticlesBlock █
+  ParticleType &particle_type;
+  AttributeArrays attribute_offsets;
+  ArrayRef<float> remaining_durations;
+  float step_end_time;
+};
+
 /**
  * Utility array wrapper that can hold different kinds of plain-old-data values.
  */
@@ -420,10 +430,8 @@ class EventStorage {
  */
 class EventFilterInterface {
  private:
+  BlockStepData &m_step_data;
   ParticleSet m_particles;
-  AttributeArrays &m_attribute_offsets;
-  ArrayRef<float> m_durations;
-  float m_end_time;
   ArrayRef<float> m_known_min_time_factors;
 
   EventStorage &m_event_storage;
@@ -434,10 +442,8 @@ class EventFilterInterface {
   char m_dummy_event_storage[64];
 
  public:
-  EventFilterInterface(ParticleSet particles,
-                       AttributeArrays &attribute_offsets,
-                       ArrayRef<float> durations,
-                       float end_time,
+  EventFilterInterface(BlockStepData &step_data,
+                       ParticleSet particles,
                        ArrayRef<float> known_min_time_factors,
                        EventStorage &r_event_storage,
                        SmallVector<uint> &r_filtered_pindices,
@@ -487,22 +493,16 @@ class EventFilterInterface {
  */
 class EventExecuteInterface {
  private:
+  BlockStepData &m_step_data;
   ParticleSet m_particles;
-  ParticleAllocator &m_particle_allocator;
-  ArrayAllocator &m_array_allocator;
   ArrayRef<float> m_current_times;
-  ArrayRef<float> m_remaining_times;
   EventStorage &m_event_storage;
-  AttributeArrays m_attribute_offsets;
 
  public:
-  EventExecuteInterface(ParticleSet particles,
-                        ParticleAllocator &particle_allocator,
-                        ArrayAllocator &array_allocator,
+  EventExecuteInterface(BlockStepData &step_data,
+                        ParticleSet particles,
                         ArrayRef<float> current_times,
-                        ArrayRef<float> remaining_times,
-                        EventStorage &event_storage,
-                        AttributeArrays attribute_offsets);
+                        EventStorage &event_storage);
 
   ~EventExecuteInterface() = default;
 
@@ -516,7 +516,7 @@ class EventExecuteInterface {
    */
   ArrayRef<float> current_times();
 
-  ArrayRef<float> remaining_times();
+  ArrayRef<float> remaining_durations();
 
   /**
    * Get the data stored in the Event->filter() function for a particle index.
@@ -586,19 +586,13 @@ class IntegratorInterface {
 
 class ForwardingListenerInterface {
  private:
+  BlockStepData &m_step_data;
   ParticleSet m_particl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list