[Bf-blender-cvs] [31fc01eecbe] master: OIpenSubdiv: Cleanup, move to a better sounding namespace

Sergey Sharybin noreply at git.blender.org
Mon May 18 17:29:16 CEST 2020


Commit: 31fc01eecbef87c1b69c6ab6b11c33de36f55003
Author: Sergey Sharybin
Date:   Mon May 18 17:25:07 2020 +0200
Branches: master
https://developer.blender.org/rB31fc01eecbef87c1b69c6ab6b11c33de36f55003

OIpenSubdiv: Cleanup, move to a better sounding namespace

The code is not only part of C-API, but also implements Blender-specific
glue level implementation.

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

M	intern/opensubdiv/internal/opensubdiv.cc
M	intern/opensubdiv/internal/opensubdiv_converter_factory.cc
M	intern/opensubdiv/internal/opensubdiv_converter_factory.h
M	intern/opensubdiv/internal/opensubdiv_converter_internal.cc
M	intern/opensubdiv/internal/opensubdiv_converter_internal.h
M	intern/opensubdiv/internal/opensubdiv_edge_map.h
M	intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
M	intern/opensubdiv/internal/opensubdiv_evaluator_internal.h
M	intern/opensubdiv/internal/opensubdiv_topology_refiner.cc
M	intern/opensubdiv/internal/opensubdiv_util.cc
M	intern/opensubdiv/internal/opensubdiv_util.h

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

diff --git a/intern/opensubdiv/internal/opensubdiv.cc b/intern/opensubdiv/internal/opensubdiv.cc
index b09e3a54328..e9f6086851b 100644
--- a/intern/opensubdiv/internal/opensubdiv.cc
+++ b/intern/opensubdiv/internal/opensubdiv.cc
@@ -84,7 +84,7 @@ int openSubdiv_getVersionHex(void)
   }
   int major = 0, minor = 0, patch = 0;
   vector<string> tokens;
-  opensubdiv_capi::stringSplit(&tokens, version, "_", true);
+  blender::opensubdiv::stringSplit(&tokens, version, "_", true);
   if (tokens.size() == 3) {
     major = atoi(tokens[0].c_str());
     minor = atoi(tokens[1].c_str());
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc
index 4344bfe8305..dba2a969062 100644
--- a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc
+++ b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc
@@ -32,9 +32,9 @@
 #include "internal/opensubdiv_util.h"
 #include "opensubdiv_converter_capi.h"
 
-using opensubdiv_capi::min;
-using opensubdiv_capi::stack;
-using opensubdiv_capi::vector;
+using blender::opensubdiv::min;
+using blender::opensubdiv::stack;
+using blender::opensubdiv::vector;
 
 struct TopologyRefinerData {
   const OpenSubdiv_Converter *converter;
@@ -245,7 +245,8 @@ inline void TopologyRefinerFactory<TopologyRefinerData>::reportInvalidTopology(
 } /* namespace OPENSUBDIV_VERSION */
 } /* namespace OpenSubdiv */
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 namespace {
 
@@ -291,4 +292,5 @@ OpenSubdiv::Far::TopologyRefiner *createOSDTopologyRefinerFromConverter(
   return TopologyRefinerFactory<TopologyRefinerData>::Create(cb_data, topology_options);
 }
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_factory.h b/intern/opensubdiv/internal/opensubdiv_converter_factory.h
index a1038474d33..3519d3059b2 100644
--- a/intern/opensubdiv/internal/opensubdiv_converter_factory.h
+++ b/intern/opensubdiv/internal/opensubdiv_converter_factory.h
@@ -27,11 +27,13 @@
 
 struct OpenSubdiv_Converter;
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 OpenSubdiv::Far::TopologyRefiner *createOSDTopologyRefinerFromConverter(
     struct OpenSubdiv_Converter *converter);
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
 
 #endif  // OPENSUBDIV_CONVERTER_FACTORY_H_
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_internal.cc b/intern/opensubdiv/internal/opensubdiv_converter_internal.cc
index 0335219d6b9..eedca88f77b 100644
--- a/intern/opensubdiv/internal/opensubdiv_converter_internal.cc
+++ b/intern/opensubdiv/internal/opensubdiv_converter_internal.cc
@@ -25,7 +25,8 @@
 #include <cassert>
 #include <opensubdiv/sdc/crease.h>
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type)
 {
@@ -85,4 +86,5 @@ OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
   return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
 }
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_internal.h b/intern/opensubdiv/internal/opensubdiv_converter_internal.h
index 11c6bdd7f3b..7c586b0787a 100644
--- a/intern/opensubdiv/internal/opensubdiv_converter_internal.h
+++ b/intern/opensubdiv/internal/opensubdiv_converter_internal.h
@@ -30,7 +30,8 @@
 
 struct OpenSubdiv_Converter;
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 // Convert scheme type from C-API enum to an OpenSubdiv native enum.
 OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type);
