diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 14:44:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 15:27:31 +0300 |
commit | 4bf26fda97d61bcaad8df52cac92e62c485e8513 (patch) | |
tree | 5e62fe5ea0437f958202d18431669d41b8192856 /intern/opensubdiv/opensubdiv_converter.cc | |
parent | 11ad18c82ab08b0adadc7683c9431b70da8426cc (diff) |
OpenSubdiv: Mark non-manifold verts as sharp
Diffstat (limited to 'intern/opensubdiv/opensubdiv_converter.cc')
-rw-r--r-- | intern/opensubdiv/opensubdiv_converter.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/intern/opensubdiv/opensubdiv_converter.cc b/intern/opensubdiv/opensubdiv_converter.cc index 117edc41bfc..c0fca86ebab 100644 --- a/intern/opensubdiv/opensubdiv_converter.cc +++ b/intern/opensubdiv/opensubdiv_converter.cc @@ -351,21 +351,23 @@ inline bool TopologyRefinerFactory<OpenSubdiv_Converter>::assignComponentTags( setBaseEdgeSharpness(refiner, edge, sharpness); } -#if 0 - /* Non-manifold vertices can't be always smooth. - * I.e. when there's loose edge adjacent to the vertex - * opensubdiv expects vertices to be sharp. But this needs - * some further investigation. + /* OpenSubdiv expects non-manifold vertices to be sharp but at the + * time it handles correct cases when vertex is a corner of plane. + * Currently mark verts which are adjacent to a loose edge as sharp, + * but this decision needs some more investigation. */ int num_vert = conv.get_num_verts(&conv); for (int vert = 0; vert < num_vert; ++vert) { - IndexArray vert_faces = getBaseVertexFaces(refiner, vert), - vert_edges = getBaseVertexEdges(refiner, vert); - if (vert_faces.size() != vert_edges.size()) { - setBaseVertexSharpness(refiner, vert, Crease::SHARPNESS_INFINITE); + ConstIndexArray vert_edges = getBaseVertexEdges(refiner, vert); + for (int edge_index = 0; edge_index < vert_edges.size(); ++edge_index) { + int edge = vert_edges[edge_index]; + ConstIndexArray edge_faces = getBaseEdgeFaces(refiner, edge); + if (edge_faces.size() == 0) { + setBaseVertexSharpness(refiner, vert, Crease::SHARPNESS_INFINITE); + break; + } } } -#endif return true; } |