[Bf-blender-cvs] [bef1fb79ee5] soc-2018-npr: Vertical line hack: tip point threshod fix and a condition branch.

Nick Wu noreply at git.blender.org
Sun Sep 16 09:02:25 CEST 2018


Commit: bef1fb79ee52a000419bc131e52957906464a06d
Author: Nick Wu
Date:   Sun Sep 16 15:00:57 2018 +0800
Branches: soc-2018-npr
https://developer.blender.org/rBbef1fb79ee52a000419bc131e52957906464a06d

Vertical line hack: tip point threshod fix and a condition branch.

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

M	release/scripts/addons
M	source/blender/draw/engines/lanpr/lanpr_ops.c
M	source/blender/draw/engines/lanpr/lanpr_util.h

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

diff --git a/release/scripts/addons b/release/scripts/addons
index 5f7fba0565a..c88411ff777 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 5f7fba0565a7c9ae93eae31a08fc9bbbd16d333a
+Subproject commit c88411ff7776a2db5d6ef6117a1b2faa42a95611
diff --git a/source/blender/draw/engines/lanpr/lanpr_ops.c b/source/blender/draw/engines/lanpr/lanpr_ops.c
index f1a4e15a1ec..5f077d5e15f 100644
--- a/source/blender/draw/engines/lanpr/lanpr_ops.c
+++ b/source/blender/draw/engines/lanpr/lanpr_ops.c
@@ -816,6 +816,8 @@ void lanpr_calculate_single_line_occlusion(LANPR_RenderBuffer *rb, LANPR_RenderL
 	int PositiveX = (rl->R->FrameBufferCoord[0] - rl->L->FrameBufferCoord[0]) > 0 ? 1 : (rl->R->FrameBufferCoord[0] == rl->L->FrameBufferCoord[0] ? 0 : -1);
 	int PositiveY = (rl->R->FrameBufferCoord[1] - rl->L->FrameBufferCoord[1]) > 0 ? 1 : (rl->R->FrameBufferCoord[1] == rl->L->FrameBufferCoord[1] ? 0 : -1);
 
+	//printf("PX %d %lf   PY %d %lf\n", PositiveX, rl->R->FrameBufferCoord[0] - rl->L->FrameBufferCoord[0], PositiveY, rl->R->FrameBufferCoord[1] - rl->L->FrameBufferCoord[1]);
+
 	while (nba) {
 
 
@@ -2203,8 +2205,11 @@ int lanpr_triangle_line_imagespace_intersection_v2(SpinLock *spl, LANPR_RenderTr
 	//Trans[2] = tmat_dist_3dv(GLocation, cam->Base.GLocation);
 	//Trans[2] = cam->clipsta*cam->clipend / (cam->clipend - fabs(Trans[2]) * (cam->clipend - cam->clipsta));
 
-
-	Cut = tMatGetLinearRatio(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], Trans[0]);
+	//prevent vertical problem ?
+	if(rl->L->FrameBufferCoord[0] != rl->R->FrameBufferCoord[0])
+		Cut = tMatGetLinearRatio(rl->L->FrameBufferCoord[0], rl->R->FrameBufferCoord[0], Trans[0]);
+	else
+		Cut = tMatGetLinearRatio(rl->L->FrameBufferCoord[1], rl->R->FrameBufferCoord[1], Trans[1]);
 
 	In = lanpr_point_inside_triangled(Trans, rt->V[0]->FrameBufferCoord, rt->V[1]->FrameBufferCoord, rt->V[2]->FrameBufferCoord);
 
diff --git a/source/blender/draw/engines/lanpr/lanpr_util.h b/source/blender/draw/engines/lanpr/lanpr_util.h
index fd1f8a7c9fb..7d7f79d6e65 100644
--- a/source/blender/draw/engines/lanpr/lanpr_util.h
+++ b/source/blender/draw/engines/lanpr/lanpr_util.h
@@ -46,7 +46,7 @@ typedef int tnsVector2i[2];
 	typedef struct _##a a; \
 	struct _##a
 
-#define DBL_TRIANGLE_LIM 1e-11
+#define DBL_TRIANGLE_LIM 1e-8
 #define DBL_EDGE_LIM 1e-9



More information about the Bf-blender-cvs mailing list