[Bf-blender-cvs] [f85c4ca3ae6] functions: cleanup
Jacques Lucke
noreply at git.blender.org
Sun Dec 22 14:25:55 CET 2019
Commit: f85c4ca3ae649e970f56bbe6d7cf3dfe7b540e70
Author: Jacques Lucke
Date: Sun Dec 22 12:40:44 2019 +0100
Branches: functions
https://developer.blender.org/rBf85c4ca3ae649e970f56bbe6d7cf3dfe7b540e70
cleanup
===================================================================
M source/blender/simulations/bparticles/offset_handler_interface.hpp
M source/blender/simulations/bparticles/offset_handlers.cpp
M source/blender/simulations/bparticles/particle_action.cpp
===================================================================
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>(),
More information about the Bf-blender-cvs
mailing list