diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-07 12:16:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-07 12:16:42 +0400 |
commit | 8ae4476fc4049b991c09615ec7521666f295db93 (patch) | |
tree | 56c84db1f1cf6e683437f3bc9b465f2110207a39 /source/blender/nodes/intern/CMP_nodes/CMP_math.c | |
parent | 044ae5e3c8d8e3ed30366c791a0596392a46689a (diff) |
getting useful results out of the round compo node was tricky, use the second value to determine how much to round by (can be used like a posterize filter)
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_math.c')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_math.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index da17e5fe288..96fa13d99f0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -140,7 +140,12 @@ static void do_math(bNode *node, float *out, float *in, float *in2) break; case 14: /* Round */ { - out[0]= floorf(in[0] + 0.5f); + /* round by the second value */ + if( in2[0] != 0.0f ) + out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0]; + else + floorf(in[0] + 0.5f); + } break; case 15: /* Less Than */ |