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/nodes/texture
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/nodes/texture')
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 134a0ebb093..53022c9e120 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -282,12 +282,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
}
case NODE_MATH_PINGPONG: {
- if (in1 == 0.0f) {
- *out = 0.0f;
- }
- else {
- *out = fabsf(fractf((in0 - in1) / (in1 * 2.0f)) * in1 * 2.0f - in1);
- }
+ *out = pingpongf(in0, in1);
break;
}