Cleanup: Various clang-tidy warnings in intern
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
# include <iso646.h>
|
||||
#endif
|
||||
|
||||
#include "internal/base/util.h"
|
||||
|
||||
void openSubdiv_init() {}
|
||||
|
||||
void openSubdiv_cleanup() {}
|
||||
|
||||
@@ -32,7 +32,7 @@ OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type)
|
||||
OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFromCAPI(
|
||||
OpenSubdiv_FVarLinearInterpolation linear_interpolation)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
switch (linear_interpolation) {
|
||||
case OSD_FVAR_LINEAR_INTERPOLATION_NONE:
|
||||
return Options::FVAR_LINEAR_NONE;
|
||||
@@ -54,7 +54,7 @@ OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFrom
|
||||
OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(
|
||||
OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
switch (linear_interpolation) {
|
||||
case Options::FVAR_LINEAR_NONE:
|
||||
return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
|
||||
|
||||
@@ -170,7 +170,7 @@ template<typename EVAL_VERTEX_BUFFER,
|
||||
typename DEVICE_CONTEXT = void>
|
||||
class FaceVaryingVolatileEval {
|
||||
public:
|
||||
typedef OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR> EvaluatorCache;
|
||||
using EvaluatorCache = OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR>;
|
||||
|
||||
FaceVaryingVolatileEval(int face_varying_channel,
|
||||
const StencilTable *face_varying_stencils,
|
||||
@@ -309,13 +309,12 @@ template<typename SRC_VERTEX_BUFFER,
|
||||
typename DEVICE_CONTEXT = void>
|
||||
class VolatileEvalOutput : public EvalOutputAPI::EvalOutput {
|
||||
public:
|
||||
typedef OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR> EvaluatorCache;
|
||||
typedef FaceVaryingVolatileEval<EVAL_VERTEX_BUFFER,
|
||||
STENCIL_TABLE,
|
||||
PATCH_TABLE,
|
||||
EVALUATOR,
|
||||
DEVICE_CONTEXT>
|
||||
FaceVaryingEval;
|
||||
using EvaluatorCache = OpenSubdiv::Osd::EvaluatorCacheT<EVALUATOR>;
|
||||
using FaceVaryingEval = FaceVaryingVolatileEval<EVAL_VERTEX_BUFFER,
|
||||
STENCIL_TABLE,
|
||||
PATCH_TABLE,
|
||||
EVALUATOR,
|
||||
DEVICE_CONTEXT>;
|
||||
|
||||
VolatileEvalOutput(const StencilTable *vertex_stencils,
|
||||
const StencilTable *varying_stencils,
|
||||
|
||||
@@ -32,7 +32,7 @@ class CpuEvalOutput : public VolatileEvalOutput<CpuVertexBuffer,
|
||||
const std::vector<const StencilTable *> &all_face_varying_stencils,
|
||||
const int face_varying_width,
|
||||
const PatchTable *patch_table,
|
||||
EvaluatorCache *evaluator_cache = NULL)
|
||||
EvaluatorCache *evaluator_cache = nullptr)
|
||||
: VolatileEvalOutput<CpuVertexBuffer,
|
||||
CpuVertexBuffer,
|
||||
StencilTable,
|
||||
|
||||
@@ -21,7 +21,7 @@ static void buildPatchArraysBufferFromVector(const PatchArrayVector &patch_array
|
||||
patch_arrays_buffer->device_alloc(patch_arrays_buffer, patch_arrays.size());
|
||||
patch_arrays_buffer->bind_gpu(patch_arrays_buffer);
|
||||
patch_arrays_buffer->device_update(
|
||||
patch_arrays_buffer, 0, patch_array_byte_site, &patch_arrays[0]);
|
||||
patch_arrays_buffer, 0, patch_array_byte_site, patch_arrays.data());
|
||||
}
|
||||
|
||||
GpuEvalOutput::GpuEvalOutput(const StencilTable *vertex_stencils,
|
||||
|
||||
@@ -28,7 +28,7 @@ class GpuEvalOutput : public VolatileEvalOutput<GLVertexBuffer,
|
||||
const std::vector<const StencilTable *> &all_face_varying_stencils,
|
||||
const int face_varying_width,
|
||||
const PatchTable *patch_table,
|
||||
EvaluatorCache *evaluator_cache = NULL);
|
||||
EvaluatorCache *evaluator_cache = nullptr);
|
||||
|
||||
void fillPatchArraysBuffer(OpenSubdiv_Buffer *patch_arrays_buffer) override;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "internal/evaluator/eval_output_gpu.h"
|
||||
|
||||
OpenSubdiv_EvaluatorCacheImpl::OpenSubdiv_EvaluatorCacheImpl() {}
|
||||
OpenSubdiv_EvaluatorCacheImpl::OpenSubdiv_EvaluatorCacheImpl() = default;
|
||||
|
||||
OpenSubdiv_EvaluatorCacheImpl::~OpenSubdiv_EvaluatorCacheImpl()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache *evaluator_cache)
|
||||
MEM_delete(evaluator_cache);
|
||||
}
|
||||
|
||||
const char *openSubdiv_getGLSLPatchBasisSource(void)
|
||||
const char *openSubdiv_getGLSLPatchBasisSource()
|
||||
{
|
||||
/* Using a global string to avoid dealing with memory allocation/ownership. */
|
||||
static std::string patch_basis_source;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* Author: Sergey Sharybin. */
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <iso646.h>
|
||||
@@ -18,8 +17,6 @@
|
||||
#include <opensubdiv/osd/types.h>
|
||||
#include <opensubdiv/version.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "internal/evaluator/eval_output_cpu.h"
|
||||
#include "internal/evaluator/eval_output_gpu.h"
|
||||
#include "internal/evaluator/evaluator_cache_impl.h"
|
||||
@@ -43,7 +40,10 @@ namespace blender::opensubdiv {
|
||||
template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
public:
|
||||
StackOrHeapArray()
|
||||
: num_elements_(0), heap_elements_(NULL), num_heap_elements_(0), effective_elements_(NULL)
|
||||
: num_elements_(0),
|
||||
heap_elements_(nullptr),
|
||||
num_heap_elements_(0),
|
||||
effective_elements_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
return;
|
||||
}
|
||||
// Simple case: no previously allocated buffer, can simply do one allocation.
|
||||
if (effective_elements_ == NULL) {
|
||||
if (effective_elements_ == nullptr) {
|
||||
effective_elements_ = allocate(num_elements);
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ template<typename T, int kNumMaxElementsOnStack> class StackOrHeapArray {
|
||||
};
|
||||
|
||||
// 32 is a number of inner vertices along the patch size at subdivision level 6.
|
||||
typedef StackOrHeapArray<PatchCoord, 32 * 32> StackOrHeapPatchCoordArray;
|
||||
using StackOrHeapPatchCoordArray = StackOrHeapArray<PatchCoord, 32 * 32>;
|
||||
|
||||
static void convertPatchCoordsToArray(const OpenSubdiv_PatchCoord *patch_coords,
|
||||
const int num_patch_coords,
|
||||
@@ -259,7 +259,7 @@ void EvalOutputAPI::evaluateLimit(const int ptex_face_index,
|
||||
assert(face_v <= 1.0f);
|
||||
const PatchTable::PatchHandle *handle = patch_map_->FindPatch(ptex_face_index, face_u, face_v);
|
||||
PatchCoord patch_coord(*handle, face_u, face_v);
|
||||
if (dPdu != NULL || dPdv != NULL) {
|
||||
if (dPdu != nullptr || dPdv != nullptr) {
|
||||
implementation_->evalPatchesWithDerivatives(&patch_coord, 1, P, dPdu, dPdv);
|
||||
}
|
||||
else {
|
||||
@@ -318,7 +318,7 @@ void EvalOutputAPI::evaluatePatchesLimit(const OpenSubdiv_PatchCoord *patch_coor
|
||||
{
|
||||
StackOrHeapPatchCoordArray patch_coords_array;
|
||||
convertPatchCoordsToArray(patch_coords, num_patch_coords, patch_map_, &patch_coords_array);
|
||||
if (dPdu != NULL || dPdv != NULL) {
|
||||
if (dPdu != nullptr || dPdv != nullptr) {
|
||||
implementation_->evalPatchesWithDerivatives(
|
||||
patch_coords_array.data(), num_patch_coords, P, dPdu, dPdv);
|
||||
}
|
||||
@@ -342,12 +342,12 @@ void EvalOutputAPI::getPatchMap(OpenSubdiv_Buffer *patch_map_handles,
|
||||
const std::vector<PatchTable::PatchHandle> &handles = patch_map_->getHandles();
|
||||
PatchTable::PatchHandle *buffer_handles = static_cast<PatchTable::PatchHandle *>(
|
||||
patch_map_handles->alloc(patch_map_handles, handles.size()));
|
||||
memcpy(buffer_handles, &handles[0], sizeof(PatchTable::PatchHandle) * handles.size());
|
||||
memcpy(buffer_handles, handles.data(), sizeof(PatchTable::PatchHandle) * handles.size());
|
||||
|
||||
const std::vector<PatchMap::QuadNode> &quadtree = patch_map_->nodes();
|
||||
PatchMap::QuadNode *buffer_nodes = static_cast<PatchMap::QuadNode *>(
|
||||
patch_map_quadtree->alloc(patch_map_quadtree, quadtree.size()));
|
||||
memcpy(buffer_nodes, &quadtree[0], sizeof(PatchMap::QuadNode) * quadtree.size());
|
||||
memcpy(buffer_nodes, quadtree.data(), sizeof(PatchMap::QuadNode) * quadtree.size());
|
||||
}
|
||||
|
||||
void EvalOutputAPI::fillPatchArraysBuffer(OpenSubdiv_Buffer *patch_arrays_buffer)
|
||||
@@ -407,7 +407,7 @@ bool EvalOutputAPI::hasVertexData() const
|
||||
} // namespace blender::opensubdiv
|
||||
|
||||
OpenSubdiv_Evaluator::OpenSubdiv_Evaluator()
|
||||
: eval_output(NULL), patch_map(NULL), patch_table(NULL)
|
||||
: eval_output(nullptr), patch_map(nullptr), patch_table(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -424,9 +424,9 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
OpenSubdiv_EvaluatorCache *evaluator_cache_descr)
|
||||
{
|
||||
TopologyRefiner *refiner = topology_refiner->topology_refiner;
|
||||
if (refiner == NULL) {
|
||||
if (refiner == nullptr) {
|
||||
// Happens on bad topology.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// TODO(sergey): Base this on actual topology.
|
||||
const bool has_varying_data = false;
|
||||
@@ -471,7 +471,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
//
|
||||
// TODO(sergey): Seems currently varying stencils are always required in
|
||||
// OpenSubdiv itself.
|
||||
const StencilTable *varying_stencils = NULL;
|
||||
const StencilTable *varying_stencils = nullptr;
|
||||
if (has_varying_data) {
|
||||
StencilTableFactory::Options varying_stencil_options;
|
||||
varying_stencil_options.generateOffsets = stencil_generate_offsets;
|
||||
@@ -503,7 +503,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
// Append local points stencils.
|
||||
// Point stencils.
|
||||
const StencilTable *local_point_stencil_table = patch_table->GetLocalPointStencilTable();
|
||||
if (local_point_stencil_table != NULL) {
|
||||
if (local_point_stencil_table != nullptr) {
|
||||
const StencilTable *table = StencilTableFactory::AppendLocalPointStencilTable(
|
||||
*refiner, vertex_stencils, local_point_stencil_table);
|
||||
delete_stencil_table(vertex_stencils);
|
||||
@@ -513,7 +513,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
if (has_varying_data) {
|
||||
const StencilTable *local_point_varying_stencil_table =
|
||||
patch_table->GetLocalPointVaryingStencilTable();
|
||||
if (local_point_varying_stencil_table != NULL) {
|
||||
if (local_point_varying_stencil_table != nullptr) {
|
||||
const StencilTable *table = StencilTableFactory::AppendLocalPointStencilTable(
|
||||
*refiner, varying_stencils, local_point_varying_stencil_table);
|
||||
delete_stencil_table(varying_stencils);
|
||||
@@ -528,7 +528,7 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(
|
||||
all_face_varying_stencils[face_varying_channel],
|
||||
patch_table->GetLocalPointFaceVaryingStencilTable(face_varying_channel),
|
||||
face_varying_channel);
|
||||
if (table != NULL) {
|
||||
if (table != nullptr) {
|
||||
delete_stencil_table(all_face_varying_stencils[face_varying_channel]);
|
||||
all_face_varying_stencils[face_varying_channel] = table;
|
||||
}
|
||||
|
||||
@@ -190,12 +190,12 @@ static GLuint compileKernel(BufferDescriptor const &srcDesc,
|
||||
|
||||
std::string defineStr = defines.str();
|
||||
|
||||
const char *shaderSources[4] = {"#version 430\n", 0, 0, 0};
|
||||
const char *shaderSources[4] = {"#version 430\n", nullptr, nullptr, nullptr};
|
||||
|
||||
shaderSources[1] = defineStr.c_str();
|
||||
shaderSources[2] = patchBasisShaderSource.c_str();
|
||||
shaderSources[3] = datatoc_glsl_compute_kernel_glsl;
|
||||
glShaderSource(shader, 4, shaderSources, NULL);
|
||||
glShaderSource(shader, 4, shaderSources, nullptr);
|
||||
glCompileShader(shader);
|
||||
glAttachShader(program, shader);
|
||||
|
||||
@@ -205,10 +205,10 @@ static GLuint compileKernel(BufferDescriptor const &srcDesc,
|
||||
|
||||
if (linked == GL_FALSE) {
|
||||
char buffer[1024];
|
||||
glGetShaderInfoLog(shader, 1024, NULL, buffer);
|
||||
glGetShaderInfoLog(shader, 1024, nullptr, buffer);
|
||||
OpenSubdiv::Far::Error(OpenSubdiv::Far::FAR_RUNTIME_ERROR, buffer);
|
||||
|
||||
glGetProgramInfoLog(program, 1024, NULL, buffer);
|
||||
glGetProgramInfoLog(program, 1024, nullptr, buffer);
|
||||
OpenSubdiv::Far::Error(OpenSubdiv::Far::FAR_RUNTIME_ERROR, buffer);
|
||||
|
||||
glDeleteProgram(program);
|
||||
@@ -524,7 +524,7 @@ bool GLComputeEvaluator::EvalPatches(GLuint srcBuffer,
|
||||
int patchArraySize = sizeof(PatchArray);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, _patchArraysSSBO);
|
||||
glBufferData(
|
||||
GL_SHADER_STORAGE_BUFFER, patchArrays.size() * patchArraySize, NULL, GL_STATIC_DRAW);
|
||||
GL_SHADER_STORAGE_BUFFER, patchArrays.size() * patchArraySize, nullptr, GL_STATIC_DRAW);
|
||||
for (int i = 0; i < (int)patchArrays.size(); ++i) {
|
||||
glBufferSubData(
|
||||
GL_SHADER_STORAGE_BUFFER, i * patchArraySize, sizeof(PatchArray), &patchArrays[i]);
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
#include <opensubdiv/osd/types.h>
|
||||
#include <opensubdiv/version.h>
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
namespace Far {
|
||||
namespace OpenSubdiv::OPENSUBDIV_VERSION::Far {
|
||||
class LimitStencilTable;
|
||||
class StencilTable;
|
||||
} // namespace Far
|
||||
} // namespace OPENSUBDIV_VERSION
|
||||
} // namespace OpenSubdiv
|
||||
} // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
|
||||
// namespace OPENSUBDIV_VERSION
|
||||
|
||||
namespace blender::opensubdiv {
|
||||
|
||||
@@ -30,13 +27,13 @@ namespace blender::opensubdiv {
|
||||
class GLStencilTableSSBO {
|
||||
public:
|
||||
static GLStencilTableSSBO *Create(OpenSubdiv::Far::StencilTable const *stencilTable,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // unused
|
||||
return new GLStencilTableSSBO(stencilTable);
|
||||
}
|
||||
static GLStencilTableSSBO *Create(OpenSubdiv::Far::LimitStencilTable const *limitStencilTable,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // unused
|
||||
return new GLStencilTableSSBO(limitStencilTable);
|
||||
@@ -105,12 +102,12 @@ class GLStencilTableSSBO {
|
||||
|
||||
class GLComputeEvaluator {
|
||||
public:
|
||||
typedef bool Instantiatable;
|
||||
using Instantiatable = bool;
|
||||
static GLComputeEvaluator *Create(OpenSubdiv::Osd::BufferDescriptor const &srcDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvDesc,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
return Create(srcDesc,
|
||||
dstDesc,
|
||||
@@ -129,7 +126,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duuDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &duvDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvvDesc,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
(void)deviceContext; // not used
|
||||
GLComputeEvaluator *instance = new GLComputeEvaluator();
|
||||
@@ -137,7 +134,7 @@ class GLComputeEvaluator {
|
||||
return instance;
|
||||
}
|
||||
delete instance;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// Constructor.
|
||||
@@ -186,26 +183,25 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dstDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer, srcDesc, dstBuffer, dstDesc, stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic static stencil function. This function has a same
|
||||
@@ -258,7 +254,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
@@ -272,25 +268,24 @@ class GLComputeEvaluator {
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic static stencil function. This function has a same
|
||||
@@ -367,7 +362,7 @@ class GLComputeEvaluator {
|
||||
OpenSubdiv::Osd::BufferDescriptor const &dvvDesc,
|
||||
STENCIL_TABLE const *stencilTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
@@ -387,31 +382,30 @@ class GLComputeEvaluator {
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalStencils(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
stencilTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic stencil function.
|
||||
@@ -786,28 +780,26 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -870,9 +862,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -886,27 +877,26 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -993,9 +983,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1015,33 +1004,32 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatches(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1336,28 +1324,26 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(
|
||||
srcBuffer, srcDesc, dstBuffer, dstDesc, numPatchCoords, patchCoords, patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1472,9 +1458,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1488,27 +1473,26 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1663,9 +1647,8 @@ class GLComputeEvaluator {
|
||||
PATCHCOORD_BUFFER *patchCoords,
|
||||
PATCH_TABLE *patchTable,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1685,33 +1668,32 @@ class GLComputeEvaluator {
|
||||
patchCoords,
|
||||
patchTable);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -1859,9 +1841,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -1872,27 +1853,26 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc,
|
||||
dstDesc,
|
||||
OpenSubdiv::Osd::BufferDescriptor(),
|
||||
OpenSubdiv::Osd::BufferDescriptor());
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -2013,9 +1993,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -2030,28 +2009,27 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
@@ -2212,9 +2190,8 @@ class GLComputeEvaluator {
|
||||
PATCH_TABLE *patchTable,
|
||||
int fvarChannel,
|
||||
GLComputeEvaluator const *instance,
|
||||
void *deviceContext = NULL)
|
||||
void *deviceContext = nullptr)
|
||||
{
|
||||
|
||||
if (instance) {
|
||||
return instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
@@ -2235,34 +2212,33 @@ class GLComputeEvaluator {
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
}
|
||||
else {
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
|
||||
// Create an instance on demand (slow)
|
||||
(void)deviceContext; // unused
|
||||
instance = Create(srcDesc, dstDesc, duDesc, dvDesc, duuDesc, duvDesc, dvvDesc);
|
||||
if (instance) {
|
||||
bool r = instance->EvalPatchesFaceVarying(srcBuffer,
|
||||
srcDesc,
|
||||
dstBuffer,
|
||||
dstDesc,
|
||||
duBuffer,
|
||||
duDesc,
|
||||
dvBuffer,
|
||||
dvDesc,
|
||||
duuBuffer,
|
||||
duuDesc,
|
||||
duvBuffer,
|
||||
duvDesc,
|
||||
dvvBuffer,
|
||||
dvvDesc,
|
||||
numPatchCoords,
|
||||
patchCoords,
|
||||
patchTable,
|
||||
fvarChannel);
|
||||
delete instance;
|
||||
return r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// \brief Generic limit eval function. This function has a same
|
||||
|
||||
@@ -64,12 +64,11 @@ inline PatchMap::QuadNode *PatchMap::assignLeafOrChildNode(QuadNode *node,
|
||||
if (node->children[quadrant].isSet) {
|
||||
return &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
else {
|
||||
int newChildNodeIndex = (int)_quadtree.size();
|
||||
_quadtree.push_back(QuadNode());
|
||||
node->SetChild(quadrant, newChildNodeIndex, false);
|
||||
return &_quadtree[newChildNodeIndex];
|
||||
}
|
||||
|
||||
int newChildNodeIndex = (int)_quadtree.size();
|
||||
_quadtree.emplace_back();
|
||||
node->SetChild(quadrant, newChildNodeIndex, false);
|
||||
return &_quadtree[newChildNodeIndex];
|
||||
}
|
||||
|
||||
//
|
||||
@@ -97,8 +96,8 @@ void PatchMap::initializeHandles(PatchTable const &patchTable)
|
||||
_minPatchFace = (int)patchTable.GetPatchParamTable()[0].GetFaceId();
|
||||
_maxPatchFace = _minPatchFace;
|
||||
|
||||
int numArrays = (int)patchTable.GetNumPatchArrays();
|
||||
int numPatches = (int)patchTable.GetNumPatchesTotal();
|
||||
int numArrays = patchTable.GetNumPatchArrays();
|
||||
int numPatches = patchTable.GetNumPatchesTotal();
|
||||
|
||||
_handles.resize(numPatches);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class PatchMap {
|
||||
Child children[4];
|
||||
};
|
||||
|
||||
typedef OpenSubdiv::Far::PatchTable::PatchHandle Handle;
|
||||
using Handle = OpenSubdiv::Far::PatchTable::PatchHandle;
|
||||
|
||||
/// \brief Constructor
|
||||
///
|
||||
@@ -104,7 +104,7 @@ class PatchMap {
|
||||
void initializeHandles(OpenSubdiv::Far::PatchTable const &patchTable);
|
||||
void initializeQuadtree(OpenSubdiv::Far::PatchTable const &patchTable);
|
||||
|
||||
typedef std::vector<QuadNode> QuadTree;
|
||||
using QuadTree = std::vector<QuadNode>;
|
||||
|
||||
// Internal methods supporting quadtree construction and queries
|
||||
void assignRootNode(QuadNode *node, int index);
|
||||
@@ -114,7 +114,6 @@ class PatchMap {
|
||||
template<class T>
|
||||
static int transformUVToTriQuadrant(T const &median, T &u, T &v, bool &rotated);
|
||||
|
||||
private:
|
||||
bool _patchesAreTriangular; // tri and quad assembly and search requirements differ
|
||||
|
||||
int _minPatchFace; // minimum patch face index supported by the map
|
||||
@@ -180,23 +179,22 @@ int inline PatchMap::transformUVToTriQuadrant(T const &median, T &u, T &v, bool
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (u < median) {
|
||||
v -= median;
|
||||
return 1;
|
||||
}
|
||||
if (v < median) {
|
||||
u -= median;
|
||||
return 2;
|
||||
}
|
||||
u -= median;
|
||||
|
||||
if (u < median) {
|
||||
v -= median;
|
||||
if ((u + v) < median) {
|
||||
rotated = false;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
if (v < median) {
|
||||
u -= median;
|
||||
return 2;
|
||||
}
|
||||
u -= median;
|
||||
v -= median;
|
||||
if ((u + v) < median) {
|
||||
rotated = false;
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Returns a handle to the sub-patch of the face at the given (u,v).
|
||||
@@ -209,13 +207,13 @@ inline PatchMap::Handle const *PatchMap::FindPatch(int faceid, double u, double
|
||||
// have all or no quadrants set):
|
||||
//
|
||||
if ((faceid < _minPatchFace) || (faceid > _maxPatchFace)) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QuadNode const *node = &_quadtree[faceid - _minPatchFace];
|
||||
|
||||
if (!node->children[0].isSet) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -237,12 +235,10 @@ inline PatchMap::Handle const *PatchMap::FindPatch(int faceid, double u, double
|
||||
if (node->children[quadrant].isLeaf) {
|
||||
return &_handles[node->children[quadrant].index];
|
||||
}
|
||||
else {
|
||||
node = &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
node = &_quadtree[node->children[quadrant].index];
|
||||
}
|
||||
assert(0);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace blender::opensubdiv
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace blender::opensubdiv {
|
||||
|
||||
MeshTopology::MeshTopology() : num_vertices_(0), num_edges_(0), num_faces_(0) {}
|
||||
|
||||
MeshTopology::~MeshTopology() {}
|
||||
MeshTopology::~MeshTopology() = default;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Vertices.
|
||||
|
||||
@@ -24,11 +24,9 @@ struct TopologyRefinerData {
|
||||
blender::opensubdiv::MeshTopology *base_mesh_topology;
|
||||
};
|
||||
|
||||
typedef OpenSubdiv::Far::TopologyRefinerFactory<TopologyRefinerData> TopologyRefinerFactoryType;
|
||||
using TopologyRefinerFactoryType = OpenSubdiv::Far::TopologyRefinerFactory<TopologyRefinerData>;
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
namespace Far {
|
||||
namespace OpenSubdiv::OPENSUBDIV_VERSION::Far {
|
||||
|
||||
template<>
|
||||
inline bool TopologyRefinerFactory<TopologyRefinerData>::resizeComponentTopology(
|
||||
@@ -139,15 +137,15 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTopology
|
||||
IndexArray dst_vertex_faces = getBaseVertexFaces(refiner, vertex_index);
|
||||
const int num_vertex_faces = converter->getNumVertexFaces(converter, vertex_index);
|
||||
vertex_faces.resize(num_vertex_faces);
|
||||
converter->getVertexFaces(converter, vertex_index, &vertex_faces[0]);
|
||||
converter->getVertexFaces(converter, vertex_index, vertex_faces.data());
|
||||
|
||||
// Vertex-edges.
|
||||
IndexArray dst_vertex_edges = getBaseVertexEdges(refiner, vertex_index);
|
||||
const int num_vertex_edges = converter->getNumVertexEdges(converter, vertex_index);
|
||||
vertex_edges.resize(num_vertex_edges);
|
||||
converter->getVertexEdges(converter, vertex_index, &vertex_edges[0]);
|
||||
memcpy(&dst_vertex_edges[0], &vertex_edges[0], sizeof(int) * num_vertex_edges);
|
||||
memcpy(&dst_vertex_faces[0], &vertex_faces[0], sizeof(int) * num_vertex_faces);
|
||||
converter->getVertexEdges(converter, vertex_index, vertex_edges.data());
|
||||
memcpy(&dst_vertex_edges[0], vertex_edges.data(), sizeof(int) * num_vertex_edges);
|
||||
memcpy(&dst_vertex_faces[0], vertex_faces.data(), sizeof(int) * num_vertex_faces);
|
||||
}
|
||||
|
||||
// Edge relations.
|
||||
@@ -184,7 +182,7 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
MeshTopology *base_mesh_topology = cb_data.base_mesh_topology;
|
||||
|
||||
const bool full_topology_specified = converter->specifiesFullTopology(converter);
|
||||
if (full_topology_specified || converter->getEdgeVertices != NULL) {
|
||||
if (full_topology_specified || converter->getEdgeVertices != nullptr) {
|
||||
const int num_edges = converter->getNumEdges(converter);
|
||||
for (int edge_index = 0; edge_index < num_edges; ++edge_index) {
|
||||
const float sharpness = converter->getEdgeSharpness(converter, edge_index);
|
||||
@@ -228,7 +226,7 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags(
|
||||
|
||||
// Get sharpness provided by the converter.
|
||||
float sharpness = 0.0f;
|
||||
if (converter->getVertexSharpness != NULL) {
|
||||
if (converter->getVertexSharpness != nullptr) {
|
||||
sharpness = converter->getVertexSharpness(converter, vertex_index);
|
||||
base_mesh_topology->setVertexSharpness(vertex_index, sharpness);
|
||||
}
|
||||
@@ -256,11 +254,11 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignFaceVaryingTopolo
|
||||
TopologyRefiner &refiner, const TopologyRefinerData &cb_data)
|
||||
{
|
||||
const OpenSubdiv_Converter *converter = cb_data.converter;
|
||||
if (converter->getNumUVLayers == NULL) {
|
||||
assert(converter->precalcUVLayer == NULL);
|
||||
assert(converter->getNumUVCoordinates == NULL);
|
||||
assert(converter->getFaceCornerUVIndex == NULL);
|
||||
assert(converter->finishUVLayer == NULL);
|
||||
if (converter->getNumUVLayers == nullptr) {
|
||||
assert(converter->precalcUVLayer == nullptr);
|
||||
assert(converter->getNumUVCoordinates == nullptr);
|
||||
assert(converter->getFaceCornerUVIndex == nullptr);
|
||||
assert(converter->finishUVLayer == nullptr);
|
||||
return true;
|
||||
}
|
||||
const int num_layers = converter->getNumUVLayers(converter);
|
||||
@@ -295,9 +293,7 @@ inline void TopologyRefinerFactory<TopologyRefinerData>::reportInvalidTopology(
|
||||
printf("OpenSubdiv Error: %s\n", msg);
|
||||
}
|
||||
|
||||
} /* namespace Far */
|
||||
} /* namespace OPENSUBDIV_VERSION */
|
||||
} /* namespace OpenSubdiv */
|
||||
} // namespace OpenSubdiv::OPENSUBDIV_VERSION::Far
|
||||
|
||||
namespace blender::opensubdiv {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ static bool checkSchemeTypeMatches(const TopologyRefinerImpl *topology_refiner_i
|
||||
static bool checkOptionsMatches(const TopologyRefinerImpl *topology_refiner_impl,
|
||||
const OpenSubdiv_Converter *converter)
|
||||
{
|
||||
typedef OpenSubdiv::Sdc::Options Options;
|
||||
using Options = OpenSubdiv::Sdc::Options;
|
||||
const Options options = getOSDTopologyRefiner(topology_refiner_impl)->GetSchemeOptions();
|
||||
const Options::FVarLinearInterpolation fvar_interpolation = options.GetFVarLinearInterpolation();
|
||||
const Options::FVarLinearInterpolation converter_fvar_interpolation =
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
// Global initialization/deinitialization.
|
||||
//
|
||||
// Supposed to be called from main thread.
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint> // for bool
|
||||
|
||||
#include "BLI_offset_indices.hh"
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <opensubdiv/far/patchMap.h>
|
||||
#include <opensubdiv/far/patchTable.h>
|
||||
|
||||
#include "internal/base/memory.h"
|
||||
|
||||
#include "opensubdiv_capi_type.hh"
|
||||
|
||||
struct OpenSubdiv_Buffer;
|
||||
@@ -104,15 +102,15 @@ class EvalOutputAPI {
|
||||
float dPdv[3]);
|
||||
|
||||
// Evaluate varying data at a given bilinear coordinate of given ptex face.
|
||||
void evaluateVertexData(const int ptes_face_index, float face_u, float face_v, float data[]);
|
||||
void evaluateVertexData(const int ptex_face_index, float face_u, float face_v, float data[]);
|
||||
|
||||
// Evaluate varying data at a given bilinear coordinate of given ptex face.
|
||||
void evaluateVarying(const int ptes_face_index, float face_u, float face_v, float varying[3]);
|
||||
void evaluateVarying(const int ptex_face_index, float face_u, float face_v, float varying[3]);
|
||||
|
||||
// Evaluate facee-varying data at a given bilinear coordinate of given
|
||||
// ptex face.
|
||||
void evaluateFaceVarying(const int face_varying_channel,
|
||||
const int ptes_face_index,
|
||||
const int ptex_face_index,
|
||||
float face_u,
|
||||
float face_v,
|
||||
float face_varying[2]);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <opensubdiv/far/topologyRefiner.h>
|
||||
|
||||
#include "internal/base/memory.h"
|
||||
#include "internal/topology/mesh_topology.h"
|
||||
|
||||
// Those settings don't really belong to OpenSubdiv's topology refiner, but
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
OpenSubdiv_EvaluatorCache *openSubdiv_createEvaluatorCache(eOpenSubdivEvaluator /*evaluator_type*/)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache * /*evaluator_cache*/) {}
|
||||
|
||||
const char *openSubdiv_getGLSLPatchBasisSource()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user