Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-01-07 12:29:48 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-01-07 12:33:40 +0300
commitf19b3f9b77a54e12a083bde0a6036d7d60bb53e6 (patch)
treec448ebfeac0384f8150deaca6450c006e9a2bbf0 /intern/opensubdiv
parentcfeffa7529a251c3a2af2cf2208a8550eb81ddcc (diff)
OpenSundiv: Simplify tweaking of shared stencil/patch settings
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r--intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
index 8ebae7dda06..564c8a8c3ec 100644
--- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
+++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
@@ -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(