Revision: 20311
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20311
Author:   campbellbarton
Date:     2009-05-21 09:28:02 +0200 (Thu, 21 May 2009)

Log Message:
-----------
[#18795] Subdivide Smooth can give wrong vcol
weights given by subdivide are not normalized, if that was fixed could avoid 
clamping.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/customdata.c

Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c 2009-05-20 
23:31:58 UTC (rev 20310)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c 2009-05-21 
07:28:02 UTC (rev 20311)
@@ -33,7 +33,7 @@
 */ 
 
 #include "BKE_customdata.h"
-
+#include "BKE_utildefines.h" // CLAMP
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"
 #include "BLI_mempool.h"
@@ -421,6 +421,14 @@
                        col.b += src->b * weight;
                }
        }
+       
+       /* Subdivide smooth or fractal can cause problems without clamping
+        * although weights should also not cause this situation */
+       CLAMP(col.a, 0.0f, 255.0f);
+       CLAMP(col.r, 0.0f, 255.0f);
+       CLAMP(col.g, 0.0f, 255.0f);
+       CLAMP(col.b, 0.0f, 255.0f);
+       
        mc->a = (int)col.a;
        mc->r = (int)col.r;
        mc->g = (int)col.g;
@@ -496,6 +504,14 @@
        }
 
        for(j = 0; j < 4; ++j) {
+               
+               /* Subdivide smooth or fractal can cause problems without 
clamping
+                * although weights should also not cause this situation */
+               CLAMP(col[j].a, 0.0f, 255.0f);
+               CLAMP(col[j].r, 0.0f, 255.0f);
+               CLAMP(col[j].g, 0.0f, 255.0f);
+               CLAMP(col[j].b, 0.0f, 255.0f);
+               
                mc[j].a = (int)col[j].a;
                mc[j].r = (int)col[j].r;
                mc[j].g = (int)col[j].g;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to