diff options
author | Germano <germano.costa@ig.com.br> | 2017-12-14 17:21:38 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2017-12-14 17:21:38 +0300 |
commit | 5b5de35604569bfe5007a7ed427c702775c7871c (patch) | |
tree | 10bf8f2d8728239b84a97dd343aed96590d9feab /source/blender/draw/intern/draw_cache.c | |
parent | bb9d068ccc2b86d4f3fc06fceca90f26e34cdf7e (diff) |
Support for Batchs split by material for objects of type Curve, Surface, and Text
**ToDo:**
- add vertbuff for UV (what can be adapted from `dl_surf_to_renderdata`)
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 8010a232f89..e02f6bd6306 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -520,6 +520,12 @@ Gwn_Batch **DRW_cache_object_surface_material_get( switch (ob->type) { case OB_MESH: return DRW_cache_mesh_surface_shaded_get(ob, gpumat_array, gpumat_array_len); + case OB_CURVE: + return DRW_cache_curve_surface_shaded_get(ob, gpumat_array, gpumat_array_len); + case OB_SURF: + return DRW_cache_surf_surface_shaded_get(ob, gpumat_array, gpumat_array_len); + case OB_FONT: + return DRW_cache_text_surface_shaded_get(ob, gpumat_array, gpumat_array_len); default: return NULL; } @@ -2334,6 +2340,16 @@ Gwn_Batch *DRW_cache_curve_surface_get(Object *ob) return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); } +/* Return list of batches */ +Gwn_Batch **DRW_cache_curve_surface_shaded_get( + Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len) +{ + BLI_assert(ob->type == OB_CURVE); + + struct Curve *cu = ob->data; + return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len); +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -2372,6 +2388,17 @@ Gwn_Batch *DRW_cache_text_surface_get(Object *ob) return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); } +Gwn_Batch **DRW_cache_text_surface_shaded_get( + Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len) +{ + BLI_assert(ob->type == OB_FONT); + struct Curve *cu = ob->data; + if (cu->editfont && (cu->flag & CU_FAST)) { + return NULL; + } + return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len); +} + Gwn_Batch *DRW_cache_text_cursor_overlay_get(Object *ob) { BLI_assert(ob->type == OB_FONT); @@ -2401,6 +2428,16 @@ Gwn_Batch *DRW_cache_surf_surface_get(Object *ob) return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); } +/* Return list of batches */ +Gwn_Batch **DRW_cache_surf_surface_shaded_get( + Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len) +{ + BLI_assert(ob->type == OB_SURF); + + struct Curve *cu = ob->data; + return DRW_curve_batch_cache_get_surface_shaded(cu, ob->curve_cache, gpumat_array, gpumat_array_len); +} + /** \} */ /* -------------------------------------------------------------------- */ |