diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-24 00:10:41 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-24 00:10:48 +0300 |
commit | ee4ec69b28047629a1c153af356757a8fac5cee9 (patch) | |
tree | be1023060e66794968e8e6f7a64b8dea268872ad /source/blender/draw/engines/gpencil/gpencil_engine.h | |
parent | d795dd1fa78036e7faa92891ee985c61508612c6 (diff) |
Fix T66924 : Move GPencil Modifiers evaluation to Depsgraph
Before, the evaluation of modifers were done in draw manager. The reason of the old design was grease pencil was designed before depsgraph was in place.
This commit moves this logic to depsgraph to follow general design and reduce Draw Manager complexity. Also, this is required in order to use modifiers in Edit modes.
Really, there is nothing really new in the creation of derived data, only the logic has been moved to depsgraph, but the main logic is the same. In order to get a reference to the original stroke and points, a pointer is added to Runtime data as part of the evaluated data. These pointers allow to know and use the original data.
As the modifiers now are evaluated in Depsgraph, the evaluated stroke is usable in Edit modes, so now it's possible to work with the evaluated version instead to use a "ghost" of the final image over the original geometry as work today.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5470
Diffstat (limited to 'source/blender/draw/engines/gpencil/gpencil_engine.h')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.h | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index bc83136fece..6c2c9583979 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -35,6 +35,10 @@ struct RenderLayer; struct bGPDstroke; struct tGPspoint; +struct GPUBatch; +struct GPUVertBuf; +struct GPUVertFormat; + #define GPENCIL_CACHE_BLOCK_SIZE 8 #define GPENCIL_MAX_SHGROUPS 65536 #define GPENCIL_GROUPS_BLOCK_SIZE 1024 @@ -46,23 +50,6 @@ struct tGPspoint; #define GPENCIL_COLOR_TEXTURE 1 #define GPENCIL_COLOR_PATTERN 2 -#define GP_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE)) -#define GP_SIMPLIFY_ONPLAY(playing) \ - (((playing == true) && (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY)) || \ - ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ON_PLAY) == 0)) -#define GP_SIMPLIFY_FILL(scene, playing) \ - ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ - (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FILL))) -#define GP_SIMPLIFY_MODIF(scene, playing) \ - ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ - (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_MODIFIER))) -#define GP_SIMPLIFY_FX(scene, playing) \ - ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ - (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_FX))) -#define GP_SIMPLIFY_BLEND(scene, playing) \ - ((GP_SIMPLIFY_ONPLAY(playing) && (GP_SIMPLIFY(scene)) && \ - (scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_BLEND))) - #define GP_IS_CAMERAVIEW ((rv3d != NULL) && (rv3d->persp == RV3D_CAMOB && v3d->camera)) /* *********** OBJECTS CACHE *********** */ @@ -341,13 +328,13 @@ typedef struct GPENCIL_e_data { } GPENCIL_e_data; /* Engine data */ -/* GPUBatch Cache */ +/* GPUBatch Cache Element */ typedef struct GpencilBatchCacheElem { GPUBatch *batch; GPUVertBuf *vbo; int vbo_len; /* attr ids */ - GPUVertFormat format; + GPUVertFormat *format; uint pos_id; uint color_id; uint thickness_id; @@ -358,6 +345,7 @@ typedef struct GpencilBatchCacheElem { int tot_vertex; } GpencilBatchCacheElem; +/* Defines each batch group to define later the shgroup */ typedef struct GpencilBatchGroup { struct bGPDlayer *gpl; /* reference to original layer */ struct bGPDframe *gpf; /* reference to original frame */ @@ -375,6 +363,7 @@ typedef enum GpencilBatchGroup_Type { eGpencilBatchGroupType_Edlin = 5, } GpencilBatchGroup_Type; +/* Runtime data for GPU and evaluated frames after applying modifiers */ typedef struct GpencilBatchCache { GpencilBatchCacheElem b_stroke; GpencilBatchCacheElem b_point; @@ -382,18 +371,19 @@ typedef struct GpencilBatchCache { GpencilBatchCacheElem b_edit; GpencilBatchCacheElem b_edlin; - /* settings to determine if cache is invalid */ + /** Cache is dirty */ bool is_dirty; + /** Edit mode flag */ bool is_editmode; + /** Last cache frame */ 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 */ + /** Total groups in arrays */ + int grp_used; + /** Max size of the array */ + int grp_size; + /** Array of cache elements */ + struct GpencilBatchGroup *grp_cache; } GpencilBatchCache; /* general drawing functions */ |