diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-25 17:33:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-25 17:34:01 +0300 |
commit | cb10bd379b2d4b33c1626c7bff3c571f26e1493c (patch) | |
tree | 7444abd76b1b94d749236ebf6aae9f6c1e8a80e6 /source/blender/blenkernel/intern | |
parent | 4f363283eb2cd4f54a8278051c85ded18d1efa4a (diff) |
Fix T67599: Issue with Simple subdivision of loose edges
They were always acting as a B-Spline subdivision.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_mesh.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 75e05f8ffab..a6feae2430d 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -1086,20 +1086,27 @@ static void subdiv_mesh_vertex_of_loose_edge(const struct SubdivForeachContext * const MEdge *coarse_edge = &coarse_mesh->medge[coarse_edge_index]; Mesh *subdiv_mesh = ctx->subdiv_mesh; MVert *subdiv_mvert = subdiv_mesh->mvert; + const bool is_simple = ctx->subdiv->settings.is_simple; /* Find neighbors of the current loose edge. */ const MEdge *neighbors[2]; find_edge_neighbors(ctx, coarse_edge, neighbors); - /* Get points for b-spline interpolation. */ - float points[4][3]; - points_for_loose_edges_interpolation_get(ctx, coarse_edge, neighbors, points); - /* Perform interpolation. */ - float weights[4]; - key_curve_position_weights(u, weights, KEY_BSPLINE); /* Interpolate custom data. */ subdiv_mesh_vertex_of_loose_edge_interpolate(ctx, coarse_edge, u, subdiv_vertex_index); - /* Initialize */ + /* Interpolate coordinate. */ MVert *subdiv_vertex = &subdiv_mvert[subdiv_vertex_index]; - interp_v3_v3v3v3v3(subdiv_vertex->co, points[0], points[1], points[2], points[3], weights); + if (is_simple) { + const MVert *coarse_mvert = coarse_mesh->mvert; + const MVert *vert_1 = &coarse_mvert[coarse_edge->v1]; + const MVert *vert_2 = &coarse_mvert[coarse_edge->v2]; + interp_v2_v2v2(subdiv_vertex->co, vert_1->co, vert_2->co, u); + } + else { + float points[4][3]; + points_for_loose_edges_interpolation_get(ctx, coarse_edge, neighbors, points); + float weights[4]; + key_curve_position_weights(u, weights, KEY_BSPLINE); + interp_v3_v3v3v3v3(subdiv_vertex->co, points[0], points[1], points[2], points[3], weights); + } /* Reset flags and such. */ subdiv_vertex->flag = 0; /* TODO(sergey): This matches old behavior, but we can as well interpolate |