Commit: d2f77ce653cf0daac253328675536dc61132f142 Author: Nick Wu Date: Wed Aug 1 20:29:17 2018 +0800 Branches: soc-2018-npr https://developer.blender.org/rBd2f77ce653cf0daac253328675536dc61132f142
Uncrustify processed. =================================================================== M source/blender/draw/engines/lanpr/lanpr_all.h M source/blender/draw/engines/lanpr/lanpr_chain.c M source/blender/draw/engines/lanpr/lanpr_dpix.c M source/blender/draw/engines/lanpr/lanpr_engine.c M source/blender/draw/engines/lanpr/lanpr_ops.c M source/blender/draw/engines/lanpr/lanpr_util.c M source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_dpix_preview_geom.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_clip_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_dpix_project_passthrough_vert.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_edge_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_image_peel_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_geom.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_line_connection_vert.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_snake_multichannel_frag.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_software_chain_geom.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_software_line_chain_geom.glsl M source/blender/draw/engines/lanpr/shaders/lanpr_software_passthrough_vert.glsl M source/blender/makesdna/DNA_lamp_types.h M source/blender/makesdna/DNA_lanpr_types.h M source/blender/makesdna/DNA_scene_types.h M source/blender/makesrna/intern/rna_lanpr.c M source/blender/makesrna/intern/rna_scene.c =================================================================== diff --git a/source/blender/draw/engines/lanpr/lanpr_all.h b/source/blender/draw/engines/lanpr/lanpr_all.h index 99660b88ad9..3188a0beaa9 100644 --- a/source/blender/draw/engines/lanpr/lanpr_all.h +++ b/source/blender/draw/engines/lanpr/lanpr_all.h @@ -73,8 +73,8 @@ typedef struct LANPRSharedResource { int init_complete; SpinLock render_flag_lock; - int during_render; // get/set using access funcion which uses render_flag_lock to lock. - // this prevents duplicate too much resource. (no render preview in viewport while rendering) + int during_render; // get/set using access funcion which uses render_flag_lock to lock. + // this prevents duplicate too much resource. (no render preview in viewport while rendering) } LANPRSharedResource; @@ -321,7 +321,7 @@ typedef struct LANPR_RenderBuffer { //render status - int cached_for_frame; + int cached_for_frame; real ViewVector[3]; @@ -353,8 +353,8 @@ typedef struct LANPR_RenderBuffer { ListBase EdgeMarks; ListBase Chains; - GPUBatch* ChainDrawBatch; - DRWShadingGroup* ChainShgrp; + GPUBatch *ChainDrawBatch; + DRWShadingGroup *ChainShgrp; SpinLock csInfo; SpinLock csData; @@ -469,17 +469,17 @@ typedef struct LANPR_RenderLine { }LANPR_RenderLine; typedef struct LANPR_RenderLineChain { - nListItem Item; + nListItem Item; ListBase Chain; //int SegmentCount; // we count before draw cmd. - float Length; // calculated before draw cmd. + float Length; // calculated before draw cmd. }LANPR_RenderLineChain; typedef struct LANPR_RenderLineChainItem { - nListItem Item; - float pos[3]; // need z value for fading - char LineType; // style of [1] style of [2] - char OcclusionLevel; // [1]--------------->[2]---------------->[3]--.... + nListItem Item; + float pos[3]; // need z value for fading + char LineType; // style of [1] style of [2] + char OcclusionLevel; // [1]--------------->[2]---------------->[3]--.... }LANPR_RenderLineChainItem; typedef struct LANPR_BoundingArea { @@ -598,7 +598,7 @@ BLI_INLINE int lanpr_TrangleLineBoundBoxTest(LANPR_RenderTriangle *rt, LANPR_Ren } BLI_INLINE double tMatGetLinearRatio(real L, real R, real FromL); -BLI_INLINE int lanpr_LineIntersectTest2d(const double* a1, const double* a2, const double* b1, const double* b2, double *aRatio) { +BLI_INLINE int lanpr_LineIntersectTest2d(const double *a1, const double *a2, const double *b1, const double *b2, double *aRatio) { double k1, k2; double x; double y; diff --git a/source/blender/draw/engines/lanpr/lanpr_chain.c b/source/blender/draw/engines/lanpr/lanpr_chain.c index 8b8aede8f53..f0b53e9ee9f 100644 --- a/source/blender/draw/engines/lanpr/lanpr_chain.c +++ b/source/blender/draw/engines/lanpr/lanpr_chain.c @@ -27,30 +27,31 @@ #include <math.h> int lanpr_get_line_bounding_areas(LANPR_RenderBuffer *rb, LANPR_RenderLine *rl, int *rowBegin, int *rowEnd, int *colBegin, int *colEnd); -LANPR_BoundingArea* lanpr_get_point_bounding_area(LANPR_RenderBuffer *rb, real x, real y); +LANPR_BoundingArea *lanpr_get_point_bounding_area(LANPR_RenderBuffer *rb, real x, real y); -#define LANPR_OTHER_RV(rl,rv) ((rv) == (rl)->L?(rl)->R:(rl)->L) +#define LANPR_OTHER_RV(rl, rv) ((rv) == (rl)->L ? (rl)->R : (rl)->L) -LANPR_RenderLine* lanpr_get_connected_render_line(LANPR_BoundingArea* ba, LANPR_RenderVert* rv, LANPR_RenderVert** new_rv) { - nListItemPointer* lip; - LANPR_RenderLine* nrl; +LANPR_RenderLine *lanpr_get_connected_render_line(LANPR_BoundingArea *ba, LANPR_RenderVert *rv, LANPR_RenderVert **new_rv) { + nListItemPointer *lip; + LANPR_RenderLine *nrl; real cosine; for (lip = ba->LinkedLines.first; lip; lip = lip->pNext) { nrl = lip->p; - if ((!(nrl->Flags&LANPR_EDGE_FLAG_ALL_TYPE)) || (nrl->Flags & LANPR_EDGE_FLAG_CHAIN_PICKED)) continue; + if ((!(nrl->Flags & LANPR_EDGE_FLAG_ALL_TYPE)) || (nrl->Flags & LANPR_EDGE_FLAG_CHAIN_PICKED)) continue; // always chain connected lines for now. // simplification will take care of the sharp points. // if(cosine whatever) continue; if (rv != nrl->L && rv != nrl->R) { - if (nrl->Flags&LANPR_EDGE_FLAG_INTERSECTION) { + if (nrl->Flags & LANPR_EDGE_FLAG_INTERSECTION) { if (rv->FrameBufferCoord[0] == nrl->L->FrameBufferCoord[0] && rv->FrameBufferCoord[1] == nrl->L->FrameBufferCoord[1]) { *new_rv = LANPR_OTHER_RV(nrl, nrl->L); return nrl; - }elif(rv->FrameBufferCoord[0] == nrl->R->FrameBufferCoord[0] && rv->FrameBufferCoord[1] == nrl->R->FrameBufferCoord[1]){ + } elif(rv->FrameBufferCoord[0] == nrl->R->FrameBufferCoord[0] && rv->FrameBufferCoord[1] == nrl->R->FrameBufferCoord[1]) + { *new_rv = LANPR_OTHER_RV(nrl, nrl->R); return nrl; } @@ -59,164 +60,166 @@ LANPR_RenderLine* lanpr_get_connected_render_line(LANPR_BoundingArea* ba, LANPR_ } *new_rv = LANPR_OTHER_RV(nrl, rv); - return nrl; - } + return nrl; + } - return 0; + return 0; } -int lanpr_get_nearby_render_line(LANPR_BoundingArea* ba, LANPR_RenderLine* rl){ - // hold on +int lanpr_get_nearby_render_line(LANPR_BoundingArea *ba, LANPR_RenderLine *rl){ + // hold on return 1; } -LANPR_RenderLineChain* lanpr_create_render_line_chain(LANPR_RenderBuffer *rb){ - LANPR_RenderLineChain* rlc; - rlc = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChain)); +LANPR_RenderLineChain *lanpr_create_render_line_chain(LANPR_RenderBuffer *rb){ + LANPR_RenderLineChain *rlc; + rlc = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChain)); - BLI_addtail(&rb->Chains,rlc); + BLI_addtail(&rb->Chains, rlc); - return rlc; + return rlc; } -LANPR_RenderLineChainItem* lanpr_append_render_line_chain_point(LANPR_RenderBuffer *rb, LANPR_RenderLineChain* rlc, float x, float y, char type, int level){ - LANPR_RenderLineChainItem* rlci; - rlci = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChainItem)); +LANPR_RenderLineChainItem *lanpr_append_render_line_chain_point(LANPR_RenderBuffer *rb, LANPR_RenderLineChain *rlc, float x, float y, char type, int level){ + LANPR_RenderLineChainItem *rlci; + rlci = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChainItem)); - rlci->pos[0] = x; - rlci->pos[1] = y; - rlci->LineType = type&LANPR_EDGE_FLAG_ALL_TYPE; + rlci->pos[0] = x; + rlci->pos[1] = y; + rlci->LineType = type & LANPR_EDGE_FLAG_ALL_TYPE; rlci->OcclusionLevel = level; - BLI_addtail(&rlc->Chain,rlci); + BLI_addtail(&rlc->Chain, rlci); - //printf("a %f,%f %d\n", x, y, level); + //printf("a %f,%f %d\n", x, y, level); - return rlci; + return rlci; } -LANPR_RenderLineChainItem* lanpr_push_render_line_chain_point(LANPR_RenderBuffer *rb, LANPR_RenderLineChain* rlc, float x, float y, char type, int level){ - LANPR_RenderLineChainItem* rlci; - rlci = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChainItem)); +LANPR_RenderLineChainItem *lanpr_push_render_line_chain_point(LANPR_RenderBuffer *rb, LANPR_RenderLineChain *rlc, float x, float y, char type, int level){ + LANPR_RenderLineChainItem *rlci; + rlci = mem_static_aquire(&rb->RenderDataPool, sizeof(LANPR_RenderLineChainItem)); - rlci->pos[0] = x; - rlci->pos[1] = y; - rlci->LineType = type&LANPR_EDGE_FLAG_ALL_TYPE; + rlci->pos[0] = x; + rlci->pos[1] = y; + rlci->LineType = type & LANPR_EDGE_FLAG_ALL_TYPE; rlci->OcclusionLevel = level; - BLI_addhead(&rlc->Chain,rlci); + BLI_addhead(&rlc->Chain, rlci); //printf("p %f,%f %d\n", x, y, level); - return rlci; + return rlci; } // refer to http://karthaus.nl/rdp/ for description -void lanpr_reduce_render_line_chain_recursive(LANPR_RenderLineChain* rlc, LANPR_RenderLineChainItem* from, LANPR_RenderLineChainItem* to, float dist_threshold){ - LANPR_RenderLineChainItem* rlci,*next_rlci; - float l[2],r[2],c[2]; - float max_dist=0; - LANPR_RenderLineChainItem* max_rlci=0; +void lanpr_reduce_render_line_chain_recursive(LANPR_RenderLineChain *rlc, LANPR_RenderLineChainItem *from, LANPR_RenderLineChainItem *to, float dist_threshold){ + LANPR_RenderLineChainItem *rlci, *next_rlci; + float l[2], r[2], c[2]; + float max_dist = 0; + LANPR_RenderLineChainItem *max_rlci = 0; - // find the max distance item - for(rlci = from->Item.pNext; rlci!= to; rlci=next_rlci){ - next_rlci = rlci->Item.pNext; + // find the max distance item + for (rlci = from->Item.pNext; rlci != to; rlci = next_rlci) { + next_rlci = rlci->Item.pNext; - if(next_rlci && (next_rlci->OcclusionLevel!= rlci->OcclusionLevel || next_rlci->LineType!= rlci->LineType)) continue; + if (next_rlci && (next_rlci->OcclusionLevel != rlci->OcclusionLevel || next_rlci->LineType != rlci->LineType)) continue; float dist = dist_to_line_segment_v2(rlci->pos, from->pos, to->pos); - if (dist>dist_threshold && dist>max_dist) { max_dist = dist; max_rlci = rlci; } + if (dist > dist_threshold && dist > max_dist) { max_dist = dist; max_rlci = rlci; } //if (dist <= dist_threshold) BLI_remlink(&rlc->Chain, (void*)rlci); - } + } if (!max_rlci) { if (from->Item.pNext == to) return; for (rlci = from->Item.pNext; rlci != to; rlci = next_rlci) { next_rlci = rlci->Item.pNext; if (next_rlci && (next_rlci->OcclusionLevel != rlci->OcclusionLevel || next_rlci->LineType != rlci->LineType)) continue; - BLI_remlink(&rlc->Chain, (void*)rlci); + BLI_remlink(&rlc->Chain, (void *)rlci); } - }else { + } + else { if (from->Item.pNext != max_rlci) lanpr_reduce_render_line_chain_recursive(rlc, from, max_rlci, dist_threshold); - if (to->Item.pPrev != max_rlci) lanpr_reduce_render_line_chain_recursive(rlc, max_rlci, to, dist_threshold); + if (to->Item.pPrev != max_rlci) lanpr_reduce_render_line_chain_recursive(rlc, max_rlci, to, dist_threshold); } } void lanpr_NO_THREAD_chain_feature_lines(LANPR_RenderBuffer *rb, float dist_threshold){ - LANPR_RenderLineChain* rlc; - LANPR_RenderLineChainItem* rlci; - LANPR_RenderLine* rl; - LANPR_BoundingArea* ba; - LANPR_RenderLineSegment* rls; + LANPR_RenderLineChain *rlc; + L @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs