[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48887] trunk/blender/source/blender/ blenkernel/intern/mask_rasterize.c: temp disable quad interpolation

Campbell Barton ideasman42 at gmail.com
Fri Jul 13 13:48:30 CEST 2012


Revision: 48887
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48887
Author:   campbellbarton
Date:     2012-07-13 11:48:30 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
temp disable quad interpolation

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-13 09:22:58 UTC (rev 48886)
+++ trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c	2012-07-13 11:48:30 UTC (rev 48887)
@@ -46,6 +46,8 @@
 
 #ifndef USE_RASKTER
 
+#define RESOL 64
+
 /**
  * A single #MaskRasterHandle contains multile #MaskRasterLayer's,
  * each #MaskRasterLayer does its own lookup which contributes to
@@ -195,7 +197,7 @@
                                    const short do_feather)
 {
 	/* TODO: real size */
-	const int resol = 16;
+	const int resol = RESOL;
 	const float aa_filter_size = 1.0f / MIN2(width, height);
 
 	const float zvec[3] = {0.0f, 0.0f, 1.0f};
@@ -244,59 +246,59 @@
 				diff_feather_points = NULL;
 			}
 
-			if (do_aspect_correct) {
-				if (width != height) {
-					float *fp;
-					float *ffp;
-					int i;
-					float asp;
+			if (tot_diff_point > 3) {
+				ScanFillVert *sf_vert_prev;
+				int j;
 
-					if (width < height) {
-						fp = &diff_points[0][0];
-						ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
-						asp = (float)width / (float)height;
-					}
-					else {
-						fp = &diff_points[0][1];
-						ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
-						asp = (float)height / (float)width;
-					}
+				float co[3];
+				co[2] = 0.0f;
 
-					for (i = 0; i < tot_diff_point; i++, fp += 2) {
-						(*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
-					}
+				if (do_aspect_correct) {
+					if (width != height) {
+						float *fp;
+						float *ffp;
+						int i;
+						float asp;
 
-					if (tot_diff_feather_points) {
-						for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
-							(*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+						if (width < height) {
+							fp = &diff_points[0][0];
+							ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
+							asp = (float)width / (float)height;
 						}
+						else {
+							fp = &diff_points[0][1];
+							ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
+							asp = (float)height / (float)width;
+						}
+
+						for (i = 0; i < tot_diff_point; i++, fp += 2) {
+							(*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
+						}
+
+						if (tot_diff_feather_points) {
+							for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
+								(*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+							}
+						}
 					}
 				}
-			}
 
-			/* fake aa, using small feather */
-			if (do_mask_aa == TRUE) {
-				if (do_feather == FALSE) {
-					tot_diff_feather_points = tot_diff_point;
-					diff_feather_points = MEM_mallocN(sizeof(*diff_feather_points) * tot_diff_feather_points, __func__);
-					/* add single pixel feather */
-					maskrasterize_spline_differentiate_point_inset(diff_feather_points, diff_points,
-					                                               tot_diff_point, aa_filter_size, FALSE);
+				/* fake aa, using small feather */
+				if (do_mask_aa == TRUE) {
+					if (do_feather == FALSE) {
+						tot_diff_feather_points = tot_diff_point;
+						diff_feather_points = MEM_mallocN(sizeof(*diff_feather_points) * tot_diff_feather_points, __func__);
+						/* add single pixel feather */
+						maskrasterize_spline_differentiate_point_inset(diff_feather_points, diff_points,
+						                                               tot_diff_point, aa_filter_size, FALSE);
+					}
+					else {
+						/* ensure single pixel feather, on any zero feather areas */
+						maskrasterize_spline_differentiate_point_inset(diff_feather_points, diff_points,
+						                                               tot_diff_point, aa_filter_size, TRUE);
+					}
 				}
-				else {
-					/* ensure single pixel feather, on any zero feather areas */
-					maskrasterize_spline_differentiate_point_inset(diff_feather_points, diff_points,
-					                                               tot_diff_point, aa_filter_size, TRUE);
-				}
-			}
 
-			if (tot_diff_point > 3) {
-				ScanFillVert *sf_vert_prev;
-				int j;
-
-				float co[3];
-				co[2] = 0.0f;
-
 				copy_v2_v2(co, diff_points[0]);
 				sf_vert_prev = BLI_scanfill_vert_add(&sf_ctx, co);
 				sf_vert_prev->tmp.u = sf_vert_tot;
@@ -396,7 +398,7 @@
 			tri_array = MEM_mallocN(sizeof(*tri_array) * (sf_tri_tot + tot_feather_quads), "maskrast_tri_index");
 
 			/* */
-			bvhtree = BLI_bvhtree_new(sf_tri_tot + tot_feather_quads, 0.000001f, 4, 6);
+			bvhtree = BLI_bvhtree_new(sf_tri_tot + tot_feather_quads, 0.000001f, 8, 6);
 
 			/* tri's */
 			tri = (unsigned int *)tri_array;
@@ -469,6 +471,11 @@
 	}
 }
 
+//static void tri_flip_tri(unsigned int tri[3])
+//{
+
+//}
+
 /* 2D ray test */
 static float maskrasterize_layer_z_depth_tri(const float pt[2],
                                              const float v1[3], const float v2[3], const float v3[3])
@@ -478,6 +485,7 @@
 	return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
 }
 
+#if 0
 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])
 {
@@ -485,6 +493,7 @@
 	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]);
 }
+#endif
 
 static void maskrasterize_layer_bvh_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
 {
@@ -520,6 +529,7 @@
 		    (cos[2][2] < dist_orig) ||
 		    (cos[3][2] < dist_orig))
 		{
+#if 0
 			if (isect_point_quad_v2(ray->origin, cos[tri[0]], cos[tri[1]], cos[tri[2]], cos[tri[3]])) {
 				const float dist = maskrasterize_layer_z_depth_quad(ray->origin, cos[tri[0]], cos[tri[1]], cos[tri[2]], cos[tri[3]]);
 				if (dist < dist_orig) {
@@ -527,6 +537,25 @@
 					hit->dist = dist;
 				}
 			}
+#elif 1
+			if (isect_point_tri_v2(ray->origin, cos[tri[0]], cos[tri[1]], cos[tri[2]])) {
+				const float dist = maskrasterize_layer_z_depth_tri(ray->origin, cos[tri[0]], cos[tri[1]], cos[tri[2]]);
+				if (dist < dist_orig) {
+					hit->index = index;
+					hit->dist = dist;
+				}
+			}
+			else if (isect_point_tri_v2(ray->origin, cos[tri[0]], cos[tri[2]], cos[tri[3]])) {
+				const float dist = maskrasterize_layer_z_depth_tri(ray->origin, cos[tri[0]], cos[tri[2]], cos[tri[3]]);
+				if (dist < dist_orig) {
+					hit->index = index;
+					hit->dist = dist;
+				}
+			}
+#else
+			/* cheat - we know first 2 verts are z0.0f and second 2 are z 1.0f */
+			/* ... worth looking into */
+#endif
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list