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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-05-18 18:25:07 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-05-18 18:25:07 +0300
commit31fc01eecbef87c1b69c6ab6b11c33de36f55003 (patch)
tree7e0433bb2d0fc9be6bc8c04397587b3766007f29 /intern
parent2ad5131f77c76576cfb3def7218aa893d8783337 (diff)
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.
Diffstat (limited to 'intern')
-rw-r--r--intern/opensubdiv/internal/opensubdiv.cc2
-rw-r--r--intern/opensubdiv/internal/opensubdiv_converter_factory.cc12
-rw-r--r--intern/opensubdiv/internal/opensubdiv_converter_factory.h6
-rw-r--r--intern/opensubdiv/internal/opensubdiv_converter_internal.cc6
-rw-r--r--intern/opensubdiv/internal/opensubdiv_converter_internal.h6
-rw-r--r--intern/opensubdiv/internal/opensubdiv_edge_map.h10
-rw-r--r--intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc12
-rw-r--r--intern/opensubdiv/internal/opensubdiv_evaluator_internal.h8
-rw-r--r--intern/opensubdiv/internal/opensubdiv_topology_refiner.cc24
-rw-r--r--intern/opensubdiv/internal/opensubdiv_util.cc6
-rw-r--r--intern/opensubdiv/internal/opensubdiv_util.h6
11 files changed, 59 insertions, 39 deletions
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_refin
////////////////////////////////////////////////////////////////////////////////
// Comparison with converter.
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
namespace {
///////////////////////////////////////////////////////////
@@ -274,8 +275,8 @@ namespace {
bool checkSchemeTypeMatches(const OpenSubdiv::Far::TopologyRefiner *topology_refiner,
const OpenSubdiv_Converter *converter)
{
- const OpenSubdiv::Sdc::SchemeType converter_scheme_type = opensubdiv_capi::getSchemeTypeFromCAPI(
- converter->getSchemeType(converter));
+ const OpenSubdiv::Sdc::SchemeType converter_scheme_type =
+ blender::opensubdiv::getSchemeTypeFromCAPI(converter->getSchemeType(converter));
return (converter_scheme_type == topology_refiner->GetSchemeType());
}
@@ -286,7 +287,7 @@ bool checkOptionsMatches(const OpenSubdiv::Far::TopologyRefiner *topology_refine
const Options options = topology_refiner->GetSchemeOptions();
const Options::FVarLinearInterpolation fvar_interpolation = options.GetFVarLinearInterpolation();
const Options::FVarLinearInterpolation converter_fvar_interpolation =
- opensubdiv_capi::getFVarLinearInterpolationFromCAPI(
+ blender::opensubdiv::getFVarLinearInterpolationFromCAPI(
converter->getFVarLinearInterpolation(converter));
if (fvar_interpolation != converter_fvar_interpolation) {
return false;
@@ -660,13 +661,14 @@ bool checkTopologyAttributesMatch(const OpenSubdiv::Far::TopologyRefiner *topolo
}
} // namespace
-} // namespace opensubdiv_capi
+} // namespace opensubdiv
+} // namespace blender
bool openSubdiv_topologyRefinerCompareWithConverter(
const OpenSubdiv_TopologyRefiner *topology_refiner, const OpenSubdiv_Converter *converter)
{
const OpenSubdiv::Far::TopologyRefiner *refiner = getOSDTopologyRefiner(topology_refiner);
- return (opensubdiv_capi::checkPreliminaryMatches(refiner, converter) &&
- opensubdiv_capi::checkGeometryMatches(refiner, converter) &&
- opensubdiv_capi::checkTopologyAttributesMatch(refiner, converter));
+ return (blender::opensubdiv::checkPreliminaryMatches(refiner, converter) &&
+ blender::opensubdiv::checkGeometryMatches(refiner, converter) &&
+ blender::opensubdiv::checkTopologyAttributesMatch(refiner, converter));
}
diff --git a/intern/opensubdiv/internal/opensubdiv_util.cc b/intern/opensubdiv/internal/opensubdiv_util.cc
index 6e6f3a0920f..ea61b21e5d0 100644
--- a/intern/opensubdiv/internal/opensubdiv_util.cc
+++ b/intern/opensubdiv/internal/opensubdiv_util.cc
@@ -23,7 +23,8 @@
# include <iso646.h>
#endif
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
void stringSplit(vector<string> *tokens,
const string &str,
@@ -56,4 +57,5 @@ void stringSplit(vector<string> *tokens,
}
}
-} // namespace opensubdiv_capi
+} // namespace opensubdiv
+} // namespace blender
diff --git a/intern/opensubdiv/internal/opensubdiv_util.h b/intern/opensubdiv/internal/opensubdiv_util.h
index e515859b42f..3fcfdd4c32b 100644
--- a/intern/opensubdiv/internal/opensubdiv_util.h
+++ b/intern/opensubdiv/internal/opensubdiv_util.h
@@ -27,7 +27,8 @@
#include <utility>
#include <vector>
-namespace opensubdiv_capi {
+namespace blender {
+namespace opensubdiv {
using std::fill;
using std::make_pair;
@@ -51,6 +52,7 @@ void stringSplit(vector<string> *tokens,
const string &separators,
bool skip_empty);
-} // namespace opensubdiv_capi
+} // namespace opensubdiv
+} // namespace blender
#endif // OPENSUBDIV_UTIL_H_