diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-09-23 13:08:36 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-09-23 13:08:36 +0300 |
commit | d4e58e630c26bd142e946df1a0838b54abfd6f6b (patch) | |
tree | e9f65e0a9e9ab4d5260d4d303d68c431163f26d2 /source/blender/simulations/bparticles/forces.cpp | |
parent | 31a3dc769d100e9cecf2f31dae21e6898a42dedb (diff) |
Replace Falloff with weight input
Diffstat (limited to 'source/blender/simulations/bparticles/forces.cpp')
-rw-r--r-- | source/blender/simulations/bparticles/forces.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp index fed9dc35a8c..973a2e12740 100644 --- a/source/blender/simulations/bparticles/forces.cpp +++ b/source/blender/simulations/bparticles/forces.cpp @@ -14,12 +14,9 @@ void GravityForce::add_force(ForceInterface &interface) auto inputs = m_inputs_fn->compute(interface); - TemporaryArray<float> weights(destination.size()); - m_falloff->compute(interface.attributes(), interface.pindices(), weights); - for (uint pindex : interface.pindices()) { float3 acceleration = inputs->get<float3>("Direction", 0, pindex); - float weight = weights[pindex]; + float weight = inputs->get<float>("Weight", 1, pindex); destination[pindex] += acceleration * weight; } }; @@ -31,14 +28,11 @@ void TurbulenceForce::add_force(ForceInterface &interface) auto inputs = m_inputs_fn->compute(interface); - TemporaryArray<float> weights(destination.size()); - m_falloff->compute(interface.attributes(), interface.pindices(), weights); - for (uint pindex : interface.pindices()) { float3 pos = positions[pindex]; float3 strength = inputs->get<float3>("Strength", 0, pindex); float size = inputs->get<float>("Size", 1, pindex); - float weight = weights[pindex]; + float weight = inputs->get<float>("Weight", 2, pindex); float x = (BLI_gNoise(size, pos.x, pos.y, pos.z + 1000.0f, false, 1) - 0.5f) * strength.x; float y = (BLI_gNoise(size, pos.x, pos.y + 1000.0f, pos.z, false, 1) - 0.5f) * strength.y; float z = (BLI_gNoise(size, pos.x + 1000.0f, pos.y, pos.z, false, 1) - 0.5f) * strength.z; @@ -53,13 +47,10 @@ void DragForce::add_force(ForceInterface &interface) auto inputs = m_inputs_fn->compute(interface); - TemporaryArray<float> weights(destination.size()); - m_falloff->compute(interface.attributes(), interface.pindices(), weights); - for (uint pindex : interface.pindices()) { float3 velocity = velocities[pindex]; float strength = inputs->get<float>("Strength", 0, pindex); - float weight = weights[pindex]; + float weight = inputs->get<float>("Weight", 1, pindex); destination[pindex] -= velocity * strength * weight; } } |