Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c4
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c2
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c16
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c6
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h16
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c13
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c112
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c28
9 files changed, 138 insertions, 63 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index d59d2cb52fc..bd8fd9f72ad 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -182,7 +182,7 @@ void generic_bake_deform_stroke(
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
if (retime) {
- CFRA = gpf->framenum;
+ scene->r.cfra = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph);
}
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
@@ -193,7 +193,7 @@ void generic_bake_deform_stroke(
/* Return frame state and DB to original state. */
if (retime) {
- CFRA = oldframe;
+ scene->r.cfra = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph);
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
index 96e649bf7a1..30f1a004338 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
@@ -129,7 +129,7 @@ static void bakeModifier(Main *UNUSED(bmain),
/* Apply lattice effects on this frame
* NOTE: this assumes that we don't want lattice animation on non-keyframed frames.
*/
- CFRA = gpf->framenum;
+ scene->r.cfra = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph);
/* Recalculate lattice data. */
@@ -153,7 +153,7 @@ static void bakeModifier(Main *UNUSED(bmain),
}
/* Return frame state and DB to original state. */
- CFRA = oldframe;
+ scene->r.cfra = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph);
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 1c5485d2640..77616ae13b6 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -448,7 +448,7 @@ static void options_light_reference_draw(const bContext *UNUSED(C), Panel *panel
uiItemR(col, ptr, "shadow_camera_near", 0, "Near", ICON_NONE);
uiItemR(col, ptr, "shadow_camera_far", 0, "Far", ICON_NONE);
- uiItemR(layout, ptr, "shadow_enclosed_shapes", 0, IFACE_("Eclosed Shapes"), ICON_NONE);
+ uiItemR(layout, ptr, "use_shadow_enclosed_shapes", 0, IFACE_("Enclosed Shapes"), ICON_NONE);
}
static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
index df66251159c..1a8d1e75746 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
@@ -23,6 +23,7 @@
#include "BKE_context.h"
#include "BKE_gpencil.h"
+#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
@@ -100,9 +101,11 @@ static void update_position(Object *ob, MirrorGpencilModifierData *mmd, bGPDstro
}
}
-static void generate_geometry(GpencilModifierData *md, Object *ob, bGPDlayer *gpl, bGPDframe *gpf)
+static void generate_geometry(
+ GpencilModifierData *md, Object *ob, bGPDlayer *gpl, bGPDframe *gpf, const bool update)
{
MirrorGpencilModifierData *mmd = (MirrorGpencilModifierData *)md;
+ bGPdata *gpd = ob->data;
bGPDstroke *gps, *gps_new = NULL;
int tot_strokes;
int i;
@@ -129,6 +132,9 @@ static void generate_geometry(GpencilModifierData *md, Object *ob, bGPDlayer *gp
mmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
gps_new = BKE_gpencil_stroke_duplicate(gps, true, true);
update_position(ob, mmd, gps_new, xi);
+ if (update) {
+ BKE_gpencil_stroke_geometry_update(gpd, gps_new);
+ }
BLI_addtail(&gpf->strokes, gps_new);
}
}
@@ -147,7 +153,7 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
if (gpf == NULL) {
continue;
}
- generate_geometry(md, ob, gpl, gpf);
+ generate_geometry(md, ob, gpl, gpf, false);
}
}
@@ -163,16 +169,16 @@ static void bakeModifier(Main *UNUSED(bmain),
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
/* apply mirror effects on this frame */
- CFRA = gpf->framenum;
+ scene->r.cfra = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph);
/* compute mirror effects on this frame */
- generate_geometry(md, ob, gpl, gpf);
+ generate_geometry(md, ob, gpl, gpf, true);
}
}
/* return frame state and DB to original state */
- CFRA = oldframe;
+ scene->r.cfra = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph);
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
index cd2373dcb26..09c1005ecac 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c
@@ -135,7 +135,7 @@ static void bakeModifier(Main *UNUSED(bmain),
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
/* Apply shrinkwrap effects on this frame. */
- CFRA = gpf->framenum;
+ scene->r.cfra = gpf->framenum;
BKE_scene_graph_update_for_newframe(depsgraph);
/* Recalculate shrinkwrap data. */
@@ -144,7 +144,7 @@ static void bakeModifier(Main *UNUSED(bmain),
MEM_SAFE_FREE(mmd->cache_data);
}
Object *ob_target = DEG_get_evaluated_object(depsgraph, mmd->target);
- Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
+ Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
mmd->cache_data = MEM_callocN(sizeof(ShrinkwrapTreeData), __func__);
if (BKE_shrinkwrap_init_tree(
mmd->cache_data, target, mmd->shrink_type, mmd->shrink_mode, false)) {
@@ -163,7 +163,7 @@ static void bakeModifier(Main *UNUSED(bmain),
}
/* Return frame state and DB to original state. */
- CFRA = oldframe;
+ scene->r.cfra = oldframe;
BKE_scene_graph_update_for_newframe(depsgraph);
}
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 5e9b2556fe0..5dd833fb12b 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -108,7 +108,7 @@ typedef struct LineartEdgeSegment {
typedef struct LineartShadowEdge {
struct LineartShadowEdge *next, *prev;
- /* Two end points in framebuffer coordinates viewed from the light source. */
+ /* Two end points in frame-buffer coordinates viewed from the light source. */
double fbc1[4], fbc2[4];
double g1[3], g2[3];
bool orig1, orig2;
@@ -129,11 +129,11 @@ typedef struct LineartShadowSegment {
/* eLineartShadowSegmentFlag */
int flag;
/* The point after which a property of the segment is changed. e.g. shadow mask/target_ref etc.
- * Coordinates in NDC during shadow caluclation but transformed to global linear before cutting
+ * Coordinates in NDC during shadow calculation but transformed to global linear before cutting
* onto edges during the loading stage of the "actual" rendering. */
double ratio;
/* Left and right pos, because when casting shadows at some point there will be
- * non-continuous cuts, see #lineart_shadow_edge_cut for detailed explaination. */
+ * non-continuous cuts, see #lineart_shadow_edge_cut for detailed explanation. */
double fbc1[4], fbc2[4];
/* Global position. */
double g1[4], g2[4];
@@ -276,7 +276,7 @@ typedef struct LineartData {
* calculation is finished. */
LineartStaticMemPool *shadow_data_pool;
- /* Storing shadow edge eln, array, and cuts for shadow information, so it's avaliable when line
+ /* Storing shadow edge eln, array, and cuts for shadow information, so it's available when line
* art runs the second time for occlusion. Either a reference to LineartCache::shadow_data_pool
* (shadow stage) or a reference to LineartData::render_data_pool (final stage). */
LineartStaticMemPool *edge_data_pool;
@@ -549,7 +549,7 @@ typedef struct LineartBoundingArea {
uint32_t max_triangle_count;
uint32_t line_count;
uint32_t max_line_count;
- uint32_t user_count;
+ uint32_t insider_triangle_count;
/* Use array for speeding up multiple accesses. */
struct LineartTriangle **linked_triangles;
@@ -746,8 +746,8 @@ BLI_INLINE int lineart_line_isec_2d_ignore_line2pos(const double a1[2],
double *r_a_ratio)
{
/* The define here is used to check how vector or slope method handles boundary cases. The result
- * of lim(div->0) and lim(k->0) could both produce some unwanted flickers in line art, the
- * influence of which is still not fully understood, so keep the switch there for futher
+ * of `lim(div->0)` and `lim(k->0)` could both produce some unwanted flickers in line art, the
+ * influence of which is still not fully understood, so keep the switch there for further
* investigations. */
#define USE_VECTOR_LINE_INTERSECTION_IGN
#ifdef USE_VECTOR_LINE_INTERSECTION_IGN
@@ -845,7 +845,7 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld);
* implemented yet.
*/
void MOD_lineart_chain_connect(LineartData *ld);
-void MOD_lineart_chain_discard_short(LineartData *ld, float threshold);
+void MOD_lineart_chain_discard_unused(LineartData *ld, float threshold, uint8_t max_occlusion);
void MOD_lineart_chain_clip_at_border(LineartData *ld);
/**
* This should always be the last stage!, see the end of
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 4ee18c6738f..7c8e0c5a6f5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -725,8 +725,9 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld)
}
}
}
- /* Get rid of those very short "zig-zag" lines that jumps around visibility. */
- MOD_lineart_chain_discard_short(ld, DBL_EDGE_LIM);
+
+ MOD_lineart_chain_discard_unused(ld, DBL_EDGE_LIM, ld->conf.max_occlusion_level);
+
LISTBASE_FOREACH (LineartEdgeChain *, iec, &ld->chains) {
lineart_bounding_area_link_chain(ld, iec);
}
@@ -1018,12 +1019,14 @@ float MOD_lineart_chain_compute_length(LineartEdgeChain *ec)
return offset_accum;
}
-void MOD_lineart_chain_discard_short(LineartData *ld, const float threshold)
+void MOD_lineart_chain_discard_unused(LineartData *ld,
+ const float threshold,
+ uint8_t max_occlusion)
{
LineartEdgeChain *ec, *next_ec;
for (ec = ld->chains.first; ec; ec = next_ec) {
next_ec = ec->next;
- if (MOD_lineart_chain_compute_length(ec) < threshold) {
+ if (ec->level > max_occlusion || MOD_lineart_chain_compute_length(ec) < threshold) {
BLI_remlink(&ld->chains, ec);
}
}
@@ -1338,4 +1341,4 @@ void MOD_lineart_chain_find_silhouette_backdrop_objects(LineartData *ld)
ec->silhouette_backdrop = eln->object_ref;
}
}
-} \ No newline at end of file
+}
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index c17827b7228..874da3b88c9 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -494,10 +494,10 @@ static bool lineart_point_inside_triangle(const double v[2],
const double v1[2],
const double v2[2])
{
- double cl, c;
+ double cl, c, cl0;
cl = (v0[0] - v[0]) * (v1[1] - v[1]) - (v0[1] - v[1]) * (v1[0] - v[0]);
- c = cl;
+ c = cl0 = cl;
cl = (v1[0] - v[0]) * (v2[1] - v[1]) - (v1[1] - v[1]) * (v2[0] - v[0]);
if (c * cl <= 0) {
@@ -513,8 +513,7 @@ static bool lineart_point_inside_triangle(const double v[2],
c = cl;
- cl = (v0[0] - v[0]) * (v1[1] - v[1]) - (v0[1] - v[1]) * (v1[0] - v[0]);
- if (c * cl <= 0) {
+ if (c * cl0 <= 0) {
return false;
}
@@ -3658,7 +3657,7 @@ static LineartData *lineart_create_render_buffer(Scene *scene,
ld->chain_data_pool = &lc->chain_data_pool;
- /* See LineartData::edge_data_pool for explaination. */
+ /* See #LineartData::edge_data_pool for explanation. */
ld->edge_data_pool = &ld->render_data_pool;
BLI_spin_init(&ld->lock_task);
@@ -3972,7 +3971,7 @@ static void lineart_bounding_area_split(LineartData *ld,
BLI_spin_init(&ba[i].lock);
}
- for (int i = 0; i < root->triangle_count; i++) {
+ for (uint32_t i = 0; i < root->triangle_count; i++) {
LineartTriangle *tri = root->linked_triangles[i];
double b[4];
@@ -4011,10 +4010,8 @@ static bool lineart_bounding_area_edge_intersect(LineartData *UNUSED(fb),
double converted[4];
double c1, c;
- if (((converted[0] = (double)ba->l) > MAX2(l[0], r[0])) ||
- ((converted[1] = (double)ba->r) < MIN2(l[0], r[0])) ||
- ((converted[2] = (double)ba->b) > MAX2(l[1], r[1])) ||
- ((converted[3] = (double)ba->u) < MIN2(l[1], r[1]))) {
+ if (((converted[0] = ba->l) > MAX2(l[0], r[0])) || ((converted[1] = ba->r) < MIN2(l[0], r[0])) ||
+ ((converted[2] = ba->b) > MAX2(l[1], r[1])) || ((converted[3] = ba->u) < MIN2(l[1], r[1]))) {
return false;
}
@@ -4047,22 +4044,26 @@ static bool lineart_bounding_area_edge_intersect(LineartData *UNUSED(fb),
static bool lineart_bounding_area_triangle_intersect(LineartData *fb,
LineartTriangle *tri,
- LineartBoundingArea *ba)
+ LineartBoundingArea *ba,
+ bool *r_triangle_vert_inside)
{
double p1[2], p2[2], p3[2], p4[2];
double *FBC1 = tri->v[0]->fbcoord, *FBC2 = tri->v[1]->fbcoord, *FBC3 = tri->v[2]->fbcoord;
- p3[0] = p1[0] = (double)ba->l;
- p2[1] = p1[1] = (double)ba->b;
- p2[0] = p4[0] = (double)ba->r;
- p3[1] = p4[1] = (double)ba->u;
+ p3[0] = p1[0] = ba->l;
+ p2[1] = p1[1] = ba->b;
+ p2[0] = p4[0] = ba->r;
+ p3[1] = p4[1] = ba->u;
if ((FBC1[0] >= p1[0] && FBC1[0] <= p2[0] && FBC1[1] >= p1[1] && FBC1[1] <= p3[1]) ||
(FBC2[0] >= p1[0] && FBC2[0] <= p2[0] && FBC2[1] >= p1[1] && FBC2[1] <= p3[1]) ||
(FBC3[0] >= p1[0] && FBC3[0] <= p2[0] && FBC3[1] >= p1[1] && FBC3[1] <= p3[1])) {
+ *r_triangle_vert_inside = true;
return true;
}
+ *r_triangle_vert_inside = false;
+
if (lineart_point_inside_triangle(p1, FBC1, FBC2, FBC3) ||
lineart_point_inside_triangle(p2, FBC1, FBC2, FBC3) ||
lineart_point_inside_triangle(p3, FBC1, FBC2, FBC3) ||
@@ -4101,7 +4102,8 @@ static void lineart_bounding_area_link_triangle(LineartData *ld,
bool do_intersection,
struct LineartIsecThread *th)
{
- if (!lineart_bounding_area_triangle_intersect(ld, tri, root_ba)) {
+ bool triangle_vert_inside;
+ if (!lineart_bounding_area_triangle_intersect(ld, tri, root_ba, &triangle_vert_inside)) {
return;
}
@@ -4138,7 +4140,12 @@ static void lineart_bounding_area_link_triangle(LineartData *ld,
if (old_ba->triangle_count < old_ba->max_triangle_count) {
const uint32_t old_tri_count = old_ba->triangle_count;
- old_ba->linked_triangles[old_ba->triangle_count++] = tri;
+ old_ba->linked_triangles[old_tri_count] = tri;
+
+ if (triangle_vert_inside) {
+ old_ba->insider_triangle_count++;
+ }
+ old_ba->triangle_count++;
/* Do intersections in place. */
if (do_intersection && ld->conf.use_intersections) {
@@ -4151,7 +4158,8 @@ static void lineart_bounding_area_link_triangle(LineartData *ld,
}
else { /* We need to wait for either splitting or array extension to be done. */
- if (recursive_level < ld->qtree.recursive_level) {
+ if (recursive_level < ld->qtree.recursive_level &&
+ old_ba->insider_triangle_count >= LRT_TILE_SPLITTING_TRIANGLE_LIMIT) {
if (!old_ba->child) {
/* old_ba->child==NULL, means we are the thread that's doing the splitting. */
lineart_bounding_area_split(ld, old_ba, recursive_level);
@@ -4271,6 +4279,62 @@ void lineart_main_link_lines(LineartData *ld)
LRT_ITER_ALL_LINES_END
}
+static void lineart_main_remove_unused_lines_recursive(LineartBoundingArea *ba,
+ uint8_t max_occlusion)
+{
+ if (ba->child) {
+ for (int i = 0; i < 4; i++) {
+ lineart_main_remove_unused_lines_recursive(&ba->child[i], max_occlusion);
+ }
+ return;
+ }
+
+ if (!ba->line_count) {
+ return;
+ }
+
+ int usable_count = 0;
+ for (int i = 0; i < ba->line_count; i++) {
+ LineartEdge *e = ba->linked_lines[i];
+ if (e->min_occ > max_occlusion) {
+ continue;
+ }
+ usable_count++;
+ }
+
+ if (!usable_count) {
+ ba->line_count = 0;
+ return;
+ }
+
+ LineartEdge **new_array = MEM_callocN(sizeof(LineartEdge *) * usable_count,
+ "cleaned lineart edge array");
+
+ int new_i = 0;
+ for (int i = 0; i < ba->line_count; i++) {
+ LineartEdge *e = ba->linked_lines[i];
+ if (e->min_occ > max_occlusion) {
+ continue;
+ }
+ new_array[new_i] = e;
+ new_i++;
+ }
+
+ MEM_freeN(ba->linked_lines);
+ ba->linked_lines = new_array;
+ ba->max_line_count = ba->line_count = usable_count;
+}
+
+static void lineart_main_remove_unused_lines_from_tiles(LineartData *ld)
+{
+ for (int row = 0; row < ld->qtree.count_y; row++) {
+ for (int col = 0; col < ld->qtree.count_x; col++) {
+ lineart_main_remove_unused_lines_recursive(
+ &ld->qtree.initials[row * ld->qtree.count_x + col], ld->conf.max_occlusion_level);
+ }
+ }
+}
+
static bool lineart_get_triangle_bounding_areas(
LineartData *ld, LineartTriangle *tri, int *rowbegin, int *rowend, int *colbegin, int *colend)
{
@@ -4494,7 +4558,7 @@ static void lineart_create_edges_from_isec_data(LineartIsecData *d)
return;
}
- /* We don't care about removing duplicated vert in this method, chaning can handle that,
+ /* We don't care about removing duplicated vert in this method, chaining can handle that,
* and it saves us from using locks and look up tables. */
LineartVert *v = lineart_mem_acquire(ld->edge_data_pool, sizeof(LineartVert) * total_lines * 2);
LineartEdge *e = lineart_mem_acquire(ld->edge_data_pool, sizeof(LineartEdge) * total_lines);
@@ -4565,7 +4629,7 @@ static void lineart_create_edges_from_isec_data(LineartIsecData *d)
}
else { /* equal priority */
if (ob1 == ob2) {
- /* object_ref should be ambigious if intersection lines comes from different objects. */
+ /* object_ref should be ambiguous if intersection lines comes from different objects. */
e->object_ref = ob1;
}
}
@@ -4997,6 +5061,8 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
lineart_main_make_enclosed_shapes(ld, shadow_rb);
+ lineart_main_remove_unused_lines_from_tiles(ld);
+
/* Chaining is all single threaded. See lineart_chain.c
* In this particular call, only lines that are geometrically connected (share the _exact_
* same end point) will be chained together. */
@@ -5010,10 +5076,6 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
* the place threshold value gets involved. */
MOD_lineart_chain_connect(ld);
- float *t_image = &lmd->chaining_image_threshold;
- /* This configuration ensures there won't be accidental lost of short unchained segments. */
- MOD_lineart_chain_discard_short(ld, MIN2(*t_image, 0.001f) - FLT_EPSILON);
-
if (ld->conf.chain_smooth_tolerance > FLT_EPSILON) {
/* Keeping UI range of 0-1 for ease of read while scaling down the actual value for best
* effective range in image-space (Coordinate only goes from -1 to 1). This value is
@@ -5165,7 +5227,7 @@ static void lineart_gpencil_generate(LineartCache *cache,
}
if (shaodow_selection) {
if (ec->shadow_mask_bits != LRT_SHADOW_MASK_UNDEFINED) {
- /* TODO(Yiming): Give a behaviour option for how to display undefined shadow info. */
+ /* TODO(@Yiming): Give a behavior option for how to display undefined shadow info. */
if ((shaodow_selection == LRT_SHADOW_FILTER_LIT &&
(!(ec->shadow_mask_bits & LRT_SHADOW_MASK_LIT))) ||
(shaodow_selection == LRT_SHADOW_FILTER_SHADED &&
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
index ec1d9a14233..ad0137fe0f0 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_shadow.c
@@ -193,10 +193,12 @@ static void lineart_shadow_segment_slice_get(double *fb_co_1,
interp_v3_v3v3_db(r_gloc, gloc_1, gloc_2, ga);
}
-/* This function tries to get the closest projected segments along two end points.
- * The x,y of s1, s2 are aligned in framebuffer coordinates, only z,w are different.
+/**
+ * This function tries to get the closest projected segments along two end points.
+ * The x,y of s1, s2 are aligned in frame-buffer coordinates, only z,w are different.
* We will get the closest z/w as well as the corresponding global coordinates.
*
+ * \code{.unparsed}
* (far side)
* l-------r [s1] ^
* _-r [s2] | In this situation it will essentially return the coordinates of s2.
@@ -209,9 +211,11 @@ static void lineart_shadow_segment_slice_get(double *fb_co_1,
* l-----_c`-----r [s1] | and `r_new` will be assigned coordinates of `c`.
* _-` |
* l-` |
+ * \endcode
*
* Returns true when a new cut (`c`) is needed in the middle, otherwise returns false, and
- * `*r_new_xxx` are not touched. */
+ * `*r_new_xxx` are not touched.
+ */
static bool lineart_do_closest_segment(bool is_persp,
double *s1_fb_co_1,
double *s1_fb_co_2,
@@ -309,7 +313,7 @@ static void lineart_shadow_create_shadow_edge_array(LineartData *ld,
LRT_ITER_ALL_LINES_BEGIN
{
/* Only contour and loose edges can actually cast shadows. We allow light contour here because
- * we want to see if it also doubles as a view contouror, in that case we also need to project
+ * we want to see if it also doubles as a view contour, in that case we also need to project
* them. */
if (!(e->flags & accept_types)) {
continue;
@@ -383,7 +387,7 @@ static void lineart_shadow_create_shadow_edge_array(LineartData *ld,
interp_v3_v3v3_db(sedge[i].g2, e->v1->gloc, e->v2->gloc, ga2);
/* Assign an absurdly big W for initial distance so when triangles show up to catch the
- * shadow, their w must certainlly be smaller than this value so the shadow catches
+ * shadow, their w must certainly be smaller than this value so the shadow catches
* successfully. */
sedge[i].fbc1[3] = 1e30;
sedge[i].fbc2[3] = 1e30;
@@ -712,7 +716,7 @@ static bool lineart_shadow_cast_onto_triangle(LineartData *ld,
/* Bound box check. Because we have already done occlusion in the shadow camera, so any visual
* intersection found in this function must mean that the triangle is behind the given line so it
- * will always project a shadow, hence no need to do depth boundbox check. */
+ * will always project a shadow, hence no need to do depth bound-box check. */
if ((MAX3(FBC0[0], FBC1[0], FBC2[0]) < MIN2(LFBC[0], RFBC[0])) ||
(MIN3(FBC0[0], FBC1[0], FBC2[0]) > MAX2(LFBC[0], RFBC[0])) ||
(MAX3(FBC0[1], FBC1[1], FBC2[1]) < MIN2(LFBC[1], RFBC[1])) ||
@@ -1055,7 +1059,7 @@ static void lineart_shadow_register_enclosed_shapes(LineartData *ld, LineartData
e = shadow_ld->pending_edges.array[i];
/* Only care about shade-on-light and light-on-light situations, hence we only need
- * non-occludded segments in shadow buffer. */
+ * non-occluded segments in shadow buffer. */
if (e->min_occ > 0) {
continue;
}
@@ -1103,7 +1107,7 @@ static void lineart_shadow_register_enclosed_shapes(LineartData *ld, LineartData
}
}
-/* This call would internally duplicate #original_ld, override necessary configureations for shadow
+/* This call would internally duplicate #original_ld, override necessary configurations for shadow
* computations. It will return:
*
* 1) Generated shadow edges in format of `LineartElementLinkNode` which can be directly loaded
@@ -1151,7 +1155,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
ld->conf.do_shadow_cast = true;
ld->shadow_data_pool = shadow_data_pool;
- /* See LineartData::edge_data_pool for explaination. */
+ /* See LineartData::edge_data_pool for explanation. */
if (ld->conf.shadow_selection) {
ld->edge_data_pool = shadow_data_pool;
}
@@ -1180,7 +1184,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
}
ld->qtree.recursive_level = is_persp ? LRT_TILE_RECURSIVE_PERSPECTIVE : LRT_TILE_RECURSIVE_ORTHO;
- /* Contour and loose edge from light viewing direction will be casted as shadow, so only
+ /* Contour and loose edge from light viewing direction will be cast as shadow, so only
* force them on. If we need lit/shaded information for other line types, they are then
* enabled as-is so that cutting positions can also be calculated through shadow projection.
*/
@@ -1250,7 +1254,7 @@ bool lineart_main_try_generate_shadow(Depsgraph *depsgraph,
}
if (ld->conf.shadow_enclose_shapes) {
- /* Need loaded data for reprojecting the 3rd time to get shape boundary against lit/shaded
+ /* Need loaded data for re-projecting the 3rd time to get shape boundary against lit/shaded
* region. */
(*r_shadow_ld_if_reproject) = ld;
}
@@ -1342,7 +1346,7 @@ void lineart_main_transform_and_add_shadow(LineartData *ld,
}
/* Does the 3rd stage reprojection, will not re-load objects because #shadow_ld is not deleted.
- * Only reprojects view camera edges and check visibility in light camera, then we can determine
+ * Only re-projects view camera edges and check visibility in light camera, then we can determine
* whether an edge landed on a lit or shaded area. */
void lineart_main_make_enclosed_shapes(LineartData *ld, LineartData *shadow_ld)
{