Cleanup, LineArt: Rename LineartLine -> LineartEdge
Also cleanup various other "line" variable names
This commit is contained in:
parent
d7fb38ddd4
commit
df28063795
Notes:
blender-bot
2023-02-14 06:00:51 +01:00
Referenced by commit f75d690ee4
, LineArt: Add missing dna variable rename
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 \
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -285,7 +285,7 @@
|
|||
|
||||
#define _DNA_DEFAULT_LineartGpencilModifierData \
|
||||
{ \
|
||||
.line_types = LRT_EDGE_FLAG_ALL_TYPE, \
|
||||
.edge_types = LRT_EDGE_FLAG_ALL_TYPE, \
|
||||
.thickness = 25, \
|
||||
.opacity = 1.0f, \
|
||||
.flags = LRT_GPENCIL_MATCH_OUTPUT_VGROUP | LRT_GPENCIL_SOFT_SELECTION, \
|
||||
|
|
|
@ -832,7 +832,7 @@ typedef enum eLineartGpencilTransparencyFlags {
|
|||
typedef struct LineartGpencilModifierData {
|
||||
GpencilModifierData modifier;
|
||||
|
||||
short line_types; /* line type enable flags, bits in eLineartEdgeFlag */
|
||||
short edge_types; /* line type enable flags, bits in eLineartEdgeFlag */
|
||||
|
||||
char source_type; /* Object or Collection, from eLineartGpencilModifierSource */
|
||||
|
||||
|
|
|
@ -2429,28 +2429,28 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
|
|||
|
||||
/* types */
|
||||
prop = RNA_def_property(srna, "use_contour", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CONTOUR);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_CONTOUR);
|
||||
RNA_def_property_ui_text(prop, "Use Contour", "Generate strokes from contours lines");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_CREASE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_CREASE);
|
||||
RNA_def_property_ui_text(prop, "Use Crease", "Generate strokes from creased edges");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_MATERIAL);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_MATERIAL);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Material", "Generate strokes from borders between materials");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_edge_mark", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_EDGE_MARK);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_EDGE_MARK);
|
||||
RNA_def_property_ui_text(prop, "Use Edge Mark", "Generate strokes from freestyle marked edges");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_intersection", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "line_types", LRT_EDGE_FLAG_INTERSECTION);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_INTERSECTION);
|
||||
RNA_def_property_ui_text(prop, "Use Intersection", "Generate strokes from intersections");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
|
|
Loading…
Reference in New Issue