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:
authorJeroen Bakker <j.bakker@atmind.nl>2019-03-28 16:51:29 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-03-28 16:52:25 +0300
commitdeb3b8301ab3e94b34b990a434332501e39ae77a (patch)
tree98c6406b74acfc7b4d37ccdcad2be08a76ffbdad /source/blender/draw/intern/draw_cache.c
parentf916b43256a0a9cc351292be88616cde7a5ef5a8 (diff)
DrawManager: Add Edge Detection To DisplayLists
Objects that internally uses DispList do not cast shadow in the workbench. Their outline is also not visible in object mode. The reason for this is that edge detection was not implemented for Display Lists. This patch will implement the edge detection. Reviewed By: fclem Maniphest Tasks: T62479 Differential Revision: https://developer.blender.org/D4605
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r--source/blender/draw/intern/draw_cache.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 482cc047bbc..cdbbcf9ec2b 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -705,8 +705,14 @@ GPUBatch *DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_edge_detection_get(ob, r_is_manifold);
-
- /* TODO, should match 'DRW_cache_object_surface_get' */
+ case OB_CURVE:
+ return DRW_cache_curve_edge_detection_get(ob, r_is_manifold);
+ case OB_SURF:
+ return DRW_cache_surf_edge_detection_get(ob, r_is_manifold);
+ case OB_FONT:
+ return DRW_cache_text_edge_detection_get(ob, r_is_manifold);
+ case OB_MBALL:
+ return DRW_cache_mball_edge_detection_get(ob, r_is_manifold);
default:
return NULL;
}
@@ -3179,6 +3185,19 @@ GPUBatch *DRW_cache_curve_face_wireframe_get(Object *ob)
}
}
+GPUBatch *DRW_cache_curve_edge_detection_get(Object *ob, bool *r_is_manifold)
+{
+ BLI_assert(ob->type == OB_CURVE);
+ struct Curve *cu = ob->data;
+ struct Mesh *mesh_eval = ob->runtime.mesh_eval;
+ if (mesh_eval != NULL) {
+ return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
+ }
+ else {
+ return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
+ }
+}
+
/* Return list of batches */
GPUBatch **DRW_cache_curve_surface_shaded_get(
Object *ob, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
@@ -3207,6 +3226,11 @@ GPUBatch *DRW_cache_mball_surface_get(Object *ob)
return DRW_metaball_batch_cache_get_triangles_with_normals(ob);
}
+GPUBatch *DRW_cache_mball_edge_detection_get(Object *ob, bool *r_is_manifold) {
+ BLI_assert(ob->type == OB_MBALL);
+ return DRW_metaball_batch_cache_get_edge_detection(ob, r_is_manifold);
+}
+
GPUBatch *DRW_cache_mball_face_wireframe_get(Object *ob)
{
BLI_assert(ob->type == OB_MBALL);
@@ -3251,6 +3275,22 @@ GPUBatch *DRW_cache_text_surface_get(Object *ob)
}
}
+GPUBatch *DRW_cache_text_edge_detection_get(Object *ob, bool *r_is_manifold)
+{
+ BLI_assert(ob->type == OB_FONT);
+ struct Curve *cu = ob->data;
+ struct Mesh *mesh_eval = ob->runtime.mesh_eval;
+ if (cu->editfont && (cu->flag & CU_FAST)) {
+ return NULL;
+ }
+ if (mesh_eval != NULL) {
+ return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
+ }
+ else {
+ return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
+ }
+}
+
GPUBatch *DRW_cache_text_loose_edges_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
@@ -3343,6 +3383,19 @@ GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob)
}
}
+GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold)
+{
+ BLI_assert(ob->type == OB_SURF);
+ struct Curve *cu = ob->data;
+ struct Mesh *mesh_eval = ob->runtime.mesh_eval;
+ if (mesh_eval != NULL) {
+ return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold);
+ }
+ else {
+ return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold);
+ }
+}
+
GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob)
{
BLI_assert(ob->type == OB_SURF);