forked from bartvdbraak/blender
Project Paint: simplify uv bleed factor calc
This commit is contained in:
parent
7969b238db
commit
3e782756e3
@ -2742,7 +2742,7 @@ static void project_paint_face_init(
|
||||
int fidx1, fidx2; /* face edge pairs - loop throuh these ((0,1), (1,2), (2,3), (3,0)) or ((0,1), (1,2), (2,0)) for a tri */
|
||||
|
||||
float seam_subsection[4][2];
|
||||
float fac1, fac2, ftot;
|
||||
float fac1, fac2;
|
||||
|
||||
if (outset_uv[0][0] == FLT_MAX) /* first time initialize */
|
||||
uv_image_outset(tf_uv_pxoffset, outset_uv, ps->seam_bleed_px, ibuf->x, ibuf->y, mf->v4 != 0, (ps->faceWindingFlags[face_index] & PROJ_FACE_WINDING_CW) == 0);
|
||||
@ -2776,17 +2776,14 @@ static void project_paint_face_init(
|
||||
if ((face_seam_flag & (1 << fidx1)) && /* 1<<fidx1 -> PROJ_FACE_SEAM# */
|
||||
line_clip_rect2f(bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1]))
|
||||
{
|
||||
|
||||
ftot = len_v2v2(vCoSS[fidx1], vCoSS[fidx2]); /* screenspace edge length */
|
||||
|
||||
if (ftot > 0.0f) { /* avoid div by zero */
|
||||
if (len_squared_v2v2(vCoSS[fidx1], vCoSS[fidx2]) > FLT_EPSILON) { /* avoid div by zero */
|
||||
if (mf->v4) {
|
||||
if (fidx1 == 2 || fidx2 == 2) side = 1;
|
||||
else side = 0;
|
||||
}
|
||||
|
||||
fac1 = len_v2v2(vCoSS[fidx1], bucket_clip_edges[0]) / ftot;
|
||||
fac2 = len_v2v2(vCoSS[fidx1], bucket_clip_edges[1]) / ftot;
|
||||
fac1 = line_point_factor_v2(bucket_clip_edges[0], vCoSS[fidx1], vCoSS[fidx2]);
|
||||
fac2 = line_point_factor_v2(bucket_clip_edges[1], vCoSS[fidx1], vCoSS[fidx2]);
|
||||
|
||||
interp_v2_v2v2(seam_subsection[0], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac1);
|
||||
interp_v2_v2v2(seam_subsection[1], tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2], fac2);
|
||||
|
Loading…
Reference in New Issue
Block a user