[Bf-blender-cvs] [1ef3f9c] soc-2013-paint: Merge branch 'master' into soc-2013-paint

Antony Riakiotakis noreply at git.blender.org
Wed May 21 19:04:17 CEST 2014


Commit: 1ef3f9c6a825e980ba97c6bd285ef59359676a99
Author: Antony Riakiotakis
Date:   Wed May 21 19:04:03 2014 +0200
https://developer.blender.org/rB1ef3f9c6a825e980ba97c6bd285ef59359676a99

Merge branch 'master' into soc-2013-paint

Conflicts:
	source/blender/editors/sculpt_paint/paint_image_proj.c

===================================================================



===================================================================

diff --cc source/blender/editors/sculpt_paint/paint_image_proj.c
index f20a9bd,53435b6..df0fb92
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@@ -874,6 -840,21 +879,21 @@@ static bool pixel_bounds_array(float (*
  
  #ifndef PROJ_DEBUG_NOSEAMBLEED
  
+ static void project_face_winding_init(const ProjPaintState *ps, const int face_index)
+ {
+ 	/* detect the winding of faces in uv space */
 -	MTFace *tf = ps->dm_mtface + face_index;
++	MTFace *tf = ps->dm_mtface[face_index];
+ 	float winding = cross_tri_v2(tf->uv[0], tf->uv[1], tf->uv[2]);
+ 
+ 	if (ps->dm_mface[face_index].v4)
+ 		winding += cross_tri_v2(tf->uv[2], tf->uv[3], tf->uv[0]);
+ 
+ 	if (winding > 0)
+ 		ps->faceWindingFlags[face_index] |= PROJ_FACE_WINDING_CW;
+ 
+ 	ps->faceWindingFlags[face_index] |= PROJ_FACE_WINDING_INIT;
+ }
+ 
  /* This function returns 1 if this face has a seam along the 2 face-vert indices
   * 'orig_i1_fidx' and 'orig_i2_fidx' */
  static bool check_seam(const ProjPaintState *ps,
@@@ -921,39 -902,26 +941,25 @@@
  				*other_face = face_index;
  				*orig_fidx = (i1_fidx < i2_fidx) ? i1_fidx : i2_fidx;
  
- 				/* first test if they have the same image, then if uvs coincide.
- 				 * last check detects if faces are pointing to opposite ways. For
- 				 * well behaved UV maps, the winding of the faces at the connnection edge
- 				 * should be opposing */
+ 				/* initialize face winding if needed */
+ 				if (!ps->faceWindingFlags[face_index] & PROJ_FACE_WINDING_INIT)
+ 					project_face_winding_init(ps, face_index);
+ 
+ 				/* first test if they have the same image */
  				if ((orig_tpage == tpage) &&
  				    cmp_uv(orig_tf->uv[orig_i1_fidx], tf->uv[i1_fidx]) &&
 -				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]) )
 +				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]))
  				{
- 					/* as extra check, we need to check if the polygons occupy the same uv space. To test
- 					 * that, we generate a point slightly to the side of the uv edge and check for intersection */
- 					float uv_edge[2] = {tf->uv[i1_fidx][0] - tf->uv[i2_fidx][0],
- 					                    tf->uv[i1_fidx][1] - tf->uv[i2_fidx][1]};
- 					float uv_normal[2];
- 					float uv_point[2];
- 					bool isect_orig, isect;
- 					normalize_v2_v2(uv_normal, uv_edge);
- 					SWAP(float, uv_normal[0], uv_normal[1]);
- 					uv_normal[0] = -uv_normal[0];
- 					mul_v2_fl(uv_normal, FLT_EPSILON*5);
- 
- 					add_v2_v2v2(uv_point, tf->uv[i1_fidx], tf->uv[i2_fidx]);
- 					mul_v2_fl(uv_point, 0.5);
- 					add_v2_v2(uv_point, uv_normal);
- 
- 					/* we now have a point in the middle of the uv edge, slightly offset in uv space.
- 					 * Test if it is within both faces */
- 					isect_orig = isect_point_poly_v2(uv_point, orig_tf->uv, ((orig_mf->v4) ? 4 : 3), false);
- 					isect = isect_point_poly_v2(uv_point, ((const MTFace *)tf)->uv, ((mf->v4) ? 4 : 3), false);
- 
- 					if (isect_orig == isect)
+ 					/* if faces don't have the same winding in uv space,
+ 					 * they are on the same side so edge is boundary */
+ 					if ((ps->faceWindingFlags[face_index] & PROJ_FACE_WINDING_CW) !=
+ 					    (ps->faceWindingFlags[orig_face] & PROJ_FACE_WINDING_CW))
+ 					{
  						return 1;
+ 					}
+ 
  					// printf("SEAM (NONE)\n");
  					return 0;
 -
  				}
  				else {
  					// printf("SEAM (UV GAP)\n");




More information about the Bf-blender-cvs mailing list