[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48964] trunk/blender/source/blender/ blenkernel/intern/mask_rasterize.c: mask rasterizer - use quad interpolation - gets rid of ugly diagonal banding , introduces glitch with bowtie quads, will have to fix next.

Campbell Barton ideasman42 at gmail.com
Mon Jul 16 14:08:29 CEST 2012


Revision: 48964
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48964
Author:   campbellbarton
Date:     2012-07-16 12:08:28 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
mask rasterizer - use quad interpolation - gets rid of ugly diagonal banding, introduces glitch with bowtie quads, will have to fix next.

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

Modified: trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-16 12:01:18 UTC (rev 48963)
+++ trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-16 12:08:28 UTC (rev 48964)
@@ -849,6 +849,7 @@
 /* --------------------------------------------------------------------- */
 
 /* 2D ray test */
+#if 0
 static float maskrasterize_layer_z_depth_tri(const float pt[2],
                                              const float v1[3], const float v2[3], const float v3[3])
 {
@@ -856,14 +857,16 @@
 	barycentric_weights_v2(v1, v2, v3, pt, w);
 	return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
 }
+#endif
 
-#if 0
+#if 1
 static float maskrasterize_layer_z_depth_quad(const float pt[2],
                                               const float v1[3], const float v2[3], const float v3[3], const float v4[3])
 {
 	float w[4];
 	barycentric_weights_v2_quad(v1, v2, v3, v4, pt, w);
-	return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]) + (v4[2] * w[3]);
+	//return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]) + (v4[2] * w[3]);
+	return (1.0f * w[2]) + (1.0f * w[3]);  /* we can make this assumption for small speedup */
 }
 #endif
 
@@ -904,8 +907,12 @@
 		{
 
 			/* needs work */
-#if 0
-			if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]])) {
+#if 1
+			/* quad check fails for bowtie, so keep using 2 tri checks */
+			//if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]))
+			if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]]) ||
+			    isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]]))
+			{
 				return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]);
 			}
 #elif 1




More information about the Bf-blender-cvs mailing list