diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
commit | 29f3af95272590d26f610ae828b2eeee89c82a00 (patch) | |
tree | a696a58a2561c48f7ec6166e369e22081e0a64d8 /source/blender/draw/intern/draw_cache.c | |
parent | dcb93126876879d969a30a7865700abd072066f8 (diff) |
GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes.
Also, a huge code cleanup has been done at all levels.
Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development.
Differential Revision: https://developer.blender.org/D6293
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index f37e5b14d83..d0cea5b8c5c 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -136,6 +136,7 @@ static struct DRWShapeCache { GPUBatch *drw_particle_cross; GPUBatch *drw_particle_circle; GPUBatch *drw_particle_axis; + GPUBatch *drw_gpencil_dummy_quad; } SHC = {NULL}; void DRW_shape_cache_free(void) @@ -747,6 +748,29 @@ GPUBatch *DRW_cache_normal_arrow_get(void) } /* -------------------------------------------------------------------- */ +/** \name Dummy vbos + * + * We need a dummy vbo containing the vertex count to draw instances ranges. + * + * \{ */ + +GPUBatch *DRW_gpencil_dummy_buffer_get(void) +{ + if (SHC.drw_gpencil_dummy_quad == NULL) { + GPUVertFormat format = {0}; + GPU_vertformat_attr_add(&format, "dummy", GPU_COMP_U8, 1, GPU_FETCH_INT); + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, 4); + + SHC.drw_gpencil_dummy_quad = GPU_batch_create_ex( + GPU_PRIM_TRI_FAN, vbo, NULL, GPU_BATCH_OWNS_VBO); + } + return SHC.drw_gpencil_dummy_quad; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Common Object API * \{ */ @@ -793,6 +817,9 @@ GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob) return DRW_cache_text_face_wireframe_get(ob); case OB_MBALL: return DRW_cache_mball_face_wireframe_get(ob); + case OB_GPENCIL: { + return DRW_cache_gpencil_face_wireframe_get(ob); + } default: return NULL; } |