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:
authorSebastian Parborg <darkdefende@gmail.com>2021-03-17 16:28:12 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-03-18 14:41:44 +0300
commitdf280637952d35cfaa74e31f03a0d825b22eddf4 (patch)
tree21d215dc1a5dbf2752257de6b378b71aee9434c7 /source/blender/gpencil_modifiers
parentd7fb38ddd4afdb44a97a3ac9d5d3a73509f83a90 (diff)
Cleanup, LineArt: Rename LineartLine -> LineartEdge
Also cleanup various other "line" variable names
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c2
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h66
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c222
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c648
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h16
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c2
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/lineart_util.c10
7 files changed, 483 insertions, 483 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 2170e486416..fd880dbbe41 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -102,7 +102,7 @@ static void generate_strokes_actual(
lmd->level_start,
lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
- lmd->line_types,
+ lmd->edge_types,
lmd->transparency_flags,
lmd->transparency_mask,
lmd->thickness,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 0c170deacbb..c523809a4ad 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -46,7 +46,7 @@ typedef struct LineartStaticMemPool {
} LineartStaticMemPool;
typedef struct LineartTriangleAdjacent {
- struct LineartLine *rl[3];
+ struct LineartEdge *e[3];
} LineartTriangleAdjacent;
typedef struct LineartTriangle {
@@ -71,9 +71,9 @@ typedef struct LineartTriangleThread {
* also re-used to store triangle-triangle pair for intersection testing stage.
* Do not directly use LineartTriangleThread.
* The size of LineartTriangle 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 LineartLine *testing[1];
+ * "testing_e" field. Worker threads will test lines against the "base" triangle.
+ * At least one thread is present, thus we always have at least testing_e[0]. */
+ struct LineartEdge *testing_e[1];
} LineartTriangleThread;
typedef enum eLineArtElementNodeFlag {
@@ -135,14 +135,14 @@ typedef enum eLineArtVertFlags {
LRT_VERT_EDGE_USED = (1 << 1),
} eLineArtVertFlags;
-typedef struct LineartLine {
+typedef struct LineartEdge {
/* We only need link node kind of list here. */
- struct LineartLine *next;
- struct LineartVert *l, *r;
+ struct LineartEdge *next;
+ struct LineartVert *v1, *v2;
/* Local vertex index for two ends, not puting in RenderVert because all verts are loaded, so as
* long as fewer than half of the mesh edges are becoming a feature line, we save more memory. */
- int l_obindex, r_obindex;
- struct LineartTriangle *tl, *tr;
+ int v1_obindex, v2_obindex;
+ struct LineartTriangle *t1, *t2;
ListBase segments;
char min_occ;
@@ -154,7 +154,7 @@ typedef struct LineartLine {
* another bit in flags to be able to show the difference.
*/
struct Object *object_ref;
-} LineartLine;
+} LineartEdge;
typedef struct LineartLineChain {
struct LineartLineChain *next, *prev;
@@ -232,29 +232,29 @@ typedef struct LineartRenderBuffer {
unsigned int contour_count;
unsigned int contour_processed;
- LineartLine *contour_managed;
+ LineartEdge *contour_managed;
/* Now changed to linknodes. */
- LineartLine *contours;
+ LineartEdge *contours;
unsigned int intersection_count;
unsigned int intersection_processed;
- LineartLine *intersection_managed;
- LineartLine *intersection_lines;
+ LineartEdge *intersection_managed;
+ LineartEdge *intersection_lines;
unsigned int crease_count;
unsigned int crease_processed;
- LineartLine *crease_managed;
- LineartLine *crease_lines;
+ LineartEdge *crease_managed;
+ LineartEdge *crease_lines;
unsigned int material_line_count;
unsigned int material_processed;
- LineartLine *material_managed;
- LineartLine *material_lines;
+ LineartEdge *material_managed;
+ LineartEdge *material_lines;
unsigned int edge_mark_count;
unsigned int edge_mark_processed;
- LineartLine *edge_mark_managed;
- LineartLine *edge_marks;
+ LineartEdge *edge_mark_managed;
+ LineartEdge *edge_marks;
ListBase chains;
@@ -307,30 +307,30 @@ typedef enum eLineartTriangleFlags {
LRT_TRIANGLE_NO_INTERSECTION = (1 << 4),
} eLineartTriangleFlags;
-/** Controls how many lines a worker thread is processing at one request.
+/** Controls how many edges a worker thread is processing at one request.
* There's no significant performance impact on choosing different values.
* Don't make it too small so that the worker thread won't request too many times. */
-#define LRT_THREAD_LINE_COUNT 1000
+#define LRT_THREAD_EDGE_COUNT 1000
typedef struct LineartRenderTaskInfo {
struct LineartRenderBuffer *rb;
int thread_id;
- LineartLine *contour;
- LineartLine *contour_end;
+ LineartEdge *contour;
+ LineartEdge *contour_end;
- LineartLine *intersection;
- LineartLine *intersection_end;
+ LineartEdge *intersection;
+ LineartEdge *intersection_end;
- LineartLine *crease;
- LineartLine *crease_end;
+ LineartEdge *crease;
+ LineartEdge *crease_end;
- LineartLine *material;
- LineartLine *material_end;
+ LineartEdge *material;
+ LineartEdge *material_end;
- LineartLine *edge_mark;
- LineartLine *edge_mark_end;
+ LineartEdge *edge_mark;
+ LineartEdge *edge_mark_end;
} LineartRenderTaskInfo;
@@ -535,7 +535,7 @@ void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
int level_start,
int level_end,
int mat_nr,
- short line_types,
+ short edge_types,
unsigned char transparency_flags,
unsigned char transparency_mask,
short thickness,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 10a028d94cc..fae5bcd7c2e 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -44,39 +44,39 @@
#include <math.h>
-#define LRT_OTHER_RV(rl, rv) ((rv) == (rl)->l ? (rl)->r : ((rv) == (rl)->r ? (rl)->l : NULL))
+#define LRT_OTHER_RV(e, rv) ((rv) == (e)->v1 ? (e)->v2 : ((rv) == (e)->v2 ? (e)->v1 : NULL))
/* Get a connected line, only for lines who has the exact given vert, or (in the case of
* intersection lines) who has a vert that has the exact same position. */
-static LineartLine *lineart_line_get_connected(LineartBoundingArea *ba,
+static LineartEdge *lineart_line_get_connected(LineartBoundingArea *ba,
LineartVert *rv,
LineartVert **new_rv,
int match_flag)
{
LISTBASE_FOREACH (LinkData *, lip, &ba->linked_lines) {
- LineartLine *nrl = lip->data;
+ LineartEdge *n_e = lip->data;
- if ((!(nrl->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (nrl->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
+ if ((!(n_e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (n_e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
continue;
}
- if (match_flag && ((nrl->flags & LRT_EDGE_FLAG_ALL_TYPE) & match_flag) == 0) {
+ if (match_flag && ((n_e->flags & LRT_EDGE_FLAG_ALL_TYPE) & match_flag) == 0) {
continue;
}
- *new_rv = LRT_OTHER_RV(nrl, rv);
+ *new_rv = LRT_OTHER_RV(n_e, rv);
if (*new_rv) {
- return nrl;
+ return n_e;
}
- if (nrl->flags & LRT_EDGE_FLAG_INTERSECTION) {
- if (rv->fbcoord[0] == nrl->l->fbcoord[0] && rv->fbcoord[1] == nrl->l->fbcoord[1]) {
- *new_rv = LRT_OTHER_RV(nrl, nrl->l);
- return nrl;
+ if (n_e->flags & LRT_EDGE_FLAG_INTERSECTION) {
+ if (rv->fbcoord[0] == n_e->v1->fbcoord[0] && rv->fbcoord[1] == n_e->v1->fbcoord[1]) {
+ *new_rv = LRT_OTHER_RV(n_e, n_e->v1);
+ return n_e;
}
- if (rv->fbcoord[0] == nrl->r->fbcoord[0] && rv->fbcoord[1] == nrl->r->fbcoord[1]) {
- *new_rv = LRT_OTHER_RV(nrl, nrl->r);
- return nrl;
+ if (rv->fbcoord[0] == n_e->v2->fbcoord[0] && rv->fbcoord[1] == n_e->v2->fbcoord[1]) {
+ *new_rv = LRT_OTHER_RV(n_e, n_e->v2);
+ return n_e;
}
}
}
@@ -198,216 +198,216 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
LRT_ITER_ALL_LINES_BEGIN
{
- if ((!(rl->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (rl->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
+ if ((!(e->flags & LRT_EDGE_FLAG_ALL_TYPE)) || (e->flags & LRT_EDGE_FLAG_CHAIN_PICKED)) {
LRT_ITER_ALL_LINES_NEXT
continue;
}
- rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
+ e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
rlc = lineart_chain_create(rb);
/* One chain can only have one object_ref,
* so we assign it based on the first segment we found. */
- rlc->object_ref = rl->object_ref;
+ rlc->object_ref = e->object_ref;
- LineartLine *new_rl = rl;
+ LineartEdge *new_e = e;
LineartVert *new_rv;
float N[3] = {0};
- if (rl->tl) {
- N[0] += rl->tl->gn[0];
- N[1] += rl->tl->gn[1];
- N[2] += rl->tl->gn[2];
+ if (e->t1) {
+ N[0] += e->t1->gn[0];
+ N[1] += e->t1->gn[1];
+ N[2] += e->t1->gn[2];
}
- if (rl->tr) {
- N[0] += rl->tr->gn[0];
- N[1] += rl->tr->gn[1];
- N[2] += rl->tr->gn[2];
+ if (e->t2) {
+ N[0] += e->t2->gn[0];
+ N[1] += e->t2->gn[1];
+ N[2] += e->t2->gn[2];
}
- if (rl->tl || rl->tr) {
+ if (e->t1 || e->t2) {
normalize_v3(N);
}
/* Step 1: grow left. */
- ba = MOD_lineart_get_bounding_area(rb, rl->l->fbcoord[0], rl->l->fbcoord[1]);
- new_rv = rl->l;
- rls = rl->segments.first;
+ ba = MOD_lineart_get_bounding_area(rb, e->v1->fbcoord[0], e->v1->fbcoord[1]);
+ new_rv = e->v1;
+ rls = e->segments.first;
VERT_COORD_TO_FLOAT(new_rv);
lineart_chain_prepend_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- rl->flags,
+ e->flags,
rls->occlusion,
rls->transparency_mask,
- rl->l_obindex);
- while (ba && (new_rl = lineart_line_get_connected(ba, new_rv, &new_rv, rl->flags))) {
- new_rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
+ e->v1_obindex);
+ while (ba && (new_e = lineart_line_get_connected(ba, new_rv, &new_rv, e->flags))) {
+ new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
- if (new_rl->tl || new_rl->tr) {
+ if (new_e->t1 || new_e->t2) {
zero_v3(N);
- if (new_rl->tl) {
- N[0] += new_rl->tl->gn[0];
- N[1] += new_rl->tl->gn[1];
- N[2] += new_rl->tl->gn[2];
+ if (new_e->t1) {
+ N[0] += new_e->t1->gn[0];
+ N[1] += new_e->t1->gn[1];
+ N[2] += new_e->t1->gn[2];
}
- if (new_rl->tr) {
- N[0] += new_rl->tr->gn[0];
- N[1] += new_rl->tr->gn[1];
- N[2] += new_rl->tr->gn[2];
+ if (new_e->t2) {
+ N[0] += new_e->t2->gn[0];
+ N[1] += new_e->t2->gn[1];
+ N[2] += new_e->t2->gn[2];
}
normalize_v3(N);
}
- if (new_rv == new_rl->l) {
- for (rls = new_rl->segments.last; rls; rls = rls->prev) {
+ if (new_rv == new_e->v1) {
+ for (rls = new_e->segments.last; rls; rls = rls->prev) {
double gpos[3], lpos[3];
- double *lfb = new_rl->l->fbcoord, *rfb = new_rl->r->fbcoord;
+ double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * rls->at / (rls->at * lfb[3] + (1 - rls->at) * rfb[3]);
- interp_v3_v3v3_db(lpos, new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at);
- interp_v3_v3v3_db(gpos, new_rl->l->gloc, new_rl->r->gloc, global_at);
+ interp_v3_v3v3_db(lpos, new_e->v1->fbcoord, new_e->v2->fbcoord, rls->at);
+ interp_v3_v3v3_db(gpos, new_e->v1->gloc, new_e->v2->gloc, global_at);
POS_TO_FLOAT(lpos, gpos)
lineart_chain_prepend_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
rls->occlusion,
rls->transparency_mask,
- new_rl->l_obindex);
+ new_e->v1_obindex);
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
}
}
- else if (new_rv == new_rl->r) {
- rls = new_rl->segments.first;
+ else if (new_rv == new_e->v2) {
+ rls = new_e->segments.first;
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
rls = rls->next;
for (; rls; rls = rls->next) {
double gpos[3], lpos[3];
- double *lfb = new_rl->l->fbcoord, *rfb = new_rl->r->fbcoord;
+ double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * rls->at / (rls->at * lfb[3] + (1 - rls->at) * rfb[3]);
- interp_v3_v3v3_db(lpos, new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at);
- interp_v3_v3v3_db(gpos, new_rl->l->gloc, new_rl->r->gloc, global_at);
+ interp_v3_v3v3_db(lpos, new_e->v1->fbcoord, new_e->v2->fbcoord, rls->at);
+ interp_v3_v3v3_db(gpos, new_e->v1->gloc, new_e->v2->gloc, global_at);
POS_TO_FLOAT(lpos, gpos)
lineart_chain_prepend_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
last_occlusion,
last_transparency,
- new_rl->r_obindex);
+ new_e->v2_obindex);
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
}
- VERT_COORD_TO_FLOAT(new_rl->r);
+ VERT_COORD_TO_FLOAT(new_e->v2);
lineart_chain_prepend_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
last_occlusion,
last_transparency,
- new_rl->r_obindex);
+ new_e->v2_obindex);
}
ba = MOD_lineart_get_bounding_area(rb, new_rv->fbcoord[0], new_rv->fbcoord[1]);
}
/* Restore normal value. */
- if (rl->tl || rl->tr) {
+ if (e->t1 || e->t2) {
zero_v3(N);
- if (rl->tl) {
- N[0] += rl->tl->gn[0];
- N[1] += rl->tl->gn[1];
- N[2] += rl->tl->gn[2];
+ if (e->t1) {
+ N[0] += e->t1->gn[0];
+ N[1] += e->t1->gn[1];
+ N[2] += e->t1->gn[2];
}
- if (rl->tr) {
- N[0] += rl->tr->gn[0];
- N[1] += rl->tr->gn[1];
- N[2] += rl->tr->gn[2];
+ if (e->t2) {
+ N[0] += e->t2->gn[0];
+ N[1] += e->t2->gn[1];
+ N[2] += e->t2->gn[2];
}
normalize_v3(N);
}
/* Step 2: Adding all cuts from the given line, so we can continue connecting the right side
* of the line. */
- rls = rl->segments.first;
+ rls = e->segments.first;
last_occlusion = ((LineartLineSegment *)rls)->occlusion;
last_transparency = ((LineartLineSegment *)rls)->transparency_mask;
for (rls = rls->next; rls; rls = rls->next) {
double gpos[3], lpos[3];
- double *lfb = rl->l->fbcoord, *rfb = rl->r->fbcoord;
+ double *lfb = e->v1->fbcoord, *rfb = e->v2->fbcoord;
double global_at = lfb[3] * rls->at / (rls->at * lfb[3] + (1 - rls->at) * rfb[3]);
- interp_v3_v3v3_db(lpos, rl->l->fbcoord, rl->r->fbcoord, rls->at);
- interp_v3_v3v3_db(gpos, rl->l->gloc, rl->r->gloc, global_at);
+ interp_v3_v3v3_db(lpos, e->v1->fbcoord, e->v2->fbcoord, rls->at);
+ interp_v3_v3v3_db(gpos, e->v1->gloc, e->v2->gloc, global_at);
POS_TO_FLOAT(lpos, gpos)
lineart_chain_append_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- rl->flags,
+ e->flags,
rls->occlusion,
rls->transparency_mask,
- rl->l_obindex);
+ e->v1_obindex);
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
}
- VERT_COORD_TO_FLOAT(rl->r)
+ VERT_COORD_TO_FLOAT(e->v2)
lineart_chain_append_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- rl->flags,
+ e->flags,
last_occlusion,
last_transparency,
- rl->r_obindex);
+ e->v2_obindex);
/* Step 3: grow right. */
- ba = MOD_lineart_get_bounding_area(rb, rl->r->fbcoord[0], rl->r->fbcoord[1]);
- new_rv = rl->r;
- while (ba && (new_rl = lineart_line_get_connected(ba, new_rv, &new_rv, rl->flags))) {
- new_rl->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
+ ba = MOD_lineart_get_bounding_area(rb, e->v2->fbcoord[0], e->v2->fbcoord[1]);
+ new_rv = e->v2;
+ while (ba && (new_e = lineart_line_get_connected(ba, new_rv, &new_rv, e->flags))) {
+ new_e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED;
- if (new_rl->tl || new_rl->tr) {
+ if (new_e->t1 || new_e->t2) {
zero_v3(N);
- if (new_rl->tl) {
- N[0] += new_rl->tl->gn[0];
- N[1] += new_rl->tl->gn[1];
- N[2] += new_rl->tl->gn[2];
+ if (new_e->t1) {
+ N[0] += new_e->t1->gn[0];
+ N[1] += new_e->t1->gn[1];
+ N[2] += new_e->t1->gn[2];
}
- if (new_rl->tr) {
- N[0] += new_rl->tr->gn[0];
- N[1] += new_rl->tr->gn[1];
- N[2] += new_rl->tr->gn[2];
+ if (new_e->t2) {
+ N[0] += new_e->t2->gn[0];
+ N[1] += new_e->t2->gn[1];
+ N[2] += new_e->t2->gn[2];
}
normalize_v3(N);
}
/* Fix leading vertex type. */
rlci = rlc->chain.last;
- rlci->line_type = new_rl->flags & LRT_EDGE_FLAG_ALL_TYPE;
+ rlci->line_type = new_e->flags & LRT_EDGE_FLAG_ALL_TYPE;
- if (new_rv == new_rl->l) {
- rls = new_rl->segments.last;
+ if (new_rv == new_e->v1) {
+ rls = new_e->segments.last;
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
/* Fix leading vertex occlusion. */
rlci->occlusion = last_occlusion;
rlci->transparency_mask = last_transparency;
- for (rls = new_rl->segments.last; rls; rls = rls->prev) {
+ for (rls = new_e->segments.last; rls; rls = rls->prev) {
double gpos[3], lpos[3];
- double *lfb = new_rl->l->fbcoord, *rfb = new_rl->r->fbcoord;
+ double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * rls->at / (rls->at * lfb[3] + (1 - rls->at) * rfb[3]);
- interp_v3_v3v3_db(lpos, new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at);
- interp_v3_v3v3_db(gpos, new_rl->l->gloc, new_rl->r->gloc, global_at);
+ interp_v3_v3v3_db(lpos, new_e->v1->fbcoord, new_e->v2->fbcoord, rls->at);
+ interp_v3_v3v3_db(gpos, new_e->v1->gloc, new_e->v2->gloc, global_at);
last_occlusion = rls->prev ? rls->prev->occlusion : last_occlusion;
last_transparency = rls->prev ? rls->prev->transparency_mask : last_transparency;
POS_TO_FLOAT(lpos, gpos)
@@ -416,14 +416,14 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
last_occlusion,
last_transparency,
- new_rl->l_obindex);
+ new_e->v1_obindex);
}
}
- else if (new_rv == new_rl->r) {
- rls = new_rl->segments.first;
+ else if (new_rv == new_e->v2) {
+ rls = new_e->segments.first;
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
rlci->occlusion = last_occlusion;
@@ -431,33 +431,33 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
rls = rls->next;
for (; rls; rls = rls->next) {
double gpos[3], lpos[3];
- double *lfb = new_rl->l->fbcoord, *rfb = new_rl->r->fbcoord;
+ double *lfb = new_e->v1->fbcoord, *rfb = new_e->v2->fbcoord;
double global_at = lfb[3] * rls->at / (rls->at * lfb[3] + (1 - rls->at) * rfb[3]);
- interp_v3_v3v3_db(lpos, new_rl->l->fbcoord, new_rl->r->fbcoord, rls->at);
- interp_v3_v3v3_db(gpos, new_rl->l->gloc, new_rl->r->gloc, global_at);
+ interp_v3_v3v3_db(lpos, new_e->v1->fbcoord, new_e->v2->fbcoord, rls->at);
+ interp_v3_v3v3_db(gpos, new_e->v1->gloc, new_e->v2->gloc, global_at);
POS_TO_FLOAT(lpos, gpos)
lineart_chain_append_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
rls->occlusion,
rls->transparency_mask,
- new_rl->r_obindex);
+ new_e->v2_obindex);
last_occlusion = rls->occlusion;
last_transparency = rls->transparency_mask;
}
- VERT_COORD_TO_FLOAT(new_rl->r)
+ VERT_COORD_TO_FLOAT(new_e->v2)
lineart_chain_append_point(rb,
rlc,
use_fbcoord,
use_gpos,
N,
- new_rl->flags,
+ new_e->flags,
last_occlusion,
last_transparency,
- new_rl->r_obindex);
+ new_e->v2_obindex);
}
ba = MOD_lineart_get_bounding_area(rb, new_rv->fbcoord[0], new_rv->fbcoord[1]);
}
@@ -465,7 +465,7 @@ void MOD_lineart_chain_feature_lines(LineartRenderBuffer *rb)
rlc->type = LRT_EDGE_FLAG_CONTOUR;
}
else {
- rlc->type = (rl->flags & LRT_EDGE_FLAG_ALL_TYPE);
+ rlc->type = (e->flags & LRT_EDGE_FLAG_ALL_TYPE);
}
}
LRT_ITER_ALL_LINES_END
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index ca65fc9bd57..6c638478983 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -78,15 +78,15 @@
#include "lineart_intern.h"
-static LineartBoundingArea *lineart_line_first_bounding_area(LineartRenderBuffer *rb,
- LineartLine *rl);
+static LineartBoundingArea *lineart_edge_first_bounding_area(LineartRenderBuffer *rb,
+ LineartEdge *e);
static void lineart_bounding_area_link_line(LineartRenderBuffer *rb,
LineartBoundingArea *root_ba,
- LineartLine *rl);
+ LineartEdge *e);
-static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *This,
- LineartLine *rl,
+static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this,
+ LineartEdge *e,
double x,
double y,
double k,
@@ -95,8 +95,8 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *This
double *next_x,
double *next_y);
-static bool lineart_get_line_bounding_areas(LineartRenderBuffer *rb,
- LineartLine *rl,
+static bool lineart_get_edge_bounding_areas(LineartRenderBuffer *rb,
+ LineartEdge *e,
int *rowbegin,
int *rowend,
int *colbegin,
@@ -110,9 +110,9 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
int recursive_level,
bool do_intersection);
-static bool lineart_triangle_line_image_space_occlusion(SpinLock *spl,
+static bool lineart_triangle_edge_image_space_occlusion(SpinLock *spl,
const LineartTriangle *rt,
- const LineartLine *rl,
+ const LineartEdge *e,
const double *override_camera_loc,
const bool override_cam_is_persp,
const bool allow_overlapping_edges,
@@ -123,9 +123,9 @@ static bool lineart_triangle_line_image_space_occlusion(SpinLock *spl,
double *from,
double *to);
-static void lineart_add_line_to_list(LineartRenderBuffer *rb, LineartLine *rl);
+static void lineart_add_edge_to_list(LineartRenderBuffer *rb, LineartEdge *e);
-static void lineart_line_discard_segment(LineartRenderBuffer *rb, LineartLineSegment *rls)
+static void lineart_discard_segment(LineartRenderBuffer *rb, LineartLineSegment *rls)
{
BLI_spin_lock(&rb->lock_cuts);
@@ -138,7 +138,7 @@ static void lineart_line_discard_segment(LineartRenderBuffer *rb, LineartLineSeg
BLI_spin_unlock(&rb->lock_cuts);
}
-static LineartLineSegment *lineart_line_give_segment(LineartRenderBuffer *rb)
+static LineartLineSegment *lineart_give_segment(LineartRenderBuffer *rb)
{
BLI_spin_lock(&rb->lock_cuts);
@@ -156,9 +156,9 @@ static LineartLineSegment *lineart_line_give_segment(LineartRenderBuffer *rb)
sizeof(LineartLineSegment));
}
-/* Cuts the line in image space and mark occlusion level for each segment. */
-static void lineart_line_cut(LineartRenderBuffer *rb,
- LineartLine *rl,
+/* Cuts the edge in image space and mark occlusion level for each segment. */
+static void lineart_edge_cut(LineartRenderBuffer *rb,
+ LineartEdge *e,
double start,
double end,
unsigned char transparency_mask)
@@ -192,7 +192,7 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
/* Begin looking for starting position of the segment. */
/* Not using a list iteration macro because of it more clear when using for loops to iterate
* through the segments. */
- for (rls = rl->segments.first; rls; rls = rls->next) {
+ for (rls = e->segments.first; rls; rls = rls->next) {
if (LRT_DOUBLE_CLOSE_ENOUGH(rls->at, start)) {
cut_start_before = rls;
ns = cut_start_before;
@@ -204,7 +204,7 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
irls = rls->next;
if (irls->at > start + 1e-09 && start > rls->at) {
cut_start_before = irls;
- ns = lineart_line_give_segment(rb);
+ ns = lineart_give_segment(rb);
break;
}
}
@@ -230,14 +230,14 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
/* When an actual cut is needed in the line. */
if (rls->at > end) {
cut_end_before = rls;
- ns2 = lineart_line_give_segment(rb);
+ ns2 = lineart_give_segment(rb);
break;
}
}
/* When we still can't find any existing cut in the line, we allocate new ones. */
if (ns == NULL) {
- ns = lineart_line_give_segment(rb);
+ ns = lineart_give_segment(rb);
}
if (ns2 == NULL) {
if (untouched) {
@@ -245,7 +245,7 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
cut_end_before = ns2;
}
else {
- ns2 = lineart_line_give_segment(rb);
+ ns2 = lineart_give_segment(rb);
}
}
@@ -255,17 +255,17 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
irls = cut_start_before->prev ? cut_start_before->prev : NULL;
ns->occlusion = irls ? irls->occlusion : 0;
ns->transparency_mask = irls->transparency_mask;
- BLI_insertlinkbefore(&rl->segments, (void *)cut_start_before, (void *)ns);
+ BLI_insertlinkbefore(&e->segments, (void *)cut_start_before, (void *)ns);
}
/* Otherwise we already found a existing cutting point, no need to insert a new one. */
}
else {
/* We have yet to reach a existing cutting point even after we searched the whole line, so we
* append the new cut to the end. */
- irls = rl->segments.last;
+ irls = e->segments.last;
ns->occlusion = irls->occlusion;
ns->transparency_mask = irls->transparency_mask;
- BLI_addtail(&rl->segments, ns);
+ BLI_addtail(&e->segments, ns);
}
if (cut_end_before) {
/* The same manipulation as on "cut_start_before". */
@@ -273,14 +273,14 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
irls = cut_end_before->prev ? cut_end_before->prev : NULL;
ns2->occlusion = irls ? irls->occlusion : 0;
ns2->transparency_mask = irls ? irls->transparency_mask : 0;
- BLI_insertlinkbefore(&rl->segments, (void *)cut_end_before, (void *)ns2);
+ BLI_insertlinkbefore(&e->segments, (void *)cut_end_before, (void *)ns2);
}
}
else {
- irls = rl->segments.last;
+ irls = e->segments.last;
ns2->occlusion = irls->occlusion;
ns2->transparency_mask = irls->transparency_mask;
- BLI_addtail(&rl->segments, ns2);
+ BLI_addtail(&e->segments, ns2);
}
/* If we touched the cut list, we assign the new cut position based on new cut position, this way
@@ -303,15 +303,15 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
/* Reduce adjacent cutting points of the same level, which saves memory. */
char min_occ = 127;
prev_rls = NULL;
- for (rls = rl->segments.first; rls; rls = next_rls) {
+ for (rls = e->segments.first; rls; rls = next_rls) {
next_rls = rls->next;
if (prev_rls && prev_rls->occlusion == rls->occlusion &&
prev_rls->transparency_mask == rls->transparency_mask) {
- BLI_remlink(&rl->segments, rls);
+ BLI_remlink(&e->segments, rls);
/* This puts the node back to the render buffer, if more cut happens, these unused nodes get
* picked first. */
- lineart_line_discard_segment(rb, rls);
+ lineart_discard_segment(rb, rls);
continue;
}
@@ -319,49 +319,49 @@ static void lineart_line_cut(LineartRenderBuffer *rb,
prev_rls = rls;
}
- rl->min_occ = min_occ;
+ e->min_occ = min_occ;
}
/* To see if given line is connected to an adjacent intersection line. */
-BLI_INLINE bool lineart_occlusion_is_adjacent_intersection(LineartLine *rl, LineartTriangle *rt)
+BLI_INLINE bool lineart_occlusion_is_adjacent_intersection(LineartEdge *e, LineartTriangle *rt)
{
- LineartVertIntersection *l = (void *)rl->l;
- LineartVertIntersection *r = (void *)rl->r;
- return ((l->base.flag && l->intersecting_with == (void *)rt) ||
- (r->base.flag && r->intersecting_with == (void *)rt));
+ LineartVertIntersection *v1 = (void *)e->v1;
+ LineartVertIntersection *v2 = (void *)e->v2;
+ return ((v1->base.flag && v1->intersecting_with == (void *)rt) ||
+ (v2->base.flag && v2->intersecting_with == (void *)rt));
}
-static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartLine *rl, int thread_id)
+static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartEdge *e, int thread_id)
{
- double x = rl->l->fbcoord[0], y = rl->l->fbcoord[1];
- LineartBoundingArea *ba = lineart_line_first_bounding_area(rb, rl);
+ double x = e->v1->fbcoord[0], y = e->v1->fbcoord[1];
+ LineartBoundingArea *ba = lineart_edge_first_bounding_area(rb, e);
LineartBoundingArea *nba = ba;
LineartTriangleThread *rt;
/* These values are used for marching along the line. */
double l, r;
- double k = (rl->r->fbcoord[1] - rl->l->fbcoord[1]) /
- (rl->r->fbcoord[0] - rl->l->fbcoord[0] + 1e-30);
- int positive_x = (rl->r->fbcoord[0] - rl->l->fbcoord[0]) > 0 ?
+ double k = (e->v2->fbcoord[1] - e->v1->fbcoord[1]) /
+ (e->v2->fbcoord[0] - e->v1->fbcoord[0] + 1e-30);
+ int positive_x = (e->v2->fbcoord[0] - e->v1->fbcoord[0]) > 0 ?
1 :
- (rl->r->fbcoord[0] == rl->l->fbcoord[0] ? 0 : -1);
- int positive_y = (rl->r->fbcoord[1] - rl->l->fbcoord[1]) > 0 ?
+ (e->v2->fbcoord[0] == e->v1->fbcoord[0] ? 0 : -1);
+ int positive_y = (e->v2->fbcoord[1] - e->v1->fbcoord[1]) > 0 ?
1 :
- (rl->r->fbcoord[1] == rl->l->fbcoord[1] ? 0 : -1);
+ (e->v2->fbcoord[1] == e->v1->fbcoord[1] ? 0 : -1);
while (nba) {
LISTBASE_FOREACH (LinkData *, lip, &nba->linked_triangles) {
rt = lip->data;
/* If we are already testing the line in this thread, then don't do it. */
- if (rt->testing[thread_id] == rl || (rt->base.flags & LRT_TRIANGLE_INTERSECTION_ONLY) ||
- lineart_occlusion_is_adjacent_intersection(rl, (LineartTriangle *)rt)) {
+ if (rt->testing_e[thread_id] == e || (rt->base.flags & LRT_TRIANGLE_INTERSECTION_ONLY) ||
+ lineart_occlusion_is_adjacent_intersection(e, (LineartTriangle *)rt)) {
continue;
}
- rt->testing[thread_id] = rl;
- if (lineart_triangle_line_image_space_occlusion(&rb->lock_task,
+ rt->testing_e[thread_id] = e;
+ if (lineart_triangle_edge_image_space_occlusion(&rb->lock_task,
(void *)rt,
- rl,
+ e,
rb->camera_pos,
rb->cam_is_persp,
rb->allow_overlapping_edges,
@@ -371,22 +371,22 @@ static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartLine *
rb->shift_y,
&l,
&r)) {
- lineart_line_cut(rb, rl, l, r, rt->base.transparency_mask);
- if (rl->min_occ > rb->max_occlusion_level) {
+ lineart_edge_cut(rb, e, l, r, rt->base.transparency_mask);
+ if (e->min_occ > rb->max_occlusion_level) {
/* No need to caluclate any longer on this line because no level more than set value is
* going to show up in the rendered result. */
return;
}
}
}
- /* Marching along rl->l to rl->r, searching each possible bounding areas it may touch. */
- nba = lineart_bounding_area_next(nba, rl, x, y, k, positive_x, positive_y, &x, &y);
+ /* Marching along e->v1 to e->v2, searching each possible bounding areas it may touch. */
+ nba = lineart_bounding_area_next(nba, e, x, y, k, positive_x, positive_y, &x, &y);
}
}
static int lineart_occlusion_make_task_info(LineartRenderBuffer *rb, LineartRenderTaskInfo *rti)
{
- LineartLine *data;
+ LineartEdge *data;
int i;
int res = 0;
@@ -396,7 +396,7 @@ static int lineart_occlusion_make_task_info(LineartRenderBuffer *rb, LineartRend
if (rb->name##_managed) { \
data = rb->name##_managed; \
rti->name = (void *)data; \
- for (i = 0; i < LRT_THREAD_LINE_COUNT && data; i++) { \
+ for (i = 0; i < LRT_THREAD_EDGE_COUNT && data; i++) { \
data = data->next; \
} \
rti->name##_end = data; \
@@ -423,28 +423,28 @@ static int lineart_occlusion_make_task_info(LineartRenderBuffer *rb, LineartRend
static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartRenderTaskInfo *rti)
{
LineartRenderBuffer *rb = rti->rb;
- LineartLine *lip;
+ LineartEdge *eip;
while (lineart_occlusion_make_task_info(rb, rti)) {
- for (lip = (void *)rti->contour; lip && lip != rti->contour_end; lip = lip->next) {
- lineart_occlusion_single_line(rb, lip, rti->thread_id);
+ for (eip = (void *)rti->contour; eip && eip != rti->contour_end; eip = eip->next) {
+ lineart_occlusion_single_line(rb, eip, rti->thread_id);
}
- for (lip = (void *)rti->crease; lip && lip != rti->crease_end; lip = lip->next) {
- lineart_occlusion_single_line(rb, lip, rti->thread_id);
+ for (eip = (void *)rti->crease; eip && eip != rti->crease_end; eip = eip->next) {
+ lineart_occlusion_single_line(rb, eip, rti->thread_id);
}
- for (lip = (void *)rti->intersection; lip && lip != rti->intersection_end; lip = lip->next) {
- lineart_occlusion_single_line(rb, lip, rti->thread_id);
+ for (eip = (void *)rti->intersection; eip && eip != rti->intersection_end; eip = eip->next) {
+ lineart_occlusion_single_line(rb, eip, rti->thread_id);
}
- for (lip = (void *)rti->material; lip && lip != rti->material_end; lip = lip->next) {
- lineart_occlusion_single_line(rb, lip, rti->thread_id);
+ for (eip = (void *)rti->material; eip && eip != rti->material_end; eip = eip->next) {
+ lineart_occlusion_single_line(rb, eip, rti->thread_id);
}
- for (lip = (void *)rti->edge_mark; lip && lip != rti->edge_mark_end; lip = lip->next) {
- lineart_occlusion_single_line(rb, lip, rti->thread_id);
+ for (eip = (void *)rti->edge_mark; eip && eip != rti->edge_mark_end; eip = eip->next) {
+ lineart_occlusion_single_line(rb, eip, rti->thread_id);
}
}
}
@@ -668,15 +668,15 @@ static LineartElementLinkNode *lineart_memory_get_vert_space(LineartRenderBuffer
return reln;
}
-static LineartElementLinkNode *lineart_memory_get_line_space(LineartRenderBuffer *rb)
+static LineartElementLinkNode *lineart_memory_get_edge_space(LineartRenderBuffer *rb)
{
LineartElementLinkNode *reln;
- LineartLine *render_lines = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLine) * 64);
+ LineartEdge *render_edges = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartEdge) * 64);
reln = lineart_list_append_pointer_pool_sized(&rb->line_buffer_pointers,
&rb->render_data_pool,
- render_lines,
+ render_edges,
sizeof(LineartElementLinkNode));
reln->element_count = 64;
reln->crease_threshold = rb->crease_threshold;
@@ -699,10 +699,10 @@ static void lineart_triangle_set_cull_flag(LineartTriangle *rt, unsigned char fl
rt->flags |= intersection_only;
}
-static bool lineart_line_match(LineartTriangle *rt, LineartLine *rl, int v1, int v2)
+static bool lineart_edge_match(LineartTriangle *rt, LineartEdge *e, int v1, int v2)
{
- return ((rt->v[v1] == rl->l && rt->v[v2] == rl->r) ||
- (rt->v[v2] == rl->l && rt->v[v1] == rl->r));
+ return ((rt->v[v1] == e->v1 && rt->v[v2] == e->v2) ||
+ (rt->v[v2] == e->v1 && rt->v[v1] == e->v2));
}
/* Does near-plane cut on 1 triangle only. When cutting with far-plane, the camera vectors gets
@@ -718,21 +718,21 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
double (*vp)[4],
Object *ob,
int *r_v_count,
- int *r_l_count,
+ int *r_e_count,
int *r_t_count,
- LineartElementLinkNode *veln,
- LineartElementLinkNode *leln,
- LineartElementLinkNode *teln)
+ LineartElementLinkNode *v_eln,
+ LineartElementLinkNode *e_eln,
+ LineartElementLinkNode *t_eln)
{
double vv1[3], vv2[3], dot1, dot2;
double a;
int v_count = *r_v_count;
- int l_count = *r_l_count;
+ int e_count = *r_e_count;
int t_count = *r_t_count;
- int l_obi, r_obi;
+ int v1_obi, v2_obi;
char new_flag = 0;
- LineartLine *new_rl, *rl, *old_rl;
+ LineartEdge *new_e, *e, *old_e;
LineartLineSegment *rls;
LineartTriangleAdjacent *rta;
@@ -744,57 +744,57 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
* lineart_geometry_object_load() for details. */
rta = (void *)rt->intersecting_verts;
- LineartVert *rv = &((LineartVert *)veln->pointer)[v_count];
- LineartTriangle *rt1 = (void *)(((unsigned char *)teln->pointer) + rb->triangle_size * t_count);
- LineartTriangle *rt2 = (void *)(((unsigned char *)teln->pointer) +
+ LineartVert *rv = &((LineartVert *)v_eln->pointer)[v_count];
+ LineartTriangle *rt1 = (void *)(((unsigned char *)t_eln->pointer) + rb->triangle_size * t_count);
+ LineartTriangle *rt2 = (void *)(((unsigned char *)t_eln->pointer) +
rb->triangle_size * (t_count + 1));
- new_rl = &((LineartLine *)leln->pointer)[l_count];
+ new_e = &((LineartEdge *)e_eln->pointer)[e_count];
/* Init rl to the last rl entry. */
- rl = new_rl;
+ e = new_e;
#define INCREASE_RL \
- l_count++; \
- l_obi = rl->l_obindex; \
- r_obi = rl->r_obindex; \
- new_rl = &((LineartLine *)leln->pointer)[l_count]; \
- rl = new_rl; \
- rl->l_obindex = l_obi; \
- rl->r_obindex = r_obi; \
+ e_count++; \
+ v1_obi = e->v1_obindex; \
+ v2_obi = e->v2_obindex; \
+ new_e = &((LineartEdge *)e_eln->pointer)[e_count]; \
+ e = new_e; \
+ e->v1_obindex = v1_obi; \
+ e->v2_obindex = v2_obi; \
rls = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLineSegment)); \
- BLI_addtail(&rl->segments, rls);
+ BLI_addtail(&e->segments, rls);
-#define SELECT_RL(rl_num, llink, rlink, newrt) \
- if (rta->rl[rl_num]) { \
- old_rl = rta->rl[rl_num]; \
- new_flag = old_rl->flags; \
- old_rl->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
+#define SELECT_RL(e_num, v1_link, v2_link, newrt) \
+ if (rta->e[e_num]) { \
+ old_e = rta->e[e_num]; \
+ new_flag = old_e->flags; \
+ old_e->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
INCREASE_RL \
- rl->l = (llink); \
- rl->r = (rlink); \
- rl->flags = new_flag; \
- rl->object_ref = ob; \
- rl->tl = ((old_rl->tl == rt) ? (newrt) : (old_rl->tl)); \
- rl->tr = ((old_rl->tr == rt) ? (newrt) : (old_rl->tr)); \
- lineart_add_line_to_list(rb, rl); \
+ e->v1 = (v1_link); \
+ e->v2 = (v2_link); \
+ e->flags = new_flag; \
+ e->object_ref = ob; \
+ e->t1 = ((old_e->t1 == rt) ? (newrt) : (old_e->t1)); \
+ e->t2 = ((old_e->t2 == rt) ? (newrt) : (old_e->t2)); \
+ lineart_add_edge_to_list(rb, e); \
}
-#define RELINK_RL(rl_num, newrt) \
- if (rta->rl[rl_num]) { \
- old_rl = rta->rl[rl_num]; \
- old_rl->tl = ((old_rl->tl == rt) ? (newrt) : (old_rl->tl)); \
- old_rl->tr = ((old_rl->tr == rt) ? (newrt) : (old_rl->tr)); \
+#define RELINK_RL(e_num, newrt) \
+ if (rta->e[e_num]) { \
+ old_e = rta->e[e_num]; \
+ old_e->t1 = ((old_e->t1 == rt) ? (newrt) : (old_e->t1)); \
+ old_e->t2 = ((old_e->t2 == rt) ? (newrt) : (old_e->t2)); \
}
#define REMOVE_TRIANGLE_RL \
- if (rta->rl[0]) { \
- rta->rl[0]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
+ if (rta->e[0]) { \
+ rta->e[0]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
} \
- if (rta->rl[1]) { \
- rta->rl[1]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
+ if (rta->e[1]) { \
+ rta->e[1]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
} \
- if (rta->rl[2]) { \
- rta->rl[2]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
+ if (rta->e[2]) { \
+ rta->e[2]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \
}
switch (in0 + in1 + in2) {
@@ -854,19 +854,19 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
/* New line connecting two new points. */
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- /* Note: inverting rl->l/r (left/right point) doesn't matter as long as
+ /* Note: inverting e->v1/v2 (left/right point) doesn't matter as long as
* rt->rl and rt->v has the same sequence. and the winding direction
* can be either CW or CCW but needs to be consistent throughout the calculation.
*/
- rl->l = &rv[1];
- rl->r = &rv[0];
+ e->v1 = &rv[1];
+ e->v2 = &rv[0];
/* Only one adjacent triangle, because the other side is the near plane. */
/* Use tl or tr doesn't matter. */
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->t1 = rt1;
+ e->object_ref = ob;
/* New line connecting original point 0 and a new point, only when it's a selected line. */
SELECT_RL(2, rt->v[0], &rv[0], rt1)
@@ -904,13 +904,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- rl->l = &rv[0];
- rl->r = &rv[1];
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->v1 = &rv[0];
+ e->v2 = &rv[1];
+ e->t1 = rt1;
+ e->object_ref = ob;
SELECT_RL(2, rt->v[2], &rv[0], rt1)
SELECT_RL(1, rt->v[2], &rv[1], rt1)
@@ -945,13 +945,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- rl->l = &rv[1];
- rl->r = &rv[0];
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->v1 = &rv[1];
+ e->v2 = &rv[0];
+ e->t1 = rt1;
+ e->object_ref = ob;
SELECT_RL(1, rt->v[1], &rv[0], rt1)
SELECT_RL(0, rt->v[1], &rv[1], rt1)
@@ -1017,13 +1017,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
/* New line connects two new points. */
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- rl->l = &rv[1];
- rl->r = &rv[0];
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->v1 = &rv[1];
+ e->v2 = &rv[0];
+ e->t1 = rt1;
+ e->object_ref = ob;
/* New line connects new point 0 and old point 1,
* this is a border line.
@@ -1070,13 +1070,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- rl->l = &rv[1];
- rl->r = &rv[0];
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->v1 = &rv[1];
+ e->v2 = &rv[0];
+ e->t1 = rt1;
+ e->object_ref = ob;
SELECT_RL(1, rt->v[2], &rv[0], rt1)
SELECT_RL(0, rt->v[0], &rv[1], rt2)
@@ -1118,13 +1118,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
INCREASE_RL
if (allow_boundaries) {
- rl->flags = LRT_EDGE_FLAG_CONTOUR;
- lineart_prepend_line_direct(&rb->contours, rl);
+ e->flags = LRT_EDGE_FLAG_CONTOUR;
+ lineart_prepend_edge_direct(&rb->contours, e);
}
- rl->l = &rv[1];
- rl->r = &rv[0];
- rl->tl = rt1;
- rl->object_ref = ob;
+ e->v1 = &rv[1];
+ e->v2 = &rv[0];
+ e->t1 = rt1;
+ e->object_ref = ob;
SELECT_RL(2, rt->v[0], &rv[0], rt1)
SELECT_RL(1, rt->v[1], &rv[1], rt2)
@@ -1147,7 +1147,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
break;
}
*r_v_count = v_count;
- *r_l_count = l_count;
+ *r_e_count = e_count;
*r_t_count = t_count;
#undef INCREASE_RL
@@ -1164,10 +1164,10 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
static void lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far)
{
LineartTriangle *rt;
- LineartElementLinkNode *veln, *teln, *leln;
+ LineartElementLinkNode *v_eln, *t_eln, *e_eln;
double(*vp)[4] = rb->view_projection;
int i;
- int v_count = 0, t_count = 0, l_count = 0;
+ int v_count = 0, t_count = 0, e_count = 0;
Object *ob;
bool allow_boundaries = rb->allow_boundaries;
double cam_pos[3];
@@ -1192,26 +1192,26 @@ static void lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far)
add_v3_v3_db(cam_pos, clip_advance);
}
- veln = lineart_memory_get_vert_space(rb);
- teln = lineart_memory_get_triangle_space(rb);
- leln = lineart_memory_get_line_space(rb);
+ v_eln = lineart_memory_get_vert_space(rb);
+ t_eln = lineart_memory_get_triangle_space(rb);
+ e_eln = lineart_memory_get_edge_space(rb);
/* Additional memory space for storing generated points and triangles. */
#define LRT_CULL_ENSURE_MEMORY \
if (v_count > 60) { \
- veln->element_count = v_count; \
- veln = lineart_memory_get_vert_space(rb); \
+ v_eln->element_count = v_count; \
+ v_eln = lineart_memory_get_vert_space(rb); \
v_count = 0; \
} \
if (t_count > 60) { \
- teln->element_count = t_count; \
- teln = lineart_memory_get_triangle_space(rb); \
+ t_eln->element_count = t_count; \
+ t_eln = lineart_memory_get_triangle_space(rb); \
t_count = 0; \
} \
- if (l_count > 60) { \
- leln->element_count = l_count; \
- leln = lineart_memory_get_line_space(rb); \
- l_count = 0; \
+ if (e_count > 60) { \
+ e_eln->element_count = e_count; \
+ e_eln = lineart_memory_get_edge_space(rb); \
+ e_count = 0; \
}
#define LRT_CULL_DECIDE_INSIDE \
@@ -1274,14 +1274,14 @@ static void lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far)
vp,
ob,
&v_count,
- &l_count,
+ &e_count,
&t_count,
- veln,
- leln,
- teln);
+ v_eln,
+ e_eln,
+ t_eln);
}
- teln->element_count = t_count;
- veln->element_count = v_count;
+ t_eln->element_count = t_count;
+ v_eln->element_count = v_count;
}
#undef LRT_CULL_ENSURE_MEMORY
@@ -1421,39 +1421,39 @@ static char lineart_identify_feature_line(LineartRenderBuffer *rb,
return 0;
}
-static void lineart_add_line_to_list(LineartRenderBuffer *rb, LineartLine *rl)
+static void lineart_add_edge_to_list(LineartRenderBuffer *rb, LineartEdge *e)
{
- switch (rl->flags) {
+ switch (e->flags) {
case LRT_EDGE_FLAG_CONTOUR:
- lineart_prepend_line_direct(&rb->contours, rl);
+ lineart_prepend_edge_direct(&rb->contours, e);
break;
case LRT_EDGE_FLAG_CREASE:
- lineart_prepend_line_direct(&rb->crease_lines, rl);
+ lineart_prepend_edge_direct(&rb->crease_lines, e);
break;
case LRT_EDGE_FLAG_MATERIAL:
- lineart_prepend_line_direct(&rb->material_lines, rl);
+ lineart_prepend_edge_direct(&rb->material_lines, e);
break;
case LRT_EDGE_FLAG_EDGE_MARK:
- lineart_prepend_line_direct(&rb->edge_marks, rl);
+ lineart_prepend_edge_direct(&rb->edge_marks, e);
break;
case LRT_EDGE_FLAG_INTERSECTION:
- lineart_prepend_line_direct(&rb->intersection_lines, rl);
+ lineart_prepend_edge_direct(&rb->intersection_lines, e);
break;
}
}
static void lineart_triangle_adjacent_assign(LineartTriangle *rt,
LineartTriangleAdjacent *rta,
- LineartLine *rl)
+ LineartEdge *e)
{
- if (lineart_line_match(rt, rl, 0, 1)) {
- rta->rl[0] = rl;
+ if (lineart_edge_match(rt, e, 0, 1)) {
+ rta->e[0] = e;
}
- else if (lineart_line_match(rt, rl, 1, 2)) {
- rta->rl[1] = rl;
+ else if (lineart_edge_match(rt, e, 1, 2)) {
+ rta->e[1] = e;
}
- else if (lineart_line_match(rt, rl, 2, 0)) {
- rta->rl[2] = rl;
+ else if (lineart_edge_match(rt, e, 2, 0)) {
+ rta->e[2] = e;
}
}
@@ -1470,14 +1470,14 @@ static void lineart_geometry_object_load(Depsgraph *dg,
BMFace *f;
BMEdge *e;
BMLoop *loop;
- LineartLine *rl;
+ LineartEdge *la_e;
LineartTriangle *rt;
LineartTriangleAdjacent *orta;
double new_mvp[4][4], new_mv[4][4], normal[4][4];
float imat[4][4];
LineartElementLinkNode *reln;
LineartVert *orv;
- LineartLine *orl;
+ LineartEdge *o_la_e;
LineartTriangle *ort;
Object *orig_ob;
int CanFindFreestyle = 0;
@@ -1653,7 +1653,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
/* Use BM_ELEM_TAG in f->head.hflag to store needed faces in the first iteration. */
- int allocate_rl = 0;
+ int allocate_la_e = 0;
for (i = 0; i < bm->totedge; i++) {
e = BM_edge_at_index(bm, i);
@@ -1662,7 +1662,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
rb, e, ort, orv, use_crease, ob->type == OB_FONT, CanFindFreestyle, bm);
if (eflag) {
/* Only allocate for feature lines (instead of all lines) to save memory. */
- allocate_rl++;
+ allocate_la_e++;
}
/* Here we just use bm's flag for when loading actual lines, then we don't need to call
* lineart_identify_feature_line() again, e->head.hflag deleted after loading anyway. Always
@@ -1670,13 +1670,13 @@ static void lineart_geometry_object_load(Depsgraph *dg,
e->head.hflag = eflag;
}
- orl = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLine) * allocate_rl);
+ o_la_e = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartEdge) * allocate_la_e);
reln = lineart_list_append_pointer_pool_sized(
- &rb->line_buffer_pointers, &rb->render_data_pool, orl, sizeof(LineartElementLinkNode));
- reln->element_count = allocate_rl;
+ &rb->line_buffer_pointers, &rb->render_data_pool, o_la_e, sizeof(LineartElementLinkNode));
+ reln->element_count = allocate_la_e;
reln->object_ref = orig_ob;
- rl = orl;
+ la_e = o_la_e;
for (i = 0; i < bm->totedge; i++) {
e = BM_edge_at_index(bm, i);
@@ -1685,32 +1685,32 @@ static void lineart_geometry_object_load(Depsgraph *dg,
continue;
}
- rl->l = &orv[BM_elem_index_get(e->v1)];
- rl->r = &orv[BM_elem_index_get(e->v2)];
- rl->l_obindex = rl->l->index - global_i;
- rl->r_obindex = rl->r->index - global_i;
+ la_e->v1 = &orv[BM_elem_index_get(e->v1)];
+ la_e->v2 = &orv[BM_elem_index_get(e->v2)];
+ la_e->v1_obindex = la_e->v1->index - global_i;
+ la_e->v2_obindex = la_e->v2->index - global_i;
if (e->l) {
int findex = BM_elem_index_get(e->l->f);
- rl->tl = lineart_triangle_from_index(rb, ort, findex);
- lineart_triangle_adjacent_assign(rl->tl, &orta[findex], rl);
+ la_e->t1 = lineart_triangle_from_index(rb, ort, findex);
+ lineart_triangle_adjacent_assign(la_e->t1, &orta[findex], la_e);
if (e->l->radial_next && e->l->radial_next != e->l) {
findex = BM_elem_index_get(e->l->radial_next->f);
- rl->tr = lineart_triangle_from_index(rb, ort, findex);
- lineart_triangle_adjacent_assign(rl->tr, &orta[findex], rl);
+ la_e->t2 = lineart_triangle_from_index(rb, ort, findex);
+ lineart_triangle_adjacent_assign(la_e->t2, &orta[findex], la_e);
}
}
- rl->flags = e->head.hflag;
- rl->object_ref = orig_ob;
+ la_e->flags = e->head.hflag;
+ la_e->object_ref = orig_ob;
LineartLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool,
sizeof(LineartLineSegment));
- BLI_addtail(&rl->segments, rls);
+ BLI_addtail(&la_e->segments, rls);
if (usage == OBJECT_LRT_INHERENT || usage == OBJECT_LRT_INCLUDE ||
usage == OBJECT_LRT_NO_INTERSECTION) {
- lineart_add_line_to_list(rb, rl);
+ lineart_add_edge_to_list(rb, la_e);
}
- rl++;
+ la_e++;
}
LRT_MESH_FINISH
@@ -1846,11 +1846,11 @@ static bool lineart_triangle_get_other_verts(const LineartTriangle *rt,
}
static bool lineart_edge_from_triangle(const LineartTriangle *rt,
- const LineartLine *rl,
+ const LineartEdge *e,
bool allow_overlapping_edges)
{
/* Normally we just determine from the pointer address. */
- if (rl->tl == rt || rl->tr == rt) {
+ if (e->t1 == rt || e->t2 == rt) {
return true;
}
/* If allows overlapping, then we compare the vertex coordinates one by one to determine if one
@@ -1863,10 +1863,10 @@ static bool lineart_edge_from_triangle(const LineartTriangle *rt,
(LRT_DOUBLE_CLOSE_ENOUGH(rt->v[i]->gloc[0], pt->gloc[0]) && \
LRT_DOUBLE_CLOSE_ENOUGH(rt->v[i]->gloc[1], pt->gloc[1]) && \
LRT_DOUBLE_CLOSE_ENOUGH(rt->v[i]->gloc[2], pt->gloc[2])))
- if ((LRT_TRI_SAME_POINT(rt, 0, rl->l) || LRT_TRI_SAME_POINT(rt, 1, rl->l) ||
- LRT_TRI_SAME_POINT(rt, 2, rl->l)) &&
- (LRT_TRI_SAME_POINT(rt, 0, rl->r) || LRT_TRI_SAME_POINT(rt, 1, rl->r) ||
- LRT_TRI_SAME_POINT(rt, 2, rl->r))) {
+ if ((LRT_TRI_SAME_POINT(rt, 0, e->v1) || LRT_TRI_SAME_POINT(rt, 1, e->v1) ||
+ LRT_TRI_SAME_POINT(rt, 2, e->v1)) &&
+ (LRT_TRI_SAME_POINT(rt, 0, e->v2) || LRT_TRI_SAME_POINT(rt, 1, e->v2) ||
+ LRT_TRI_SAME_POINT(rt, 2, e->v2))) {
return true;
}
#undef LRT_TRI_SAME_POINT
@@ -1904,11 +1904,11 @@ static bool lineart_edge_from_triangle(const LineartTriangle *rt,
/* This is the main function to calculate
* the occlusion status between 1(one) triangle and 1(one) line.
* if returns true, then from/to will carry the occludded segments
- * in ratio from rl->l to rl->r. The line is later cut with these two values.
+ * in ratio from e->v1 to e->v2. The line is later cut with these two values.
*/
-static bool lineart_triangle_line_image_space_occlusion(SpinLock *UNUSED(spl),
+static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
const LineartTriangle *rt,
- const LineartLine *rl,
+ const LineartEdge *e,
const double *override_camera_loc,
const bool override_cam_is_persp,
const bool allow_overlapping_edges,
@@ -1934,7 +1934,7 @@ static bool lineart_triangle_line_image_space_occlusion(SpinLock *UNUSED(spl),
double gloc[4], trans[4];
double cut = -1;
- double *LFBC = rl->l->fbcoord, *RFBC = rl->r->fbcoord, *FBC0 = rt->v[0]->fbcoord,
+ double *LFBC = e->v1->fbcoord, *RFBC = e->v2->fbcoord, *FBC0 = rt->v[0]->fbcoord,
*FBC1 = rt->v[1]->fbcoord, *FBC2 = rt->v[2]->fbcoord;
/* Overlapping not possible, return early. */
@@ -1947,7 +1947,7 @@ static bool lineart_triangle_line_image_space_occlusion(SpinLock *UNUSED(spl),
}
/* If the the line is one of the edge in the triangle, then it's not occludded. */
- if (lineart_edge_from_triangle(rt, rl, allow_overlapping_edges)) {
+ if (lineart_edge_from_triangle(rt, e, allow_overlapping_edges)) {
return false;
}
@@ -1959,8 +1959,8 @@ static bool lineart_triangle_line_image_space_occlusion(SpinLock *UNUSED(spl),
/* Sort the intersection distance. */
INTERSECT_SORT_MIN_TO_MAX_3(is[0], is[1], is[2], order);
- sub_v3_v3v3_db(Lv, rl->l->gloc, rt->v[0]->gloc);
- sub_v3_v3v3_db(Rv, rl->r->gloc, rt->v[0]->gloc);
+ sub_v3_v3v3_db(Lv, e->v1->gloc, rt->v[0]->gloc);
+ sub_v3_v3v3_db(Rv, e->v2->gloc, rt->v[0]->gloc);
copy_v3_v3_db(Cv, camera_dir);
@@ -2017,22 +2017,22 @@ static bool lineart_triangle_line_image_space_occlusion(SpinLock *UNUSED(spl),
/* Transform the cut from geometry space to image space. */
if (override_cam_is_persp) {
- interp_v3_v3v3_db(gloc, rl->l->gloc, rl->r->gloc, cut);
+ interp_v3_v3v3_db(gloc, e->v1->gloc, e->v2->gloc, cut);
mul_v4_m4v3_db(trans, vp, gloc);
mul_v3db_db(trans, (1 / trans[3]));
}
else {
- interp_v3_v3v3_db(trans, rl->l->fbcoord, rl->r->fbcoord, cut);
+ interp_v3_v3v3_db(trans, e->v1->fbcoord, e->v2->fbcoord, cut);
}
trans[0] -= cam_shift_x * 2;
trans[1] -= cam_shift_y * 2;
/* To accomodate k=0 and k=inf (vertical) lines. here the cut is in image space. */
- if (fabs(rl->l->fbcoord[0] - rl->r->fbcoord[0]) > fabs(rl->l->fbcoord[1] - rl->r->fbcoord[1])) {
- cut = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], trans[0]);
+ if (fabs(e->v1->fbcoord[0] - e->v2->fbcoord[0]) > fabs(e->v1->fbcoord[1] - e->v2->fbcoord[1])) {
+ cut = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], trans[0]);
}
else {
- cut = ratiod(rl->l->fbcoord[1], rl->r->fbcoord[1], trans[1]);
+ cut = ratiod(e->v1->fbcoord[1], e->v2->fbcoord[1], trans[1]);
}
/* Determine the pair of edges that the line has crossed. */
@@ -2295,13 +2295,13 @@ static LineartVert *lineart_triangle_2v_intersection_test(LineartRenderBuffer *r
}
/* Test if two triangles intersect. Generates one intersection line if the check succeeds */
-static LineartLine *lineart_triangle_intersect(LineartRenderBuffer *rb,
+static LineartEdge *lineart_triangle_intersect(LineartRenderBuffer *rb,
LineartTriangle *rt,
LineartTriangle *testing)
{
- LineartVert *l = 0, *r = 0;
- LineartVert **next = &l;
- LineartLine *result;
+ LineartVert *v1 = 0, *v2 = 0;
+ LineartVert **next = &v1;
+ LineartEdge *result;
LineartVert *E0T = 0;
LineartVert *E1T = 0;
LineartVert *E2T = 0;
@@ -2324,18 +2324,18 @@ static LineartLine *lineart_triangle_intersect(LineartRenderBuffer *rb,
LineartVert *new_share;
lineart_triangle_get_other_verts(rt, share, &sv1, &sv2);
- l = new_share = lineart_mem_aquire(&rb->render_data_pool, (sizeof(LineartVertIntersection)));
+ v1 = new_share = lineart_mem_aquire(&rb->render_data_pool, (sizeof(LineartVertIntersection)));
new_share->flag = LRT_VERT_HAS_INTERSECTION_DATA;
copy_v3_v3_db(new_share->gloc, share->gloc);
- r = lineart_triangle_2v_intersection_test(rb, sv1, sv2, rt, testing, 0);
+ v2 = lineart_triangle_2v_intersection_test(rb, sv1, sv2, rt, testing, 0);
- if (r == NULL) {
+ if (v2 == NULL) {
lineart_triangle_get_other_verts(testing, share, &sv1, &sv2);
- r = lineart_triangle_2v_intersection_test(rb, sv1, sv2, testing, rt, 0);
- if (r == NULL) {
+ v2 = lineart_triangle_2v_intersection_test(rb, sv1, sv2, testing, rt, 0);
+ if (v2 == NULL) {
return 0;
}
lineart_prepend_pool(&testing->intersecting_verts, &rb->render_data_pool, new_share);
@@ -2351,49 +2351,49 @@ static LineartLine *lineart_triangle_intersect(LineartRenderBuffer *rb,
if (E0T && (!(*next))) {
(*next) = E0T;
lineart_vert_set_intersection_2v((*next), rt->v[0], rt->v[1]);
- next = &r;
+ next = &v2;
}
- E1T = lineart_triangle_2v_intersection_test(rb, rt->v[1], rt->v[2], rt, testing, l);
+ E1T = lineart_triangle_2v_intersection_test(rb, rt->v[1], rt->v[2], rt, testing, v1);
if (E1T && (!(*next))) {
(*next) = E1T;
lineart_vert_set_intersection_2v((*next), rt->v[1], rt->v[2]);
- next = &r;
+ next = &v2;
}
if (!(*next)) {
- E2T = lineart_triangle_2v_intersection_test(rb, rt->v[2], rt->v[0], rt, testing, l);
+ E2T = lineart_triangle_2v_intersection_test(rb, rt->v[2], rt->v[0], rt, testing, v1);
}
if (E2T && (!(*next))) {
(*next) = E2T;
lineart_vert_set_intersection_2v((*next), rt->v[2], rt->v[0]);
- next = &r;
+ next = &v2;
}
if (!(*next)) {
TE0 = lineart_triangle_2v_intersection_test(
- rb, testing->v[0], testing->v[1], testing, rt, l);
+ rb, testing->v[0], testing->v[1], testing, rt, v1);
}
if (TE0 && (!(*next))) {
(*next) = TE0;
lineart_vert_set_intersection_2v((*next), testing->v[0], testing->v[1]);
- next = &r;
+ next = &v2;
}
if (!(*next)) {
TE1 = lineart_triangle_2v_intersection_test(
- rb, testing->v[1], testing->v[2], testing, rt, l);
+ rb, testing->v[1], testing->v[2], testing, rt, v1);
}
if (TE1 && (!(*next))) {
(*next) = TE1;
lineart_vert_set_intersection_2v((*next), testing->v[1], testing->v[2]);
- next = &r;
+ next = &v2;
}
if (!(*next)) {
TE2 = lineart_triangle_2v_intersection_test(
- rb, testing->v[2], testing->v[0], testing, rt, l);
+ rb, testing->v[2], testing->v[0], testing, rt, v1);
}
if (TE2 && (!(*next))) {
(*next) = TE2;
lineart_vert_set_intersection_2v((*next), testing->v[2], testing->v[0]);
- next = &r;
+ next = &v2;
}
if (!(*next)) {
@@ -2403,39 +2403,39 @@ static LineartLine *lineart_triangle_intersect(LineartRenderBuffer *rb,
/* The intersection line has been generated only in geometry space, so we need to transform them
* as well. */
- mul_v4_m4v3_db(l->fbcoord, rb->view_projection, l->gloc);
- mul_v4_m4v3_db(r->fbcoord, rb->view_projection, r->gloc);
- mul_v3db_db(l->fbcoord, (1 / l->fbcoord[3]));
- mul_v3db_db(r->fbcoord, (1 / r->fbcoord[3]));
+ mul_v4_m4v3_db(v1->fbcoord, rb->view_projection, v1->gloc);
+ mul_v4_m4v3_db(v2->fbcoord, rb->view_projection, v2->gloc);
+ mul_v3db_db(v1->fbcoord, (1 / v1->fbcoord[3]));
+ mul_v3db_db(v2->fbcoord, (1 / v2->fbcoord[3]));
- l->fbcoord[0] -= rb->shift_x * 2;
- l->fbcoord[1] -= rb->shift_y * 2;
- r->fbcoord[0] -= rb->shift_x * 2;
- r->fbcoord[1] -= rb->shift_y * 2;
+ v1->fbcoord[0] -= rb->shift_x * 2;
+ v1->fbcoord[1] -= rb->shift_y * 2;
+ v2->fbcoord[0] -= rb->shift_x * 2;
+ v2->fbcoord[1] -= rb->shift_y * 2;
/* This z transformation is not the same as the rest of the part, because the data don't go
* through normal perspective division calls in the pipeline, but this way the 3D result and
* occlution on the generated line is correct, and we don't really use 2D for viewport stroke
* generation anyway.*/
- l->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(l->fbcoord[2]) * (ZMax - ZMin));
- r->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(r->fbcoord[2]) * (ZMax - ZMin));
+ v1->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(v1->fbcoord[2]) * (ZMax - ZMin));
+ v2->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(v2->fbcoord[2]) * (ZMax - ZMin));
- ((LineartVertIntersection *)l)->intersecting_with = rt;
- ((LineartVertIntersection *)r)->intersecting_with = testing;
+ ((LineartVertIntersection *)v1)->intersecting_with = rt;
+ ((LineartVertIntersection *)v2)->intersecting_with = testing;
- result = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLine));
- result->l = l;
- result->r = r;
- result->tl = rt;
- result->tr = testing;
+ result = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartEdge));
+ result->v1 = v1;
+ result->v2 = v2;
+ result->t1 = rt;
+ result->t2 = testing;
LineartLineSegment *rls = lineart_mem_aquire(&rb->render_data_pool, sizeof(LineartLineSegment));
BLI_addtail(&result->segments, rls);
/* Don't need to OR flags right now, just a type mark. */
result->flags = LRT_EDGE_FLAG_INTERSECTION;
- lineart_prepend_line_direct(&rb->intersection_lines, result);
+ lineart_prepend_edge_direct(&rb->intersection_lines, result);
int r1, r2, c1, c2, row, col;
- if (lineart_get_line_bounding_areas(rb, result, &r1, &r2, &c1, &c2)) {
+ if (lineart_get_edge_bounding_areas(rb, result, &r1, &r2, &c1, &c2)) {
for (row = r1; row != r2 + 1; row++) {
for (col = c1; col != c2 + 1; col++) {
lineart_bounding_area_link_line(
@@ -2476,7 +2476,7 @@ static void lineart_triangle_intersect_in_bounding_area(LineartRenderBuffer *rb,
testing_triangle = lip->data;
rtt = (LineartTriangleThread *)testing_triangle;
- if (testing_triangle == rt || rtt->testing[0] == (LineartLine *)rt ||
+ if (testing_triangle == rt || rtt->testing_e[0] == (LineartEdge *)rt ||
(testing_triangle->flags & LRT_TRIANGLE_NO_INTERSECTION) ||
((testing_triangle->flags & LRT_TRIANGLE_INTERSECTION_ONLY) &&
(rt->flags & LRT_TRIANGLE_INTERSECTION_ONLY)) ||
@@ -2484,7 +2484,7 @@ static void lineart_triangle_intersect_in_bounding_area(LineartRenderBuffer *rb,
continue;
}
- rtt->testing[0] = (LineartLine *)rt;
+ rtt->testing_e[0] = (LineartEdge *)rt;
double *RG0 = testing_triangle->v[0]->gloc, *RG1 = testing_triangle->v[1]->gloc,
*RG2 = testing_triangle->v[2]->gloc;
@@ -2619,11 +2619,11 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene,
/* See lineart_edge_from_triangle() for how this option may impact performance. */
rb->allow_overlapping_edges = (lmd->calculation_flags & LRT_ALLOW_OVERLAPPING_EDGES) != 0;
- rb->use_contour = (lmd->line_types & LRT_EDGE_FLAG_CONTOUR) != 0;
- rb->use_crease = (lmd->line_types & LRT_EDGE_FLAG_CREASE) != 0;
- rb->use_material = (lmd->line_types & LRT_EDGE_FLAG_MATERIAL) != 0;
- rb->use_edge_marks = (lmd->line_types & LRT_EDGE_FLAG_EDGE_MARK) != 0;
- rb->use_intersections = (lmd->line_types & LRT_EDGE_FLAG_INTERSECTION) != 0;
+ rb->use_contour = (lmd->edge_types & LRT_EDGE_FLAG_CONTOUR) != 0;
+ rb->use_crease = (lmd->edge_types & LRT_EDGE_FLAG_CREASE) != 0;
+ rb->use_material = (lmd->edge_types & LRT_EDGE_FLAG_MATERIAL) != 0;
+ rb->use_edge_marks = (lmd->edge_types & LRT_EDGE_FLAG_EDGE_MARK) != 0;
+ rb->use_intersections = (lmd->edge_types & LRT_EDGE_FLAG_INTERSECTION) != 0;
BLI_spin_init(&rb->lock_task);
BLI_spin_init(&rb->lock_cuts);
@@ -2637,7 +2637,7 @@ static int lineart_triangle_size_get(const Scene *scene, LineartRenderBuffer *rb
if (rb->thread_count == 0) {
rb->thread_count = BKE_render_num_threads(&scene->r);
}
- return sizeof(LineartTriangle) + (sizeof(LineartLine *) * (rb->thread_count));
+ return sizeof(LineartTriangle) + (sizeof(LineartEdge *) * (rb->thread_count));
}
static void lineart_main_bounding_area_make_initial(LineartRenderBuffer *rb)
@@ -2854,7 +2854,7 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb,
LineartBoundingArea *ba = lineart_mem_aquire(&rb->render_data_pool,
sizeof(LineartBoundingArea) * 4);
LineartTriangle *rt;
- LineartLine *rl;
+ LineartEdge *e;
ba[0].l = root->cx;
ba[0].r = root->r;
@@ -2909,8 +2909,8 @@ static void lineart_bounding_area_split(LineartRenderBuffer *rb,
}
}
- while ((rl = lineart_list_pop_pointer_no_free(&root->linked_lines)) != NULL) {
- lineart_bounding_area_link_line(rb, root, rl);
+ while ((e = lineart_list_pop_pointer_no_free(&root->linked_lines)) != NULL) {
+ lineart_bounding_area_link_line(rb, root, e);
}
rb->bounding_area_count += 3;
@@ -3052,27 +3052,27 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
static void lineart_bounding_area_link_line(LineartRenderBuffer *rb,
LineartBoundingArea *root_ba,
- LineartLine *rl)
+ LineartEdge *e)
{
if (root_ba->child == NULL) {
- lineart_list_append_pointer_pool(&root_ba->linked_lines, &rb->render_data_pool, rl);
+ lineart_list_append_pointer_pool(&root_ba->linked_lines, &rb->render_data_pool, e);
}
else {
if (lineart_bounding_area_line_intersect(
- rb, rl->l->fbcoord, rl->r->fbcoord, &root_ba->child[0])) {
- lineart_bounding_area_link_line(rb, &root_ba->child[0], rl);
+ rb, e->v1->fbcoord, e->v2->fbcoord, &root_ba->child[0])) {
+ lineart_bounding_area_link_line(rb, &root_ba->child[0], e);
}
if (lineart_bounding_area_line_intersect(
- rb, rl->l->fbcoord, rl->r->fbcoord, &root_ba->child[1])) {
- lineart_bounding_area_link_line(rb, &root_ba->child[1], rl);
+ rb, e->v1->fbcoord, e->v2->fbcoord, &root_ba->child[1])) {
+ lineart_bounding_area_link_line(rb, &root_ba->child[1], e);
}
if (lineart_bounding_area_line_intersect(
- rb, rl->l->fbcoord, rl->r->fbcoord, &root_ba->child[2])) {
- lineart_bounding_area_link_line(rb, &root_ba->child[2], rl);
+ rb, e->v1->fbcoord, e->v2->fbcoord, &root_ba->child[2])) {
+ lineart_bounding_area_link_line(rb, &root_ba->child[2], e);
}
if (lineart_bounding_area_line_intersect(
- rb, rl->l->fbcoord, rl->r->fbcoord, &root_ba->child[3])) {
- lineart_bounding_area_link_line(rb, &root_ba->child[3], rl);
+ rb, e->v1->fbcoord, e->v2->fbcoord, &root_ba->child[3])) {
+ lineart_bounding_area_link_line(rb, &root_ba->child[3], e);
}
}
}
@@ -3083,11 +3083,11 @@ static void lineart_main_link_lines(LineartRenderBuffer *rb)
LRT_ITER_ALL_LINES_BEGIN
{
int r1, r2, c1, c2, row, col;
- if (lineart_get_line_bounding_areas(rb, rl, &r1, &r2, &c1, &c2)) {
+ if (lineart_get_edge_bounding_areas(rb, e, &r1, &r2, &c1, &c2)) {
for (row = r1; row != r2 + 1; row++) {
for (col = c1; col != c2 + 1; col++) {
lineart_bounding_area_link_line(
- rb, &rb->initial_bounding_areas[row * LRT_BA_ROWS + col], rl);
+ rb, &rb->initial_bounding_areas[row * LRT_BA_ROWS + col], e);
}
}
}
@@ -3139,8 +3139,8 @@ static bool lineart_get_triangle_bounding_areas(LineartRenderBuffer *rb,
return true;
}
-static bool lineart_get_line_bounding_areas(LineartRenderBuffer *rb,
- LineartLine *rl,
+static bool lineart_get_edge_bounding_areas(LineartRenderBuffer *rb,
+ LineartEdge *e,
int *rowbegin,
int *rowend,
int *colbegin,
@@ -3149,18 +3149,18 @@ static bool lineart_get_line_bounding_areas(LineartRenderBuffer *rb,
double sp_w = rb->width_per_tile, sp_h = rb->height_per_tile;
double b[4];
- if (!rl->l || !rl->r) {
+ if (!e->v1 || !e->v2) {
return false;
}
- if (rl->l->fbcoord[0] != rl->l->fbcoord[0] || rl->r->fbcoord[0] != rl->r->fbcoord[0]) {
+ if (e->v1->fbcoord[0] != e->v1->fbcoord[0] || e->v2->fbcoord[0] != e->v2->fbcoord[0]) {
return false;
}
- b[0] = MIN2(rl->l->fbcoord[0], rl->r->fbcoord[0]);
- b[1] = MAX2(rl->l->fbcoord[0], rl->r->fbcoord[0]);
- b[2] = MIN2(rl->l->fbcoord[1], rl->r->fbcoord[1]);
- b[3] = MAX2(rl->l->fbcoord[1], rl->r->fbcoord[1]);
+ b[0] = MIN2(e->v1->fbcoord[0], e->v2->fbcoord[0]);
+ b[1] = MAX2(e->v1->fbcoord[0], e->v2->fbcoord[0]);
+ b[2] = MIN2(e->v1->fbcoord[1], e->v2->fbcoord[1]);
+ b[3] = MAX2(e->v1->fbcoord[1], e->v2->fbcoord[1]);
if (b[0] > 1 || b[1] < -1 || b[2] > 1 || b[3] < -1) {
return false;
@@ -3305,12 +3305,12 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb)
}
}
-/* This function gets the tile for the point rl->l, and later use lineart_bounding_area_next() to
+/* This function gets the tile for the point e->v1, and later use lineart_bounding_area_next() to
* get next along the way. */
-static LineartBoundingArea *lineart_line_first_bounding_area(LineartRenderBuffer *rb,
- LineartLine *rl)
+static LineartBoundingArea *lineart_edge_first_bounding_area(LineartRenderBuffer *rb,
+ LineartEdge *e)
{
- double data[2] = {rl->l->fbcoord[0], rl->l->fbcoord[1]};
+ double data[2] = {e->v1->fbcoord[0], e->v1->fbcoord[1]};
double LU[2] = {-1, 1}, RU[2] = {1, 1}, LB[2] = {-1, -1}, RB[2] = {1, -1};
double r = 1, sr = 1;
@@ -3318,23 +3318,23 @@ static LineartBoundingArea *lineart_line_first_bounding_area(LineartRenderBuffer
return lineart_get_bounding_area(rb, data[0], data[1]);
}
- if (lineart_LineIntersectTest2d(rl->l->fbcoord, rl->r->fbcoord, LU, RU, &sr) && sr < r &&
+ if (lineart_LineIntersectTest2d(e->v1->fbcoord, e->v2->fbcoord, LU, RU, &sr) && sr < r &&
sr > 0) {
r = sr;
}
- if (lineart_LineIntersectTest2d(rl->l->fbcoord, rl->r->fbcoord, LB, RB, &sr) && sr < r &&
+ if (lineart_LineIntersectTest2d(e->v1->fbcoord, e->v2->fbcoord, LB, RB, &sr) && sr < r &&
sr > 0) {
r = sr;
}
- if (lineart_LineIntersectTest2d(rl->l->fbcoord, rl->r->fbcoord, LB, LU, &sr) && sr < r &&
+ if (lineart_LineIntersectTest2d(e->v1->fbcoord, e->v2->fbcoord, LB, LU, &sr) && sr < r &&
sr > 0) {
r = sr;
}
- if (lineart_LineIntersectTest2d(rl->l->fbcoord, rl->r->fbcoord, RB, RU, &sr) && sr < r &&
+ if (lineart_LineIntersectTest2d(e->v1->fbcoord, e->v2->fbcoord, RB, RU, &sr) && sr < r &&
sr > 0) {
r = sr;
}
- interp_v2_v2v2_db(data, rl->l->fbcoord, rl->r->fbcoord, r);
+ interp_v2_v2v2_db(data, e->v1->fbcoord, e->v2->fbcoord, r);
return lineart_get_bounding_area(rb, data[0], data[1]);
}
@@ -3342,7 +3342,7 @@ static LineartBoundingArea *lineart_line_first_bounding_area(LineartRenderBuffer
/* This march along one render line in image space and
* get the next bounding area the line is crossing. */
static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this,
- LineartLine *rl,
+ LineartEdge *e,
double x,
double y,
double k,
@@ -3364,8 +3364,8 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
if (positive_y > 0) {
uy = this->u;
ux = x + (uy - y) / k;
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], rx);
- r2 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], ux);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], rx);
+ r2 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], ux);
if (MIN2(r1, r2) > 1) {
return 0;
}
@@ -3397,8 +3397,8 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
else if (positive_y < 0) {
by = this->b;
bx = x + (by - y) / k;
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], rx);
- r2 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], bx);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], rx);
+ r2 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], bx);
if (MIN2(r1, r2) > 1) {
return 0;
}
@@ -3425,7 +3425,7 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
}
/* If the line is compeletely horizontal, in which Y diffence == 0. */
else {
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], this->r);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], this->r);
if (r1 > 1) {
return 0;
}
@@ -3449,8 +3449,8 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
if (positive_y > 0) {
uy = this->u;
ux = x + (uy - y) / k;
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], lx);
- r2 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], ux);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], lx);
+ r2 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], ux);
if (MIN2(r1, r2) > 1) {
return 0;
}
@@ -3480,8 +3480,8 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
else if (positive_y < 0) {
by = this->b;
bx = x + (by - y) / k;
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], lx);
- r2 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], bx);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], lx);
+ r2 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], bx);
if (MIN2(r1, r2) > 1) {
return 0;
}
@@ -3508,7 +3508,7 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
}
/* Again, horizontal. */
else {
- r1 = ratiod(rl->l->fbcoord[0], rl->r->fbcoord[0], this->l);
+ r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], this->l);
if (r1 > 1) {
return 0;
}
@@ -3525,7 +3525,7 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
/* If the line is completely vertical, hence X difference == 0. */
else {
if (positive_y > 0) {
- r1 = ratiod(rl->l->fbcoord[1], rl->r->fbcoord[1], this->u);
+ r1 = ratiod(e->v1->fbcoord[1], e->v2->fbcoord[1], this->u);
if (r1 > 1) {
return 0;
}
@@ -3539,7 +3539,7 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
}
}
else if (positive_y < 0) {
- r1 = ratiod(rl->l->fbcoord[1], rl->r->fbcoord[1], this->b);
+ r1 = ratiod(e->v1->fbcoord[1], e->v2->fbcoord[1], this->b);
if (r1 > 1) {
return 0;
}
@@ -3632,7 +3632,7 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
MOD_lineart_chain_feature_lines(rb);
/* We are unable to take care of occlusion if we only connect end points, so here we do a spit,
- * where the splitting point could be any cut in rl->segments. */
+ * where the splitting point could be any cut in e->segments. */
MOD_lineart_chain_split_for_fixed_occlusion(rb);
/* Then we connect chains based on the _proximity_ of their end points in geometry or image
@@ -3674,7 +3674,7 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
return OPERATOR_FINISHED;
}
-static int lineart_rb_line_types(LineartRenderBuffer *rb)
+static int lineart_rb_edge_types(LineartRenderBuffer *rb)
{
int types = 0;
types |= rb->use_contour ? LRT_EDGE_FLAG_CONTOUR : 0;
@@ -3732,7 +3732,7 @@ static void lineart_gpencil_generate(LineartRenderBuffer *rb,
float mat[4][4];
unit_m4(mat);
- int enabled_types = lineart_rb_line_types(rb);
+ int enabled_types = lineart_rb_edge_types(rb);
bool invert_input = modifier_flags & LRT_GPENCIL_INVERT_SOURCE_VGROUP;
bool match_output = modifier_flags & LRT_GPENCIL_MATCH_OUTPUT_VGROUP;
bool preserve_weight = modifier_flags & LRT_GPENCIL_SOFT_SELECTION;
@@ -3867,7 +3867,7 @@ void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
int level_start,
int level_end,
int mat_nr,
- short line_types,
+ short edge_types,
unsigned char transparency_flags,
unsigned char transparency_mask,
short thickness,
@@ -3891,18 +3891,18 @@ void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
}
source_object = (Object *)source_reference;
/* Note that intersection lines will only be in collection. */
- use_types = line_types & (~LRT_EDGE_FLAG_INTERSECTION);
+ use_types = edge_types & (~LRT_EDGE_FLAG_INTERSECTION);
}
else if (source_type == LRT_SOURCE_COLLECTION) {
if (!source_reference) {
return;
}
source_collection = (Collection *)source_reference;
- use_types = line_types;
+ use_types = edge_types;
}
else {
/* Whole scene. */
- use_types = line_types;
+ use_types = edge_types;
}
float gp_obmat_inverse[4][4];
invert_m4_m4(gp_obmat_inverse, ob->obmat);
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
index 34f6e62546d..2c3130b46c9 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h
@@ -35,7 +35,7 @@
struct LineartStaticMemPool;
struct LineartStaticMemPoolNode;
-struct LineartLine;
+struct LineartEdge;
struct LineartRenderBuffer;
void *lineart_list_append_pointer_pool(ListBase *h, struct LineartStaticMemPool *smp, void *data);
@@ -58,7 +58,7 @@ void *lineart_mem_aquire(struct LineartStaticMemPool *smp, size_t size);
void *lineart_mem_aquire_thread(struct LineartStaticMemPool *smp, size_t size);
void lineart_mem_destroy(struct LineartStaticMemPool *smp);
-void lineart_prepend_line_direct(struct LineartLine **first, void *node);
+void lineart_prepend_edge_direct(struct LineartEdge **first, void *node);
void lineart_prepend_pool(LinkNode **first, struct LineartStaticMemPool *smp, void *link);
void lineart_matrix_ortho_44d(double (*mProjection)[4],
@@ -76,13 +76,13 @@ int lineart_count_intersection_segment_count(struct LineartRenderBuffer *rb);
void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb);
#define LRT_ITER_ALL_LINES_BEGIN \
- LineartLine *rl, *next_rl, **current_list; \
- rl = rb->contours; \
- for (current_list = &rb->contours; rl; rl = next_rl) { \
- next_rl = rl->next;
+ LineartEdge *e, *next_e, **current_list; \
+ e = rb->contours; \
+ for (current_list = &rb->contours; e; e = next_e) { \
+ next_e = e->next;
#define LRT_ITER_ALL_LINES_NEXT \
- while (!next_rl) { \
+ while (!next_e) { \
if (current_list == &rb->contours) { \
current_list = &rb->crease_lines; \
} \
@@ -98,7 +98,7 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb
else { \
break; \
} \
- next_rl = *current_list; \
+ next_e = *current_list; \
}
#define LRT_ITER_ALL_LINES_END \
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
index 56490a84279..9d5d52b8388 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
@@ -105,7 +105,7 @@ static bool bake_strokes(Object *ob, Depsgraph *dg, GpencilModifierData *md, int
lmd->level_start,
lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
lmd->target_material ? BKE_gpencil_object_material_index_get(ob, lmd->target_material) : 0,
- lmd->line_types,
+ lmd->edge_types,
lmd->transparency_flags,
lmd->transparency_mask,
lmd->thickness,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c
index 8e8c39391c3..b38124fc7a5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_util.c
@@ -130,11 +130,11 @@ void lineart_mem_destroy(LineartStaticMemPool *smp)
}
}
-void lineart_prepend_line_direct(LineartLine **first, void *node)
+void lineart_prepend_edge_direct(LineartEdge **first, void *node)
{
- LineartLine *ln = (LineartLine *)node;
- ln->next = (*first);
- (*first) = ln;
+ LineartEdge *e_n = (LineartEdge *)node;
+ e_n->next = (*first);
+ (*first) = e_n;
}
void lineart_prepend_pool(LinkNode **first, LineartStaticMemPool *smp, void *link)
@@ -215,7 +215,7 @@ void lineart_count_and_print_render_buffer_memory(LineartRenderBuffer *rb)
LISTBASE_FOREACH (LineartElementLinkNode *, reln, &rb->line_buffer_pointers) {
count_this++;
- sum_this += reln->element_count * sizeof(LineartLine);
+ sum_this += reln->element_count * sizeof(LineartEdge);
}
printf(" allocated %lu edge blocks, total %lu Bytes.\n", count_this, sum_this);
total += sum_this;