diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-09-18 20:30:02 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-09-18 20:30:51 +0300 |
commit | 6c9ec1c893f98c2349edd3aaae4b606b55b393c9 (patch) | |
tree | 1a3747a77a7eacd59304143ef717896fb5991371 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | ea6cd1c8f05b27a81e835251e779f047a3488203 (diff) |
Sculpt: Render Mask and Face Sets with modifiers active
This removes the limitation of the sculpt overlays not being visible
with modifiers active.
Reviewed By: fclem
Maniphest Tasks: T68900
Differential Revision: https://developer.blender.org/D8673
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index d090832dc4b..6df0c7cc5ad 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -891,6 +891,17 @@ int DRW_mesh_material_count_get(Mesh *me) return mesh_render_mat_len_get(me); } +GPUBatch *DRW_mesh_batch_cache_get_sculpt_overlays(Mesh *me) +{ + MeshBatchCache *cache = mesh_batch_cache_get(me); + + cache->cd_needed.sculpt_overlays = 1; + mesh_batch_cache_add_request(cache, MBC_SCULPT_OVERLAYS); + DRW_batch_request(&cache->batch.sculpt_overlays); + + return cache->batch.sculpt_overlays; +} + /** \} */ /* ---------------------------------------------------------------------- */ @@ -1242,6 +1253,9 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, if (cache->cd_used.orco != cache->cd_needed.orco) { GPU_VERTBUF_DISCARD_SAFE(mbuffercache->vbo.orco); } + if (cache->cd_used.sculpt_overlays != cache->cd_needed.sculpt_overlays) { + GPU_VERTBUF_DISCARD_SAFE(mbuffercache->vbo.sculpt_data); + } if (((cache->cd_used.vcol & cache->cd_needed.vcol) != cache->cd_needed.vcol) || ((cache->cd_used.sculpt_vcol & cache->cd_needed.sculpt_vcol) != cache->cd_needed.sculpt_vcol)) { @@ -1333,6 +1347,11 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, if (DRW_batch_requested(cache->batch.all_verts, GPU_PRIM_POINTS)) { DRW_vbo_request(cache->batch.all_verts, &mbufcache->vbo.pos_nor); } + if (DRW_batch_requested(cache->batch.sculpt_overlays, GPU_PRIM_TRIS)) { + DRW_ibo_request(cache->batch.sculpt_overlays, &mbufcache->ibo.tris); + DRW_vbo_request(cache->batch.sculpt_overlays, &mbufcache->vbo.pos_nor); + DRW_vbo_request(cache->batch.sculpt_overlays, &mbufcache->vbo.sculpt_data); + } if (DRW_batch_requested(cache->batch.all_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.all_edges, &mbufcache->ibo.lines); DRW_vbo_request(cache->batch.all_edges, &mbufcache->vbo.pos_nor); |