diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt index 5b5aebd88b8..90895cf6ed3 100644 --- a/intern/opensubdiv/CMakeLists.txt +++ b/intern/opensubdiv/CMakeLists.txt @@ -66,6 +66,11 @@ if(WITH_OPENSUBDIV) internal/device/device_context_openmp.cc internal/device/device_context_openmp.h + # Evaluator. + internal/evaluator/evaluator_capi.cc + internal/evaluator/evaluator_impl.cc + internal/evaluator/evaluator_impl.h + # Topology. internal/topology/topology_refiner_capi.cc internal/topology/topology_refiner_factory.cc @@ -74,12 +79,9 @@ if(WITH_OPENSUBDIV) internal/opensubdiv.cc internal/opensubdiv_converter_internal.cc - internal/opensubdiv_evaluator.cc - internal/opensubdiv_evaluator_internal.cc internal/opensubdiv_util.cc internal/opensubdiv_converter_internal.h - internal/opensubdiv_evaluator_internal.h internal/opensubdiv_util.h ) diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator.cc b/intern/opensubdiv/internal/evaluator/evaluator_capi.cc similarity index 84% rename from intern/opensubdiv/internal/opensubdiv_evaluator.cc rename to intern/opensubdiv/internal/evaluator/evaluator_capi.cc index c599a3c9f68..4b12206e103 100644 --- a/intern/opensubdiv/internal/opensubdiv_evaluator.cc +++ b/intern/opensubdiv/internal/evaluator/evaluator_capi.cc @@ -21,7 +21,7 @@ #include "MEM_guardedalloc.h" #include -#include "internal/opensubdiv_evaluator_internal.h" +#include "internal/evaluator/evaluator_impl.h" namespace { @@ -30,8 +30,7 @@ void setCoarsePositions(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setCoarsePositions( - positions, start_vertex_index, num_vertices); + evaluator->impl->eval_output->setCoarsePositions(positions, start_vertex_index, num_vertices); } void setVaryingData(OpenSubdiv_Evaluator *evaluator, @@ -39,7 +38,7 @@ void setVaryingData(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setVaryingData(varying_data, start_vertex_index, num_vertices); + evaluator->impl->eval_output->setVaryingData(varying_data, start_vertex_index, num_vertices); } void setFaceVaryingData(OpenSubdiv_Evaluator *evaluator, @@ -48,7 +47,7 @@ void setFaceVaryingData(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setFaceVaryingData( + evaluator->impl->eval_output->setFaceVaryingData( face_varying_channel, face_varying_data, start_vertex_index, num_vertices); } @@ -59,7 +58,7 @@ void setCoarsePositionsFromBuffer(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setCoarsePositionsFromBuffer( + evaluator->impl->eval_output->setCoarsePositionsFromBuffer( buffer, start_offset, stride, start_vertex_index, num_vertices); } @@ -70,7 +69,7 @@ void setVaryingDataFromBuffer(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setVaryingDataFromBuffer( + evaluator->impl->eval_output->setVaryingDataFromBuffer( buffer, start_offset, stride, start_vertex_index, num_vertices); } @@ -82,13 +81,13 @@ void setFaceVaryingDataFromBuffer(OpenSubdiv_Evaluator *evaluator, const int start_vertex_index, const int num_vertices) { - evaluator->internal->eval_output->setFaceVaryingDataFromBuffer( + evaluator->impl->eval_output->setFaceVaryingDataFromBuffer( face_varying_channel, buffer, start_offset, stride, start_vertex_index, num_vertices); } void refine(OpenSubdiv_Evaluator *evaluator) { - evaluator->internal->eval_output->refine(); + evaluator->impl->eval_output->refine(); } void evaluateLimit(OpenSubdiv_Evaluator *evaluator, @@ -99,7 +98,7 @@ void evaluateLimit(OpenSubdiv_Evaluator *evaluator, float dPdu[3], float dPdv[3]) { - evaluator->internal->eval_output->evaluateLimit(ptex_face_index, face_u, face_v, P, dPdu, dPdv); + evaluator->impl->eval_output->evaluateLimit(ptex_face_index, face_u, face_v, P, dPdu, dPdv); } void evaluatePatchesLimit(OpenSubdiv_Evaluator *evaluator, @@ -109,7 +108,7 @@ void evaluatePatchesLimit(OpenSubdiv_Evaluator *evaluator, float *dPdu, float *dPdv) { - evaluator->internal->eval_output->evaluatePatchesLimit( + evaluator->impl->eval_output->evaluatePatchesLimit( patch_coords, num_patch_coords, P, dPdu, dPdv); } @@ -119,7 +118,7 @@ void evaluateVarying(OpenSubdiv_Evaluator *evaluator, float face_v, float varying[3]) { - evaluator->internal->eval_output->evaluateVarying(ptex_face_index, face_u, face_v, varying); + evaluator->impl->eval_output->evaluateVarying(ptex_face_index, face_u, face_v, varying); } void evaluateFaceVarying(OpenSubdiv_Evaluator *evaluator, @@ -129,7 +128,7 @@ void evaluateFaceVarying(OpenSubdiv_Evaluator *evaluator, float face_v, float face_varying[2]) { - evaluator->internal->eval_output->evaluateFaceVarying( + evaluator->impl->eval_output->evaluateFaceVarying( face_varying_channel, ptex_face_index, face_u, face_v, face_varying); } @@ -159,12 +158,12 @@ OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner( { OpenSubdiv_Evaluator *evaluator = OBJECT_GUARDED_NEW(OpenSubdiv_Evaluator); assignFunctionPointers(evaluator); - evaluator->internal = openSubdiv_createEvaluatorInternal(topology_refiner); + evaluator->impl = openSubdiv_createEvaluatorInternal(topology_refiner); return evaluator; } void openSubdiv_deleteEvaluator(OpenSubdiv_Evaluator *evaluator) { - openSubdiv_deleteEvaluatorInternal(evaluator->internal); + openSubdiv_deleteEvaluatorInternal(evaluator->impl); OBJECT_GUARDED_DELETE(evaluator, OpenSubdiv_Evaluator); } diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc similarity index 98% rename from intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc rename to intern/opensubdiv/internal/evaluator/evaluator_impl.cc index a9960a9b027..7c80fceb51e 100644 --- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc +++ b/intern/opensubdiv/internal/evaluator/evaluator_impl.cc @@ -16,7 +16,7 @@ // // Author: Sergey Sharybin -#include "internal/opensubdiv_evaluator_internal.h" +#include "internal/evaluator/evaluator_impl.h" #include #include @@ -735,19 +735,19 @@ void CpuEvalOutputAPI::evaluatePatchesLimit(const OpenSubdiv_PatchCoord *patch_c } // namespace opensubdiv } // namespace blender -OpenSubdiv_EvaluatorInternal::OpenSubdiv_EvaluatorInternal() +OpenSubdiv_EvaluatorImpl::OpenSubdiv_EvaluatorImpl() : eval_output(NULL), patch_map(NULL), patch_table(NULL) { } -OpenSubdiv_EvaluatorInternal::~OpenSubdiv_EvaluatorInternal() +OpenSubdiv_EvaluatorImpl::~OpenSubdiv_EvaluatorImpl() { delete eval_output; delete patch_map; delete patch_table; } -OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal( +OpenSubdiv_EvaluatorImpl *openSubdiv_createEvaluatorInternal( OpenSubdiv_TopologyRefiner *topology_refiner) { using blender::opensubdiv::vector; @@ -857,8 +857,8 @@ OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal( 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 = new OpenSubdiv_EvaluatorInternal(); + OpenSubdiv_EvaluatorImpl *evaluator_descr; + evaluator_descr = new OpenSubdiv_EvaluatorImpl(); evaluator_descr->eval_output = new blender::opensubdiv::CpuEvalOutputAPI(eval_output, patch_map); evaluator_descr->patch_map = patch_map; evaluator_descr->patch_table = patch_table; @@ -871,7 +871,7 @@ OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal( return evaluator_descr; } -void openSubdiv_deleteEvaluatorInternal(OpenSubdiv_EvaluatorInternal *evaluator) +void openSubdiv_deleteEvaluatorInternal(OpenSubdiv_EvaluatorImpl *evaluator) { delete evaluator; } diff --git a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h b/intern/opensubdiv/internal/evaluator/evaluator_impl.h similarity index 93% rename from intern/opensubdiv/internal/opensubdiv_evaluator_internal.h rename to intern/opensubdiv/internal/evaluator/evaluator_impl.h index a60b82b02fe..6a3682efa62 100644 --- a/intern/opensubdiv/internal/opensubdiv_evaluator_internal.h +++ b/intern/opensubdiv/internal/evaluator/evaluator_impl.h @@ -16,8 +16,8 @@ // // Author: Sergey Sharybin -#ifndef OPENSUBDIV_EVALUATOR_INTERNAL_H_ -#define OPENSUBDIV_EVALUATOR_INTERNAL_H_ +#ifndef OPENSUBDIV_EVALUATOR_IMPL_H_ +#define OPENSUBDIV_EVALUATOR_IMPL_H_ #ifdef _MSC_VER # include @@ -138,21 +138,21 @@ class CpuEvalOutputAPI { } // namespace opensubdiv } // namespace blender -struct OpenSubdiv_EvaluatorInternal { +struct OpenSubdiv_EvaluatorImpl { public: - OpenSubdiv_EvaluatorInternal(); - ~OpenSubdiv_EvaluatorInternal(); + OpenSubdiv_EvaluatorImpl(); + ~OpenSubdiv_EvaluatorImpl(); blender::opensubdiv::CpuEvalOutputAPI *eval_output; const OpenSubdiv::Far::PatchMap *patch_map; const OpenSubdiv::Far::PatchTable *patch_table; - MEM_CXX_CLASS_ALLOC_FUNCS("OpenSubdiv_EvaluatorInternal"); + MEM_CXX_CLASS_ALLOC_FUNCS("OpenSubdiv_EvaluatorImpl"); }; -OpenSubdiv_EvaluatorInternal *openSubdiv_createEvaluatorInternal( +OpenSubdiv_EvaluatorImpl *openSubdiv_createEvaluatorInternal( struct OpenSubdiv_TopologyRefiner *topology_refiner); -void openSubdiv_deleteEvaluatorInternal(OpenSubdiv_EvaluatorInternal *evaluator); +void openSubdiv_deleteEvaluatorInternal(OpenSubdiv_EvaluatorImpl *evaluator); -#endif // OPENSUBDIV_EVALUATOR_INTERNAL_H_ +#endif // OPENSUBDIV_EVALUATOR_IMPL_H_ diff --git a/intern/opensubdiv/opensubdiv_evaluator_capi.h b/intern/opensubdiv/opensubdiv_evaluator_capi.h index 1572d01b851..b860ae8db2e 100644 --- a/intern/opensubdiv/opensubdiv_evaluator_capi.h +++ b/intern/opensubdiv/opensubdiv_evaluator_capi.h @@ -122,10 +122,8 @@ typedef struct OpenSubdiv_Evaluator { float *dPdu, float *dPdv); - // Internal storage for the use in this module only. - // - // This is where actual OpenSubdiv's evaluator is living. - struct OpenSubdiv_EvaluatorInternal *internal; + // Implementation of the evaluator. + struct OpenSubdiv_EvaluatorImpl *impl; } OpenSubdiv_Evaluator; OpenSubdiv_Evaluator *openSubdiv_createEvaluatorFromTopologyRefiner(