From be03a756e5f8b691c8b25e52fed63816ca02add1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 19 May 2020 10:52:35 +0200 Subject: OpenSubdiv: Cleanup, move utility function to base type conversion --- intern/opensubdiv/internal/base/type_convert.cc | 17 +++++++++++++++++ intern/opensubdiv/internal/base/type_convert.h | 5 ++++- .../internal/topology/topology_refiner_capi.cc | 1 + .../internal/topology/topology_refiner_factory.cc | 17 ----------------- 4 files changed, 22 insertions(+), 18 deletions(-) (limited to 'intern') diff --git a/intern/opensubdiv/internal/base/type_convert.cc b/intern/opensubdiv/internal/base/type_convert.cc index 43412a66f33..08778ab3877 100644 --- a/intern/opensubdiv/internal/base/type_convert.cc +++ b/intern/opensubdiv/internal/base/type_convert.cc @@ -86,5 +86,22 @@ OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD( return OSD_FVAR_LINEAR_INTERPOLATION_NONE; } +OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI( + OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation) +{ + using OpenSubdiv::Sdc::Options; + + switch (boundary_interpolation) { + case OSD_VTX_BOUNDARY_NONE: + return Options::VTX_BOUNDARY_NONE; + case OSD_VTX_BOUNDARY_EDGE_ONLY: + return Options::VTX_BOUNDARY_EDGE_ONLY; + case OSD_VTX_BOUNDARY_EDGE_AND_CORNER: + return Options::VTX_BOUNDARY_EDGE_AND_CORNER; + } + assert(!"Unknown veretx boundary interpolation."); + return Options::VTX_BOUNDARY_EDGE_ONLY; +} + } // namespace opensubdiv } // namespace blender diff --git a/intern/opensubdiv/internal/base/type_convert.h b/intern/opensubdiv/internal/base/type_convert.h index 52989a4bef9..b0de0d8fc54 100644 --- a/intern/opensubdiv/internal/base/type_convert.h +++ b/intern/opensubdiv/internal/base/type_convert.h @@ -26,7 +26,7 @@ #include #include -#include "opensubdiv_converter_capi.h" +#include "opensubdiv_capi_type.h" struct OpenSubdiv_Converter; @@ -45,6 +45,9 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFrom OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD( OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation); +OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI( + OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation); + } // namespace opensubdiv } // namespace blender diff --git a/intern/opensubdiv/internal/topology/topology_refiner_capi.cc b/intern/opensubdiv/internal/topology/topology_refiner_capi.cc index 928fe49114e..fbca43065b4 100644 --- a/intern/opensubdiv/internal/topology/topology_refiner_capi.cc +++ b/intern/opensubdiv/internal/topology/topology_refiner_capi.cc @@ -23,6 +23,7 @@ #include "internal/base/type_convert.h" #include "internal/opensubdiv_util.h" #include "internal/topology/topology_refiner_impl.h" +#include "opensubdiv_converter_capi.h" using blender::opensubdiv::vector; diff --git a/intern/opensubdiv/internal/topology/topology_refiner_factory.cc b/intern/opensubdiv/internal/topology/topology_refiner_factory.cc index ae97797f214..b35b0cf1f82 100644 --- a/intern/opensubdiv/internal/topology/topology_refiner_factory.cc +++ b/intern/opensubdiv/internal/topology/topology_refiner_factory.cc @@ -251,23 +251,6 @@ namespace opensubdiv { namespace { -OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI( - OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation) -{ - using OpenSubdiv::Sdc::Options; - - switch (boundary_interpolation) { - case OSD_VTX_BOUNDARY_NONE: - return Options::VTX_BOUNDARY_NONE; - case OSD_VTX_BOUNDARY_EDGE_ONLY: - return Options::VTX_BOUNDARY_EDGE_ONLY; - case OSD_VTX_BOUNDARY_EDGE_AND_CORNER: - return Options::VTX_BOUNDARY_EDGE_AND_CORNER; - } - assert(!"Unknown veretx boundary interpolation."); - return Options::VTX_BOUNDARY_EDGE_ONLY; -} - OpenSubdiv::Sdc::Options getSDCOptions(OpenSubdiv_Converter *converter) { using OpenSubdiv::Sdc::Options; -- cgit v1.2.3