Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-13 03:26:07 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-14 18:17:29 +0300
commit2afed99da3a8e76b8041e9f636fb198b332896cc (patch)
tree685db211975adce08a3b299e3eb9cbf7fb7a8d44 /source/blender/draw/intern/draw_cache.c
parent77164e30c730be27910d92a666d4b6c2d2d30721 (diff)
Curve Batch Cache: Rework Implementation to use new batch request
Shaded triangles are not yet implemented (request from gpumaterials). This also changes the mechanism to draw curve normals to make it not dependant on normal size display. This way different viewport can reuse the same batch.
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r--source/blender/draw/intern/draw_cache.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 39e4ecf0520..3e49d890327 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3195,15 +3195,15 @@ GPUBatch *DRW_cache_curve_edge_wire_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_wire_edge(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_wire_edge(cu);
}
-GPUBatch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
+GPUBatch *DRW_cache_curve_edge_normal_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_normal_edge(cu, ob->runtime.curve_cache, normal_size);
+ return DRW_curve_batch_cache_get_normal_edge(cu);
}
GPUBatch *DRW_cache_curve_edge_overlay_get(Object *ob)
@@ -3227,7 +3227,7 @@ GPUBatch *DRW_cache_curve_surface_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_triangles_with_normals(cu);
}
GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob)
@@ -3235,7 +3235,7 @@ GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob)
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_wireframes_face(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_wireframes_face(cu);
}
/* Return list of batches */
@@ -3245,7 +3245,7 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(
BLI_assert(ob->type == OB_CURVE);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
+ return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
}
/** \} */
@@ -3287,7 +3287,7 @@ GPUBatch *DRW_cache_text_edge_wire_get(Object *ob)
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_wire_edge(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_wire_edge(cu);
}
GPUBatch *DRW_cache_text_surface_get(Object *ob)
@@ -3297,7 +3297,7 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob)
if (cu->editfont && (cu->flag & CU_FAST)) {
return NULL;
}
- return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_triangles_with_normals(cu);
}
GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob)
@@ -3307,7 +3307,7 @@ GPUBatch *DRW_cache_text_face_wireframe_get(Object *ob)
if (cu->editfont && (cu->flag & CU_FAST)) {
return NULL;
}
- return DRW_curve_batch_cache_get_wireframes_face(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_wireframes_face(cu);
}
GPUBatch **DRW_cache_text_surface_shaded_get(
@@ -3318,21 +3318,7 @@ GPUBatch **DRW_cache_text_surface_shaded_get(
if (cu->editfont && (cu->flag & CU_FAST)) {
return NULL;
}
- return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
-}
-
-GPUBatch *DRW_cache_text_cursor_overlay_get(Object *ob)
-{
- BLI_assert(ob->type == OB_FONT);
- struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_edit_cursor(cu);
-}
-
-GPUBatch *DRW_cache_text_select_overlay_get(Object *ob)
-{
- BLI_assert(ob->type == OB_FONT);
- struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_edit_select(cu);
+ return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
}
/** \} */
@@ -3347,7 +3333,7 @@ GPUBatch *DRW_cache_surf_surface_get(Object *ob)
BLI_assert(ob->type == OB_SURF);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_triangles_with_normals(cu);
}
GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob)
@@ -3355,7 +3341,7 @@ GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob)
BLI_assert(ob->type == OB_SURF);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_wireframes_face(cu, ob->runtime.curve_cache);
+ return DRW_curve_batch_cache_get_wireframes_face(cu);
}
/* Return list of batches */
@@ -3365,7 +3351,7 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(
BLI_assert(ob->type == OB_SURF);
struct Curve *cu = ob->data;
- return DRW_curve_batch_cache_get_surface_shaded(cu, ob->runtime.curve_cache, gpumat_array, gpumat_array_len);
+ return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len);
}
/** \} */
@@ -3748,6 +3734,11 @@ void drw_batch_cache_generate_requested(Object *ob)
case OB_MESH:
DRW_mesh_batch_cache_create_requested(ob);
break;
+ case OB_CURVE:
+ case OB_FONT:
+ case OB_SURF:
+ DRW_curve_batch_cache_create_requested(ob);
+ break;
/* TODO all cases */
default:
break;