[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37292] trunk/blender/source/blender/nodes /intern/CMP_nodes/CMP_math.c: 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)

Campbell Barton ideasman42 at gmail.com
Tue Jun 7 10:16:43 CEST 2011


Revision: 37292
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37292
Author:   campbellbarton
Date:     2011-06-07 08:16:42 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
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)

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_math.c

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_math.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_math.c	2011-06-07 07:57:26 UTC (rev 37291)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_math.c	2011-06-07 08:16:42 UTC (rev 37292)
@@ -140,7 +140,12 @@
 		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 */




More information about the Bf-blender-cvs mailing list