OpenSubdiv: Refactor, move utils to base

Also split them across utilities and types.
This commit is contained in:
Sergey Sharybin 2020-05-19 10:59:38 +02:00
parent 39cf673132
commit 444ca1a117
9 changed files with 46 additions and 28 deletions

View File

@ -54,8 +54,11 @@ if(WITH_OPENSUBDIV)
internal/base/edge_map.h
internal/base/memory.h
internal/base/opensubdiv_capi.cc
internal/base/type.h
internal/base/type_convert.cc
internal/base/type_convert.h
internal/base/util.cc
internal/base/util.h
# Device.
internal/device/device_context_cuda.cc
@ -79,9 +82,6 @@ if(WITH_OPENSUBDIV)
internal/topology/topology_refiner_factory.cc
internal/topology/topology_refiner_impl.cc
internal/topology/topology_refiner_impl.h
internal/opensubdiv_util.cc
internal/opensubdiv_util.h
)
list(APPEND LIB

View File

@ -19,7 +19,7 @@
#ifndef OPENSUBDIV_BASE_EDGE_MAP_H_
#define OPENSUBDIV_BASE_EDGE_MAP_H_
#include "internal/opensubdiv_util.h"
#include "internal/base/type.h"
namespace blender {
namespace opensubdiv {

View File

@ -20,6 +20,7 @@
# include <iso646.h>
#endif
#include "internal/base/util.h"
#include "internal/device/device_context_cuda.h"
#include "internal/device/device_context_glsl_compute.h"
#include "internal/device/device_context_glsl_transform_feedback.h"

View File

@ -14,8 +14,8 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef OPENSUBDIV_UTIL_H_
#define OPENSUBDIV_UTIL_H_
#ifndef OPENSUBDIV_BASE_TYPE_H_
#define OPENSUBDIV_BASE_TYPE_H_
#include <stdint.h>
@ -41,16 +41,7 @@ using std::swap;
using std::unordered_map;
using std::vector;
#define STRINGIFY_ARG(x) "" #x
#define STRINGIFY_APPEND(a, b) "" a #b
#define STRINGIFY(x) STRINGIFY_APPEND("", x)
void stringSplit(vector<string> *tokens,
const string &str,
const string &separators,
bool skip_empty);
} // namespace opensubdiv
} // namespace blender
#endif // OPENSUBDIV_UTIL_H_
#endif // OPENSUBDIV_BASE_TYPE_H_

View File

@ -14,14 +14,7 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "internal/opensubdiv_util.h"
#include <GL/glew.h>
#include <cstring>
#ifdef _MSC_VER
# include <iso646.h>
#endif
#include "internal/base/util.h"
namespace blender {
namespace opensubdiv {
@ -44,7 +37,7 @@ void stringSplit(vector<string> *tokens,
string token = str.substr(token_start, token_length);
tokens->push_back(token);
}
// Re-set token pointers,
// Re-set token pointers.
token_start = i + 1;
token_length = 0;
}

View File

@ -0,0 +1,33 @@
// Copyright 2013 Blender Foundation. All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef OPENSUBDIV_BASE_UTIL_H_
#define OPENSUBDIV_BASE_UTIL_H_
#include "internal/base/type.h"
namespace blender {
namespace opensubdiv {
void stringSplit(vector<string> *tokens,
const string &str,
const string &separators,
bool skip_empty);
} // namespace opensubdiv
} // namespace blender
#endif // OPENSUBDIV_BASE_UTIL_H_

View File

@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "internal/opensubdiv_util.h"
#include "internal/base/type.h"
#include "internal/topology/topology_refiner_impl.h"
#include "opensubdiv_topology_refiner_capi.h"

View File

@ -20,8 +20,8 @@
#include "MEM_guardedalloc.h"
#include "internal/base/edge_map.h"
#include "internal/base/type.h"
#include "internal/base/type_convert.h"
#include "internal/opensubdiv_util.h"
#include "internal/topology/topology_refiner_impl.h"
#include "opensubdiv_converter_capi.h"

View File

@ -27,8 +27,8 @@
#include <opensubdiv/far/topologyRefinerFactory.h>
#include "internal/base/type.h"
#include "internal/base/type_convert.h"
#include "internal/opensubdiv_util.h"
#include "opensubdiv_converter_capi.h"
using blender::opensubdiv::min;