Compare commits
12 Commits
tmp-volume
...
lineart-ob
Author | SHA1 | Date | |
---|---|---|---|
5ba3e6001f | |||
0ebc062604 | |||
a3b38c979a | |||
77afe859a0 | |||
ce689964a4 | |||
516ec45d10 | |||
58511c4175 | |||
f49948bf48 | |||
50840bb2a3 | |||
3a055e8f41 | |||
0d5d554287 | |||
fe2df4c771 |
@@ -355,32 +355,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
|
||||
{
|
||||
BLI_freenode *newhead = addr;
|
||||
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
BLI_mempool_chunk *chunk;
|
||||
bool found = false;
|
||||
for (chunk = pool->chunks; chunk; chunk = chunk->next) {
|
||||
if (ARRAY_HAS_ITEM((char *)addr, (char *)CHUNK_DATA(chunk), pool->csize)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
BLI_assert_msg(0, "Attempt to free data which is not in pool.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable for debugging. */
|
||||
if (UNLIKELY(mempool_debug_memset)) {
|
||||
memset(addr, 255, pool->esize);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
|
||||
#ifndef NDEBUG
|
||||
/* This will detect double free's. */
|
||||
BLI_assert(newhead->freeword != FREEWORD);
|
||||
#endif
|
||||
newhead->freeword = FREEWORD;
|
||||
}
|
||||
|
||||
|
@@ -68,12 +68,29 @@ set(SRC
|
||||
intern/lineart/lineart_cpu.c
|
||||
intern/lineart/lineart_ops.c
|
||||
intern/lineart/lineart_util.c
|
||||
intern/lineart/lineart_cpp_bridge.cpp
|
||||
|
||||
intern/lineart/MOD_lineart.h
|
||||
intern/lineart/lineart_intern.h
|
||||
|
||||
)
|
||||
|
||||
if(WITH_TBB)
|
||||
add_definitions(-DWITH_TBB)
|
||||
if(WIN32)
|
||||
# TBB includes Windows.h which will define min/max macros
|
||||
# that will collide with the stl versions.
|
||||
add_definitions(-DNOMINMAX)
|
||||
endif()
|
||||
list(APPEND INC_SYS
|
||||
${TBB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
list(APPEND LIB
|
||||
${TBB_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(LIB
|
||||
)
|
||||
|
||||
|
@@ -387,7 +387,6 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, true);
|
||||
|
||||
uiItemR(col, ptr, "use_remove_doubles", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE);
|
||||
uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
|
||||
|
@@ -14,6 +14,14 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
typedef struct EdgeFacePair {
|
||||
int v1;
|
||||
int v2;
|
||||
int f1;
|
||||
int f2;
|
||||
uint16_t eflag;
|
||||
} EdgeFacePair;
|
||||
|
||||
typedef struct LineartStaticMemPoolNode {
|
||||
Link item;
|
||||
size_t size;
|
||||
@@ -132,7 +140,7 @@ typedef struct LineartEdge {
|
||||
char min_occ;
|
||||
|
||||
/** Also for line type determination on chaining. */
|
||||
unsigned char flags;
|
||||
short flags;
|
||||
unsigned char intersection_mask;
|
||||
|
||||
/**
|
||||
@@ -171,7 +179,7 @@ typedef struct LineartEdgeChainItem {
|
||||
/** For restoring position to 3d space. */
|
||||
float gpos[3];
|
||||
float normal[3];
|
||||
unsigned char line_type;
|
||||
short line_type;
|
||||
char occlusion;
|
||||
unsigned char material_mask_bits;
|
||||
unsigned char intersection_mask;
|
||||
@@ -189,6 +197,12 @@ typedef struct LineartChainRegisterEntry {
|
||||
char is_left;
|
||||
} LineartChainRegisterEntry;
|
||||
|
||||
typedef struct LineartAdjacentItem {
|
||||
unsigned int v1;
|
||||
unsigned int v2;
|
||||
unsigned int e;
|
||||
} LineartAdjacentItem;
|
||||
|
||||
enum eLineArtTileRecursiveLimit {
|
||||
/* If tile gets this small, it's already much smaller than a pixel. No need to continue
|
||||
* splitting. */
|
||||
@@ -396,7 +410,7 @@ typedef struct LineartObjectInfo {
|
||||
|
||||
typedef struct LineartObjectLoadTaskInfo {
|
||||
struct LineartRenderBuffer *rb;
|
||||
struct Depsgraph *dg;
|
||||
int thread_id;
|
||||
/* LinkNode styled list */
|
||||
LineartObjectInfo *pending;
|
||||
/* Used to spread the load across several threads. This can not overflow. */
|
||||
|
@@ -0,0 +1,28 @@
|
||||
#include "BLI_sort.hh"
|
||||
#include "BLI_vector.hh"
|
||||
#include "MOD_lineart.h"
|
||||
#include "lineart_intern.h"
|
||||
|
||||
static int cmp_adjacent_items(const LineartAdjacentItem &p1, const LineartAdjacentItem &p2)
|
||||
{
|
||||
int a = (int)p1.v1 - (int)p2.v1;
|
||||
int b = (int)p1.v2 - (int)p2.v2;
|
||||
return a ? a : b;
|
||||
}
|
||||
|
||||
void lineart_sort_adjacent_items(LineartAdjacentItem *ai, int length)
|
||||
{
|
||||
blender::Vector<LineartAdjacentItem> _ai;
|
||||
_ai.reserve(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
_ai[i] = ai[i];
|
||||
printf("(%d %d %d)", _ai[i].v1, _ai[i].v2, _ai[i].e);
|
||||
}
|
||||
_ai.resize(length);
|
||||
printf("\n");
|
||||
std::sort(ai, ai + length, cmp_adjacent_items);
|
||||
for (int i = 0; i < length; i++) {
|
||||
ai[i] = _ai[i];
|
||||
printf("(%d %d %d)", _ai[i].v1, _ai[i].v2, _ai[i].e);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -121,3 +121,13 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb
|
||||
/* Initial bounding area row/column count, setting 4 is the simplest way algorithm could function
|
||||
* efficiently. */
|
||||
#define LRT_BA_ROWS 4
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lineart_sort_adjacent_items(LineartAdjacentItem *ai, int length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -21,7 +21,7 @@ typedef enum eLineartMainFlags {
|
||||
LRT_ALLOW_DUPLI_OBJECTS = (1 << 2),
|
||||
LRT_ALLOW_OVERLAPPING_EDGES = (1 << 3),
|
||||
LRT_ALLOW_CLIPPING_BOUNDARIES = (1 << 4),
|
||||
LRT_REMOVE_DOUBLES = (1 << 5),
|
||||
/* LRT_REMOVE_DOUBLES = (1 << 5), Deprecated */
|
||||
LRT_LOOSE_AS_CONTOUR = (1 << 6),
|
||||
LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 7),
|
||||
LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 8),
|
||||
@@ -47,9 +47,16 @@ typedef enum eLineartEdgeFlag {
|
||||
LRT_EDGE_FLAG_MATERIAL = (1 << 3),
|
||||
LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
|
||||
LRT_EDGE_FLAG_LOOSE = (1 << 5),
|
||||
LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6),
|
||||
LRT_EDGE_FLAG_CLIPPED = (1 << 7),
|
||||
/** Limited to 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */
|
||||
/* LRT_EDGE_FLAG_FOR_FUTURE = (1 << 7), */
|
||||
/* Limited to 8 bits for edge type flag, don't add anymore because BMEdge->head.eflag only has 8
|
||||
bits. So unless we changed this into a non-single-bit flag thing, we keep it this way. */
|
||||
/** Also used as discarded line mark. */
|
||||
LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 8),
|
||||
LRT_EDGE_FLAG_CLIPPED = (1 << 9),
|
||||
/** Limited to 16 bits for the entire thing. */
|
||||
|
||||
/** For object loading code to use only. */
|
||||
LRT_EDGE_FLAG_INHIBIT = (1 << 14),
|
||||
} eLineartEdgeFlag;
|
||||
|
||||
#define LRT_EDGE_FLAG_ALL_TYPE 0x3f
|
||||
|
@@ -3254,12 +3254,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna)
|
||||
RNA_def_property_range(prop, 0.0f, 30.0f);
|
||||
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_remove_doubles", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_REMOVE_DOUBLES);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Remove Doubles", "Remove doubles from the source geometry before generating stokes");
|
||||
RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_loose_as_contour", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_LOOSE_AS_CONTOUR);
|
||||
RNA_def_property_ui_text(prop, "Loose As Contour", "Loose edges will have contour type");
|
||||
|
Reference in New Issue
Block a user