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 <jacques@blender.org>2020-11-25 14:24:32 +0300
committerJacques Lucke <jacques@blender.org>2020-11-25 14:24:44 +0300
commit1c86d32fa7d4c367370d06b7983410f4c33d58a2 (patch)
treecdf9c9eb7de3b3e03da649f0be07026670837fa0 /source/blender/compositor
parent9e77fc533c1387776900fcc91ed9591f33dd8bf2 (diff)
Nodes: deduplicate ping pong math operation
The formula did not change. The only side effect of this change should be that the compositor node now does not divide by zero in some cases.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index edd5bb6d139..dbec6dd1874 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -671,9 +671,7 @@ void MathPingpongOperation::executePixelSampled(float output[4],
this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler);
this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler);
- output[0] = fabsf(fractf((inputValue1[0] - inputValue2[0]) / (inputValue2[0] * 2.0f)) *
- inputValue2[0] * 2.0f -
- inputValue2[0]);
+ output[0] = pingpongf(inputValue1[0], inputValue2[0]);
clampIfNeeded(output);
}