diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-10-31 19:46:22 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-10-31 19:47:40 +0300 |
commit | a2a8e7121081404e35d9aa4769b17ebf23f83f11 (patch) | |
tree | dcb80b6466cba21f905740abadd6383aa07f0a16 /source/blender/blenkernel/intern | |
parent | 9c328502bb37ab082e4205be4b61fe9d4a43aa1b (diff) |
OpenSubdiv: API, expose vertex boundary interpolation option
Only affects internal API, bout could be exposed as an option for
the compatibility reasons with other software.
Is a part of some ongoing development of multires, but might or
might not be used.
Diffstat (limited to 'source/blender/blenkernel/intern')
5 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c index f81a1d9eec9..0301582b303 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv_converter.c @@ -84,6 +84,13 @@ static OpenSubdiv_SchemeType conv_dm_get_type( return OSD_SCHEME_CATMARK; } +static OpenSubdiv_VtxBoundaryInterpolation +conv_dm_get_vtx_boundary_interpolation( + const OpenSubdiv_Converter *UNUSED(converter)) +{ + return OSD_VTX_BOUNDARY_EDGE_ONLY; +} + static OpenSubdiv_FVarLinearInterpolation conv_dm_get_fvar_linear_interpolation( const OpenSubdiv_Converter *converter) { @@ -448,6 +455,8 @@ void ccgSubSurf_converter_setup_from_derivedmesh( converter->getSchemeType = conv_dm_get_type; + converter->getVtxBoundaryInterpolation = + conv_dm_get_vtx_boundary_interpolation; converter->getFVarLinearInterpolation = conv_dm_get_fvar_linear_interpolation; converter->specifiesFullTopology = conv_dm_specifies_full_topology; @@ -546,6 +555,13 @@ static OpenSubdiv_SchemeType conv_ccg_get_bilinear_type( } } +static OpenSubdiv_VtxBoundaryInterpolation +conv_ccg_get_vtx_boundary_interpolation( + const OpenSubdiv_Converter *UNUSED(converter)) +{ + return OSD_VTX_BOUNDARY_EDGE_ONLY; +} + static OpenSubdiv_FVarLinearInterpolation conv_ccg_get_fvar_linear_interpolation(const OpenSubdiv_Converter *converter) { @@ -750,6 +766,8 @@ void ccgSubSurf_converter_setup_from_ccg(CCGSubSurf *ss, { converter->getSchemeType = conv_ccg_get_bilinear_type; + converter->getVtxBoundaryInterpolation = + conv_ccg_get_vtx_boundary_interpolation; converter->getFVarLinearInterpolation = conv_ccg_get_fvar_linear_interpolation; converter->specifiesFullTopology = conv_ccg_specifies_full_topology; diff --git a/source/blender/blenkernel/intern/multires_subdiv.c b/source/blender/blenkernel/intern/multires_subdiv.c index f745418295d..e0b316d49de 100644 --- a/source/blender/blenkernel/intern/multires_subdiv.c +++ b/source/blender/blenkernel/intern/multires_subdiv.c @@ -48,6 +48,7 @@ void BKE_multires_subdiv_settings_init( settings->is_simple = (mmd->simple != 0); settings->is_adaptive = !settings->is_simple; settings->level = mmd->quality; + settings->vtx_boundary_interpolation = SUBDIV_VTX_BOUNDARY_EDGE_ONLY; settings->fvar_linear_interpolation = BKE_subdiv_fvar_interpolation_from_uv_smooth(mmd->uv_smooth); } diff --git a/source/blender/blenkernel/intern/subdiv_converter.c b/source/blender/blenkernel/intern/subdiv_converter.c index 47e87bfdd78..b3eab1565d7 100644 --- a/source/blender/blenkernel/intern/subdiv_converter.c +++ b/source/blender/blenkernel/intern/subdiv_converter.c @@ -40,6 +40,21 @@ void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter) } } +int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings( + const SubdivSettings *settings) +{ + switch (settings->vtx_boundary_interpolation) { + case SUBDIV_VTX_BOUNDARY_NONE: + return OSD_VTX_BOUNDARY_NONE; + case SUBDIV_VTX_BOUNDARY_EDGE_ONLY: + return OSD_VTX_BOUNDARY_EDGE_ONLY; + case SUBDIV_VTX_BOUNDARY_EDGE_AND_CORNER: + return OSD_VTX_BOUNDARY_EDGE_AND_CORNER; + } + BLI_assert(!"Unknown vtx boundary interpolation"); + return OSD_VTX_BOUNDARY_EDGE_ONLY; +} + /*OpenSubdiv_FVarLinearInterpolation*/ int BKE_subdiv_converter_fvar_linear_from_settings(const SubdivSettings *settings) { diff --git a/source/blender/blenkernel/intern/subdiv_converter.h b/source/blender/blenkernel/intern/subdiv_converter.h index 0326c9e504c..17172bc29f7 100644 --- a/source/blender/blenkernel/intern/subdiv_converter.h +++ b/source/blender/blenkernel/intern/subdiv_converter.h @@ -52,6 +52,12 @@ void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter); /* ============================ INTERNAL HELPERS ============================ */ +/* TODO(sergey): Find a way to make it OpenSubdiv_VtxBoundaryInterpolation, + * without breaking compilation without OpenSubdiv. + */ +int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings( + const SubdivSettings *settings); + /* TODO(sergey): Find a way to make it OpenSubdiv_FVarLinearInterpolation, * without breaking compilation without OpenSubdiv. */ diff --git a/source/blender/blenkernel/intern/subdiv_converter_mesh.c b/source/blender/blenkernel/intern/subdiv_converter_mesh.c index d17ee49ca0c..34675da063e 100644 --- a/source/blender/blenkernel/intern/subdiv_converter_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_converter_mesh.c @@ -87,6 +87,13 @@ static OpenSubdiv_SchemeType get_scheme_type( } } +static OpenSubdiv_VtxBoundaryInterpolation get_vtx_boundary_interpolation( + const struct OpenSubdiv_Converter* converter) { + ConverterStorage *storage = converter->user_data; + return BKE_subdiv_converter_vtx_boundary_interpolation_from_settings( + &storage->settings); +} + static OpenSubdiv_FVarLinearInterpolation get_fvar_linear_interpolation( const OpenSubdiv_Converter *converter) { @@ -264,6 +271,7 @@ static void free_user_data(const OpenSubdiv_Converter *converter) static void init_functions(OpenSubdiv_Converter *converter) { converter->getSchemeType = get_scheme_type; + converter->getVtxBoundaryInterpolation = get_vtx_boundary_interpolation; converter->getFVarLinearInterpolation = get_fvar_linear_interpolation; converter->specifiesFullTopology = specifies_full_topology; |