[Bf-blender-cvs] [31d1e751b50] temp-lineart-contained: LineArt: Continue comment cleanups.

YimingWu noreply at git.blender.org
Mon Mar 15 16:46:52 CET 2021


Commit: 31d1e751b508c8bcf11d6732dfe7c006345e00ee
Author: YimingWu
Date:   Mon Mar 15 23:46:39 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB31d1e751b508c8bcf11d6732dfe7c006345e00ee

LineArt: Continue comment cleanups.

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

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

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index e569a09429f..90cfe934d5d 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -67,12 +67,13 @@ typedef struct LineartRenderTriangle {
 
 typedef struct LineartRenderTriangleThread {
   struct LineartRenderTriangle base;
-  /** This variable is used to store per-thread triangle-line testing pair,
-   *  also re-used to store triangle-triangle pair for intersection testing stage.
-   *  Do not directly use LineartRenderTriangleThread, but use it as a pointer,
-   * the size of LineartRenderTriangle is dynamically allocated to contain set thread number of
-   * "testing" field, at least one thread is present, thus we always have at least testing[0].*/
-  struct LineartRenderLine *testing[127];
+  /* This variable is used to store per-thread triangle-line testing pair,
+   * also re-used to store triangle-triangle pair for intersection testing stage.
+   * Do not directly use LineartRenderTriangleThread.
+   * The size of LineartRenderTriangle is dynamically allocated to contain set thread number of
+   * "testing" field. Worker threads will test lines against the "base" triangle.
+   * At least one thread is present, thus we always have at least testing[0]. */
+  struct LineartRenderLine *testing;
 } LineartRenderTriangleThread;
 
 typedef enum eLineArtElementNodeFlag {
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 3ae2f99fc1e..195f0088114 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -3575,7 +3575,8 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
 
   rb = lineart_create_render_buffer(scene, lmd);
 
-  /* Triangle size varies based on thread count. */
+  /* Triangle thread testing data size varies depending on the thread count.
+   * See definition of LineartRenderTriangleThread for details. */
   rb->triangle_size = lineart_triangle_size_get(scene, rb);
 
   /* This is used to limit calculation to a certain level to save time, lines who have higher
@@ -3588,11 +3589,11 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
       depsgraph, scene, scene->camera, rb, lmd->calculation_flags & LRT_ALLOW_DUPLI_OBJECTS);
 
   if (!rb->vertex_buffer_pointers.first) {
-    /* Nothing loaded, early return. */
+    /* No geometry loaded, return early. */
     return OPERATOR_FINISHED;
   }
 
-  /* This is the acceleration strucrure, a lot like BVH in 3D. */
+  /* Initialize the bounding box acceleration structure, it's a lot like BVH in 3D. */
   lineart_main_bounding_area_make_initial(rb);
 
   /* We need to get cut into triangles that are crossing near/far plans, only this way can we get
@@ -3602,9 +3603,10 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
   /* clip_far==true for far plane. */
   lineart_main_cull_triangles(rb, true);
 
-  /* Triangle adjacent info pointers are no longer used. This saves memory. */
+  /* At this point triangle adjacent info pointers is no longer needed, free them. */
   lineart_main_free_adjacent_data(rb);
 
+  /* Do the perspective division after clipping is done. */
   lineart_main_perspective_division(rb);
 
   /* Triangle intersections are done here during sequential adding of them. Only after this,



More information about the Bf-blender-cvs mailing list