Commit: dd55ac91281470cac147f80e01402fe41ace9d2e Author: Jacques Lucke Date: Thu Jun 27 15:30:56 2019 +0200 Branches: functions https://developer.blender.org/rBdd55ac91281470cac147f80e01402fe41ace9d2e
cleanup: remove unnecessary state parameter =================================================================== 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/core.cpp b/source/blender/simulations/bparticles/core.cpp index 3ca4f9c22fd..848f0dcb3c3 100644 --- a/source/blender/simulations/bparticles/core.cpp +++ b/source/blender/simulations/bparticles/core.cpp @@ -79,7 +79,7 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, uint size) uint remaining_size = size; while (remaining_size > 0) { - ParticlesBlock &block = m_allocator.get_non_full_block(particle_type_id); + ParticlesBlock &block = m_block_allocator.get_non_full_block(particle_type_id); uint size_to_use = std::min(block.inactive_amount(), remaining_size); Range<uint> range(block.active_amount(), block.active_amount() + size_to_use); @@ -96,7 +96,8 @@ EmitTarget &EmitterInterface::request(uint particle_type_id, uint size) remaining_size -= size_to_use; } - ParticlesContainer &container = m_state.particle_container(particle_type_id); + ParticlesContainer &container = m_block_allocator.particles_state().particle_container( + particle_type_id); m_targets.append(new EmitTarget(particle_type_id, container.attributes_info(), blocks, ranges)); return *m_targets.last(); } diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp index 945b49ec42d..0e57a356b8a 100644 --- a/source/blender/simulations/bparticles/core.hpp +++ b/source/blender/simulations/bparticles/core.hpp @@ -56,6 +56,11 @@ class BlockAllocator { BlockAllocator(ParticlesState &state); ParticlesBlock &get_non_full_block(uint particle_type_id); + + ParticlesState &particles_state() + { + return m_state; + } }; class EmitTarget { @@ -140,13 +145,11 @@ class EmitTarget { class EmitterInterface { private: - ParticlesState &m_state; - BlockAllocator &m_allocator; + BlockAllocator &m_block_allocator; SmallVector<EmitTarget *> m_targets; public: - EmitterInterface(ParticlesState &state, BlockAllocator &allocator) - : m_state(state), m_allocator(allocator) + EmitterInterface(BlockAllocator &allocator) : m_block_allocator(allocator) { } diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 94190642264..e3624a37179 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -372,12 +372,11 @@ BLI_NOINLINE static void delete_tagged_particles(ArrayRef<ParticlesBlock *> bloc **********************************************/ BLI_NOINLINE static void emit_new_particles_from_emitter(StepDescription &description, - ParticlesState &state, BlockAllocator &block_allocator, TimeSpan time_span, Emitter &emitter) { - EmitterInterface interface(state, block_allocator); + EmitterInterface interface(block_allocator); emitter.emit(interface); for (EmitTarget *target_ptr : interface.targets()) { @@ -483,7 +482,7 @@ void simulate_step(ParticlesState &state, StepDescription &description) BlockAllocator block_allocator(state); for (Emitter *emitter : description.emitters()) { - emit_new_particles_from_emitter(description, state, block_allocator, time_span, *emitter); + emit_new_particles_from_emitter(description, block_allocator, time_span, *emitter); } for (uint type_id : description.particle_type_ids()) { _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs