diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/opensubdiv/internal/opensubdiv_converter_factory.cc | 11 | ||||
-rw-r--r-- | intern/opensubdiv/opensubdiv_converter_capi.h | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc index 321f580af97..901a421314a 100644 --- a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc +++ b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc @@ -379,13 +379,18 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags( if (converter->isInfiniteSharpVertex(converter, vertex_index)) { setBaseVertexSharpness( refiner, vertex_index, Crease::SHARPNESS_INFINITE); - } else if (vertex_edges.size() == 2) { + continue; + } + float sharpness = converter->getVertexSharpness(converter, vertex_index); + if (vertex_edges.size() == 2) { const int edge0 = vertex_edges[0], edge1 = vertex_edges[1]; const float sharpness0 = refiner._levels[0]->getEdgeSharpness(edge0); const float sharpness1 = refiner._levels[0]->getEdgeSharpness(edge1); - const float sharpness = std::min(sharpness0, sharpness1); - setBaseVertexSharpness(refiner, vertex_index, sharpness); + // TODO(sergey): Find a better mixing between edge and vertex sharpness. + sharpness += std::min(sharpness0, sharpness1); + sharpness = std::min(sharpness, 1.0f); } + setBaseVertexSharpness(refiner, vertex_index, sharpness); } return true; } diff --git a/intern/opensubdiv/opensubdiv_converter_capi.h b/intern/opensubdiv/opensubdiv_converter_capi.h index 1dd68f43c32..9f559ee208b 100644 --- a/intern/opensubdiv/opensubdiv_converter_capi.h +++ b/intern/opensubdiv/opensubdiv_converter_capi.h @@ -111,6 +111,10 @@ typedef struct OpenSubdiv_Converter { bool (*isInfiniteSharpVertex)(const struct OpenSubdiv_Converter* converter, const int vertex_index); + // If vertex is not infinitely sharp, this is it's actual sharpness. + float (*getVertexSharpness)(const struct OpenSubdiv_Converter* converter, + const int vertex_index); + ////////////////////////////////////////////////////////////////////////////// // Face-varying data. |