Commit: 56bc8e929a7d5fccf8caec49d2e0889187b9d9f3 Author: Antonioya Date: Thu Jun 27 16:44:09 2019 +0200 Branches: greasepencil-object https://developer.blender.org/rB56bc8e929a7d5fccf8caec49d2e0889187b9d9f3
Merge branch 'master' into greasepencil-object Conflicts: source/blender/draw/engines/gpencil/gpencil_draw_utils.c =================================================================== =================================================================== diff --cc source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c index c270480e4dd,18950f00823..65c1ba89dda --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@@ -129,19 -129,12 +129,19 @@@ static void gpencil_vbo_ensure_size(Gpe } } +static void gpencil_elem_format_ensure(GpencilBatchCacheElem *be) +{ + if (be->format == NULL) { + be->format = MEM_callocN(sizeof(GPUVertFormat), __func__); + } +} + /* create batch geometry data for points stroke shader */ - void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be, - bGPDstroke *gps, - short thickness, - const float ink[4], - const int alignment_mode) + void gpencil_get_point_geom(GpencilBatchCacheElem *be, + bGPDstroke *gps, + short thickness, + const float ink[4], + const int alignment_mode) { int totvertex = gps->totpoints; if (be->vbo == NULL) { diff --cc source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 0af3fcd19fe,fa706812715..de2b799a683 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@@ -82,8 -86,9 +82,8 @@@ static void gpencil_calc_vertex(GPENCIL (bool)((draw_ctx->v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) : true; const bool do_onion = (bool)((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0) && overlay && - main_onion && DRW_gpencil_onion_active(gpd) && !playing; + main_onion && gpencil_onion_active(gpd) && !playing; - const bool time_remap = BKE_gpencil_has_time_modifiers(ob); const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); cache_ob->tot_vertex = 0; @@@ -1041,8 -1069,9 +1041,8 @@@ static void gpencil_draw_strokes(Gpenci /* be sure recalc all cache in source stroke to avoid recalculation when frame change * and improve fps */ - DRW_gpencil_recalc_geometry_caches( - if (src_gps) { - gpencil_recalc_geometry_caches(ob, gpl, gp_style, src_gps); - } ++ gpencil_recalc_geometry_caches( + ob, gpl, gp_style, (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps); /* if the fill has any value, it's considered a fill and is not drawn if simplify fill is * enabled */ @@@ -1315,9 -1356,28 +1315,9 @@@ static void gpencil_draw_onionskins(Gpe } } -static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe *derived_gpf) -{ - derived_gpf->prev = gpf->prev; - derived_gpf->next = gpf->next; - derived_gpf->framenum = gpf->framenum; - derived_gpf->flag = gpf->flag; - derived_gpf->key_type = gpf->key_type; - derived_gpf->runtime = gpf->runtime; - copy_m4_m4(derived_gpf->runtime.parent_obmat, gpf->runtime.parent_obmat); - - /* copy strokes */ - BLI_listbase_clear(&derived_gpf->strokes); - for (bGPDstroke *gps_src = gpf->strokes.first; gps_src; gps_src = gps_src->next) { - /* make copy of source stroke */ - bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps_src); - BLI_addtail(&derived_gpf->strokes, gps_dst); - } -} - /* Triangulate stroke for high quality fill (this is done only if cache is null or stroke was * modified) */ - void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps) + void gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps) { BLI_assert(gps->totpoints >= 3); @@@ -1851,11 -1914,33 +1852,11 @@@ void gpencil_populate_multiedit(GPENCIL cache->is_dirty = false; } -/* ensure there is a derived frame */ -static void gpencil_ensure_derived_frame(bGPdata *gpd, - bGPDlayer *gpl, - bGPDframe *gpf, - GpencilBatchCache *cache, - bGPDframe **derived_gpf) -{ - /* create derived frames array data or expand */ - int derived_idx = BLI_findindex(&gpd->layers, gpl); - *derived_gpf = &cache->derived_array[derived_idx]; - - /* if no derived frame or dirty cache, create a new one */ - if ((*derived_gpf == NULL) || (cache->is_dirty)) { - if (*derived_gpf != NULL) { - /* first clear temp data */ - BKE_gpencil_free_frame_runtime_data(*derived_gpf); - } - /* create new data (do not assign new memory)*/ - gpencil_copy_frame(gpf, *derived_gpf); - } -} - /* helper for populate a complete grease pencil datablock */ - void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, - void *vedata, - Object *ob, - tGPencilObjectCache *cache_ob) + void gpencil_populate_datablock(GPENCIL_e_data *e_data, + void *vedata, + Object *ob, + tGPencilObjectCache *cache_ob) { GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); @@@ -1967,9 -2056,14 +1968,9 @@@ cache_ob); } - /* clear any lattice data */ - if ((cache->is_dirty) && (ob->greasepencil_modifiers.first)) { - BKE_gpencil_lattice_clear(ob); - } - /* create batchs and shading groups */ - DRW_gpencil_create_batches(cache); - DRW_gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); + gpencil_create_batches(cache); + gpencil_shgroups_create(e_data, vedata, ob, cache, cache_ob); cache->is_dirty = false; } diff --cc source/blender/draw/engines/gpencil/gpencil_engine.h index 3287d355305,416331e7aeb..5467e3720c7 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@@ -328,66 -341,121 +327,66 @@@ typedef struct GPENCIL_e_data } GPENCIL_e_data; /* Engine data */ -/* GPUBatch Cache */ -typedef struct GpencilBatchCacheElem { - GPUBatch *batch; - GPUVertBuf *vbo; - int vbo_len; - /* attr ids */ - GPUVertFormat format; - uint pos_id; - uint color_id; - uint thickness_id; - uint uvdata_id; - uint prev_pos_id; - - /* size for VBO alloc */ - int tot_vertex; -} GpencilBatchCacheElem; - -typedef struct GpencilBatchGroup { - bGPDlayer *gpl; /* reference to original layer */ - bGPDframe *gpf; /* reference to original frame */ - bGPDstroke *gps; /* reference to original stroke */ - short type; /* type of element */ - bool onion; /* the group is part of onion skin */ - int vertex_idx; /* index of vertex data */ -} GpencilBatchGroup; - -typedef enum GpencilBatchGroup_Type { - eGpencilBatchGroupType_Stroke = 1, - eGpencilBatchGroupType_Point = 2, - eGpencilBatchGroupType_Fill = 3, - eGpencilBatchGroupType_Edit = 4, - eGpencilBatchGroupType_Edlin = 5, -} GpencilBatchGroup_Type; - -typedef struct GpencilBatchCache { - GpencilBatchCacheElem b_stroke; - GpencilBatchCacheElem b_point; - GpencilBatchCacheElem b_fill; - GpencilBatchCacheElem b_edit; - GpencilBatchCacheElem b_edlin; - - /* settings to determine if cache is invalid */ - bool is_dirty; - bool is_editmode; - int cache_frame; - - /* data with the shading groups */ - int grp_used; /* total groups in arrays */ - int grp_size; /* max size of the array */ - struct GpencilBatchGroup *grp_cache; /* array of elements */ - - int tot_layers; - struct bGPDframe *derived_array; /* runtime data created by modifiers */ -} GpencilBatchCache; - /* general drawing functions */ - struct DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(struct GPENCIL_Data *vedata, - struct DRWPass *pass, - struct GPUShader *shader, - struct Object *ob, - struct bGPdata *gpd, - struct bGPDlayer *gpl, - struct bGPDstroke *gps, - struct MaterialGPencilStyle *gp_style, - int id, - bool onion, - const float scale, - const int shading_type[2]); - void DRW_gpencil_populate_datablock(struct GPENCIL_e_data *e_data, - void *vedata, - struct Object *ob, - struct tGPencilObjectCache *cache_ob); - void DRW_gpencil_populate_buffer_strokes(struct GPENCIL_e_data *e_data, - void *vedata, - struct ToolSettings *ts, - struct Object *ob); - void DRW_gpencil_populate_multiedit(struct GPENCIL_e_data *e_data, - void *vedata, - struct Object *ob, - struct tGPencilObjectCache *cache_ob); - void DRW_gpencil_triangulate_stroke_fill(struct Object *ob, struct bGPDstroke *gps); - void DRW_gpencil_populate_particles(struct GPENCIL_e_data *e_data, - struct GHash *gh_objects, - void *vedata); - - void DRW_gpencil_multisample_ensure(struct GPENCIL_Data *vedata, int rect_w, int rect_h); + struct DRWShadingGroup *gpencil_shgroup_stroke_create(struct GPENCIL_Data *vedata, + struct DRWPass *pass, + @@ 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