Subsurf: Use edge sharpness directly from converter
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Aug 2018 13:13:24 +0000 (15:13 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Aug 2018 16:42:59 +0000 (18:42 +0200)
Seems it's behaving correct now, surely more tests needed, but
this is required for now to move forward.

intern/opensubdiv/internal/opensubdiv_converter_factory.cc
intern/opensubdiv/internal/opensubdiv_converter_internal.cc
intern/opensubdiv/internal/opensubdiv_converter_internal.h
intern/opensubdiv/internal/opensubdiv_topology_refiner.cc

index 06707cbf4184095fb5156cbe33e56da5a8546d0e..02b6e93a1aef85537a3cbd32768db11226e48101 100644 (file)
@@ -336,7 +336,7 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
   const int num_edges = converter->getNumEdges(converter);
   for (int edge_index = 0; edge_index < num_edges; ++edge_index) {
     const float sharpness =
-        opensubdiv_capi::getCompatibleEdgeSharpness(converter, edge_index);
+        converter->getEdgeSharpness(converter, edge_index);
     setBaseEdgeSharpness(refiner, edge_index, sharpness);
   }
   // OpenSubdiv expects non-manifold vertices to be sharp but at the time it
index 32815dc34dcc3c742268cc5f2d4d67cf5f213ffe..2f7a7109ea1a1b660baa87c7c563582837fc16d3 100644 (file)
@@ -84,13 +84,4 @@ getCAPIFVarLinearInterpolationFromOSD(
   return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
 }
 
-float getCompatibleEdgeSharpness(const OpenSubdiv_Converter* converter,
-                                 int edge_index) {
-  if (converter->getNumEdgeFaces(converter, edge_index) == 2) {
-    return converter->getEdgeSharpness(converter, edge_index);
-  } else {
-    return OpenSubdiv::Sdc::Crease::SHARPNESS_INFINITE;
-  }
-}
-
 }  // namespace opensubdiv_capi
index c47cdd1004dca066b8dffd25126e42cb82acc853..411514c45dc194000fe9e7d8555b8e64258478c5 100644 (file)
@@ -46,10 +46,6 @@ OpenSubdiv_FVarLinearInterpolation
 getCAPIFVarLinearInterpolationFromOSD(
      OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation);
 
-// Get edge sharpness in a way which makes OpenSubdiv happy.
-float getCompatibleEdgeSharpness(const OpenSubdiv_Converter* converter,
-                                 int edge_index);
-
 }  // namespace opensubdiv_capi
 
 #endif  // OPENSUBDIV_CONVERTER_INTERNAL_H_
index 93f6fdc14a1f5b3d1803673ced44853205f9711d..5e1e0bd86b3a8091972f1fa7d6bb87aeaa6a85ee 100644 (file)
@@ -340,7 +340,7 @@ bool checkEdgeSharpnessMatch(
   for (int edge_index = 0; edge_index < num_edges; ++edge_index) {
     const float sharpness = base_level.GetEdgeSharpness(edge_index);
     const float conv_sharpness =
-        opensubdiv_capi::getCompatibleEdgeSharpness(converter, edge_index);
+        converter->getEdgeSharpness(converter, edge_index);
     if (sharpness != conv_sharpness) {
       return false;
     }