diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-12-22 14:40:44 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-12-22 14:40:44 +0300 |
commit | f85c4ca3ae649e970f56bbe6d7cf3dfe7b540e70 (patch) | |
tree | 003d3787931fc52daa5b5f9a8355ccf6318a16b7 /source/blender/simulations/bparticles | |
parent | a80ffa4bc5f6f91f2545157dd5ba015145dea949 (diff) |
cleanup
Diffstat (limited to 'source/blender/simulations/bparticles')
3 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/simulations/bparticles/offset_handler_interface.hpp b/source/blender/simulations/bparticles/offset_handler_interface.hpp index f1764137271..3b78356d92d 100644 --- a/source/blender/simulations/bparticles/offset_handler_interface.hpp +++ b/source/blender/simulations/bparticles/offset_handler_interface.hpp @@ -1,31 +1,35 @@ #pragma once +#include "BLI_index_mask.h" + #include "block_step_data.hpp" #include "particle_allocator.hpp" namespace BParticles { +using BLI::IndexMask; + class OffsetHandlerInterface : public BlockStepDataAccess { private: - ArrayRef<uint> m_pindices; + IndexMask m_mask; ArrayRef<float> m_time_factors; ParticleAllocator &m_particle_allocator; public: OffsetHandlerInterface(BlockStepData &step_data, - ArrayRef<uint> pindices, + IndexMask mask, ArrayRef<float> time_factors, ParticleAllocator &particle_allocator) : BlockStepDataAccess(step_data), - m_pindices(pindices), + m_mask(mask), m_time_factors(time_factors), m_particle_allocator(particle_allocator) { } - ArrayRef<uint> pindices() + ArrayRef<uint> mask() { - return m_pindices; + return m_mask; } ArrayRef<float> time_factors() diff --git a/source/blender/simulations/bparticles/offset_handlers.cpp b/source/blender/simulations/bparticles/offset_handlers.cpp index 333bbcc8da6..b3ce0fdbc16 100644 --- a/source/blender/simulations/bparticles/offset_handlers.cpp +++ b/source/blender/simulations/bparticles/offset_handlers.cpp @@ -10,13 +10,13 @@ void CreateTrailHandler::execute(OffsetHandlerInterface &interface) auto position_offsets = interface.attribute_offsets().get<float3>("Position"); auto colors = interface.attributes().get<rgba_f>("Color"); - ParticleFunctionEvaluator inputs{m_inputs_fn, interface.pindices(), interface.attributes()}; + ParticleFunctionEvaluator inputs{m_inputs_fn, interface.mask(), interface.attributes()}; inputs.compute(); Vector<float3> new_positions; Vector<rgba_f> new_colors; Vector<float> new_birth_times; - for (uint pindex : interface.pindices()) { + for (uint pindex : interface.mask()) { float rate = inputs.get_single<float>("Rate", 0, pindex); if (rate <= 0.0f) { continue; @@ -53,10 +53,10 @@ void SizeOverTimeHandler::execute(OffsetHandlerInterface &interface) auto birth_times = interface.attributes().get<float>("Birth Time"); auto sizes = interface.attributes().get<float>("Size"); - ParticleFunctionEvaluator inputs{m_inputs_fn, interface.pindices(), interface.attributes()}; + ParticleFunctionEvaluator inputs{m_inputs_fn, interface.mask(), interface.attributes()}; inputs.compute(); - for (uint pindex : interface.pindices()) { + for (uint pindex : interface.mask()) { float final_size = inputs.get_single<float>("Final Size", 0, pindex); float final_age = inputs.get_single<float>("Final Age", 1, pindex); diff --git a/source/blender/simulations/bparticles/particle_action.cpp b/source/blender/simulations/bparticles/particle_action.cpp index 77388d08f75..918c6cfebb9 100644 --- a/source/blender/simulations/bparticles/particle_action.cpp +++ b/source/blender/simulations/bparticles/particle_action.cpp @@ -95,7 +95,7 @@ void ParticleAction::execute_for_subset(IndexMask mask, ParticleActionContext &p void ParticleAction::execute_from_offset_handler(OffsetHandlerInterface &offset_handler_interface) { LargeScopedArray<float> current_times(offset_handler_interface.array_size()); - for (uint pindex : offset_handler_interface.pindices()) { + for (uint pindex : offset_handler_interface.mask()) { current_times[pindex] = offset_handler_interface.time_span(pindex).start(); } @@ -109,7 +109,7 @@ void ParticleAction::execute_from_offset_handler(OffsetHandlerInterface &offset_ ParticleActionContext context( offset_handler_interface.particle_allocator(), - offset_handler_interface.pindices(), + offset_handler_interface.mask(), offset_handler_interface.attributes(), {BLI::get_class_id<ParticleCurrentTimesContext>(), BLI::get_class_id<ParticleIntegratedOffsets>(), |