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-05-21 14:21:26 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-27 00:01:30 +0300
commit0c9974c8cd96c1c089cb3f00fb782df7b8294d6c (patch)
tree80e1ce902c79802c543a5a3c8dcb668ca76e1146 /source/blender/draw/intern/draw_cache_impl_mesh.c
parent44935fdfa342307259c4f7163738d5e74374e70a (diff)
Workbench: Shadow: Use depth fail method for manifold objects.
Since this method have no failure case for manifold objects, use it.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 1a14eb2b413..5d60b144fd3 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1633,6 +1633,9 @@ typedef struct MeshBatchCache {
/* XXX, only keep for as long as sculpt mode uses shaded drawing. */
bool is_sculpt_points_tag;
+
+ /* Valid only if edges_adjacency is up to date. */
+ bool is_manifold;
} MeshBatchCache;
/* Gwn_Batch cache management. */
@@ -3234,6 +3237,8 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int tri_len = mesh_render_data_looptri_len_get(rdata);
+ cache->is_manifold = true;
+
/* Allocate max but only used indices are sent to GPU. */
Gwn_IndexBufBuilder elb;
GWN_indexbuf_init(&elb, GWN_PRIM_LINES_ADJ, tri_len * 3, vert_len);
@@ -3279,6 +3284,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
/* Don't share edge if triangles have non matching winding. */
GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0);
GWN_indexbuf_add_line_adj_verts(&elb, v_opposite, v1, v2, v_opposite);
+ cache->is_manifold = false;
}
else {
GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v_opposite);
@@ -3303,6 +3309,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
SWAP(unsigned int, v1, v2);
}
GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0);
+ cache->is_manifold = false;
}
BLI_edgehashIterator_free(ehi);
BLI_edgehash_free(eh, NULL);
@@ -3822,7 +3829,7 @@ Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
return cache->fancy_edges;
}
-Gwn_Batch *DRW_mesh_batch_cache_get_edge_detection(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_edge_detection(Mesh *me, bool *r_is_manifold)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3838,6 +3845,10 @@ Gwn_Batch *DRW_mesh_batch_cache_get_edge_detection(Mesh *me)
mesh_render_data_free(rdata);
}
+ if (r_is_manifold) {
+ *r_is_manifold = cache->is_manifold;
+ }
+
return cache->edge_detection;
}