OpenSundiv: Simplify tweaking of shared stencil/patch settings
This commit is contained in:
parent
cfeffa7529
commit
f19b3f9b77
|
@ -707,12 +707,16 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal(
|
|||
const bool has_face_varying_data = (num_face_varying_channels != 0);
|
||||
const int level = topology_refiner->getSubdivisionLevel(topology_refiner);
|
||||
const bool is_adaptive = topology_refiner->getIsAdaptive(topology_refiner);
|
||||
// Common settings for stencils and patches.
|
||||
const bool stencil_generate_intermediate_levels = is_adaptive;
|
||||
const bool stencil_generate_offsets = true;
|
||||
const bool use_inf_sharp_patch = true;
|
||||
// Refine the topology with given settings.
|
||||
// TODO(sergey): What if topology is already refined?
|
||||
if (is_adaptive) {
|
||||
TopologyRefiner::AdaptiveOptions options(level);
|
||||
options.considerFVarChannels = has_face_varying_data;
|
||||
options.useInfSharpPatch = true;
|
||||
options.useInfSharpPatch = use_inf_sharp_patch;
|
||||
refiner->RefineAdaptive(options);
|
||||
} else {
|
||||
TopologyRefiner::UniformOptions options(level);
|
||||
|
@ -723,8 +727,9 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal(
|
|||
//
|
||||
// Vertex stencils.
|
||||
StencilTableFactory::Options vertex_stencil_options;
|
||||
vertex_stencil_options.generateOffsets = true;
|
||||
vertex_stencil_options.generateIntermediateLevels = is_adaptive;
|
||||
vertex_stencil_options.generateOffsets = stencil_generate_offsets;
|
||||
vertex_stencil_options.generateIntermediateLevels =
|
||||
stencil_generate_intermediate_levels;
|
||||
const StencilTable* vertex_stencils =
|
||||
StencilTableFactory::Create(*refiner, vertex_stencil_options);
|
||||
// Varying stencils.
|
||||
|
@ -734,8 +739,9 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal(
|
|||
const StencilTable* varying_stencils = NULL;
|
||||
if (has_varying_data) {
|
||||
StencilTableFactory::Options varying_stencil_options;
|
||||
varying_stencil_options.generateOffsets = true;
|
||||
varying_stencil_options.generateIntermediateLevels = is_adaptive;
|
||||
varying_stencil_options.generateOffsets = stencil_generate_offsets;
|
||||
varying_stencil_options.generateIntermediateLevels =
|
||||
stencil_generate_intermediate_levels;
|
||||
varying_stencil_options.interpolationMode =
|
||||
StencilTableFactory::INTERPOLATE_VARYING;
|
||||
varying_stencils =
|
||||
|
@ -749,8 +755,9 @@ vector<const StencilTable*> all_face_varying_stencils;
|
|||
face_varying_channel < num_face_varying_channels;
|
||||
++face_varying_channel) {
|
||||
StencilTableFactory::Options face_varying_stencil_options;
|
||||
face_varying_stencil_options.generateOffsets = true;
|
||||
face_varying_stencil_options.generateIntermediateLevels = is_adaptive;
|
||||
face_varying_stencil_options.generateOffsets = stencil_generate_offsets;
|
||||
face_varying_stencil_options.generateIntermediateLevels =
|
||||
stencil_generate_intermediate_levels;
|
||||
face_varying_stencil_options.interpolationMode =
|
||||
StencilTableFactory::INTERPOLATE_FACE_VARYING;
|
||||
face_varying_stencil_options.fvarChannel = face_varying_channel;
|
||||
|
@ -764,7 +771,7 @@ vector<const StencilTable*> all_face_varying_stencils;
|
|||
// subsurf code.
|
||||
PatchTableFactory::Options patch_options(level);
|
||||
patch_options.SetEndCapType(PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS);
|
||||
patch_options.useInfSharpPatch = true;
|
||||
patch_options.useInfSharpPatch = use_inf_sharp_patch;
|
||||
patch_options.generateFVarTables = has_face_varying_data;
|
||||
patch_options.generateFVarLegacyLinearPatches = false;
|
||||
const PatchTable* patch_table = PatchTableFactory::Create(
|
||||
|
|
Loading…
Reference in New Issue