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-04 19:52:16 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-04 19:52:32 +0300
commit7e5f31be418d75fa0aa5116a2720a6b7e988f9e4 (patch)
tree809a38df1fb30cc30cd88ed0f3cbc5303a1e273f /source/blender/draw/intern
parent6f198f7851f8c8af4c55f86f0055d5da4c55d07d (diff)
Fix T58609 Subdivision Surface modifier, "Optimal Display" not working
I tried to make it progressive using the wireframe slide but it did not work well. So taking the most straight forward way.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 5d7e588b904..5e0826e9bed 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -4328,7 +4328,6 @@ static GPUVertBuf *mesh_batch_cache_create_edges_overlay_texture_buf(
for (int i = 0; i < tri_len; i++) {
uint vdata[3] = {0, 0, 0};
- bool edge_is_real[3];
bool face_has_edges = false;
const MVert *mvert = rdata->mvert;
@@ -4340,15 +4339,20 @@ static GPUVertBuf *mesh_batch_cache_create_edges_overlay_texture_buf(
for (j = 2, j_next = 0; j_next < 3; j = j_next++) {
const MEdge *ed = &medge[mloop[mlt->tri[j]].e];
const uint tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v};
- edge_is_real[j] = (
- ((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) ||
- ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0])));
+
+ if ((((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) ||
+ ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0]))) &&
+ (ed->flag & ME_EDGERENDER) != 0)
+ {
+ /* Real edge. */
+ vdata[j] |= (1 << 30);
+ }
}
- if (edge_is_real[0] || edge_is_real[1] || edge_is_real[2]) {
+ /* If at least one edge is real. */
+ if (vdata[0] || vdata[1] || vdata[2]) {
/* Decide if face has at least a "dominant" edge. */
- /* Try to do the same facing approximation as in the shader. */
float fnor[3];
if (reduce_len) {
normal_tri_v3(fnor,
@@ -4360,19 +4364,21 @@ static GPUVertBuf *mesh_batch_cache_create_edges_overlay_texture_buf(
for (int e = 0; e < 3; e++) {
int v0 = mloop[mlt->tri[e]].v;
int v1 = mloop[mlt->tri[(e + 1) % 3]].v;
- vdata[e] = (uint)v0;
- EdgeAdjacentVerts *eav = BLI_edgehash_lookup(eh, v0, v1);
- /* Real edge */
- if (edge_is_real[e]) {
- vdata[e] |= (1 << 30);
+ /* The only breakage it would cause is drawing issues. */
+ /* BLI_assert(3FFFFFFF > v0); */
+ vdata[e] |= (uint)v0;
+ /* Non-real edge. */
+ if (vdata[e] == 0) {
+ continue;
}
+ EdgeAdjacentVerts *eav = BLI_edgehash_lookup(eh, v0, v1);
/* If Non Manifold. */
if (eav->vert_index[1] == -1) {
face_has_edges = true;
vdata[e] |= (1u << 31);
}
/* Search for dominant edge. */
- if (reduce_len && !face_has_edges && edge_is_real[e]) {
+ if (reduce_len && !face_has_edges) {
int v2 = mloop[mlt->tri[(e + 2) % 3]].v;
/* Select the right opposite vertex */
v2 = (eav->vert_index[1] == v2) ? eav->vert_index[0] : eav->vert_index[1];