[Bf-blender-cvs] [02de8602c85] soc-2019-npr: LANPR: Make flag marcos into enums.
YimingWu
noreply at git.blender.org
Fri Jul 26 08:47:29 CEST 2019
Commit: 02de8602c85e15849c6ec477ea4ac0ee965e940b
Author: YimingWu
Date: Fri Jul 26 14:46:52 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB02de8602c85e15849c6ec477ea4ac0ee965e940b
LANPR: Make flag marcos into enums.
===================================================================
M source/blender/editors/include/ED_lanpr.h
M source/blender/editors/lanpr/lanpr_ops.c
M source/blender/editors/lanpr/lanpr_util.c
M source/blender/makesdna/DNA_lanpr_types.h
M source/blender/makesdna/DNA_scene_types.h
===================================================================
diff --git a/source/blender/editors/include/ED_lanpr.h b/source/blender/editors/include/ED_lanpr.h
index 4fb9e9cdf3c..c84d7e82245 100644
--- a/source/blender/editors/include/ED_lanpr.h
+++ b/source/blender/editors/include/ED_lanpr.h
@@ -137,13 +137,15 @@ typedef struct LANPR_RenderVert {
char edge_used; /* <| |> */
} LANPR_RenderVert;
-#define LANPR_EDGE_FLAG_EDGE_MARK 1
-#define LANPR_EDGE_FLAG_CONTOUR 2
-#define LANPR_EDGE_FLAG_CREASE 4
-#define LANPR_EDGE_FLAG_MATERIAL 8
-#define LANPR_EDGE_FLAG_INTERSECTION 16
-#define LANPR_EDGE_FLAG_FLOATING 32 /* floating edge, unimplemented yet */
-#define LANPR_EDGE_FLAG_CHAIN_PICKED 64
+typedef enum LANPR_EdgeFlag{
+ LANPR_EDGE_FLAG_EDGE_MARK = (1<<0),
+ LANPR_EDGE_FLAG_CONTOUR = (1<<1),
+ LANPR_EDGE_FLAG_CREASE = (1<<2),
+ LANPR_EDGE_FLAG_MATERIAL = (1<<3),
+ LANPR_EDGE_FLAG_INTERSECTION = (1<<4),
+ LANPR_EDGE_FLAG_FLOATING = (1<<5), /* floating edge, unimplemented yet */
+ LANPR_EDGE_FLAG_CHAIN_PICKED = (1<<6),
+}LANPR_EdgeFlag;
#define LANPR_EDGE_FLAG_ALL_TYPE 0x3f
@@ -274,6 +276,7 @@ typedef struct LANPR_RenderBuffer {
real crease_cos;
int thread_count;
+ /* deprecated, need another report mechanism */
real overall_progress;
int calculation_status;
@@ -335,29 +338,22 @@ typedef struct LANPR_SharedResource {
} LANPR_SharedResource;
-#define deg(r) r / M_PI * 180.0
-#define rad(d) d *M_PI / 180.0
-
#define DBL_TRIANGLE_LIM 1e-8
#define DBL_EDGE_LIM 1e-9
-#define NUL_MEMORY_POOL_1MB 1048576
-#define NUL_MEMORY_POOL_128MB 134217728
-#define NUL_MEMORY_POOL_256MB 268435456
-#define NUL_MEMORY_POOL_512MB 536870912
+#define LANPR_MEMORY_POOL_1MB 1048576
+#define LANPR_MEMORY_POOL_128MB 134217728
+#define LANPR_MEMORY_POOL_256MB 268435456
+#define LANPR_MEMORY_POOL_512MB 536870912
-#define LANPR_CULL_DISCARD 2
-#define LANPR_CULL_USED 1
+typedef enum LANPR_CullState{
+ LANPR_CULL_DONT_CARE = 0,
+ LANPR_CULL_USED = 1,
+ LANPR_CULL_DISCARD = 2,
+}LANPR_CullState;
#define TNS_THREAD_LINE_COUNT 10000
-#define TNS_CALCULATION_IDLE 0
-#define TNS_CALCULATION_GEOMETRY 1
-#define TNS_CALCULATION_CONTOUR 2
-#define TNS_CALCULATION_INTERSECTION 3
-#define TNS_CALCULATION_OCCLUTION 4
-#define TNS_CALCULATION_FINISHED 100
-
typedef struct LANPR_RenderTaskInfo {
/* thrd_t ThreadHandle; */
diff --git a/source/blender/editors/lanpr/lanpr_ops.c b/source/blender/editors/lanpr/lanpr_ops.c
index 5082f8b82a9..dcf9c32e6af 100644
--- a/source/blender/editors/lanpr/lanpr_ops.c
+++ b/source/blender/editors/lanpr/lanpr_ops.c
@@ -2722,10 +2722,6 @@ static void lanpr_compute_scene_contours(LANPR_RenderBuffer *rb, float threshold
int crease_count = 0;
int MaterialCount = 0;
- rb->overall_progress = 20;
- rb->calculation_status = TNS_CALCULATION_CONTOUR;
- /* nulThreadNotifyUsers("tns.render_buffer_list.calculation_status"); */
-
if (c->type == CAM_ORTHO) {
lanpr_compute_view_Vector(rb);
}
@@ -2822,7 +2818,6 @@ static void lanpr_clear_render_state(LANPR_RenderBuffer *rb)
rb->material_managed = 0;
rb->crease_count = 0;
rb->crease_managed = 0;
- rb->calculation_status = TNS_CALCULATION_IDLE;
}
/* Buffer operations */
@@ -2845,7 +2840,6 @@ void ED_lanpr_destroy_render_data(LANPR_RenderBuffer *rb)
rb->crease_managed = 0;
rb->edge_mark_count = 0;
rb->edge_mark_managed = 0;
- rb->calculation_status = TNS_CALCULATION_IDLE;
list_handle_empty(&rb->contours);
list_handle_empty(&rb->intersection_lines);
@@ -3712,7 +3706,6 @@ static void lanpr_add_triangles(LANPR_RenderBuffer *rb)
/* tnsglobal_TriangleIntersectionCount = 0; */
/* tnsset_RenderOverallProgress(rb, NUL_MH2); */
- rb->calculation_status = TNS_CALCULATION_INTERSECTION;
/* nulThreadNotifyUsers("tns.render_buffer_list.calculation_status"); */
for (reln = rb->triangle_buffer_pointers.first; reln; reln = reln->next) {
diff --git a/source/blender/editors/lanpr/lanpr_util.c b/source/blender/editors/lanpr/lanpr_util.c
index 08759147e65..10999843013 100644
--- a/source/blender/editors/lanpr/lanpr_util.c
+++ b/source/blender/editors/lanpr/lanpr_util.c
@@ -414,7 +414,7 @@ void list_move_down(ListBase *h, Link *li)
LANPR_StaticMemPoolNode *mem_new_static_pool(LANPR_StaticMemPool *smp)
{
- LANPR_StaticMemPoolNode *smpn = MEM_callocN(NUL_MEMORY_POOL_128MB, "mempool");
+ LANPR_StaticMemPoolNode *smpn = MEM_callocN(LANPR_MEMORY_POOL_128MB, "mempool");
smpn->used_byte = sizeof(LANPR_StaticMemPoolNode);
BLI_addhead(&smp->pools, smpn);
return smpn;
@@ -424,7 +424,7 @@ void *mem_static_aquire(LANPR_StaticMemPool *smp, int size)
LANPR_StaticMemPoolNode *smpn = smp->pools.first;
void *ret;
- if (!smpn || (smpn->used_byte + size) > NUL_MEMORY_POOL_128MB) {
+ if (!smpn || (smpn->used_byte + size) > LANPR_MEMORY_POOL_128MB) {
smpn = mem_new_static_pool(smp);
}
@@ -441,7 +441,7 @@ void *mem_static_aquire_thread(LANPR_StaticMemPool *smp, int size)
BLI_spin_lock(&smp->cs_mem);
- if (!smpn || (smpn->used_byte + size) > NUL_MEMORY_POOL_128MB) {
+ if (!smpn || (smpn->used_byte + size) > LANPR_MEMORY_POOL_128MB) {
smpn = mem_new_static_pool(smp);
}
diff --git a/source/blender/makesdna/DNA_lanpr_types.h b/source/blender/makesdna/DNA_lanpr_types.h
index 1282a63de3f..423d69855a9 100644
--- a/source/blender/makesdna/DNA_lanpr_types.h
+++ b/source/blender/makesdna/DNA_lanpr_types.h
@@ -40,32 +40,33 @@ struct Object;
struct Material;
struct Collection;
-#define LANPR_MASTER_MODE_SOFTWARE 0
-#define LANPR_MASTER_MODE_DPIX 1
-#define LANPR_MASTER_MODE_SNAKE 2
-
-#define LANPR_POST_PROCESSING_DISABLED 0
-#define LANPR_POST_PROCESSING_ENABLED 1
-
-#define LANPR_USE_DIFFERENT_TAPER 0
-#define LANPR_USE_SAME_TAPER 1
-
-/* Only on/off switch for now, below not used */
-#define LANPR_NORMAL_DONT_CARE 0
-#define LANPR_NORMAL_DIRECTIONAL 1
-#define LANPR_NORMAL_POINT 2
-
-#define LANPR_COMPONENT_MODE_ALL 0
-#define LANPR_COMPONENT_MODE_OBJECT 1
-#define LANPR_COMPONENT_MODE_MATERIAL 2
-#define LANPR_COMPONENT_MODE_COLLECTION 3
-//#define LANPR_COMPONENT_MODE_REST 4 // use _ALL
-
-#define LANPR_COMPONENT_INCLUSIVE 0
-#define LANPR_COMPONENT_EXCLUSIVE 1
-
-#define LANPR_COMPONENT_LOGIG_OR 0
-#define LANPR_COMPONENT_LOGIC_AND 1
+typedef enum LANPR_TaperSettings{
+ LANPR_USE_DIFFERENT_TAPER = 0,
+ LANPR_USE_SAME_TAPER = 1,
+}LANPR_TaperSettings;
+
+typedef enum LANPR_NomalEffect{
+ LANPR_NORMAL_DONT_CARE = 0,
+ LANPR_NORMAL_DIRECTIONAL = 1,
+ LANPR_NORMAL_POINT = 2,
+}LANPR_NomalEffect;
+
+typedef enum LANPR_ComponentMode{
+ LANPR_COMPONENT_MODE_ALL = 0,
+ LANPR_COMPONENT_MODE_OBJECT = 1,
+ LANPR_COMPONENT_MODE_MATERIAL = 2,
+ LANPR_COMPONENT_MODE_COLLECTION = 3,
+}LANPR_ComponentMode;
+
+typedef enum LANPR_ComponentUsage{
+ LANPR_COMPONENT_INCLUSIVE = 0,
+ LANPR_COMPONENT_EXCLUSIVE = 1,
+}LANPR_ComponentUsage;
+
+typedef enum LANPR_ComponentLogic{
+ LANPR_COMPONENT_LOGIG_OR = 0,
+ LANPR_COMPONENT_LOGIC_AND = 1,
+}LANPR_ComponentLogic;
struct DRWShadingGroup;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 1d31aef022c..5ccfc1afb90 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1637,12 +1637,23 @@ typedef struct SceneEEVEE {
struct LANPR_RenderBuffer;
struct LANPR_LineLayer;
+typedef enum LANPR_MasterMode{
+ LANPR_MASTER_MODE_SOFTWARE = 0,
+ LANPR_MASTER_MODE_DPIX = 1,
+ LANPR_MASTER_MODE_SNAKE = 2,
+}LANPR_MasterMode;
+
+typedef enum LANPR_PostProcessingStatus{
+ LANPR_POST_PROCESSING_DISABLED = 0,
+ LANPR_POST_PROCESSING_ENABLED = 1,
+}LANPR_PostProcessingStatus;
+
typedef struct SceneLANPR {
int enabled;
int auto_update; /* for LANPR->GP to update automatically */
- int master_mode;
+ int master_mode; /* LANPR_MasterMode */
int enable_vector_trace;
int display_thinning_result;
More information about the Bf-blender-cvs
mailing list