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:
Diffstat (limited to 'source/blender/simulations/bparticles/forces.cpp')
-rw-r--r--source/blender/simulations/bparticles/forces.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/simulations/bparticles/forces.cpp b/source/blender/simulations/bparticles/forces.cpp
new file mode 100644
index 00000000000..79a0f026008
--- /dev/null
+++ b/source/blender/simulations/bparticles/forces.cpp
@@ -0,0 +1,24 @@
+#include "BLI_noise.h"
+
+#include "forces.hpp"
+
+namespace BParticles {
+
+Force::~Force()
+{
+}
+
+void CustomForce::add_force(ForceInterface &interface)
+{
+ MutableArrayRef<float3> dst = interface.combined_destination();
+
+ ParticleFunctionEvaluator inputs{m_inputs_fn, interface.mask(), interface.attributes()};
+ inputs.context_builder().set_buffer_cache(interface.buffer_cache());
+ inputs.compute();
+
+ for (uint pindex : interface.mask()) {
+ dst[pindex] += inputs.get_single<float3>("Force", 0, pindex);
+ }
+}
+
+} // namespace BParticles