[Bf-blender-cvs] [eaee064dd17] temp-lineart-contained: LineArt: Correct handling out of bound isect index

YimingWu noreply at git.blender.org
Tue Dec 28 04:55:05 CET 2021


Commit: eaee064dd17c3646ba9ce91b2e117ec8b4d34992
Author: YimingWu
Date:   Tue Dec 28 11:54:41 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBeaee064dd17c3646ba9ce91b2e117ec8b4d34992

LineArt: Correct handling out of bound isect index

Handles rare cases where line doesn't intersect the triangle correctly.

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 3ddf8222157..6ab73bc6830 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2697,8 +2697,12 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
         INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
       }
       else {
-        INTERSECT_JUST_GREATER(is, order, is[LCross], LCross);
-        INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
+        if (LCross >= 0) {
+          INTERSECT_JUST_GREATER(is, order, is[LCross], LCross);
+          if (LCross >= 0) {
+            INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
+          }
+        }
       }
     }
   }



More information about the Bf-blender-cvs mailing list