[Bf-blender-cvs] [dacceb573f7] soc-2018-npr: Fixed vertical line missed calculations.

Nick Wu noreply at git.blender.org
Thu Sep 6 07:40:13 CEST 2018


Commit: dacceb573f7a41510dcc80d427923162ba731dff
Author: Nick Wu
Date:   Thu Sep 6 13:39:55 2018 +0800
Branches: soc-2018-npr
https://developer.blender.org/rBdacceb573f7a41510dcc80d427923162ba731dff

Fixed vertical line missed calculations.

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

M	source/blender/draw/engines/lanpr/lanpr_all.h
M	source/blender/draw/engines/lanpr/lanpr_ops.c

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

diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h b/source/blender/draw/engines/lanpr/lanpr_all.h
index fe97c160661..7ba0687add5 100644
--- a/source/blender/draw/engines/lanpr/lanpr_all.h
+++ b/source/blender/draw/engines/lanpr/lanpr_all.h
@@ -620,13 +620,14 @@ BLI_INLINE int lanpr_LineIntersectTest2d(const double *a1, const double *a2, con
 			return 0;
 		}
 		double r2 = tMatGetLinearRatio(b1[0], b2[0], a1[0]);
+		x = tnsLinearItp(b1[0], b2[0], r2);
 		y = tnsLinearItp(b1[1], b2[1], r2);
 		*aRatio = Ratio = tMatGetLinearRatio(a1[1], a2[1], y);
 	}
 	else {
 		if (xDiff2 == 0) {
 			Ratio = tMatGetLinearRatio(a1[0], a2[0], b1[0]);
-			//y = tnsLinearItp(a1[1], a2[1], r2);
+			x = tnsLinearItp(a1[0], a2[0], Ratio);
 			*aRatio = Ratio;
 		}
 		else {
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index 5f4f2af8a6a..f1a4e15a1ec 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -547,7 +547,7 @@ LANPR_BoundingArea *lanpr_get_next_bounding_area(LANPR_BoundingArea *This, LANPR
 		}
 	}else { // X difference == 0;
 		if (PositiveY > 0) {
-			r1 = tMatGetLinearRatio(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], This->U);
+			r1 = tMatGetLinearRatio(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], This->U);
 			if (r1 > 1) return 0;
 			for (lip = This->UP.first; lip; lip = lip->pNext) {
 				ba = lip->p;
@@ -555,7 +555,7 @@ LANPR_BoundingArea *lanpr_get_next_bounding_area(LANPR_BoundingArea *This, LANPR
 			}
 		}
 		else if (PositiveY < 0) {
-			r1 = tMatGetLinearRatio(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], This->B);
+			r1 = tMatGetLinearRatio(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], This->B);
 			if (r1 > 1) return 0;
 			for (lip = This->BP.first; lip; lip = lip->pNext) {
 				ba = lip->p;
@@ -1768,7 +1768,7 @@ void lanpr_make_render_geometry_buffers(Depsgraph *depsgraph, Scene *s, Object *
 		tmat_make_perspective_matrix_44d(proj, fov, asp, cam->clipsta, cam->clipend);
 	} elif(cam->type == CAM_ORTHO)
 	{
-		real w = cam->ortho_scale;
+		real w = cam->ortho_scale/2;
 		tmat_make_ortho_matrix_44d(proj, -w, w, -w / asp, w / asp, cam->clipsta, cam->clipend);
 	}
 
@@ -2944,15 +2944,18 @@ void *lanpr_make_leveled_edge_vertex_array(LANPR_RenderBuffer *rb, ListBase *Lin
 				}
 				N += 6;
 
+				CLAMP(rls->at, 0, 1);
+				if(irls = rls->Item.pNext) CLAMP(irls->at, 0, 1);
+
 				*V = tnsLinearItp(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], rls->at);
 				V++;
 				*V = tnsLinearItp(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], rls->at);
 				V++;
 				*V = componet_id;
 				V++;
-				*V = tnsLinearItp(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], rls->Item.pNext ? (irls = rls->Item.pNext)->at : 1);
+				*V = tnsLinearItp(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], irls ? irls->at : 1);
 				V++;
-				*V = tnsLinearItp(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], rls->Item.pNext ? (irls = rls->Item.pNext)->at : 1);
+				*V = tnsLinearItp(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], irls ? irls->at : 1);
 				V++;
 				*V = componet_id;
 				V++;



More information about the Bf-blender-cvs mailing list