[Bf-blender-cvs] [f19b3f9b77a] master: OpenSundiv: Simplify tweaking of shared stencil/patch settings

Sergey Sharybin noreply at git.blender.org
Mon Jan 7 10:33:49 CET 2019


Commit: f19b3f9b77a54e12a083bde0a6036d7d60bb53e6
Author: Sergey Sharybin
Date:   Mon Jan 7 10:29:48 2019 +0100
Branches: master
https://developer.blender.org/rBf19b3f9b77a54e12a083bde0a6036d7d60bb53e6

OpenSundiv: Simplify tweaking of shared stencil/patch settings

===================================================================

M	intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc

===================================================================

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(



More information about the Bf-blender-cvs mailing list