@@ -44,6 +45,7 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFrom
 OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
     OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation);
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
 
 #endif  // OPENSUBDIV_CONVERTER_INTERNAL_H_
diff --git a/intern/opensubdiv/internal/opensubdiv_edge_map.h b/intern/opensubdiv/internal/opensubdiv_edge_map.h
index e2e6d2328fe..454068b58a4 100644
--- a/intern/opensubdiv/internal/opensubdiv_edge_map.h
+++ b/intern/opensubdiv/internal/opensubdiv_edge_map.h
@@ -21,7 +21,8 @@
 
 #include "internal/opensubdiv_util.h"
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 // Helper class to ease dealing with edge indexing.
 // Simply takes care of ensuring order of vertices is strictly defined.
@@ -144,12 +145,13 @@ template<typename T> typename EdgeTagMap<T>::value_type &EdgeTagMap<T>::operator
   return edge_tags_[key];
 }
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
 
 namespace std {
 
-template<> struct hash<opensubdiv_capi::EdgeKey> {
-  std::size_t operator()(const opensubdiv_capi::EdgeKey &key) const
+template<> struct hash<blender::opensubdiv::EdgeKey> {
+  std::size_t operator()(const blender::opensubdiv::EdgeKey &key) const
   {
     return key.hash();
   }
diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
index c35909a045b..5279752ea4e 100644
--- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
+++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
@@ -53,7 +53,8 @@ using OpenSubdiv::Osd::CpuPatchTable;
 using OpenSubdiv::Osd::CpuVertexBuffer;
 using OpenSubdiv::Osd::PatchCoord;
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 namespace {
 
@@ -731,7 +732,8 @@ void CpuEvalOutputAPI::evaluatePatchesLimit(const OpenSubdiv_PatchCoord *patch_c
   }
 }
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
 
 OpenSubdiv_EvaluatorInternal::OpenSubdiv_EvaluatorInternal()
     : eval_output(NULL), patch_map(NULL), patch_table(NULL)
@@ -748,7 +750,7 @@ OpenSubdiv_EvaluatorInternal::~OpenSubdiv_EvaluatorInternal()
 OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal(
     OpenSubdiv_TopologyRefiner *topology_refiner)
 {
-  using opensubdiv_capi::vector;
+  using blender::opensubdiv::vector;
   TopologyRefiner *refiner = topology_refiner->internal->osd_topology_refiner;
   if (refiner == NULL) {
     // Happens on bad topology.
@@ -851,13 +853,13 @@ OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal(
   }
   // Create OpenSubdiv's CPU side evaluator.
   // TODO(sergey): Make it possible to use different evaluators.
-  opensubdiv_capi::CpuEvalOutput *eval_output = new opensubdiv_capi::CpuEvalOutput(
+  blender::opensubdiv::CpuEvalOutput *eval_output = new blender::opensubdiv::CpuEvalOutput(
       vertex_stencils, varying_stencils, all_face_varying_stencils, 2, patch_table);
   OpenSubdiv::Far::PatchMap *patch_map = new PatchMap(*patch_table);
   // Wrap everything we need into an object which we control from our side.
   OpenSubdiv_EvaluatorInternal *evaluator_descr;
   evaluator_descr = OBJECT_GUARDED_NEW(OpenSubdiv_EvaluatorInternal);
-  evaluator_descr->eval_output = new opensubdiv_capi::CpuEvalOutputAPI(eval_output, patch_map);
+  evaluator_descr->eval_output = new blender::opensubdiv::CpuEvalOutputAPI(eval_output, patch_map);
   evaluator_descr->patch_map = patch_map;
   evaluator_descr->patch_table = patch_table;
   // TOOD(sergey): Look into whether we've got duplicated stencils arrays.
diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h
index 392633944c6..dbe4d88539f 100644
--- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h
+++ b/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h
@@ -29,7 +29,8 @@
 struct OpenSubdiv_PatchCoord;
 struct OpenSubdiv_TopologyRefiner;
 
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
 
 // Anonymous forward declaration of actual evaluator implementation.
 class CpuEvalOutput;
@@ -132,14 +133,15 @@ class CpuEvalOutputAPI {
   OpenSubdiv::Far::PatchMap *patch_map_;
 };
 
-}  // namespace opensubdiv_capi
+}  // namespace opensubdiv
+}  // namespace blender
 
 struct OpenSubdiv_EvaluatorInternal {
  public:
   OpenSubdiv_EvaluatorInternal();
   ~OpenSubdiv_EvaluatorInternal();
 
-  opensubdiv_capi::CpuEvalOutputAPI *eval_output;
+  blender::opensubdiv::CpuEvalOutputAPI *eval_output;
   const OpenSubdiv::Far::PatchMap *patch_map;
   const OpenSubdiv::Far::PatchTable *patch_table;
 };
diff --git a/intern/opensubdiv/internal/opensubdiv_topology_refiner.cc b/intern/opensubdiv/internal/opensubdiv_topology_refiner.cc
index ac27cbdefdc..6e2dae4533a 100644
--- a/intern/opensubdiv/internal/opensubdiv_topology_refiner.cc
+++ b/intern/opensubdiv/internal/opensubdiv_topology_refiner.cc
@@ -28,7 +28,7 @@
 #include "internal/opensubdiv_topology_refiner_internal.h"
 #include "internal/opensubdiv_util.h"
 
-using opensubdiv_capi::vector;
+using blender::opensubdiv::vector;
 
 namespace {
 
@@ -182,7 +182,7 @@ int getNumFVarChannels(const struct OpenSubdiv_TopologyRefiner *topology_refiner
 OpenSubdiv_FVarLinearInterpolation getFVarLinearInterpolation(
     const struct OpenSubdiv_TopologyRefiner *topology_refiner)
 {
-  return opensubdiv_capi::getCAPIFVarLinearInterpolationFromOSD(
+  return blender::opensubdiv::getCAPIFVarLinearInterpolationFromOSD(
       getOSDTopologyRefiner(topology_refiner)->GetFVarLinearInterpolation());
 }
 
@@ -243,7 +243,7 @@ OpenSubdiv_TopologyRefiner *openSubdiv_createTopologyRefinerFromConverter(
     OpenSubdiv_Converter *converter, const OpenSubdiv_TopologyRefinerSettings *settings)
 {
   OpenSubdiv::Far::TopologyRefiner *osd_topology_refiner =
-      opensubdiv_capi::createOSDTopologyRefinerFromConverter(converter);
+      blender::opensubdiv::createOSDTopologyRefinerFromConverter(converter);
   if (osd_topology_refiner == NULL) {
     // Happens on empty or bad topology.
     return NULL;
@@ -265,7 +265,8 @@ void openSubdiv_deleteTopologyRefiner(OpenSubdiv_TopologyRefiner *topology_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list