Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <mail@jlucke.com>2019-09-23 13:08:36 +0300
committerJacques Lucke <mail@jlucke.com>2019-09-23 13:08:36 +0300
commitd4e58e630c26bd142e946df1a0838b54abfd6f6b (patch)
treee9f65e0a9e9ab4d5260d4d303d68c431163f26d2 /source/blender/simulations/bparticles/forces.cpp
parent31a3dc769d100e9cecf2f31dae21e6898a42dedb (diff)
Replace Falloff with weight input
Diffstat (limited to 'source/blender/simulations/bparticles/forces.cpp')
-rw-r--r--source/blender/simulations/bparticles/forces.cpp15
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;
}
}