From e6f951c0100ff2cbebaca5f0dde4da1313b74759 Mon Sep 17 00:00:00 2001 From: Takahito Tejima Date: Fri, 22 May 2015 10:22:47 -0700 Subject: [PATCH 1/2] renaming (1/2) PatchTables and StencilTables to PatchTable and StencilTable this commit just changes filenames (for better diffs) --- opensubdiv/far/CMakeLists.txt | 14 +++++++------- opensubdiv/far/{patchTables.cpp => patchTable.cpp} | 0 opensubdiv/far/{patchTables.h => patchTable.h} | 0 ...atchTablesFactory.cpp => patchTableFactory.cpp} | 0 .../{patchTablesFactory.h => patchTableFactory.h} | 0 opensubdiv/far/{stencilTables.h => stencilTable.h} | 0 ...ilTablesFactory.cpp => stencilTableFactory.cpp} | 0 ...tencilTablesFactory.h => stencilTableFactory.h} | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename opensubdiv/far/{patchTables.cpp => patchTable.cpp} (100%) rename opensubdiv/far/{patchTables.h => patchTable.h} (100%) rename opensubdiv/far/{patchTablesFactory.cpp => patchTableFactory.cpp} (100%) rename opensubdiv/far/{patchTablesFactory.h => patchTableFactory.h} (100%) rename opensubdiv/far/{stencilTables.h => stencilTable.h} (100%) rename opensubdiv/far/{stencilTablesFactory.cpp => stencilTableFactory.cpp} (100%) rename opensubdiv/far/{stencilTablesFactory.h => stencilTableFactory.h} (100%) diff --git a/opensubdiv/far/CMakeLists.txt b/opensubdiv/far/CMakeLists.txt index d625e040..5cef4727 100644 --- a/opensubdiv/far/CMakeLists.txt +++ b/opensubdiv/far/CMakeLists.txt @@ -33,10 +33,10 @@ set(SOURCE_FILES patchBasis.cpp patchDescriptor.cpp patchMap.cpp - patchTables.cpp - patchTablesFactory.cpp + patchTable.cpp + patchTableFactory.cpp ptexIndices.cpp - stencilTablesFactory.cpp + stencilTableFactory.cpp topologyRefiner.cpp topologyRefinerFactory.cpp ) @@ -55,11 +55,11 @@ set(PUBLIC_HEADER_FILES patchDescriptor.h patchParam.h patchMap.h - patchTables.h - patchTablesFactory.h + patchTable.h + patchTableFactory.h ptexIndices.h - stencilTables.h - stencilTablesFactory.h + stencilTable.h + stencilTableFactory.h topologyLevel.h topologyRefiner.h topologyRefinerFactory.h diff --git a/opensubdiv/far/patchTables.cpp b/opensubdiv/far/patchTable.cpp similarity index 100% rename from opensubdiv/far/patchTables.cpp rename to opensubdiv/far/patchTable.cpp diff --git a/opensubdiv/far/patchTables.h b/opensubdiv/far/patchTable.h similarity index 100% rename from opensubdiv/far/patchTables.h rename to opensubdiv/far/patchTable.h diff --git a/opensubdiv/far/patchTablesFactory.cpp b/opensubdiv/far/patchTableFactory.cpp similarity index 100% rename from opensubdiv/far/patchTablesFactory.cpp rename to opensubdiv/far/patchTableFactory.cpp diff --git a/opensubdiv/far/patchTablesFactory.h b/opensubdiv/far/patchTableFactory.h similarity index 100% rename from opensubdiv/far/patchTablesFactory.h rename to opensubdiv/far/patchTableFactory.h diff --git a/opensubdiv/far/stencilTables.h b/opensubdiv/far/stencilTable.h similarity index 100% rename from opensubdiv/far/stencilTables.h rename to opensubdiv/far/stencilTable.h diff --git a/opensubdiv/far/stencilTablesFactory.cpp b/opensubdiv/far/stencilTableFactory.cpp similarity index 100% rename from opensubdiv/far/stencilTablesFactory.cpp rename to opensubdiv/far/stencilTableFactory.cpp diff --git a/opensubdiv/far/stencilTablesFactory.h b/opensubdiv/far/stencilTableFactory.h similarity index 100% rename from opensubdiv/far/stencilTablesFactory.h rename to opensubdiv/far/stencilTableFactory.h From a7c5179ef9c7d121412e78459e08060cd26a0f37 Mon Sep 17 00:00:00 2001 From: Takahito Tejima Date: Fri, 22 May 2015 11:50:01 -0700 Subject: [PATCH 2/2] renaming (2/2) PatchTables and StencilTables to PatchTable and StencilTable replace all occurrences reffering PatchTables, StencilTables, and their factories. --- documentation/far_overview.rst | 32 +-- documentation/nav_template.txt | 4 +- documentation/osd_overview.rst | 2 +- documentation/tutorials.rst | 6 +- examples/common/patchColors.h | 2 +- examples/dxPtexViewer/dxPtexViewer.cpp | 12 +- examples/dxViewer/dxviewer.cpp | 16 +- examples/farViewer/farViewer.cpp | 124 ++++++------ examples/farViewer/gl_mesh.cpp | 40 ++-- examples/farViewer/gl_mesh.h | 10 +- examples/glEvalLimit/glEvalLimit.cpp | 72 +++---- examples/glFVarViewer/glFVarViewer.cpp | 8 +- examples/glImaging/glImaging.cpp | 14 +- examples/glPaintTest/glPaintTest.cpp | 2 +- examples/glPtexViewer/glPtexViewer.cpp | 14 +- examples/glShareTopology/glShareTopology.cpp | 16 +- examples/glShareTopology/meshRefiner.h | 16 +- examples/glShareTopology/scene.h | 4 +- examples/glShareTopology/sceneBase.cpp | 70 +++---- examples/glShareTopology/sceneBase.h | 10 +- examples/glStencilViewer/glStencilViewer.cpp | 10 +- examples/glViewer/glViewer.cpp | 24 +-- examples/mayaPolySmooth/mayaPolySmooth.cpp | 2 +- .../far/endCapBSplineBasisPatchFactory.cpp | 2 +- .../far/endCapBSplineBasisPatchFactory.h | 16 +- .../far/endCapGregoryBasisPatchFactory.cpp | 6 +- .../far/endCapGregoryBasisPatchFactory.h | 18 +- .../far/endCapLegacyGregoryPatchFactory.cpp | 34 ++-- .../far/endCapLegacyGregoryPatchFactory.h | 12 +- opensubdiv/far/gregoryBasis.cpp | 24 +-- opensubdiv/far/gregoryBasis.h | 2 +- opensubdiv/far/patchMap.cpp | 20 +- opensubdiv/far/patchMap.h | 12 +- opensubdiv/far/patchTable.cpp | 150 +++++++------- opensubdiv/far/patchTable.h | 52 ++--- opensubdiv/far/patchTableFactory.cpp | 184 +++++++++--------- opensubdiv/far/patchTableFactory.h | 34 ++-- opensubdiv/far/protoStencil.h | 4 +- opensubdiv/far/stencilTable.h | 46 ++--- opensubdiv/far/stencilTableFactory.cpp | 140 ++++++------- opensubdiv/far/stencilTableFactory.h | 60 +++--- opensubdiv/far/topologyRefiner.h | 2 +- opensubdiv/osd/clEvaluator.cpp | 18 +- opensubdiv/osd/clEvaluator.h | 22 +-- opensubdiv/osd/cpuEvaluator.cpp | 4 +- opensubdiv/osd/cpuEvaluator.h | 14 +- opensubdiv/osd/cudaEvaluator.cpp | 16 +- opensubdiv/osd/cudaEvaluator.h | 20 +- opensubdiv/osd/d3d11ComputeEvaluator.cpp | 30 +-- opensubdiv/osd/d3d11ComputeEvaluator.h | 22 +-- .../osd/d3d11LegacyGregoryPatchTable.cpp | 16 +- opensubdiv/osd/d3d11LegacyGregoryPatchTable.h | 8 +- opensubdiv/osd/d3d11PatchTable.cpp | 32 +-- opensubdiv/osd/d3d11PatchTable.h | 12 +- opensubdiv/osd/glComputeEvaluator.cpp | 18 +- opensubdiv/osd/glComputeEvaluator.h | 18 +- opensubdiv/osd/glLegacyGregoryPatchTable.cpp | 16 +- opensubdiv/osd/glLegacyGregoryPatchTable.h | 4 +- opensubdiv/osd/glPatchTable.cpp | 32 +-- opensubdiv/osd/glPatchTable.h | 8 +- opensubdiv/osd/glXFBEvaluator.cpp | 20 +- opensubdiv/osd/glXFBEvaluator.h | 18 +- opensubdiv/osd/mesh.h | 120 ++++++------ opensubdiv/vtr/fvarLevel.h | 4 +- opensubdiv/vtr/level.h | 4 +- opensubdiv/vtr/refinement.h | 4 +- regression/osd_regression/main.cpp | 28 +-- tutorials/far/tutorial_4/far_tutorial_4.cpp | 20 +- tutorials/far/tutorial_5/far_tutorial_5.cpp | 22 +-- tutorials/far/tutorial_6/far_tutorial_6.cpp | 16 +- tutorials/far/tutorial_7/far_tutorial_7.cpp | 24 +-- tutorials/osd/tutorial_0/osd_tutorial_0.cpp | 18 +- 72 files changed, 968 insertions(+), 968 deletions(-) diff --git a/documentation/far_overview.rst b/documentation/far_overview.rst index 114e7611..ba214668 100644 --- a/documentation/far_overview.rst +++ b/documentation/far_overview.rst @@ -45,11 +45,11 @@ First, *Far* provides the tools to refine subdivision topology either uniform or sparse, where extraordinary features are automatically isolated (see `feature adaptive subdivision `__). -As a geometry representation, *Far* also provides a set of *"Tables"* classes. +As a geometry representation, *Far* also provides a set of *"Table"* classes. These tables are designed to be static containers for the refined topology data, after it has been serialized and factorized. This representation is -embodied in the `Far::PatchTables <#far-patchtables>`__ and the -`Far::StencilTables <#far-patchtables>`__ classes. +embodied in the `Far::PatchTable <#far-patchtable>`__ and the +`Far::StencilTable <#far-patchtable>`__ classes. *Far* is also a fully featured API. Typically *Far* tabular data is targeted at *Osd*, where it can be processed by an implementation optimized for a specific @@ -87,8 +87,8 @@ Far::TopologyRefiner TopologyRefiner is the building block for many other useful classes in OpenSubdiv, but its purpose is more specific. It is intended to store the topology of an arbitrarily refined subdivision hierarchy to support the -construction of `stencil tables <#patch-tables>`__, `patch tables -<#patch-tables>`__, etc. +construction of `stencil table <#patch-table>`__, `patch table +<#patch-table>`__, etc. Aside from public access to topology, TopologyRefiner has public refinement methods (currently *RefineUniform()* and *RefineAdapative()*) where simple @@ -185,14 +185,14 @@ A common base class has been created for the factory class, i.e.: both to provide common code independent of and also potentially to protect core code from unwanted specialization. -Far::PatchTables +Far::PatchTable ================ -The patch tables are a serialized topology representation. This container is -generated using *Far::PatchTablesFactory* from an instance +The patch table is a serialized topology representation. This container is +generated using *Far::PatchTableFactory* from an instance *Far::TopologyRefiner* after a refinement has been applied. The -FarPatchTablesFactory traverses the data-structures of the TopologyRefiner and +FarPatchTableFactory traverses the data-structures of the TopologyRefiner and serializes the sub-faces into collections of bi-linear and bi-cubic patches, as dictated by the refinement mode (uniform or adaptive). The patches are then sorted into arrays based on their types. @@ -216,13 +216,13 @@ description of the patches in the array. This includes the patches *type*, *pattern* and *rotation*. The PatchArray *ArrayRange* provides the indices necessary to track the records -of individual patches in the tables. +of individual patches in the table. Patch Types *********** The following are the different patch types that can be represented in the -PatchTables: +PatchTable: +-------------------------------------------------------------------------+ | | @@ -285,11 +285,11 @@ Patch Transitions .. include:: under_development.rst -Far::StencilTables +Far::StencilTable ================== -The base container for stencil data is the StencilTables class. As with most -other Far entities, it has an associated StencilTablesFactory that requires a +The base container for stencil data is the StencilTable class. As with most +other Far entities, it has an associated StencilTableFactory that requires a TopologyRefiner: Advantages @@ -321,7 +321,7 @@ iteration interpolates the new vertices by applying polynomial weights to a The interpolation calculations for any given vertex can be broken down into sequences of multiply-add operations applied to the supporting vertices. -Stencil tables encode a factorization of these weighted sums : each stencils is +Stencil table encodes a factorization of these weighted sums : each stencils is created by combining the list of control vertices from the 1-ring. With iterative subdivision, each refinement step is dependent upon the previous @@ -377,7 +377,7 @@ derivatives, so limit stencils carry a set of weights for tangent vectors. .. image:: images/far_stencil0.png :align: center -Once the stencil tables have been generated, limit stencils are the most direct +Once the stencil table has been generated, limit stencils are the most direct and efficient method of evaluation of specific locations on the limit of a subdivision surface, starting from the coarse vertices of the control cage. diff --git a/documentation/nav_template.txt b/documentation/nav_template.txt index 64b4d35f..ac6c2d80 100644 --- a/documentation/nav_template.txt +++ b/documentation/nav_template.txt @@ -63,8 +63,8 @@
  • Far
  • Vtr
  • Sdc
  • diff --git a/documentation/osd_overview.rst b/documentation/osd_overview.rst index de200718..980349e6 100644 --- a/documentation/osd_overview.rst +++ b/documentation/osd_overview.rst @@ -119,7 +119,7 @@ a series of regression tests that compare the methods to each other. * **Beta Issues** Face-varying smooth data interpolation is currently only supported in - **Osd** through refinement and limit points but not in the PatchTables. + **Osd** through refinement and limit points but not in the PatchTable. ---- diff --git a/documentation/tutorials.rst b/documentation/tutorials.rst index 5898d4ce..03fce0c3 100644 --- a/documentation/tutorials.rst +++ b/documentation/tutorials.rst @@ -89,17 +89,17 @@ or in your local ``/turorials``. | |far_tut_3| | - | **Tutorial 4** - | This tutorial shows how to create and manipulate FarStencilTables. We use the + | This tutorial shows how to create and manipulate FarStencilTable. We use the factorized stencils to interpolate vertex primvar data buffers. `[code] `__ | | **Tutorial 5** | This tutorial shows how to create and manipulate both 'vertex' and 'varying' - FarStencilTables to interpolate 2 primvar data buffers: vertex positions and + FarStencilTable to interpolate 2 primvar data buffers: vertex positions and vertex colors. `[code] `__ | | **Tutorial 6** | This tutorial shows how to interpolate surface limits at arbitrary - parametric locations using feature adaptive Far::PatchTables. `[code] `__ + parametric locations using feature adaptive Far::PatchTable. `[code] `__ | |far_tut_6| | | **Tutorial 7** diff --git a/examples/common/patchColors.h b/examples/common/patchColors.h index c9a07edb..8d9a48e2 100644 --- a/examples/common/patchColors.h +++ b/examples/common/patchColors.h @@ -25,7 +25,7 @@ #ifndef OPENSUBDIV_EXAMPLES_COMMON_PATCH_COLORS_H #define OPENSUBDIV_EXAMPLES_COMMON_PATCH_COLORS_H -#include +#include // returns a unique color for each type of feature-adaptive patches float const * getAdaptivePatchColor(OpenSubdiv::Far::PatchDescriptor const & desc); diff --git a/examples/dxPtexViewer/dxPtexViewer.cpp b/examples/dxPtexViewer/dxPtexViewer.cpp index d7565be6..448d6e69 100755 --- a/examples/dxPtexViewer/dxPtexViewer.cpp +++ b/examples/dxPtexViewer/dxPtexViewer.cpp @@ -737,7 +737,7 @@ createOsdMesh(int level, int kernel) { if (g_kernel == kCPU) { g_mesh = new Osd::Mesh( @@ -749,7 +749,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_OPENMP } else if (kernel == kOPENMP) { g_mesh = new Osd::Mesh( @@ -761,7 +761,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_TBB } else if (kernel == kTBB) { g_mesh = new Osd::Mesh( @@ -774,7 +774,7 @@ createOsdMesh(int level, int kernel) { } else if(kernel == kCL) { static Osd::EvaluatorCacheT clEvaluatorCache; g_mesh = new Osd::Mesh( @@ -788,7 +788,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_CUDA } else if (g_kernel == kCUDA) { g_mesh = new Osd::Mesh( @@ -800,7 +800,7 @@ createOsdMesh(int level, int kernel) { } else if (g_kernel == kDirectCompute) { static Osd::EvaluatorCacheT d3d11ComputeEvaluatorCache; g_mesh = new Osd::Mesh( diff --git a/examples/dxViewer/dxviewer.cpp b/examples/dxViewer/dxviewer.cpp index a7d61f08..d3189e5d 100644 --- a/examples/dxViewer/dxviewer.cpp +++ b/examples/dxViewer/dxviewer.cpp @@ -322,7 +322,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= if (g_kernel == kCPU) { g_mesh = new Osd::Mesh( @@ -334,7 +334,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_OPENMP } else if (kernel == kOPENMP) { g_mesh = new Osd::Mesh( @@ -346,7 +346,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_TBB } else if (kernel == kTBB) { g_mesh = new Osd::Mesh( @@ -359,7 +359,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= } else if(kernel == kCL) { static Osd::EvaluatorCacheT clEvaluatorCache; g_mesh = new Osd::Mesh( @@ -373,7 +373,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_CUDA } else if (g_kernel == kCUDA) { g_mesh = new Osd::Mesh( @@ -385,7 +385,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= } else if (g_kernel == kDirectCompute) { static Osd::EvaluatorCacheT d3d11ComputeEvaluatorCache; g_mesh = new Osd::Mesh( @@ -405,7 +405,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= if (g_endCap == kEndCapLegacyGregory) { g_legacyGregoryPatchTable = Osd::D3D11LegacyGregoryPatchTable::Create( - g_mesh->GetFarPatchTables(), g_pd3dDeviceContext); + g_mesh->GetFarPatchTable(), g_pd3dDeviceContext); } // compute model bounding @@ -829,7 +829,7 @@ display() { g_mesh->GetPatchTable()->GetPatchIndexBuffer(), DXGI_FORMAT_R32_UINT, 0); // patch drawing - int patchCount[12]; // [Type] (see far/patchTables.h) + int patchCount[12]; // [Type] (see far/patchTable.h) int numTotalPatches = 0; int numDrawCalls = 0; diff --git a/examples/farViewer/farViewer.cpp b/examples/farViewer/farViewer.cpp index d363481b..2459187d 100644 --- a/examples/farViewer/farViewer.cpp +++ b/examples/farViewer/farViewer.cpp @@ -50,9 +50,9 @@ GLFWmonitor* g_primary=0; #include #include -#include -#include -#include +#include +#include +#include #include @@ -343,7 +343,7 @@ createFaceNumbers(OpenSubdiv::Far::TopologyRefiner const & refiner, //------------------------------------------------------------------------------ // generate display vert IDs for the selected Far patch static void -createPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables, +createPatchNumbers(OpenSubdiv::Far::PatchTable const & patchTable, std::vector const & vertexBuffer) { if (not g_currentPatch) @@ -353,8 +353,8 @@ createPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables, patchArray = -1; // Find PatchArray containing our patch - for (int array=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { - int npatches = patchTables.GetNumPatches(array); + for (int array=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { + int npatches = patchTable.GetNumPatches(array); if (patchID >= npatches) { patchID -= npatches; } else { @@ -366,10 +366,10 @@ createPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables, return; } - g_currentPatchDesc = patchTables.GetPatchArrayDescriptor(patchArray); + g_currentPatchDesc = patchTable.GetPatchArrayDescriptor(patchArray); OpenSubdiv::Far::ConstIndexArray const cvs = - patchTables.GetPatchVertices(patchArray, patchID); + patchTable.GetPatchVertices(patchArray, patchID); static char buf[16]; for (int i=0; i const & fvarBuffer) { static int channel = 0; @@ -389,20 +389,20 @@ createFVarPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables, int patch = g_currentPatch-1; static char buf[16]; - if (patch>=0 and patch=0 and patchPrint3D(fvarBuffer[cvs[i]].GetPos(), buf, 2); } - g_currentFVarPatchType = patchTables.GetFVarPatchType(channel, handle); + g_currentFVarPatchType = patchTable.GetFVarPatchType(channel, handle); } } @@ -413,7 +413,7 @@ static GLMesh fvarVerts, static void createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner, - OpenSubdiv::Far::PatchTables const & patchTables, + OpenSubdiv::Far::PatchTable const & patchTable, std::vector const & fvarBuffer) { assert(not fvarBuffer.empty()); @@ -423,14 +423,14 @@ createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner, if (g_FarDrawFVarVerts) { GLMesh::Options options; options.vertColorMode = GLMesh::VERTCOLOR_BY_LEVEL; - fvarVerts.InitializeFVar(options, refiner, &patchTables, channel, 0, (float *)(&fvarBuffer[0])); + fvarVerts.InitializeFVar(options, refiner, &patchTable, channel, 0, (float *)(&fvarBuffer[0])); } if (g_FarDrawFVarPatches) { // generate uniform tessellation for patches int tessFactor = g_FarDrawFVarPatchTess, - npatches = patchTables.GetNumPatchesTotal(), + npatches = patchTable.GetNumPatchesTotal(), nvertsperpatch = (tessFactor) * (tessFactor), nverts = npatches * nvertsperpatch; @@ -442,7 +442,7 @@ createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner, std::vector verts(nverts); memset(&verts[0], 0, verts.size()*sizeof(Vertex)); - OpenSubdiv::Far::PatchTables::PatchHandle handle; + OpenSubdiv::Far::PatchTable::PatchHandle handle; Vertex * vert = &verts[0]; for (int patch=0; patch const & vertexBuffer) { typedef OpenSubdiv::Far::PatchDescriptor PatchDescriptor; int npatches = 0; int patchArray = 0; - for (int array=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { - if (patchTables.GetPatchArrayDescriptor(array).GetType()== + for (int array=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { + if (patchTable.GetPatchArrayDescriptor(array).GetType()== PatchDescriptor::GREGORY_BASIS) { - npatches = patchTables.GetNumPatches(array); + npatches = patchTable.GetNumPatches(array); patchArray = array; break; } @@ -499,7 +499,7 @@ createGregoryBasis(OpenSubdiv::Far::PatchTables const & patchTables, * indices = &edgeindices[patch * 40]; OpenSubdiv::Far::ConstIndexArray const cvs = - patchTables.GetPatchVertices(patchArray, patch); + patchTable.GetPatchVertices(patchArray, patch); for (int i=0; i<20; ++i) { vpe[i] = 2; @@ -539,7 +539,7 @@ createGregoryBasis(OpenSubdiv::Far::PatchTables const & patchTables, //------------------------------------------------------------------------------ // generate display IDs for Far faces static void -createPtexNumbers(OpenSubdiv::Far::PatchTables const & patchTables, +createPtexNumbers(OpenSubdiv::Far::PatchTable const & patchTable, std::vector const & vertexBuffer) { typedef OpenSubdiv::Far::PatchDescriptor Descriptor; @@ -549,15 +549,15 @@ createPtexNumbers(OpenSubdiv::Far::PatchTables const & patchTables, static int regular[4] = {5, 6, 9, 10}, gregory[4] = {0, 1, 2, 3}; - for (int array=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { + for (int array=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { - for (int patch=0; patch<(int)patchTables.GetNumPatches(array); ++patch) { + for (int patch=0; patch<(int)patchTable.GetNumPatches(array); ++patch) { OpenSubdiv::Far::ConstIndexArray const cvs = - patchTables.GetPatchVertices(array, patch); + patchTable.GetPatchVertices(array, patch); int * remap = 0; - switch (patchTables.GetPatchArrayDescriptor(array).GetType()) { + switch (patchTable.GetPatchArrayDescriptor(array).GetType()) { case Descriptor::REGULAR: remap = regular; break; case Descriptor::GREGORY: case Descriptor::GREGORY_BOUNDARY: @@ -571,7 +571,7 @@ createPtexNumbers(OpenSubdiv::Far::PatchTables const & patchTables, center.AddWithWeight(vertexBuffer[cvs[remap[k]]], 0.25f); } - snprintf(buf, 16, "%d", patchTables.GetPatchParam(array, patch).faceIndex); + snprintf(buf, 16, "%d", patchTable.GetPatchParam(array, patch).faceIndex); g_font->Print3D(center.GetPos(), buf, 1); } } @@ -609,35 +609,35 @@ createFarGLMesh(Shape * shape, int maxlevel) { int numTotalVerts = refiner->GetNumVerticesTotal(); // - // Patch tables + // Patch table // std::vector fvarBuffer; - Far::PatchTables * patchTables = 0; + Far::PatchTable * patchTable = 0; bool createFVarWire = g_FarDrawFVarPatches or g_FarDrawFVarVerts; if (g_Adaptive) { - Far::PatchTablesFactory::Options options; + Far::PatchTableFactory::Options options; options.generateFVarTables = createFVarWire; options.shareEndCapPatchPoints = false; - patchTables = - Far::PatchTablesFactory::Create(*refiner, options); + patchTable = + Far::PatchTableFactory::Create(*refiner, options); // increase vertex buffer for the additional endcap verts - if (patchTables->GetEndCapVertexStencilTables()) { - numTotalVerts += patchTables->GetEndCapVertexStencilTables()->GetNumStencils(); + if (patchTable->GetEndCapVertexStencilTable()) { + numTotalVerts += patchTable->GetEndCapVertexStencilTable()->GetNumStencils(); } - g_numPatches = patchTables->GetNumPatchesTotal(); - g_maxValence = patchTables->GetMaxValence(); + g_numPatches = patchTable->GetNumPatchesTotal(); + g_maxValence = patchTable->GetMaxValence(); if (createFVarWire) { // interpolate fvar values - //Far::FVarPatchTables const * fvarTables = - // patchTables->GetFVarPatchTables(); - //assert(fvarTables); + //Far::FVarPatchTable const * fvarTable = + // patchTable->GetFVarPatchTable(); + //assert(fvarTable); int channel = 0; @@ -675,29 +675,29 @@ createFarGLMesh(Shape * shape, int maxlevel) { // // Stencil interpolation // - Far::StencilTables const * stencilTables = 0; - Far::StencilTablesFactory::Options options; + Far::StencilTable const * stencilTable = 0; + Far::StencilTableFactory::Options options; options.generateOffsets=true; options.generateIntermediateLevels=true; - stencilTables = Far::StencilTablesFactory::Create(*refiner, options); + stencilTable = Far::StencilTableFactory::Create(*refiner, options); // append endpatch stencils if needed - if (patchTables and patchTables->GetEndCapVertexStencilTables()) { - if (Far::StencilTables const * stencilTablesWithEndCap = - Far::StencilTablesFactory::AppendEndCapStencilTables( - *refiner, stencilTables, - patchTables->GetEndCapVertexStencilTables())) { - delete stencilTables; - stencilTables = stencilTablesWithEndCap; + if (patchTable and patchTable->GetEndCapVertexStencilTable()) { + if (Far::StencilTable const * stencilTableWithEndCap = + Far::StencilTableFactory::AppendEndCapStencilTable( + *refiner, stencilTable, + patchTable->GetEndCapVertexStencilTable())) { + delete stencilTable; + stencilTable = stencilTableWithEndCap; } } // // apply stencils // - stencilTables->UpdateValues(verts, verts + ncoarseverts); + stencilTable->UpdateValues(verts, verts + ncoarseverts); - delete stencilTables; + delete stencilTable; } else { // // TopologyRefiner interpolation @@ -725,21 +725,21 @@ createFarGLMesh(Shape * shape, int maxlevel) { createFaceNumbers(*refiner, vertexBuffer); } - if (g_FarDrawPtexIDs and patchTables) { - createPtexNumbers(*patchTables, vertexBuffer); + if (g_FarDrawPtexIDs and patchTable) { + createPtexNumbers(*patchTable, vertexBuffer); } if (g_Adaptive) { - createPatchNumbers(*patchTables, vertexBuffer); + createPatchNumbers(*patchTable, vertexBuffer); } if (g_Adaptive and g_FarDrawGregogyBasis) { - createGregoryBasis(*patchTables, vertexBuffer); + createGregoryBasis(*patchTable, vertexBuffer); } if (g_Adaptive and createFVarWire) { - createFVarPatches(*refiner, *patchTables, fvarBuffer); - createFVarPatchNumbers(*patchTables, fvarBuffer); + createFVarPatches(*refiner, *patchTable, fvarBuffer); + createFVarPatchNumbers(*patchTable, fvarBuffer); } createEdgeNumbers(*refiner, vertexBuffer, g_FarDrawEdgeIDs!=0, g_FarDrawEdgeSharpness!=0); @@ -749,7 +749,7 @@ createFarGLMesh(Shape * shape, int maxlevel) { options.edgeColorMode=g_Adaptive ? GLMesh::EDGECOLOR_BY_PATCHTYPE : GLMesh::EDGECOLOR_BY_SHARPNESS; options.faceColorMode=g_Adaptive ? GLMesh::FACECOLOR_BY_PATCHTYPE :GLMesh::FACECOLOR_SOLID; - g_far_glmesh.Initialize(options, *refiner, patchTables, (float *)&verts[0]); + g_far_glmesh.Initialize(options, *refiner, patchTable, (float *)&verts[0]); if (g_Adaptive) { g_far_glmesh.SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); } else { @@ -762,7 +762,7 @@ createFarGLMesh(Shape * shape, int maxlevel) { g_far_glmesh.InitializeDeviceBuffers(); delete refiner; - delete patchTables; + delete patchTable; } //------------------------------------------------------------------------------ diff --git a/examples/farViewer/gl_mesh.cpp b/examples/farViewer/gl_mesh.cpp index af925052..685887e1 100644 --- a/examples/farViewer/gl_mesh.cpp +++ b/examples/farViewer/gl_mesh.cpp @@ -243,10 +243,10 @@ GLMesh::Initialize(Options /* options */, //------------------------------------------------------------------------------ void GLMesh::Initialize(Options options, TopologyRefiner const & refiner, - PatchTables const * patchTables, float const * vertexData) { + PatchTable const * patchTable, float const * vertexData) { - if (patchTables) { - initializeBuffers(options, refiner, *patchTables, vertexData); + if (patchTable) { + initializeBuffers(options, refiner, *patchTable, vertexData); } else { initializeBuffers(options, refiner, vertexData); } @@ -413,7 +413,7 @@ setEdge(std::vector & vbo, int edge, float const * vertData, int v0, int //------------------------------------------------------------------------------ void GLMesh::InitializeFVar(Options options, TopologyRefiner const & refiner, - PatchTables const * patchTables, int channel, int tessFactor, float const * fvarData) { + PatchTable const * patchTable, int channel, int tessFactor, float const * fvarData) { int nverts = refiner.GetNumFVarValuesTotal(channel); @@ -442,7 +442,7 @@ GLMesh::InitializeFVar(Options options, TopologyRefiner const & refiner, if (tessFactor>0) { // edge color component ------------------------------ - int npatches = patchTables->GetNumPatchesTotal(), + int npatches = patchTable->GetNumPatchesTotal(), nvertsperpatch = (tessFactor) * (tessFactor), nedgesperpatch = (tessFactor-1) * (tessFactor*2+tessFactor-1), //nverts = npatches * nvertsperpatch, @@ -480,14 +480,14 @@ GLMesh::InitializeFVar(Options options, TopologyRefiner const & refiner, *ptr++ = tessFactor * (tessFactor-1) + i+1; } - OpenSubdiv::Far::PatchTables::PatchHandle handle; + OpenSubdiv::Far::PatchTable::PatchHandle handle; for (int patch=0, offset=0; patchGetFVarPatchType(channel, handle); + patchTable->GetFVarPatchType(channel, handle); if (OpenSubdiv::Far::PatchDescriptor::IsAdaptive(type)) { color = getAdaptivePatchColor( @@ -596,7 +596,7 @@ getRingSize(OpenSubdiv::Far::PatchDescriptor desc) { //------------------------------------------------------------------------------ void GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner, - PatchTables const & patchTables, float const * vertexData) { + PatchTable const & patchTable, float const * vertexData) { int nverts = refiner.GetNumVerticesTotal(); @@ -628,11 +628,11 @@ GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner, int nedges = 0; - for (int array=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { + for (int array=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { - int ncvs = getRingSize(patchTables.GetPatchArrayDescriptor(array)); + int ncvs = getRingSize(patchTable.GetPatchArrayDescriptor(array)); - nedges += patchTables.GetNumPatches(array) * getNumEdges(ncvs); + nedges += patchTable.GetNumPatches(array) * getNumEdges(ncvs); } std::vector & vbo = _vbo[COMP_EDGE]; vbo.resize(nedges * 2 * 6); @@ -646,10 +646,10 @@ GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner, float const * color=solidColor; - for (int array=0, edge=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { + for (int array=0, edge=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { OpenSubdiv::Far::PatchDescriptor desc = - patchTables.GetPatchArrayDescriptor(array); + patchTable.GetPatchArrayDescriptor(array); if (options.edgeColorMode==EDGECOLOR_BY_PATCHTYPE) { color = getAdaptivePatchColor(desc); @@ -657,10 +657,10 @@ GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner, int ncvs = getRingSize(desc); - for (int patch=0; patch & vbo = _vbo[COMP_FACE]; vbo.resize(nverts*3); @@ -691,17 +691,17 @@ GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner, _faceColors.resize(nfaces*4, 1.0f); // default to solid color - for (int array=0, face=0; array<(int)patchTables.GetNumPatchArrays(); ++array) { + for (int array=0, face=0; array<(int)patchTable.GetNumPatchArrays(); ++array) { OpenSubdiv::Far::PatchDescriptor desc = - patchTables.GetPatchArrayDescriptor(array); + patchTable.GetPatchArrayDescriptor(array); //int ncvs = getRingSize(desc); - for (int patch=0; patch #include -#include +#include #include "../common/glUtils.h" @@ -193,13 +193,13 @@ public: // Far initialization typedef OpenSubdiv::Far::TopologyRefiner TopologyRefiner; - typedef OpenSubdiv::Far::PatchTables PatchTables; + typedef OpenSubdiv::Far::PatchTable PatchTable; void Initialize(Options options, TopologyRefiner const & refiner, - PatchTables const * patchTables, float const * vertexData); + PatchTable const * patchTable, float const * vertexData); void InitializeFVar(Options options, TopologyRefiner const & refiner, - PatchTables const * patchTables, int channel, int tessFactor, float const * fvarData); + PatchTable const * patchTable, int channel, int tessFactor, float const * fvarData); void InitializeDeviceBuffers(); @@ -229,7 +229,7 @@ private: float const * vertexData); void initializeBuffers(Options options, TopologyRefiner const & refiner, - PatchTables const & patchTables, float const * vertexData); + PatchTable const & patchTable, float const * vertexData); void clearBuffers(); diff --git a/examples/glEvalLimit/glEvalLimit.cpp b/examples/glEvalLimit/glEvalLimit.cpp index 49b46602..ad6df89d 100755 --- a/examples/glEvalLimit/glEvalLimit.cpp +++ b/examples/glEvalLimit/glEvalLimit.cpp @@ -50,8 +50,8 @@ GLFWmonitor* g_primary=0; #include #include #include -#include -#include +#include +#include #include #include @@ -206,10 +206,10 @@ createCoarseMesh(OpenSubdiv::Far::TopologyRefiner const & refiner) { //------------------------------------------------------------------------------ Far::TopologyRefiner * g_topologyRefiner = 0; -Far::StencilTables const * g_vertexStencils = NULL; -Far::StencilTables const * g_varyingStencils = NULL; +Far::StencilTable const * g_vertexStencils = NULL; +Far::StencilTable const * g_varyingStencils = NULL; -Far::PatchTables const * g_patchTables = NULL; +Far::PatchTable const * g_patchTable = NULL; Far::PatchMap const * g_patchMap = NULL; std::vector g_patchCoords; @@ -295,7 +295,7 @@ updateGeom() { g_patchCoords.clear(); for (int i = 0; i < g_particles->GetNumParticles(); ++i) { STParticles::Position const &position = g_particles->GetPositions()[i]; - Far::PatchTables::PatchHandle const *handle = + Far::PatchTable::PatchHandle const *handle = g_patchMap->FindPatch(position.ptexIndex, position.s, position.t); if (handle) { g_patchCoords.push_back(Osd::PatchCoord( @@ -313,7 +313,7 @@ updateGeom() { g_outDerivatives, g_dvDesc, (int)g_patchCoords.size(), &g_patchCoords[0], - g_patchTables, NULL); + g_patchTable, NULL); } else { // evaluate positions g_nsamplesFound = Osd::CpuEvaluator::EvalPatches( @@ -321,7 +321,7 @@ updateGeom() { g_outVertexData, g_odesc, (int)g_patchCoords.size(), &g_patchCoords[0], - g_patchTables, NULL); + g_patchTable, NULL); } // color @@ -340,7 +340,7 @@ updateGeom() { g_outVertexData, g_vdesc, (int)g_patchCoords.size(), &g_patchCoords[0], - g_patchTables, NULL); + g_patchTable, NULL); } s.Stop(); @@ -388,46 +388,46 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) { Far::TopologyRefiner::AdaptiveOptions options(level); g_topologyRefiner->RefineAdaptive(options); - // Generate stencil tables to update the bi-cubic patches control + // Generate stencil table to update the bi-cubic patches control // vertices after they have been re-posed (both for vertex & varying // interpolation) - Far::StencilTablesFactory::Options soptions; + Far::StencilTableFactory::Options soptions; soptions.generateOffsets=true; soptions.generateIntermediateLevels=true; - Far::StencilTables const * vertexStencils = - Far::StencilTablesFactory::Create(*g_topologyRefiner, soptions); + Far::StencilTable const * vertexStencils = + Far::StencilTableFactory::Create(*g_topologyRefiner, soptions); - soptions.interpolationMode = Far::StencilTablesFactory::INTERPOLATE_VARYING; - Far::StencilTables const * varyingStencils = - Far::StencilTablesFactory::Create(*g_topologyRefiner, soptions); + soptions.interpolationMode = Far::StencilTableFactory::INTERPOLATE_VARYING; + Far::StencilTable const * varyingStencils = + Far::StencilTableFactory::Create(*g_topologyRefiner, soptions); - // Generate bi-cubic patch tables for the limit surface - Far::PatchTablesFactory::Options poptions; + // Generate bi-cubic patch table for the limit surface + Far::PatchTableFactory::Options poptions; poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_GREGORY_BASIS); + Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS); - Far::PatchTables const * patchTables = - Far::PatchTablesFactory::Create(*g_topologyRefiner, poptions); + Far::PatchTable const * patchTable = + Far::PatchTableFactory::Create(*g_topologyRefiner, poptions); // append endcap stencils - if (Far::StencilTables const *endCapVertexStencilTables = - patchTables->GetEndCapVertexStencilTables()) { - Far::StencilTables const *tables = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *endCapVertexStencilTable = + patchTable->GetEndCapVertexStencilTable()) { + Far::StencilTable const *table = + Far::StencilTableFactory::AppendEndCapStencilTable( *g_topologyRefiner, - vertexStencils, endCapVertexStencilTables); + vertexStencils, endCapVertexStencilTable); delete vertexStencils; - vertexStencils = tables; + vertexStencils = table; } - if (Far::StencilTables const *endCapVaryingStencilTables = - patchTables->GetEndCapVaryingStencilTables()) { - Far::StencilTables const *tables = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *endCapVaryingStencilTable = + patchTable->GetEndCapVaryingStencilTable()) { + Far::StencilTable const *table = + Far::StencilTableFactory::AppendEndCapStencilTable( *g_topologyRefiner, - varyingStencils, endCapVaryingStencilTables); + varyingStencils, endCapVaryingStencilTable); delete varyingStencils; - varyingStencils = tables; + varyingStencils = table; } // total number of vertices = coarse verts + refined verts + gregory basis verts @@ -439,12 +439,12 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) { if (g_varyingStencils) delete g_varyingStencils; g_varyingStencils = varyingStencils; - if (g_patchTables) delete g_patchTables; - g_patchTables = patchTables; + if (g_patchTable) delete g_patchTable; + g_patchTable = patchTable; // Create a far patch map if (g_patchMap) delete g_patchMap; - g_patchMap = new Far::PatchMap(*g_patchTables); + g_patchMap = new Far::PatchMap(*g_patchTable); } { // Create vertex primvar buffer for the CVs diff --git a/examples/glFVarViewer/glFVarViewer.cpp b/examples/glFVarViewer/glFVarViewer.cpp index 9e953456..faea611a 100644 --- a/examples/glFVarViewer/glFVarViewer.cpp +++ b/examples/glFVarViewer/glFVarViewer.cpp @@ -167,11 +167,11 @@ struct FVarData glDeleteTextures(1, &textureBuffer); textureBuffer = 0; } - void Create(OpenSubdiv::Far::PatchTables const *patchTables, + void Create(OpenSubdiv::Far::PatchTable const *patchTable, int fvarWidth, std::vector const & fvarSrcData) { Release(); OpenSubdiv::Far::ConstIndexArray indices = - patchTables->GetFVarPatchesValues(0); + patchTable->GetFVarPatchesValues(0); // expand fvardata to per-patch array std::vector data; @@ -407,7 +407,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, Scheme scheme = kCatmark) delete g_mesh; g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -420,7 +420,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, Scheme scheme = kCatmark) InterpolateFVarData(*refiner, *shape, fvarData); // set fvardata to texture buffer - g_fvarData.Create(g_mesh->GetFarPatchTables(), + g_fvarData.Create(g_mesh->GetFarPatchTable(), shape->GetFVarWidth(), fvarData); delete shape; diff --git a/examples/glImaging/glImaging.cpp b/examples/glImaging/glImaging.cpp index f145db90..1e0c38fb 100755 --- a/examples/glImaging/glImaging.cpp +++ b/examples/glImaging/glImaging.cpp @@ -232,7 +232,7 @@ createOsdMesh(std::string const &kernel, { if (kernel == "CPU") { return new Osd::Mesh( refiner, @@ -242,7 +242,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_OPENMP } else if (kernel == "OPENMP") { return new Osd::Mesh( refiner, @@ -253,7 +253,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_TBB } else if (kernel == "TBB") { return new Osd::Mesh( refiner, @@ -264,7 +264,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_OPENCL } else if(kernel == "CL") { return new Osd::Mesh( @@ -278,7 +278,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_CUDA } else if(kernel == "CUDA") { return new Osd::Mesh( refiner, @@ -289,7 +289,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK } else if(kernel == "XFB") { return new Osd::Mesh( refiner, @@ -300,7 +300,7 @@ createOsdMesh(std::string const &kernel, #ifdef OPENSUBDIV_HAS_GLSL_COMPUTE } else if(kernel == "GLSL") { return new Osd::Mesh( refiner, diff --git a/examples/glPaintTest/glPaintTest.cpp b/examples/glPaintTest/glPaintTest.cpp index 57f41a19..d75f1039 100644 --- a/examples/glPaintTest/glPaintTest.cpp +++ b/examples/glPaintTest/glPaintTest.cpp @@ -238,7 +238,7 @@ createOsdMesh() { bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive); g_mesh = new OpenSubdiv::Osd::Mesh( refiner, 3, 0, g_level, bits); diff --git a/examples/glPtexViewer/glPtexViewer.cpp b/examples/glPtexViewer/glPtexViewer.cpp index 9dc4eadf..1a27fd98 100644 --- a/examples/glPtexViewer/glPtexViewer.cpp +++ b/examples/glPtexViewer/glPtexViewer.cpp @@ -939,7 +939,7 @@ createOsdMesh(int level, int kernel) { if (kernel == kCPU) { g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -949,7 +949,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_OPENMP } else if (kernel == kOPENMP) { g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -960,7 +960,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_TBB } else if (kernel == kTBB) { g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -972,7 +972,7 @@ createOsdMesh(int level, int kernel) { } else if (kernel == kCL) { static OpenSubdiv::Osd::EvaluatorCacheT clEvaluatorCache; g_mesh = new OpenSubdiv::Osd::Mesh( @@ -986,7 +986,7 @@ createOsdMesh(int level, int kernel) { #ifdef OPENSUBDIV_HAS_CUDA } else if (kernel == kCUDA) { g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -998,7 +998,7 @@ createOsdMesh(int level, int kernel) { } else if (kernel == kGLSL) { static OpenSubdiv::Osd::EvaluatorCacheT glXFBEvaluatorCache; g_mesh = new OpenSubdiv::Osd::Mesh( refiner, @@ -1011,7 +1011,7 @@ createOsdMesh(int level, int kernel) { } else if (kernel == kGLSLCompute) { static OpenSubdiv::Osd::EvaluatorCacheT glComputeEvaluatorCache; g_mesh = new OpenSubdiv::Osd::Mesh( refiner, diff --git a/examples/glShareTopology/glShareTopology.cpp b/examples/glShareTopology/glShareTopology.cpp index b8809e00..8e89433e 100644 --- a/examples/glShareTopology/glShareTopology.cpp +++ b/examples/glShareTopology/glShareTopology.cpp @@ -43,7 +43,7 @@ GLFWwindow* g_window=0; GLFWmonitor* g_primary=0; #include -#include +#include #include #include @@ -891,31 +891,31 @@ rebuildTopology() { if (g_kernel == kCPU) { g_scene = new Scene(g_options); + Far::StencilTable>(g_options); #ifdef OPENSUBDIV_HAS_OPENMP } else if (g_kernel == kOPENMP) { g_scene = new Scene(g_options); + Far::StencilTable>(g_options); #endif #ifdef OPENSUBDIV_HAS_TBB } else if (g_kernel == kTBB) { g_scene = new Scene(g_options); + Far::StencilTable>(g_options); #endif #ifdef OPENSUBDIV_HAS_CUDA } else if (g_kernel == kCUDA) { g_scene = new Scene(g_options); + Osd::CudaStencilTable>(g_options); #endif #ifdef OPENSUBDIV_HAS_OPENCL } else if (g_kernel == kCL) { static Osd::EvaluatorCacheT clEvaluatorCache; g_scene = new Scene(g_options, &clEvaluatorCache, &g_clDeviceContext); #endif @@ -924,14 +924,14 @@ rebuildTopology() { static Osd::EvaluatorCacheT glXFBEvaluatorCache; g_scene = new Scene(g_options, &glXFBEvaluatorCache); + Osd::GLStencilTableTBO>(g_options, &glXFBEvaluatorCache); #endif #ifdef OPENSUBDIV_HAS_GLSL_COMPUTE } else if (g_kernel == kGLSLCompute) { static Osd::EvaluatorCacheT glComputeEvaluatorCache; g_scene = new Scene(g_options, &glComputeEvaluatorCache); + Osd::GLStencilTableSSBO>(g_options, &glComputeEvaluatorCache); #endif } diff --git a/examples/glShareTopology/meshRefiner.h b/examples/glShareTopology/meshRefiner.h index a556bdc4..fe81d18b 100644 --- a/examples/glShareTopology/meshRefiner.h +++ b/examples/glShareTopology/meshRefiner.h @@ -29,17 +29,17 @@ template class MeshRefiner { public: typedef EVALUATOR Evaluator; - typedef STENCIL_TABLES StencilTables; + typedef STENCIL_TABLE StencilTable; typedef DEVICE_CONTEXT DeviceContext; typedef OpenSubdiv::Osd::EvaluatorCacheT EvaluatorCache; - MeshRefiner(OpenSubdiv::Far::StencilTables const * vertexStencils, //XXX: takes ownership - OpenSubdiv::Far::StencilTables const * varyingStencils, + MeshRefiner(OpenSubdiv::Far::StencilTable const * vertexStencils, //XXX: takes ownership + OpenSubdiv::Far::StencilTable const * varyingStencils, int numControlVertices, EvaluatorCache * evaluatorCache = NULL, DeviceContext * deviceContext = NULL) @@ -49,9 +49,9 @@ public: _numControlVertices = numControlVertices; _numVertices = numControlVertices + vertexStencils->GetNumStencils(); - _vertexStencils = OpenSubdiv::Osd::convertToCompatibleStencilTables( + _vertexStencils = OpenSubdiv::Osd::convertToCompatibleStencilTable( vertexStencils, deviceContext); - _varyingStencils = OpenSubdiv::Osd::convertToCompatibleStencilTables( + _varyingStencils = OpenSubdiv::Osd::convertToCompatibleStencilTable( varyingStencils, deviceContext); } @@ -137,8 +137,8 @@ private: int _numVertices; int _numControlVertices; - StencilTables const *_vertexStencils; - StencilTables const *_varyingStencils; + StencilTable const *_vertexStencils; + StencilTable const *_varyingStencils; EvaluatorCache * _evaluatorCache; DeviceContext *_deviceContext; }; diff --git a/examples/glShareTopology/scene.h b/examples/glShareTopology/scene.h index c173f759..987d3bb5 100644 --- a/examples/glShareTopology/scene.h +++ b/examples/glShareTopology/scene.h @@ -91,8 +91,8 @@ public: } virtual size_t createMeshRefiner( - OpenSubdiv::Far::StencilTables const * vertexStencils, - OpenSubdiv::Far::StencilTables const * varyingStencils, + OpenSubdiv::Far::StencilTable const * vertexStencils, + OpenSubdiv::Far::StencilTable const * varyingStencils, int numControlVertices) { MeshRefinerType *meshRefiner = diff --git a/examples/glShareTopology/sceneBase.cpp b/examples/glShareTopology/sceneBase.cpp index 0943429c..3ae832f0 100644 --- a/examples/glShareTopology/sceneBase.cpp +++ b/examples/glShareTopology/sceneBase.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include "sceneBase.h" using namespace OpenSubdiv; @@ -47,7 +47,7 @@ SceneBase::~SceneBase() { void SceneBase::AddTopology(Shape const *shape, int level, bool varying) { - Far::PatchTables const * patchTable = NULL; + Far::PatchTable const * patchTable = NULL; int numVerts = createStencilTable(shape, level, varying, &patchTable); // centering rest position @@ -92,7 +92,7 @@ SceneBase::AddTopology(Shape const *shape, int level, bool varying) { int SceneBase::createStencilTable(Shape const *shape, int level, bool varying, - OpenSubdiv::Far::PatchTables const **patchTablesOut) { + OpenSubdiv::Far::PatchTable const **patchTableOut) { Far::TopologyRefiner * refiner = 0; { @@ -115,51 +115,51 @@ SceneBase::createStencilTable(Shape const *shape, int level, bool varying, refiner->RefineUniform(options); } - Far::StencilTables const * vertexStencils=0, * varyingStencils=0; + Far::StencilTable const * vertexStencils=0, * varyingStencils=0; { - Far::StencilTablesFactory::Options options; + Far::StencilTableFactory::Options options; options.generateOffsets = true; options.generateIntermediateLevels = _options.adaptive; - vertexStencils = Far::StencilTablesFactory::Create(*refiner, options); + vertexStencils = Far::StencilTableFactory::Create(*refiner, options); if (varying) { - varyingStencils = Far::StencilTablesFactory::Create(*refiner, options); + varyingStencils = Far::StencilTableFactory::Create(*refiner, options); } assert(vertexStencils); } - Far::PatchTables const * patchTables = NULL; + Far::PatchTable const * patchTable = NULL; { - Far::PatchTablesFactory::Options poptions(level); + Far::PatchTableFactory::Options poptions(level); if (_options.endCap == kEndCapBSplineBasis) { poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_BSPLINE_BASIS); + Far::PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS); } else { poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_GREGORY_BASIS); + Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS); } - patchTables = Far::PatchTablesFactory::Create(*refiner, poptions); + patchTable = Far::PatchTableFactory::Create(*refiner, poptions); } - *patchTablesOut = patchTables; + *patchTableOut = patchTable; // append gregory vertices into stencils { - if (Far::StencilTables const *vertexStencilsWithEndCap = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *vertexStencilsWithEndCap = + Far::StencilTableFactory::AppendEndCapStencilTable( *refiner, vertexStencils, - patchTables->GetEndCapVertexStencilTables())) { + patchTable->GetEndCapVertexStencilTable())) { delete vertexStencils; vertexStencils = vertexStencilsWithEndCap; } if (varyingStencils) { - if (Far::StencilTables const *varyingStencilsWithEndCap = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *varyingStencilsWithEndCap = + Far::StencilTableFactory::AppendEndCapStencilTable( *refiner, varyingStencils, - patchTables->GetEndCapVaryingStencilTables())) { + patchTable->GetEndCapVaryingStencilTable())) { delete varyingStencils; varyingStencils = varyingStencilsWithEndCap; } @@ -169,7 +169,7 @@ SceneBase::createStencilTable(Shape const *shape, int level, bool varying, _stencilTableSize = createMeshRefiner(vertexStencils, varyingStencils, numControlVertices); - // note: refiner takes ownerships of vertexStencils/ varyingStencils, patchTables + // note: refiner takes ownerships of vertexStencils/ varyingStencils, patchTable delete refiner; return numControlVertices + vertexStencils->GetNumStencils(); @@ -214,9 +214,9 @@ SceneBase::CreateIndexBuffer() { int numTopologies = (int)_topologies.size(); for (int i = 0; i < numTopologies; ++i) { - Far::PatchTables const *patchTables = _patchTables[i]; + Far::PatchTable const *patchTable = _patchTables[i]; - int nPatchArrays = patchTables->GetNumPatchArrays(); + int nPatchArrays = patchTable->GetNumPatchArrays(); _topologies[i].patchArrays.clear(); @@ -224,21 +224,21 @@ SceneBase::CreateIndexBuffer() { for (int j = 0; j < nPatchArrays; ++j) { SceneBase::PatchArray patchArray; - patchArray.desc = patchTables->GetPatchArrayDescriptor(j); - patchArray.numPatches = patchTables->GetNumPatches(j); + patchArray.desc = patchTable->GetPatchArrayDescriptor(j); + patchArray.numPatches = patchTable->GetNumPatches(j); patchArray.indexOffset = (int)buffer.size(); patchArray.primitiveIDOffset = (int)ppBuffer.size()/3; _topologies[i].patchArrays.push_back(patchArray); // indices - Far::ConstIndexArray indices = patchTables->GetPatchArrayVertices(j); + Far::ConstIndexArray indices = patchTable->GetPatchArrayVertices(j); for (int k = 0; k < indices.size(); ++k) { buffer.push_back(indices[k]); } // patchParams - Far::ConstPatchParamArray patchParams = patchTables->GetPatchParams(j); + Far::ConstPatchParamArray patchParams = patchTable->GetPatchParams(j); // XXX: needs sharpness interface for patcharray or put sharpness into patchParam. for (int k = 0; k < patchParams.size(); ++k) { float sharpness = 0.0; @@ -248,26 +248,26 @@ SceneBase::CreateIndexBuffer() { } } #if 0 - // XXX: we'll remove below APIs from Far::PatchTables. + // XXX: we'll remove below APIs from Far::PatchTable. // use GetPatchParams(patchArray) instead as above. // patch param (all in one) - Far::PatchParamTable const &patchParamTables = - patchTables->GetPatchParamTable(); + Far::PatchParamTable const &patchParamTable = + patchTable->GetPatchParamTable(); std::vector const &sharpnessIndexTable = - patchTables->GetSharpnessIndexTable(); + patchTable->GetSharpnessIndexTable(); std::vector const &sharpnessValues = - patchTables->GetSharpnessValues(); + patchTable->GetSharpnessValues(); - int npatches = (int)patchParamTables.size(); + int npatches = (int)patchParamTable.size(); for (int i = 0; i < npatches; ++i) { float sharpness = 0.0; if (i < (int)sharpnessIndexTable.size()) { sharpness = sharpnessIndexTable[i] >= 0 ? sharpnessValues[sharpnessIndexTable[i]] : 0.0f; } - ppBuffer.push_back(patchParamTables[i].faceIndex); - ppBuffer.push_back(patchParamTables[i].bitField.field); + ppBuffer.push_back(patchParamTable[i].faceIndex); + ppBuffer.push_back(patchParamTable[i].bitField.field); ppBuffer.push_back(*((unsigned int *)&sharpness)); } #endif diff --git a/examples/glShareTopology/sceneBase.h b/examples/glShareTopology/sceneBase.h index 39a4531f..fde7a0d8 100644 --- a/examples/glShareTopology/sceneBase.h +++ b/examples/glShareTopology/sceneBase.h @@ -26,7 +26,7 @@ #define OPENSUBDIV_EXAMPLES_GL_SHARE_TOPOLOGY_SCENE_BASE_H #include -#include +#include #include #include @@ -135,20 +135,20 @@ public: protected: int createStencilTable(Shape const *shape, int level, bool varying, - OpenSubdiv::Far::PatchTables const **patchTableOut); + OpenSubdiv::Far::PatchTable const **patchTableOut); void buildBatches(); virtual size_t createMeshRefiner( - OpenSubdiv::Far::StencilTables const * vertexStencils, - OpenSubdiv::Far::StencilTables const * varyingStencils, + OpenSubdiv::Far::StencilTable const * vertexStencils, + OpenSubdiv::Far::StencilTable const * varyingStencils, int numControlVertices) = 0; Options _options; std::vector _objects; std::vector _topologies; - std::vector _patchTables; + std::vector _patchTables; GLuint _indexBuffer; GLuint _patchParamTexture; BatchVector _batches; diff --git a/examples/glStencilViewer/glStencilViewer.cpp b/examples/glStencilViewer/glStencilViewer.cpp index e924606f..d7497b2f 100644 --- a/examples/glStencilViewer/glStencilViewer.cpp +++ b/examples/glStencilViewer/glStencilViewer.cpp @@ -48,9 +48,9 @@ GLFWmonitor* g_primary=0; #include "../common/glUtils.h" #include "../common/glHud.h" -#include +#include #include -#include +#include #include #include @@ -136,7 +136,7 @@ GLhud g_hud; int g_currentShape = 0; //------------------------------------------------------------------------------ -Far::LimitStencilTables const * g_controlStencils; +Far::LimitStencilTable const * g_controlStencils; // Control vertex positions (P(xyz)) Osd::CpuVertexBuffer * g_controlValues=0; @@ -271,7 +271,7 @@ static void createMesh(ShapeDesc const & shapeDesc, int level) { typedef Far::ConstIndexArray IndexArray; - typedef Far::LimitStencilTablesFactory::LocationArray LocationArray; + typedef Far::LimitStencilTableFactory::LocationArray LocationArray; Shape const * shape = Shape::parseObj(shapeDesc.data.c_str(), shapeDesc.scheme); @@ -340,7 +340,7 @@ createMesh(ShapeDesc const & shapeDesc, int level) { } delete g_controlStencils; - g_controlStencils = Far::LimitStencilTablesFactory::Create(*refiner, locs); + g_controlStencils = Far::LimitStencilTableFactory::Create(*refiner, locs); delete [] u; delete [] v; diff --git a/examples/glViewer/glViewer.cpp b/examples/glViewer/glViewer.cpp index 44522b3a..cf2663c8 100644 --- a/examples/glViewer/glViewer.cpp +++ b/examples/glViewer/glViewer.cpp @@ -250,11 +250,11 @@ struct FVarData glDeleteTextures(1, &textureBuffer); textureBuffer = 0; } - void Create(OpenSubdiv::Far::PatchTables const *patchTables, + void Create(OpenSubdiv::Far::PatchTable const *patchTable, int fvarWidth, std::vector const & fvarSrcData) { Release(); OpenSubdiv::Far::ConstIndexArray indices = - patchTables->GetFVarPatchesValues(0); + patchTable->GetFVarPatchesValues(0); // expand fvardata to per-patch array std::vector data; @@ -582,7 +582,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= if (kernel == kCPU) { g_mesh = new Osd::Mesh( refiner, @@ -592,7 +592,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_OPENMP } else if (kernel == kOPENMP) { g_mesh = new Osd::Mesh( refiner, @@ -603,7 +603,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_TBB } else if (kernel == kTBB) { g_mesh = new Osd::Mesh( refiner, @@ -616,7 +616,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= // CLKernel static Osd::EvaluatorCacheT clEvaluatorCache; g_mesh = new Osd::Mesh( @@ -630,7 +630,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= #ifdef OPENSUBDIV_HAS_CUDA } else if(kernel == kCUDA) { g_mesh = new Osd::Mesh( refiner, @@ -642,7 +642,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= } else if(kernel == kGLSL) { static Osd::EvaluatorCacheT glXFBEvaluatorCache; g_mesh = new Osd::Mesh( refiner, @@ -655,7 +655,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= } else if(kernel == kGLSLCompute) { static Osd::EvaluatorCacheT glComputeEvaluatorCache; g_mesh = new Osd::Mesh( refiner, @@ -677,7 +677,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= InterpolateFVarData(*refiner, *shape, fvarData); // set fvardata to texture buffer - g_fvarData.Create(g_mesh->GetFarPatchTables(), + g_fvarData.Create(g_mesh->GetFarPatchTable(), shape->GetFVarWidth(), fvarData); } @@ -686,7 +686,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme= g_legacyGregoryPatchTable = NULL; if (g_endCap == kEndCapLegacyGregory) { g_legacyGregoryPatchTable = - Osd::GLLegacyGregoryPatchTable::Create(g_mesh->GetFarPatchTables()); + Osd::GLLegacyGregoryPatchTable::Create(g_mesh->GetFarPatchTable()); } if (not doAnim) { @@ -1303,7 +1303,7 @@ display() { g_mesh->GetPatchTable()->GetPatchArrays(); // patch drawing - int patchCount[13]; // [Type] (see far/patchTables.h) + int patchCount[13]; // [Type] (see far/patchTable.h) int numTotalPatches = 0; int numDrawCalls = 0; memset(patchCount, 0, sizeof(patchCount)); diff --git a/examples/mayaPolySmooth/mayaPolySmooth.cpp b/examples/mayaPolySmooth/mayaPolySmooth.cpp index 1f47324a..d2ca222b 100644 --- a/examples/mayaPolySmooth/mayaPolySmooth.cpp +++ b/examples/mayaPolySmooth/mayaPolySmooth.cpp @@ -61,7 +61,7 @@ // OpenSubdiv includes #include -#include +#include #include #include diff --git a/opensubdiv/far/endCapBSplineBasisPatchFactory.cpp b/opensubdiv/far/endCapBSplineBasisPatchFactory.cpp index d457a621..5c7031a2 100644 --- a/opensubdiv/far/endCapBSplineBasisPatchFactory.cpp +++ b/opensubdiv/far/endCapBSplineBasisPatchFactory.cpp @@ -25,7 +25,7 @@ #include "../far/gregoryBasis.h" #include "../far/endCapBSplineBasisPatchFactory.h" #include "../far/error.h" -#include "../far/stencilTablesFactory.h" +#include "../far/stencilTableFactory.h" #include "../far/topologyRefiner.h" #include diff --git a/opensubdiv/far/endCapBSplineBasisPatchFactory.h b/opensubdiv/far/endCapBSplineBasisPatchFactory.h index 97a60f5c..ea5f6ad0 100644 --- a/opensubdiv/far/endCapBSplineBasisPatchFactory.h +++ b/opensubdiv/far/endCapBSplineBasisPatchFactory.h @@ -25,7 +25,7 @@ #ifndef OPENSUBDIV3_FAR_END_CAP_BSPLINE_BASIS_PATCH_FACTORY_H #define OPENSUBDIV3_FAR_END_CAP_BSPLINE_BASIS_PATCH_FACTORY_H -#include "../far/patchTablesFactory.h" +#include "../far/patchTableFactory.h" #include "../far/gregoryBasis.h" #include "../far/protoStencil.h" #include "../vtr/level.h" @@ -39,7 +39,7 @@ class TopologyRefiner; /// \brief A BSpline endcap factory /// -/// note: This is an internal use class in PatchTablesFactory, and +/// note: This is an internal use class in PatchTableFactory, and /// will be replaced with SdcSchemeWorker for mask coefficients /// and Vtr::Level for topology traversal. /// @@ -70,19 +70,19 @@ public: ConstIndexArray GetPatchPoints( Vtr::Level const * level, Index faceIndex); - /// \brief Create a StencilTables for end patch points, relative to the max + /// \brief Create a StencilTable for end patch points, relative to the max /// subdivision level. /// - StencilTables* CreateVertexStencilTables() const { - return GregoryBasis::CreateStencilTables(_vertexStencils); + StencilTable* CreateVertexStencilTable() const { + return GregoryBasis::CreateStencilTable(_vertexStencils); } - /// \brief Create a StencilTables for end patch varying primvar. + /// \brief Create a StencilTable for end patch varying primvar. /// This table is used as a convenient way to get varying primvars /// populated on end patch points along with positions. /// - StencilTables* CreateVaryingStencilTables() const { - return GregoryBasis::CreateStencilTables(_varyingStencils); + StencilTable* CreateVaryingStencilTable() const { + return GregoryBasis::CreateStencilTable(_varyingStencils); } private: diff --git a/opensubdiv/far/endCapGregoryBasisPatchFactory.cpp b/opensubdiv/far/endCapGregoryBasisPatchFactory.cpp index 20a1eede..5c2e362b 100644 --- a/opensubdiv/far/endCapGregoryBasisPatchFactory.cpp +++ b/opensubdiv/far/endCapGregoryBasisPatchFactory.cpp @@ -25,7 +25,7 @@ #include "../far/gregoryBasis.h" #include "../far/endCapGregoryBasisPatchFactory.h" #include "../far/error.h" -#include "../far/stencilTablesFactory.h" +#include "../far/stencilTableFactory.h" #include "../far/topologyRefiner.h" #include @@ -38,7 +38,7 @@ namespace OPENSUBDIV_VERSION { namespace Far { // -// EndCapGregoryBasisPatchFactory for Vertex StencilTables +// EndCapGregoryBasisPatchFactory for Vertex StencilTable // EndCapGregoryBasisPatchFactory::EndCapGregoryBasisPatchFactory( TopologyRefiner const & refiner, bool shareBoundaryVertices) : @@ -112,7 +112,7 @@ EndCapGregoryBasisPatchFactory::addPatchBasis(Index faceIndex, ConstIndexArray EndCapGregoryBasisPatchFactory::GetPatchPoints( Vtr::Level const * level, Index faceIndex, - PatchTablesFactory::PatchFaceTag const * levelPatchTags) + PatchTableFactory::PatchFaceTag const * levelPatchTags) { // allocate indices (awkward) // assert(Vtr::INDEX_INVALID==0xFFFFFFFF); diff --git a/opensubdiv/far/endCapGregoryBasisPatchFactory.h b/opensubdiv/far/endCapGregoryBasisPatchFactory.h index 328b9f2d..5ef68f34 100644 --- a/opensubdiv/far/endCapGregoryBasisPatchFactory.h +++ b/opensubdiv/far/endCapGregoryBasisPatchFactory.h @@ -25,7 +25,7 @@ #ifndef OPENSUBDIV3_FAR_END_CAP_GREGORY_BASIS_PATCH_FACTORY_H #define OPENSUBDIV3_FAR_END_CAP_GREGORY_BASIS_PATCH_FACTORY_H -#include "../far/patchTablesFactory.h" +#include "../far/patchTableFactory.h" #include "../far/gregoryBasis.h" #include "../vtr/level.h" @@ -38,7 +38,7 @@ class TopologyRefiner; /// \brief A specialized factory to gather Gregory basis control vertices /// -/// note: This is an internal use class in PatchTablesFactory, and +/// note: This is an internal use class in PatchTableFactory, and /// will be replaced with SdcSchemeWorker for mask coefficients /// and Vtr::Level for topology traversal. /// @@ -94,21 +94,21 @@ public: /// ConstIndexArray GetPatchPoints( Vtr::Level const * level, Index faceIndex, - PatchTablesFactory::PatchFaceTag const * levelPatchTags); + PatchTableFactory::PatchFaceTag const * levelPatchTags); - /// \brief Create a StencilTables for end patch points, relative to the max + /// \brief Create a StencilTable for end patch points, relative to the max /// subdivision level. /// - StencilTables* CreateVertexStencilTables() const { - return GregoryBasis::CreateStencilTables(_vertexStencils); + StencilTable* CreateVertexStencilTable() const { + return GregoryBasis::CreateStencilTable(_vertexStencils); } - /// \brief Create a StencilTables for end patch varying primvar. + /// \brief Create a StencilTable for end patch varying primvar. /// This table is used as a convenient way to get varying primvars /// populated on end patch points along with positions. /// - StencilTables* CreateVaryingStencilTables() const { - return GregoryBasis::CreateStencilTables(_varyingStencils); + StencilTable* CreateVaryingStencilTable() const { + return GregoryBasis::CreateStencilTable(_varyingStencils); } private: diff --git a/opensubdiv/far/endCapLegacyGregoryPatchFactory.cpp b/opensubdiv/far/endCapLegacyGregoryPatchFactory.cpp index b0ef21aa..7569bdd6 100644 --- a/opensubdiv/far/endCapLegacyGregoryPatchFactory.cpp +++ b/opensubdiv/far/endCapLegacyGregoryPatchFactory.cpp @@ -24,7 +24,7 @@ #include "../far/error.h" #include "../far/endCapLegacyGregoryPatchFactory.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include "../far/topologyRefiner.h" #include "../vtr/level.h" @@ -41,10 +41,10 @@ EndCapLegacyGregoryPatchFactory::EndCapLegacyGregoryPatchFactory( ConstIndexArray EndCapLegacyGregoryPatchFactory::GetPatchPoints( Vtr::Level const * level, Index faceIndex, - PatchTablesFactory::PatchFaceTag const * levelPatchTags, + PatchTableFactory::PatchFaceTag const * levelPatchTags, int levelVertOffset) { - PatchTablesFactory::PatchFaceTag patchTag = levelPatchTags[faceIndex]; + PatchTableFactory::PatchFaceTag patchTag = levelPatchTags[faceIndex]; // Gregory Regular Patch (4 CVs + quad-offsets / valence tables) Vtr::ConstIndexArray faceVerts = level->getFaceVertices(faceIndex); @@ -102,8 +102,8 @@ static void getQuadOffsets( void EndCapLegacyGregoryPatchFactory::Finalize( int maxValence, - PatchTables::QuadOffsetsTable *quadOffsetsTable, - PatchTables::VertexValenceTable *vertexValenceTable) + PatchTable::QuadOffsetsTable *quadOffsetsTable, + PatchTable::VertexValenceTable *vertexValenceTable) { // populate quad offsets @@ -116,18 +116,18 @@ EndCapLegacyGregoryPatchFactory::Finalize( quadOffsetsTable->resize(numTotalGregoryPatches*4); - if (numTotalGregoryPatches > 0) { - PatchTables::QuadOffsetsTable::value_type *p = + if (numTotalGregoryPatches > 0) { + PatchTable::QuadOffsetsTable::value_type *p = &((*quadOffsetsTable)[0]); - for (size_t i = 0; i < numGregoryPatches; ++i) { - getQuadOffsets(level, _gregoryFaceIndices[i], p); - p += 4; - } - for (size_t i = 0; i < numGregoryBoundaryPatches; ++i) { - getQuadOffsets(level, _gregoryBoundaryFaceIndices[i], p); - p += 4; - } - } + for (size_t i = 0; i < numGregoryPatches; ++i) { + getQuadOffsets(level, _gregoryFaceIndices[i], p); + p += 4; + } + for (size_t i = 0; i < numGregoryBoundaryPatches; ++i) { + getQuadOffsets(level, _gregoryBoundaryFaceIndices[i], p); + p += 4; + } + } // populate vertex valences // @@ -144,7 +144,7 @@ EndCapLegacyGregoryPatchFactory::Finalize( // const int SizePerVertex = 2*maxValence + 1; - PatchTables::VertexValenceTable & vTable = (*vertexValenceTable); + PatchTable::VertexValenceTable & vTable = (*vertexValenceTable); vTable.resize(_refiner.GetNumVerticesTotal() * SizePerVertex); int vOffset = 0; diff --git a/opensubdiv/far/endCapLegacyGregoryPatchFactory.h b/opensubdiv/far/endCapLegacyGregoryPatchFactory.h index 867f2b99..30570b31 100644 --- a/opensubdiv/far/endCapLegacyGregoryPatchFactory.h +++ b/opensubdiv/far/endCapLegacyGregoryPatchFactory.h @@ -25,19 +25,19 @@ #ifndef OPENSUBDIV3_FAR_END_CAP_LEGACY_GREGORY_PATCH_FACTORY_H #define OPENSUBDIV3_FAR_END_CAP_LEGACY_GREGORY_PATCH_FACTORY_H -#include "../far/patchTablesFactory.h" +#include "../far/patchTableFactory.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { -class PatchTables; +class PatchTable; class TopologyRefiner; namespace Far { /// \brief This factory generates legacy (OpenSubdiv 2.x) gregory patches. /// -/// note: This is an internal use class in PatchTablesFactory. +/// note: This is an internal use class in PatchTableFactory. /// will be deprecated at some point. /// class EndCapLegacyGregoryPatchFactory { @@ -58,12 +58,12 @@ public: /// @param levelVertOffset relative offset of patch vertex indices /// ConstIndexArray GetPatchPoints(Vtr::Level const * level, Index faceIndex, - PatchTablesFactory::PatchFaceTag const * levelPatchTags, + PatchTableFactory::PatchFaceTag const * levelPatchTags, int levelVertOffset); void Finalize(int maxValence, - PatchTables::QuadOffsetsTable *quadOffsetsTable, - PatchTables::VertexValenceTable *vertexValenceTable); + PatchTable::QuadOffsetsTable *quadOffsetsTable, + PatchTable::VertexValenceTable *vertexValenceTable); private: diff --git a/opensubdiv/far/gregoryBasis.cpp b/opensubdiv/far/gregoryBasis.cpp index a64937d8..9917be14 100644 --- a/opensubdiv/far/gregoryBasis.cpp +++ b/opensubdiv/far/gregoryBasis.cpp @@ -24,7 +24,7 @@ #include "../far/gregoryBasis.h" #include "../far/error.h" -#include "../far/stencilTablesFactory.h" +#include "../far/stencilTableFactory.h" #include "../far/topologyRefiner.h" #include "../vtr/stackBuffer.h" @@ -392,8 +392,8 @@ GregoryBasis::ProtoBasis::ProtoBasis( } /*static*/ -StencilTables * -GregoryBasis::CreateStencilTables(PointsVector const &stencils) { +StencilTable * +GregoryBasis::CreateStencilTable(PointsVector const &stencils) { int nStencils = (int)stencils.size(); if (nStencils == 0) return NULL; @@ -404,15 +404,15 @@ GregoryBasis::CreateStencilTables(PointsVector const &stencils) { } // allocate destination - StencilTables *stencilTables = new StencilTables(); + StencilTable *stencilTable = new StencilTable(); - // XXX: do we need numControlVertices in stencilTables? - stencilTables->_numControlVertices = 0; - stencilTables->resize(nStencils, nElements); + // XXX: do we need numControlVertices in stencilTable? + stencilTable->_numControlVertices = 0; + stencilTable->resize(nStencils, nElements); - int * sizes = &stencilTables->_sizes[0]; - Index * indices = &stencilTables->_indices[0]; - float * weights = &stencilTables->_weights[0]; + int * sizes = &stencilTable->_sizes[0]; + Index * indices = &stencilTable->_indices[0]; + float * weights = &stencilTable->_weights[0]; for (int i = 0; i < nStencils; ++i) { GregoryBasis::Point const &src = stencils[i]; @@ -426,9 +426,9 @@ GregoryBasis::CreateStencilTables(PointsVector const &stencils) { weights += size; ++sizes; } - stencilTables->generateOffsets(); + stencilTable->generateOffsets(); - return stencilTables; + return stencilTable; } } // end namespace Far diff --git a/opensubdiv/far/gregoryBasis.h b/opensubdiv/far/gregoryBasis.h index 40277451..6d3d1446 100644 --- a/opensubdiv/far/gregoryBasis.h +++ b/opensubdiv/far/gregoryBasis.h @@ -241,7 +241,7 @@ public: typedef std::vector PointsVector; - static StencilTables *CreateStencilTables(PointsVector const &stencils); + static StencilTable *CreateStencilTable(PointsVector const &stencils); private: diff --git a/opensubdiv/far/patchMap.cpp b/opensubdiv/far/patchMap.cpp index 22bf50b5..3d5b719f 100644 --- a/opensubdiv/far/patchMap.cpp +++ b/opensubdiv/far/patchMap.cpp @@ -30,8 +30,8 @@ namespace OPENSUBDIV_VERSION { namespace Far { // Constructor -PatchMap::PatchMap( PatchTables const & patchTables ) { - initialize( patchTables ); +PatchMap::PatchMap( PatchTable const & patchTable ) { + initialize( patchTable ); } // sets all the children to point to the patch of index patchIdx @@ -63,11 +63,11 @@ PatchMap::addChild( QuadTree & quadtree, QuadNode * parent, int quadrant ) { } void -PatchMap::initialize( PatchTables const & patchTables ) { +PatchMap::initialize( PatchTable const & patchTable ) { int nfaces = 0, - narrays = (int)patchTables.GetNumPatchArrays(), - npatches = (int)patchTables.GetNumPatchesTotal(); + narrays = (int)patchTable.GetNumPatchArrays(), + npatches = (int)patchTable.GetNumPatchesTotal(); if (not narrays or not npatches) return; @@ -77,11 +77,11 @@ PatchMap::initialize( PatchTables const & patchTables ) { for (int parray=0, current=0; parray @@ -38,7 +38,7 @@ namespace Far { /// \brief An quadtree-based map connecting coarse faces to their sub-patches /// -/// PatchTables::PatchArrays contain lists of patches that represent the limit +/// PatchTable::PatchArrays contain lists of patches that represent the limit /// surface of a mesh, sorted by their topological type. These arrays break the /// connection between coarse faces and their sub-patches. /// @@ -49,13 +49,13 @@ namespace Far { class PatchMap { public: - typedef PatchTables::PatchHandle Handle; + typedef PatchTable::PatchHandle Handle; /// \brief Constructor /// - /// @param patchTables A valid set of PatchTables + /// @param patchTable A valid set of PatchTable /// - PatchMap( PatchTables const & patchTables ); + PatchMap( PatchTable const & patchTable ); /// \brief Returns a handle to the sub-patch of the face at the given (u,v). /// Note : the faceid corresponds to quadrangulated face indices (ie. quads @@ -74,7 +74,7 @@ public: private: - inline void initialize( PatchTables const & patchTables ); + inline void initialize( PatchTable const & patchTable ); // Quadtree node with 4 children struct QuadNode { diff --git a/opensubdiv/far/patchTable.cpp b/opensubdiv/far/patchTable.cpp index ad32da24..84f13f80 100644 --- a/opensubdiv/far/patchTable.cpp +++ b/opensubdiv/far/patchTable.cpp @@ -22,7 +22,7 @@ // language governing permissions and limitations under the Apache License. // -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include "../far/patchBasis.h" #include @@ -33,15 +33,15 @@ namespace OPENSUBDIV_VERSION { namespace Far { -PatchTables::PatchTables(int maxvalence) : +PatchTable::PatchTable(int maxvalence) : _maxValence(maxvalence), - _vertexStencilTables(NULL), - _varyingStencilTables(NULL) { + _vertexStencilTable(NULL), + _varyingStencilTable(NULL) { } // Copy constructor // XXXX manuelk we need to eliminate this constructor (C++11 smart pointers) -PatchTables::PatchTables(PatchTables const & src) : +PatchTable::PatchTable(PatchTable const & src) : _maxValence(src._maxValence), _numPtexFaces(src._numPtexFaces), _patchArrays(src._patchArrays), @@ -49,29 +49,29 @@ PatchTables::PatchTables(PatchTables const & src) : _paramTable(src._paramTable), _quadOffsetsTable(src._quadOffsetsTable), _vertexValenceTable(src._vertexValenceTable), - _vertexStencilTables(NULL), - _varyingStencilTables(NULL), + _vertexStencilTable(NULL), + _varyingStencilTable(NULL), _fvarChannels(src._fvarChannels), _sharpnessIndices(src._sharpnessIndices), _sharpnessValues(src._sharpnessValues) { - if (src._vertexStencilTables) { - _vertexStencilTables = new StencilTables(*src._vertexStencilTables); + if (src._vertexStencilTable) { + _vertexStencilTable = new StencilTable(*src._vertexStencilTable); } - if (src._varyingStencilTables) { - _varyingStencilTables = new StencilTables(*src._varyingStencilTables); + if (src._varyingStencilTable) { + _varyingStencilTable = new StencilTable(*src._varyingStencilTable); } } -PatchTables::~PatchTables() { - delete _vertexStencilTables; - delete _varyingStencilTables; +PatchTable::~PatchTable() { + delete _vertexStencilTable; + delete _varyingStencilTable; } // // PatchArrays // -struct PatchTables::PatchArray { +struct PatchTable::PatchArray { PatchArray(PatchDescriptor d, int np, Index v, Index p, Index qo) : desc(d), numPatches(np), vertIndex(v), @@ -91,24 +91,24 @@ struct PatchTables::PatchArray { // debug helper void -PatchTables::PatchArray::print() const { +PatchTable::PatchArray::print() const { desc.print(); printf(" numPatches=%d vertIndex=%d patchIndex=%d " "quadOffsetIndex=%d\n", numPatches, vertIndex, patchIndex, quadOffsetIndex); } -inline PatchTables::PatchArray & -PatchTables::getPatchArray(Index arrayIndex) { +inline PatchTable::PatchArray & +PatchTable::getPatchArray(Index arrayIndex) { assert(arrayIndex<(Index)GetNumPatchArrays()); return _patchArrays[arrayIndex]; } -inline PatchTables::PatchArray const & -PatchTables::getPatchArray(Index arrayIndex) const { +inline PatchTable::PatchArray const & +PatchTable::getPatchArray(Index arrayIndex) const { assert(arrayIndex<(Index)GetNumPatchArrays()); return _patchArrays[arrayIndex]; } void -PatchTables::reservePatchArrays(int numPatchArrays) { +PatchTable::reservePatchArrays(int numPatchArrays) { _patchArrays.reserve(numPatchArrays); } @@ -117,16 +117,16 @@ PatchTables::reservePatchArrays(int numPatchArrays) { // // Stores a record for each patch in the primitive : // -// - Each patch in the PatchTables has a corresponding patch in each +// - Each patch in the PatchTable has a corresponding patch in each // face-varying patch channel. Patch vertex indices are sorted in the same -// patch-type order as PatchTables::PTables. Face-varying data for a patch +// patch-type order as PatchTable::PTables. Face-varying data for a patch // can therefore be quickly accessed by using the patch primitive ID as // index into patchValueOffsets to locate the face-varying control vertex // indices. // // - Face-varying channels can have a different interpolation modes // -// - Unlike "vertex" PatchTables, there are no "transition" patterns required +// - Unlike "vertex" PatchTable, there are no "transition" patterns required // for face-varying patches. // // - No transition patterns means vertex indices of face-varying patches can @@ -139,7 +139,7 @@ PatchTables::reservePatchArrays(int numPatchArrays) { // similar to single-crease to resolve this condition without requiring // isolation if possible // -struct PatchTables::FVarPatchChannel { +struct PatchTable::FVarPatchChannel { // Channel interpolation mode Sdc::Options::FVarLinearInterpolation interpolation; @@ -157,22 +157,22 @@ struct PatchTables::FVarPatchChannel { std::vector patchValues; // point values for each patch }; -inline PatchTables::FVarPatchChannel & -PatchTables::getFVarPatchChannel(int channel) { +inline PatchTable::FVarPatchChannel & +PatchTable::getFVarPatchChannel(int channel) { assert(channel<(int)_fvarChannels.size()); return _fvarChannels[channel]; } -inline PatchTables::FVarPatchChannel const & -PatchTables::getFVarPatchChannel(int channel) const { +inline PatchTable::FVarPatchChannel const & +PatchTable::getFVarPatchChannel(int channel) const { assert(channel<(int)_fvarChannels.size()); return _fvarChannels[channel]; } void -PatchTables::allocateFVarPatchChannels(int numChannels) { +PatchTable::allocateFVarPatchChannels(int numChannels) { _fvarChannels.resize(numChannels); } void -PatchTables::allocateChannelValues(int channel, +PatchTable::allocateChannelValues(int channel, int numPatches, int numVerticesTotal) { FVarPatchChannel & c = getFVarPatchChannel(channel); @@ -192,22 +192,22 @@ PatchTables::allocateChannelValues(int channel, } } void -PatchTables::setFVarPatchChannelLinearInterpolation(int channel, +PatchTable::setFVarPatchChannelLinearInterpolation(int channel, Sdc::Options::FVarLinearInterpolation interpolation) { FVarPatchChannel & c = getFVarPatchChannel(channel); c.interpolation = interpolation; } void -PatchTables::setFVarPatchChannelPatchesType(int channel, PatchDescriptor::Type type) { +PatchTable::setFVarPatchChannelPatchesType(int channel, PatchDescriptor::Type type) { FVarPatchChannel & c = getFVarPatchChannel(channel); c.patchesType = type; } void -PatchTables::setBicubicFVarPatchChannelValues(int channel, int patchSize, +PatchTable::setBicubicFVarPatchChannelValues(int channel, int patchSize, std::vector const & values) { // This method populates the sparse array of values held in the patch - // tables from a non-sparse array of value indices generated during + // table from a non-sparse array of value indices generated during // the second traversal of an adaptive TopologyRefiner. // It is assumed that the patch types have been stored in the channel's // 'patchTypes' vector during the first traversal. @@ -245,7 +245,7 @@ PatchTables::setBicubicFVarPatchChannelValues(int channel, int patchSize, } // -// PatchTables +// PatchTable // inline int @@ -254,7 +254,7 @@ getPatchSize(PatchDescriptor desc) { } void -PatchTables::pushPatchArray(PatchDescriptor desc, int npatches, +PatchTable::pushPatchArray(PatchDescriptor desc, int npatches, Index * vidx, Index * pidx, Index * qoidx) { if (npatches>0) { @@ -271,52 +271,52 @@ PatchTables::pushPatchArray(PatchDescriptor desc, int npatches, } int -PatchTables::getPatchIndex(int arrayIndex, int patchIndex) const { +PatchTable::getPatchIndex(int arrayIndex, int patchIndex) const { PatchArray const & pa = getPatchArray(arrayIndex); assert(patchIndex(&_quadOffsetsTable[pa.quadOffsetIndex + handle.vertIndex], 4); } bool -PatchTables::IsFeatureAdaptive() const { +PatchTable::IsFeatureAdaptive() const { // XXX: // revisit this function, since we'll add uniform cubic patches later. @@ -418,22 +418,22 @@ PatchTables::IsFeatureAdaptive() const { } int -PatchTables::GetNumFVarChannels() const { +PatchTable::GetNumFVarChannels() const { return (int)_fvarChannels.size(); } Sdc::Options::FVarLinearInterpolation -PatchTables::GetFVarChannelLinearInterpolation(int channel) const { +PatchTable::GetFVarChannelLinearInterpolation(int channel) const { FVarPatchChannel const & c = getFVarPatchChannel(channel); return c.interpolation; } Vtr::Array -PatchTables::getFVarPatchTypes(int channel) { +PatchTable::getFVarPatchTypes(int channel) { FVarPatchChannel & c = getFVarPatchChannel(channel); return Vtr::Array(&c.patchTypes[0], (int)c.patchTypes.size()); } Vtr::ConstArray -PatchTables::GetFVarPatchTypes(int channel) const { +PatchTable::GetFVarPatchTypes(int channel) const { FVarPatchChannel const & c = getFVarPatchChannel(channel); if (c.patchesType!=PatchDescriptor::NON_PATCH) { return Vtr::ConstArray(&c.patchesType, 1); @@ -443,17 +443,17 @@ PatchTables::GetFVarPatchTypes(int channel) const { } } ConstIndexArray -PatchTables::GetFVarPatchesValues(int channel) const { +PatchTable::GetFVarPatchesValues(int channel) const { FVarPatchChannel const & c = getFVarPatchChannel(channel); return ConstIndexArray(&c.patchValues[0], (int)c.patchValues.size()); } IndexArray -PatchTables::getFVarPatchesValues(int channel) { +PatchTable::getFVarPatchesValues(int channel) { FVarPatchChannel & c = getFVarPatchChannel(channel); return IndexArray(&c.patchValues[0], (int)c.patchValues.size()); } PatchDescriptor::Type -PatchTables::getFVarPatchType(int channel, int patch) const { +PatchTable::getFVarPatchType(int channel, int patch) const { FVarPatchChannel const & c = getFVarPatchChannel(channel); PatchDescriptor::Type type; if (c.patchesType!=PatchDescriptor::NON_PATCH) { @@ -466,15 +466,15 @@ PatchTables::getFVarPatchType(int channel, int patch) const { return type; } PatchDescriptor::Type -PatchTables::GetFVarPatchType(int channel, PatchHandle const & handle) const { +PatchTable::GetFVarPatchType(int channel, PatchHandle const & handle) const { return getFVarPatchType(channel, handle.patchIndex); } PatchDescriptor::Type -PatchTables::GetFVarPatchType(int channel, int arrayIndex, int patchIndex) const { +PatchTable::GetFVarPatchType(int channel, int arrayIndex, int patchIndex) const { return getFVarPatchType(channel, getPatchIndex(arrayIndex, patchIndex)); } ConstIndexArray -PatchTables::getFVarPatchValues(int channel, int patch) const { +PatchTable::getFVarPatchValues(int channel, int patch) const { FVarPatchChannel const & c = getFVarPatchChannel(channel); @@ -489,17 +489,17 @@ PatchTables::getFVarPatchValues(int channel, int patch) const { } } ConstIndexArray -PatchTables::GetFVarPatchValues(int channel, PatchHandle const & handle) const { +PatchTable::GetFVarPatchValues(int channel, PatchHandle const & handle) const { return getFVarPatchValues(channel, handle.patchIndex); } ConstIndexArray -PatchTables::GetFVarPatchValues(int channel, int arrayIndex, int patchIndex) const { +PatchTable::GetFVarPatchValues(int channel, int arrayIndex, int patchIndex) const { return getFVarPatchValues(channel, getPatchIndex(arrayIndex, patchIndex)); } void -PatchTables::print() const { - printf("patchTables (0x%p)\n", this); +PatchTable::print() const { + printf("patchTable (0x%p)\n", this); printf(" numPatches = %d\n", GetNumPatchesTotal()); for (int i=0; i PatchFVarPointers; namespace Far { void -PatchTablesFactory::PatchFaceTag::clear() { +PatchTableFactory::PatchFaceTag::clear() { std::memset(this, 0, sizeof(*this)); } void -PatchTablesFactory::PatchFaceTag::assignBoundaryPropertiesFromEdgeMask(int boundaryEdgeMask) { +PatchTableFactory::PatchFaceTag::assignBoundaryPropertiesFromEdgeMask(int boundaryEdgeMask) { // // The number of rotations to apply for boundary or corner patches varies on both // where the boundary/corner occurs and whether boundary or corner -- so using a @@ -134,7 +134,7 @@ PatchTablesFactory::PatchFaceTag::assignBoundaryPropertiesFromEdgeMask(int bound } void -PatchTablesFactory::PatchFaceTag::assignBoundaryPropertiesFromVertexMask(int boundaryVertexMask) { +PatchTableFactory::PatchFaceTag::assignBoundaryPropertiesFromVertexMask(int boundaryVertexMask) { // // This is strictly needed for the irregular case when a vertex is a boundary in // the presence of no boundary edges -- an extra-ordinary face with only one corner @@ -179,7 +179,7 @@ offsetAndPermuteIndices(Far::Index const indices[], int count, // The patch vertices for boundary and corner patches // are assigned index values even though indices will // be undefined along boundary and corner edges. - // When the resulting patch tables are going to be used + // When the resulting patch table is going to be used // as indices for drawing, it is convenient for invalid // indices to be replaced with known good values, such // as the first un-permuted index, which is the index @@ -217,7 +217,7 @@ class FVarChannelCursor { public: FVarChannelCursor(TopologyRefiner const & refiner, - PatchTablesFactory::Options options) { + PatchTableFactory::Options options) { if (options.generateFVarTables) { // If client-code does not select specific channels, default to all // the channels in the refiner. @@ -278,13 +278,13 @@ private: // Adaptive Context // // Helper class aggregating transient contextual data structures during the -// creation of feature adaptive patch tables. The structure simplifies +// creation of feature adaptive patch table. The structure simplifies // the function prototypes of high-level private methods in the factory. // This helps keeping the factory class stateless. // // Note : struct members are not re-entrant nor are they intended to be ! // -struct PatchTablesFactory::AdaptiveContext { +struct PatchTableFactory::AdaptiveContext { public: AdaptiveContext(TopologyRefiner const & refiner, Options options); @@ -293,8 +293,8 @@ public: Options const options; - // The patch tables being created - PatchTables * tables; + // The patch table being created + PatchTable * table; public: @@ -341,16 +341,16 @@ public: }; // Constructor -PatchTablesFactory::AdaptiveContext::AdaptiveContext( +PatchTableFactory::AdaptiveContext::AdaptiveContext( TopologyRefiner const & ref, Options opts) : - refiner(ref), options(opts), tables(0), + refiner(ref), options(opts), table(0), fvarChannelCursor(ref, opts) { fvarPatchValues.resize(fvarChannelCursor.size()); } void -PatchTablesFactory::AdaptiveContext::AllocateFVarPatchValues(int npatches) { +PatchTableFactory::AdaptiveContext::AllocateFVarPatchValues(int npatches) { FVarChannelCursor & fvc = fvarChannelCursor; for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { @@ -367,31 +367,31 @@ PatchTablesFactory::AdaptiveContext::AllocateFVarPatchValues(int npatches) { } bool -PatchTablesFactory::AdaptiveContext::RequiresFVarPatches() const { +PatchTableFactory::AdaptiveContext::RequiresFVarPatches() const { return not fvarPatchValues.empty(); } // -// Reserves tables based on the contents of the PatchArrayVector in the PatchTables: +// Reserves tables based on the contents of the PatchArrayVector in the PatchTable: // void -PatchTablesFactory::allocateVertexTables(PatchTables * tables, int /* nlevels */, bool hasSharpness) { +PatchTableFactory::allocateVertexTables(PatchTable * table, int /* nlevels */, bool hasSharpness) { int ncvs = 0, npatches = 0; - for (int i=0; iGetNumPatchArrays(); ++i) { - npatches += tables->GetNumPatches(i); - ncvs += tables->GetNumControlVertices(i); + for (int i=0; iGetNumPatchArrays(); ++i) { + npatches += table->GetNumPatches(i); + ncvs += table->GetNumControlVertices(i); } if (ncvs==0 or npatches==0) return; - tables->_patchVerts.resize( ncvs ); + table->_patchVerts.resize( ncvs ); - tables->_paramTable.resize( npatches ); + table->_paramTable.resize( npatches ); if (hasSharpness) { - tables->_sharpnessIndices.resize( npatches, Vtr::INDEX_INVALID ); + table->_sharpnessIndices.resize( npatches, Vtr::INDEX_INVALID ); } } @@ -399,11 +399,11 @@ PatchTablesFactory::allocateVertexTables(PatchTables * tables, int /* nlevels */ // Allocate face-varying tables // void -PatchTablesFactory::allocateFVarChannels(TopologyRefiner const & refiner, - Options options, int npatches, PatchTables * tables) { +PatchTableFactory::allocateFVarChannels(TopologyRefiner const & refiner, + Options options, int npatches, PatchTable * table) { assert(options.generateFVarTables and - refiner.GetNumFVarChannels()>0 and npatches>0 and tables); + refiner.GetNumFVarChannels()>0 and npatches>0 and table); // Create a channel cursor to iterate over client-selected channels or // default to the channels found in the TopologyRefiner @@ -412,7 +412,7 @@ PatchTablesFactory::allocateFVarChannels(TopologyRefiner const & refiner, return; } - tables->allocateFVarPatchChannels(fvc.size()); + table->allocateFVarPatchChannels(fvc.size()); // Iterate with the cursor to initialize each channel for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { @@ -420,7 +420,7 @@ PatchTablesFactory::allocateFVarChannels(TopologyRefiner const & refiner, Sdc::Options::FVarLinearInterpolation interpolation = refiner.GetFVarLinearInterpolation(*fvc); - tables->setFVarPatchChannelLinearInterpolation(fvc.pos(), interpolation); + table->setFVarPatchChannelLinearInterpolation(fvc.pos(), interpolation); int nverts = 0; if (interpolation==Sdc::Options::FVAR_LINEAR_ALL) { @@ -428,20 +428,20 @@ PatchTablesFactory::allocateFVarChannels(TopologyRefiner const & refiner, PatchDescriptor::Type type = options.triangulateQuads ? PatchDescriptor::TRIANGLES : PatchDescriptor::QUADS; - tables->setFVarPatchChannelPatchesType(fvc.pos(), type); + table->setFVarPatchChannelPatchesType(fvc.pos(), type); nverts = npatches * PatchDescriptor::GetNumFVarControlVertices(type); } - tables->allocateChannelValues(fvc.pos(), npatches, nverts); + table->allocateChannelValues(fvc.pos(), npatches, nverts); } } // gather face-varying patch points int -PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level, +PatchTableFactory::gatherFVarData(AdaptiveContext & context, int level, Index faceIndex, Index levelFaceOffset, int rotation, Index const * levelFVarVertOffsets, Index fofss, Index ** fptrs) { @@ -451,7 +451,7 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level, TopologyRefiner const & refiner = context.refiner; - PatchTables * tables = context.tables; + PatchTable * table = context.table; assert((levelFaceOffset + faceIndex)<(int)context.patchTags.size()); PatchFaceTag & vertexPatchTag = context.patchTags[levelFaceOffset + faceIndex]; @@ -572,7 +572,7 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level, } Vtr::Array patchTypes = - tables->getFVarPatchTypes(fvc.pos()); + table->getFVarPatchTypes(fvc.pos()); assert(not patchTypes.empty()); patchTypes[fofss] = fvarPatchType; @@ -652,7 +652,7 @@ PatchTablesFactory::gatherFVarData(AdaptiveContext & context, int level, // a pointer to the next descriptor // PatchParam * -PatchTablesFactory::computePatchParam( +PatchTableFactory::computePatchParam( TopologyRefiner const & refiner, PtexIndices const &ptexIndices, int depth, Vtr::Index faceIndex, int boundaryMask, int transitionMask, PatchParam *coord) { @@ -733,8 +733,8 @@ assignSharpnessIndex(float sharpness, std::vector & sharpnessValues) { // cases. In the past, more additional arguments were passed to the uniform version, // but that may no longer be necessary (see notes in the uniform version below)... // -PatchTables * -PatchTablesFactory::Create(TopologyRefiner const & refiner, Options options) { +PatchTable * +PatchTableFactory::Create(TopologyRefiner const & refiner, Options options) { if (refiner.IsUniform()) { return createUniform(refiner, options); @@ -743,8 +743,8 @@ PatchTablesFactory::Create(TopologyRefiner const & refiner, Options options) { } } -PatchTables * -PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options options) { +PatchTable * +PatchTableFactory::createUniform(TopologyRefiner const & refiner, Options options) { assert(refiner.IsUniform()); @@ -772,13 +772,13 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio assert(ptype!=PatchDescriptor::NON_PATCH); // - // Create the instance of the tables and allocate and initialize its members. + // Create the instance of the table and allocate and initialize its members. // - PatchTables * tables = new PatchTables(maxvalence); + PatchTable * table = new PatchTable(maxvalence); - tables->_numPtexFaces = ptexIndices.GetNumFaces(); + table->_numPtexFaces = ptexIndices.GetNumFaces(); - tables->reservePatchArrays(nlevels); + table->reservePatchArrays(nlevels); PatchDescriptor desc(ptype); @@ -799,27 +799,27 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio npatches *= 2; if (level>=firstlevel) { - tables->pushPatchArray(desc, npatches, &voffset, &poffset, 0); + table->pushPatchArray(desc, npatches, &voffset, &poffset, 0); } } // Allocate various tables - allocateVertexTables( tables, 0, /*hasSharpness=*/false ); + allocateVertexTables( table, 0, /*hasSharpness=*/false ); bool generateFVarPatches=false; FVarChannelCursor fvc(refiner, options); if (options.generateFVarTables and fvc.size()>0) { - int npatches = tables->GetNumPatchesTotal(); - allocateFVarChannels(refiner, options, npatches, tables); - assert(fvc.size() == tables->GetNumFVarChannels()); + int npatches = table->GetNumPatchesTotal(); + allocateFVarChannels(refiner, options, npatches, table); + assert(fvc.size() == table->GetNumFVarChannels()); } // // Now populate the patches: // - Index * iptr = &tables->_patchVerts[0]; - PatchParam * pptr = &tables->_paramTable[0]; + Index * iptr = &table->_patchVerts[0]; + PatchParam * pptr = &table->_paramTable[0]; Index ** fptr = 0; Index levelVertOffset = options.generateAllLevels ? @@ -833,7 +833,7 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio fptr = (Index **)alloca(fvc.size()*sizeof(Index *)); for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { - fptr[fvc.pos()] = tables->getFVarPatchesValues(fvc.pos()).begin(); + fptr[fvc.pos()] = table->getFVarPatchesValues(fvc.pos()).begin(); } } @@ -860,7 +860,7 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { ConstIndexArray fvalues = refLevel.GetFVarFaceValues(face, *fvc); for (int vert=0; vertgetFVarPatchesValues(fvc.pos()).size()); + assert((levelVertOffset + fvalues[vert]) < (int)table->getFVarPatchesValues(fvc.pos()).size()); fptr[fvc.pos()][vert] = levelFVarVertOffsets[fvc.pos()] + fvalues[vert]; } fptr[fvc.pos()]+=fvalues.size(); @@ -896,11 +896,11 @@ PatchTablesFactory::createUniform(TopologyRefiner const & refiner, Options optio } } } - return tables; + return table; } -PatchTables * -PatchTablesFactory::createAdaptive(TopologyRefiner const & refiner, Options options) { +PatchTable * +PatchTableFactory::createAdaptive(TopologyRefiner const & refiner, Options options) { assert(not refiner.IsUniform()); @@ -915,15 +915,15 @@ PatchTablesFactory::createAdaptive(TopologyRefiner const & refiner, Options opti identifyAdaptivePatches(context); // - // Create the instance of the tables and allocate and initialize its members based on + // Create the instance of the table and allocate and initialize its members based on // the inventory of patches determined above: // int maxValence = refiner.GetMaxValence(); - context.tables = new PatchTables(maxValence); + context.table = new PatchTable(maxValence); // Populate the patch array descriptors - context.tables->reservePatchArrays(context.patchInventory.getNumPatchArrays()); + context.table->reservePatchArrays(context.patchInventory.getNumPatchArrays()); // Sort through the inventory and push back non-empty patch arrays ConstPatchDescriptorArray const & descs = @@ -932,21 +932,21 @@ PatchTablesFactory::createAdaptive(TopologyRefiner const & refiner, Options opti int voffset=0, poffset=0, qoffset=0; for (int i=0; ipushPatchArray(desc, + context.table->pushPatchArray(desc, context.patchInventory.getValue(desc), &voffset, &poffset, &qoffset ); } - context.tables->_numPtexFaces = ptexIndices.GetNumFaces(); + context.table->_numPtexFaces = ptexIndices.GetNumFaces(); // Allocate various tables bool hasSharpness = context.options.useSingleCreasePatch; - allocateVertexTables(context.tables, 0, hasSharpness); + allocateVertexTables(context.table, 0, hasSharpness); if (context.RequiresFVarPatches()) { - int npatches = context.tables->GetNumPatchesTotal(); + int npatches = context.table->GetNumPatchesTotal(); - allocateFVarChannels(refiner, options, npatches, context.tables); + allocateFVarChannels(refiner, options, npatches, context.table); // Reserve temporary non-sparse storage for non-linear fvar channels. // FVar Values for these channels are copied into the final @@ -960,7 +960,7 @@ PatchTablesFactory::createAdaptive(TopologyRefiner const & refiner, Options opti // populateAdaptivePatches(context, ptexIndices); - return context.tables; + return context.table; } // @@ -969,7 +969,7 @@ PatchTablesFactory::createAdaptive(TopologyRefiner const & refiner, Options opti // later with no additional analysis. // void -PatchTablesFactory::identifyAdaptivePatches(AdaptiveContext & context) { +PatchTableFactory::identifyAdaptivePatches(AdaptiveContext & context) { TopologyRefiner const & refiner = context.refiner; @@ -1231,12 +1231,12 @@ PatchTablesFactory::identifyAdaptivePatches(AdaptiveContext & context) { // idenified. // void -PatchTablesFactory::populateAdaptivePatches( +PatchTableFactory::populateAdaptivePatches( AdaptiveContext & context, PtexIndices const & ptexIndices) { TopologyRefiner const & refiner = context.refiner; - PatchTables * tables = context.tables; + PatchTable * table = context.table; // // Setup convenience pointers at the beginning of each patch array for each @@ -1255,33 +1255,33 @@ PatchTablesFactory::populateAdaptivePatches( PatchDescriptor desc = descs[i]; - Index arrayIndex = tables->findPatchArray(desc); + Index arrayIndex = table->findPatchArray(desc); if (arrayIndex==Vtr::INDEX_INVALID) { continue; } - iptrs.getValue(desc) = tables->getPatchArrayVertices(arrayIndex).begin(); - pptrs.getValue(desc) = tables->getPatchParams(arrayIndex).begin(); + iptrs.getValue(desc) = table->getPatchArrayVertices(arrayIndex).begin(); + pptrs.getValue(desc) = table->getPatchParams(arrayIndex).begin(); if (context.options.useSingleCreasePatch) { - sptrs.getValue(desc) = tables->getSharpnessIndices(arrayIndex); + sptrs.getValue(desc) = table->getSharpnessIndices(arrayIndex); } if (context.RequiresFVarPatches()) { Index & offsets = fofss.getValue(desc); - offsets = tables->getPatchIndex(arrayIndex, 0); + offsets = table->getPatchIndex(arrayIndex, 0); // XXXX manuelk this stuff will go away as we use offsets from FVarPatchChannel FVarChannelCursor & fvc = context.fvarChannelCursor; - assert(fvc.size() == tables->GetNumFVarChannels()); + assert(fvc.size() == table->GetNumFVarChannels()); Index ** fptr = (Index **)alloca(fvc.size()*sizeof(Index *)); for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { - Index pidx = tables->getPatchIndex(arrayIndex, 0); + Index pidx = table->getPatchIndex(arrayIndex, 0); int ofs = pidx * 4; - fptr[fvc.pos()] = &tables->getFVarPatchesValues(fvc.pos())[ofs]; + fptr[fvc.pos()] = &table->getFVarPatchesValues(fvc.pos())[ofs]; } fptrs.getValue(desc) = fptr; } @@ -1377,7 +1377,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.R += 16; pptrs.R = computePatchParam(refiner, ptexIndices, i, faceIndex, boundaryMask, transitionMask, pptrs.R); // XXX: sharpness will be integrated into patch param soon. - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, table->_sharpnessValues); fofss.R += gatherFVarData(context, i, faceIndex, levelFaceOffset, /*rotation*/0, levelFVarVertOffsets, fofss.R, fptrs.R); @@ -1395,7 +1395,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.R += 16; pptrs.R = computePatchParam(refiner, ptexIndices, i, faceIndex, /*boundary*/0, transitionMask, pptrs.R); - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(sharpness, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(sharpness, table->_sharpnessValues); fofss.R += gatherFVarData(context, i, faceIndex, levelFaceOffset, bIndex, levelFVarVertOffsets, fofss.R, fptrs.R); @@ -1416,7 +1416,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.GP += cvs.size(); pptrs.GP = computePatchParam( refiner, ptexIndices, i, faceIndex, /*boundary*/0, /*transition*/0, pptrs.GP); - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, table->_sharpnessValues); fofss.GP += gatherFVarData(context, i, faceIndex, levelFaceOffset, 0, levelFVarVertOffsets, fofss.GP, fptrs.GP); @@ -1431,7 +1431,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.R += cvs.size(); pptrs.R = computePatchParam( refiner, ptexIndices, i, faceIndex, /*boundary*/0, /*transition*/0, pptrs.R); - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, table->_sharpnessValues); fofss.R += gatherFVarData(context, i, faceIndex, levelFaceOffset, 0, levelFVarVertOffsets, fofss.R, fptrs.R); @@ -1447,7 +1447,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.G += cvs.size(); pptrs.G = computePatchParam( refiner, ptexIndices, i, faceIndex, /*boundary*/0, /*transition*/0, pptrs.G); - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, table->_sharpnessValues); fofss.G += gatherFVarData(context, i, faceIndex, levelFaceOffset, 0, levelFVarVertOffsets, fofss.G, fptrs.G); @@ -1456,7 +1456,7 @@ PatchTablesFactory::populateAdaptivePatches( iptrs.GB += cvs.size(); pptrs.GB = computePatchParam( refiner, ptexIndices, i, faceIndex, /*boundary*/0, /*transition*/0, pptrs.GB); - if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, tables->_sharpnessValues); + if (sptrs.R) *sptrs.R++ = assignSharpnessIndex(0, table->_sharpnessValues); fofss.GB += gatherFVarData(context, i, faceIndex, levelFaceOffset, 0, levelFVarVertOffsets, fofss.GB, fptrs.GB); @@ -1486,24 +1486,24 @@ PatchTablesFactory::populateAdaptivePatches( // finalize end patches switch(context.options.GetEndCapType()) { case Options::ENDCAP_GREGORY_BASIS: - tables->_vertexStencilTables = - endCapGregoryBasis->CreateVertexStencilTables(); - tables->_varyingStencilTables = - endCapGregoryBasis->CreateVaryingStencilTables(); + table->_vertexStencilTable = + endCapGregoryBasis->CreateVertexStencilTable(); + table->_varyingStencilTable = + endCapGregoryBasis->CreateVaryingStencilTable(); delete endCapGregoryBasis; break; case Options::ENDCAP_BSPLINE_BASIS: - tables->_vertexStencilTables = - endCapBSpline->CreateVertexStencilTables(); - tables->_varyingStencilTables = - endCapBSpline->CreateVaryingStencilTables(); + table->_vertexStencilTable = + endCapBSpline->CreateVertexStencilTable(); + table->_varyingStencilTable = + endCapBSpline->CreateVaryingStencilTable(); delete endCapBSpline; break; case Options::ENDCAP_LEGACY_GREGORY: endCapLegacyGregory->Finalize( - tables->GetMaxValence(), - &tables->_quadOffsetsTable, - &tables->_vertexValenceTable); + table->GetMaxValence(), + &table->_quadOffsetsTable, + &table->_vertexValenceTable); delete endCapLegacyGregory; break; default: @@ -1517,8 +1517,8 @@ PatchTablesFactory::populateAdaptivePatches( FVarChannelCursor & fvc = context.fvarChannelCursor; for (fvc=fvc.begin(); fvc!=fvc.end(); ++fvc) { - if (tables->GetFVarChannelLinearInterpolation(fvc.pos())!=Sdc::Options::FVAR_LINEAR_ALL) { - tables->setBicubicFVarPatchChannelValues(fvc.pos(), + if (table->GetFVarChannelLinearInterpolation(fvc.pos())!=Sdc::Options::FVAR_LINEAR_ALL) { + table->setBicubicFVarPatchChannelValues(fvc.pos(), context.fvarPatchSize, context.fvarPatchValues[fvc.pos()]); } } diff --git a/opensubdiv/far/patchTableFactory.h b/opensubdiv/far/patchTableFactory.h index 28d6c409..b32cf2ad 100644 --- a/opensubdiv/far/patchTableFactory.h +++ b/opensubdiv/far/patchTableFactory.h @@ -22,12 +22,12 @@ // language governing permissions and limitations under the Apache License. // -#ifndef OPENSUBDIV3_FAR_PATCH_TABLES_FACTORY_H -#define OPENSUBDIV3_FAR_PATCH_TABLES_FACTORY_H +#ifndef OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H +#define OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H #include "../version.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -40,12 +40,12 @@ namespace Far { class PtexIndices; class TopologyRefiner; -class PatchTablesFactory { +class PatchTableFactory { public: // PatchFaceTag // A simple struct containing all information gathered about a face that is relevant // to constructing a patch for it (some of these enums should probably be defined more - // as part of PatchTables) + // as part of PatchTable) // // Like the HbrFace::AdaptiveFlags, this struct aggregates all of the face tags // supporting feature adaptive refinement. For now it is not used elsewhere and can @@ -125,16 +125,16 @@ public: int const * fvarChannelIndices; ///< List containing the indices of the channels selected for the factory }; - /// \brief Factory constructor for PatchTables + /// \brief Factory constructor for PatchTable /// /// @param refiner TopologyRefiner from which to generate patches /// - /// @param options Options controlling the creation of the tables + /// @param options Options controlling the creation of the table /// - /// @return A new instance of PatchTables + /// @return A new instance of PatchTable /// - static PatchTables * Create(TopologyRefiner const & refiner, - Options options=Options()); + static PatchTable * Create(TopologyRefiner const & refiner, + Options options=Options()); private: // @@ -145,11 +145,11 @@ private: // // Methods for allocating and managing the patch table data arrays: // - static PatchTables * createUniform(TopologyRefiner const & refiner, - Options options); + static PatchTable * createUniform(TopologyRefiner const & refiner, + Options options); - static PatchTables * createAdaptive(TopologyRefiner const & refiner, - Options options); + static PatchTable * createAdaptive(TopologyRefiner const & refiner, + Options options); // // High-level methods for identifying and populating patches associated with faces: @@ -160,10 +160,10 @@ private: static void populateAdaptivePatches(AdaptiveContext & state, PtexIndices const &ptexIndices); - static void allocateVertexTables(PatchTables * tables, int nlevels, bool hasSharpness); + static void allocateVertexTables(PatchTable * table, int nlevels, bool hasSharpness); static void allocateFVarChannels(TopologyRefiner const & refiner, - Options options, int npatches, PatchTables * tables); + Options options, int npatches, PatchTable * table); static PatchParam * computePatchParam(TopologyRefiner const & refiner, PtexIndices const & ptexIndices, @@ -184,4 +184,4 @@ using namespace OPENSUBDIV_VERSION; } // end namespace OpenSubdiv -#endif /* OPENSUBDIV3_FAR_PATCH_TABLES_FACTORY_H */ +#endif /* OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H */ diff --git a/opensubdiv/far/protoStencil.h b/opensubdiv/far/protoStencil.h index 13eb209a..0bed4dd9 100644 --- a/opensubdiv/far/protoStencil.h +++ b/opensubdiv/far/protoStencil.h @@ -25,7 +25,7 @@ #ifndef OPENSUBDIV3_FAR_PROTOSTENCIL_H #define OPENSUBDIV3_FAR_PROTOSTENCIL_H -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" #include #include @@ -385,7 +385,7 @@ public: } // Factorize from a finished stencil table - void AddWithWeight(StencilTables const & table, Index idx, float weight) { + void AddWithWeight(StencilTable const & table, Index idx, float weight) { assert(idx void -StencilTables::update(T const *controlValues, T *values, +StencilTable::update(T const *controlValues, T *values, std::vector const &valueWeights, Index start, Index end) const { int const * sizes = &_sizes.at(0); @@ -370,7 +370,7 @@ StencilTables::update(T const *controlValues, T *values, } inline void -StencilTables::generateOffsets() { +StencilTable::generateOffsets() { Index offset=0; int noffsets = (int)_sizes.size(); _offsets.resize(noffsets); @@ -381,7 +381,7 @@ StencilTables::generateOffsets() { } inline void -StencilTables::resize(int nstencils, int nelems) { +StencilTable::resize(int nstencils, int nelems) { _sizes.resize(nstencils); _indices.resize(nelems); @@ -390,7 +390,7 @@ StencilTables::resize(int nstencils, int nelems) { // Returns a Stencil at index i in the table inline Stencil -StencilTables::GetStencil(Index i) const { +StencilTable::GetStencil(Index i) const { assert((not _offsets.empty()) and i<(int)_offsets.size()); @@ -402,14 +402,14 @@ StencilTables::GetStencil(Index i) const { } inline Stencil -StencilTables::operator[] (Index index) const { +StencilTable::operator[] (Index index) const { return GetStencil(index); } inline void -LimitStencilTables::resize(int nstencils, int nelems) { +LimitStencilTable::resize(int nstencils, int nelems) { - StencilTables::resize(nstencils, nelems); + StencilTable::resize(nstencils, nelems); _duWeights.resize(nelems); _dvWeights.resize(nelems); } @@ -422,4 +422,4 @@ using namespace OPENSUBDIV_VERSION; } // end namespace OpenSubdiv -#endif // OPENSUBDIV3_FAR_STENCILTABLES_H +#endif // OPENSUBDIV3_FAR_STENCILTABLE_H diff --git a/opensubdiv/far/stencilTableFactory.cpp b/opensubdiv/far/stencilTableFactory.cpp index 1e42fe05..5b87bf3f 100644 --- a/opensubdiv/far/stencilTableFactory.cpp +++ b/opensubdiv/far/stencilTableFactory.cpp @@ -22,10 +22,10 @@ // language governing permissions and limitations under the Apache License. // -#include "../far/stencilTablesFactory.h" +#include "../far/stencilTableFactory.h" #include "../far/endCapGregoryBasisPatchFactory.h" -#include "../far/patchTables.h" -#include "../far/patchTablesFactory.h" +#include "../far/patchTable.h" +#include "../far/patchTableFactory.h" #include "../far/patchMap.h" #include "../far/protoStencil.h" #include "../far/topologyRefiner.h" @@ -41,7 +41,7 @@ namespace Far { //------------------------------------------------------------------------------ void -StencilTablesFactory::generateControlVertStencils( +StencilTableFactory::generateControlVertStencils( int numControlVerts, Stencil & dst) { // Control vertices contribute a single index with a weight of 1.0 @@ -54,13 +54,13 @@ StencilTablesFactory::generateControlVertStencils( } // -// StencilTables factory +// StencilTable factory // -StencilTables const * -StencilTablesFactory::Create(TopologyRefiner const & refiner, +StencilTable const * +StencilTableFactory::Create(TopologyRefiner const & refiner, Options options) { - StencilTables * result = new StencilTables; + StencilTable * result = new StencilTable; // always initialize numControlVertices (useful for torus case) result->_numControlVertices = refiner.GetLevel(0).GetNumVertices(); @@ -137,7 +137,7 @@ StencilTablesFactory::Create(TopologyRefiner const & refiner, } } - // Copy stencils from the pool allocator into the tables + // Copy stencils from the pool allocator into the table { // Add total number of stencils, weights & indices int nelems = 0, nstencils=0; @@ -192,8 +192,8 @@ StencilTablesFactory::Create(TopologyRefiner const & refiner, //------------------------------------------------------------------------------ -StencilTables const * -StencilTablesFactory::Create(int numTables, StencilTables const ** tables) { +StencilTable const * +StencilTableFactory::Create(int numTables, StencilTable const ** tables) { // XXXtakahito: // This function returns NULL for empty inputs or erroneous condition. @@ -211,7 +211,7 @@ StencilTablesFactory::Create(int numTables, StencilTables const ** tables) { for (int i=0; iresize(nstencils, nelems); int * sizes = &result->_sizes[0]; Index * indices = &result->_indices[0]; float * weights = &result->_weights[0]; for (int i=0; iGetNumStencils(), @@ -258,28 +258,28 @@ StencilTablesFactory::Create(int numTables, StencilTables const ** tables) { //------------------------------------------------------------------------------ -StencilTables const * -StencilTablesFactory::AppendEndCapStencilTables( +StencilTable const * +StencilTableFactory::AppendEndCapStencilTable( TopologyRefiner const &refiner, - StencilTables const *baseStencilTables, - StencilTables const *endCapStencilTables, + StencilTable const *baseStencilTable, + StencilTable const *endCapStencilTable, bool factorize) { // factorize and append. - if (baseStencilTables == NULL or - endCapStencilTables == NULL) return NULL; + if (baseStencilTable == NULL or + endCapStencilTable == NULL) return NULL; // endcap stencils have indices that are relative to the level // (maxlevel) of subdivision. These indices need to be offset to match - // the indices from the multi-level adaptive stencil tables. - // In addition: stencil tables can be built with singular stencils + // the indices from the multi-level adaptive stencil table. + // In addition: stencil table can be built with singular stencils // (single weight of 1.0f) as place-holders for coarse mesh vertices, // which also needs to be accounted for. int stencilsIndexOffset = 0; int controlVertsIndexOffset = 0; - int nBaseStencils = baseStencilTables->GetNumStencils(); - int nBaseStencilsElements = (int)baseStencilTables->_indices.size(); + int nBaseStencils = baseStencilTable->GetNumStencils(); + int nBaseStencilsElements = (int)baseStencilTable->_indices.size(); { int maxlevel = refiner.GetMaxLevel(); int nverts = refiner.GetNumVerticesTotal(); @@ -292,7 +292,7 @@ StencilTablesFactory::AppendEndCapStencilTables( // +---------------+----------------------------+-----------------+ // | control verts | refined verts : (max lv) | endcap points | // +---------------+----------------------------+-----------------+ - // | base stencil tables | endcap stencils | + // | base stencil table | endcap stencils | // +--------------------------------------------+-----------------+ // : ^ / // : \_________/ @@ -312,7 +312,7 @@ StencilTablesFactory::AppendEndCapStencilTables( // +---------------+----------------------------+-----------------+ // | control verts | refined verts : (max lv) | endcap points | // +---------------+----------------------------+-----------------+ - // | base stencil tables | endcap stencils | + // | base stencil table | endcap stencils | // +----------------------------+-----------------+ // : ^ / // : \_________/ @@ -332,7 +332,7 @@ StencilTablesFactory::AppendEndCapStencilTables( } // copy all endcap stencils to proto stencils, and factorize if needed. - int nEndCapStencils = endCapStencilTables->GetNumStencils(); + int nEndCapStencils = endCapStencilTable->GetNumStencils(); int nEndCapStencilsElements = 0; // we exclude zero weight stencils. the resulting number of @@ -340,7 +340,7 @@ StencilTablesFactory::AppendEndCapStencilTables( StencilAllocator allocator(16); allocator.Resize(nEndCapStencils); for (int i = 0 ; i < nEndCapStencils; ++i) { - Stencil src = endCapStencilTables->GetStencil(i); + Stencil src = endCapStencilTable->GetStencil(i); allocator[i].Clear(); for (int j = 0; j < src.GetSize(); ++j) { Index index = src.GetVertexIndices()[j]; @@ -348,7 +348,7 @@ StencilTablesFactory::AppendEndCapStencilTables( if (weight == 0.0) continue; if (factorize) { - allocator[i].AddWithWeight(*baseStencilTables, + allocator[i].AddWithWeight(*baseStencilTable, index + stencilsIndexOffset, weight); } else { @@ -360,8 +360,8 @@ StencilTablesFactory::AppendEndCapStencilTables( nEndCapStencilsElements += allocator.GetSize(i); } - // create new stencil tables - StencilTables * result = new StencilTables; + // create new stencil table + StencilTable * result = new StencilTable; result->_numControlVertices = refiner.GetLevel(0).GetNumVertices(); result->resize(nBaseStencils + nEndCapStencils, nBaseStencilsElements + nEndCapStencilsElements); @@ -371,11 +371,11 @@ StencilTablesFactory::AppendEndCapStencilTables( float * weights = &result->_weights[0]; // put base stencils first - memcpy(sizes, &baseStencilTables->_sizes[0], + memcpy(sizes, &baseStencilTable->_sizes[0], nBaseStencils*sizeof(int)); - memcpy(indices, &baseStencilTables->_indices[0], + memcpy(indices, &baseStencilTable->_indices[0], nBaseStencilsElements*sizeof(Index)); - memcpy(weights, &baseStencilTables->_weights[0], + memcpy(weights, &baseStencilTable->_weights[0], nBaseStencilsElements*sizeof(float)); sizes += nBaseStencils; @@ -399,10 +399,10 @@ StencilTablesFactory::AppendEndCapStencilTables( } //------------------------------------------------------------------------------ -LimitStencilTables const * -LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, - LocationArrayVec const & locationArrays, StencilTables const * cvStencils, - PatchTables const * patchTables) { +LimitStencilTable const * +LimitStencilTableFactory::Create(TopologyRefiner const & refiner, + LocationArrayVec const & locationArrays, StencilTable const * cvStencilsIn, + PatchTable const * patchTableIn) { // Compute the total number of stencils to generate int numStencils=0, numLimitStencils=0; @@ -418,22 +418,22 @@ LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, int maxlevel = refiner.GetMaxLevel(), maxsize=17; - StencilTables const * cvstencils = cvStencils; + StencilTable const * cvstencils = cvStencilsIn; if (not cvstencils) { // Generate stencils for the control vertices - this is necessary to // properly factorize patches with control vertices at level 0 (natural // regular patches, such as in a torus) // note: the control vertices of the mesh are added as single-index // stencils of weight 1.0f - StencilTablesFactory::Options options; + StencilTableFactory::Options options; options.generateIntermediateLevels = uniform ? false :true; options.generateControlVerts = true; options.generateOffsets = true; // XXXX (manuelk) We could potentially save some mem-copies by not - // instanciating the stencil tables and work directly off the pool + // instanciating the stencil table and work directly off the pool // allocators. - cvstencils = StencilTablesFactory::Create(refiner, options); + cvstencils = StencilTableFactory::Create(refiner, options); } else { // Sanity checks if (cvstencils->GetNumStencils() != (uniform ? @@ -444,46 +444,46 @@ LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, } // If a stencil table was given, use it, otherwise, create a new one - PatchTables const * patchtables = patchTables; + PatchTable const * patchtable = patchTableIn; - if (not patchTables) { - // XXXX (manuelk) If no patch-tables was passed, we should be able to + if (not patchtable) { + // XXXX (manuelk) If no patch-table was passed, we should be able to // infer the patches fairly easily from the refiner. Once more tags // have been added to the refiner, maybe we can remove the need for the - // patch tables. + // patch table. - PatchTablesFactory::Options options; + PatchTableFactory::Options options; options.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_GREGORY_BASIS); + Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS); - patchtables = PatchTablesFactory::Create(refiner, options); + patchtable = PatchTableFactory::Create(refiner, options); - if (not cvStencils) { + if (not cvStencilsIn) { // if cvstencils is just created above, append endcap stencils - if (StencilTables const *endCapStencilTables = - patchtables->GetEndCapVertexStencilTables()) { - StencilTables const *tables = - StencilTablesFactory::AppendEndCapStencilTables( - refiner, cvstencils, endCapStencilTables); + if (StencilTable const *endCapStencilTable = + patchtable->GetEndCapVertexStencilTable()) { + StencilTable const *table = + StencilTableFactory::AppendEndCapStencilTable( + refiner, cvstencils, endCapStencilTable); delete cvstencils; - cvstencils = tables; + cvstencils = table; } } } else { // Sanity checks - if (patchTables->IsFeatureAdaptive()==uniform) { - if (not cvStencils) { - assert(cvstencils and cvstencils!=cvStencils); + if (patchtable->IsFeatureAdaptive()==uniform) { + if (not cvStencilsIn) { + assert(cvstencils and cvstencils!=cvStencilsIn); delete cvstencils; } return 0; } } - assert(patchtables and cvstencils); + assert(patchtable and cvstencils); // Create a patch-map to locate sub-patches faster - PatchMap patchmap( *patchtables ); + PatchMap patchmap( *patchtable ); // // Generate limit stencils for locations @@ -494,7 +494,7 @@ LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, alloc.Resize(numStencils); // XXXX (manuelk) we can make uniform (bilinear) stencils faster with a - // dedicated code path that does not use PatchTables or the PatchMap + // dedicated code path that does not use PatchTable or the PatchMap float wP[20], wDs[20], wDt[20]; for (int i=0; i<(int)locationArrays.size(); ++i) { @@ -512,11 +512,11 @@ LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, if (handle) { - ConstIndexArray cvs = patchtables->GetPatchVertices(*handle); + ConstIndexArray cvs = patchtable->GetPatchVertices(*handle); - patchtables->EvaluateBasis(*handle, s, t, wP, wDs, wDt); + patchtable->EvaluateBasis(*handle, s, t, wP, wDs, wDt); - StencilTables const & src = *cvstencils; + StencilTable const & src = *cvstencils; ProtoLimitStencil dst = alloc[numLimitStencils]; dst.Clear(); @@ -529,18 +529,18 @@ LimitStencilTablesFactory::Create(TopologyRefiner const & refiner, } } - if (not cvStencils) { + if (not cvStencilsIn) { delete cvstencils; } - if (not patchTables) { - delete patchtables; + if (not patchTableIn) { + delete patchtable; } // - // Copy the proto-stencils into the limit stencil tables + // Copy the proto-stencils into the limit stencil table // - LimitStencilTables * result = new LimitStencilTables; + LimitStencilTable * result = new LimitStencilTable; int nelems = alloc.GetNumVerticesTotal(); if (nelems>0) { diff --git a/opensubdiv/far/stencilTableFactory.h b/opensubdiv/far/stencilTableFactory.h index 57925231..d7544c58 100644 --- a/opensubdiv/far/stencilTableFactory.h +++ b/opensubdiv/far/stencilTableFactory.h @@ -27,7 +27,7 @@ #include "../version.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include @@ -39,13 +39,13 @@ namespace Far { class TopologyRefiner; class Stencil; -class StencilTables; +class StencilTable; class LimitStencil; -class LimitStencilTables; +class LimitStencilTable; -/// \brief A specialized factory for StencilTables +/// \brief A specialized factory for StencilTable /// -class StencilTablesFactory { +class StencilTableFactory { public: @@ -73,7 +73,7 @@ public: maxLevel : 4; ///< generate stencils up to 'maxLevel' }; - /// \brief Instantiates StencilTables from TopologyRefiner that have been + /// \brief Instantiates StencilTable from TopologyRefiner that have been /// refined uniformly or adaptively. /// /// \note The factory only creates stencils for vertices that have already @@ -82,45 +82,45 @@ public: /// /// @param refiner The TopologyRefiner containing the topology /// - /// @param options Options controlling the creation of the tables + /// @param options Options controlling the creation of the table /// - static StencilTables const * Create(TopologyRefiner const & refiner, + static StencilTable const * Create(TopologyRefiner const & refiner, Options options = Options()); - /// \brief Instantiates StencilTables by concatenating an array of existing - /// stencil tables. + /// \brief Instantiates StencilTable by concatenating an array of existing + /// stencil table. /// - /// \note This factory checks that the stencil tables point to the same set + /// \note This factory checks that the stencil table point to the same set /// of supporting control vertices - no re-indexing is done. /// GetNumControlVertices() *must* return the same value for all input /// tables. /// /// @param numTables Number of input StencilTables /// - /// @param tables Array of input StencilTables + /// @param table Array of input StencilTables /// - static StencilTables const * Create(int numTables, StencilTables const ** tables); + static StencilTable const * Create(int numTables, StencilTable const ** tables); /// \brief Utility function for stencil splicing for endcap stencils. /// /// @param refiner The TopologyRefiner containing the topology /// - /// @param baseStencilTables Input StencilTables for refined vertices + /// @param baseStencilTable Input StencilTable for refined vertices /// - /// @param endCapStencilTables EndCap basis conversion stencils. This stenciltable + /// @param endCapStencilTable EndCap basis conversion stencils. This stenciltable /// has to be relative to the max level of subdivision. /// /// @param factorize If factorize sets to true, endcap stencils will be /// factorized with supporting vertices from baseStencil - /// tables so that the endcap points can be computed + /// table so that the endcap points can be computed /// directly from control vertices. /// - static StencilTables const * AppendEndCapStencilTables( + static StencilTable const * AppendEndCapStencilTable( TopologyRefiner const &refiner, - StencilTables const *baseStencilTables, - StencilTables const *endCapStencilTables, + StencilTable const *baseStencilTable, + StencilTable const *endCapStencilTable, bool factorize = true); private: @@ -129,9 +129,9 @@ private: static void generateControlVertStencils(int numControlVerts, Stencil & dst); }; -/// \brief A specialized factory for LimitStencilTables +/// \brief A specialized factory for LimitStencilTable /// -/// The LimitStencilTablesFactory creates tables of limit stencils. Limit +/// The LimitStencilTableFactory creates a table of limit stencils. Limit /// stencils can interpolate any arbitrary location on the limit surface. /// The stencils will be bilinear if the surface is refined uniformly, and /// bicubic if feature adaptive isolation is used instead. @@ -140,7 +140,7 @@ private: /// normalized (s,t) patch coordinates. The factory exposes the LocationArray /// struct as a container for these location descriptors. /// -class LimitStencilTablesFactory { +class LimitStencilTableFactory { public: @@ -158,7 +158,7 @@ public: typedef std::vector LocationArrayVec; - /// \brief Instantiates LimitStencilTables from a TopologyRefiner that has + /// \brief Instantiates LimitStencilTable from a TopologyRefiner that has /// been refined either uniformly or adaptively. /// /// @param refiner The TopologyRefiner containing the topology @@ -166,18 +166,18 @@ public: /// @param locationArrays An array of surface location descriptors /// (see LocationArray) /// - /// @param cvStencils A set of StencilTables generated from the + /// @param cvStencils A set of StencilTable generated from the /// TopologyRefiner (optional: prevents redundant - /// instanciation of the tables if available) + /// instanciation of the table if available) /// - /// @param patchTables A set of PatchTables generated from the + /// @param patchTable A set of PatchTable generated from the /// TopologyRefiner (optional: prevents redundant - /// instanciation of the tables if available) + /// instanciation of the table if available) /// - static LimitStencilTables const * Create(TopologyRefiner const & refiner, + static LimitStencilTable const * Create(TopologyRefiner const & refiner, LocationArrayVec const & locationArrays, - StencilTables const * cvStencils=0, - PatchTables const * patchTables=0); + StencilTable const * cvStencils=0, + PatchTable const * patchTable=0); }; diff --git a/opensubdiv/far/topologyRefiner.h b/opensubdiv/far/topologyRefiner.h index 579e067e..48cd5753 100644 --- a/opensubdiv/far/topologyRefiner.h +++ b/opensubdiv/far/topologyRefiner.h @@ -373,7 +373,7 @@ protected: // Lower level protected methods intended strictly for internal use: // friend class TopologyRefinerFactoryBase; - friend class PatchTablesFactory; + friend class PatchTableFactory; friend class EndCapGregoryBasisPatchFactory; friend class EndCapLegacyGregoryPatchFactory; friend class PtexIndices; diff --git a/opensubdiv/osd/clEvaluator.cpp b/opensubdiv/osd/clEvaluator.cpp index edc6fbee..4c2efcf8 100644 --- a/opensubdiv/osd/clEvaluator.cpp +++ b/opensubdiv/osd/clEvaluator.cpp @@ -30,7 +30,7 @@ #include "../osd/opencl.h" #include "../far/error.h" -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -61,22 +61,22 @@ createCLBuffer(std::vector const & src, cl_context clContext) { // ---------------------------------------------------------------------------- -CLStencilTables::CLStencilTables(Far::StencilTables const *stencilTables, - cl_context clContext) { - _numStencils = stencilTables->GetNumStencils(); +CLStencilTable::CLStencilTable(Far::StencilTable const *stencilTable, + cl_context clContext) { + _numStencils = stencilTable->GetNumStencils(); if (_numStencils > 0) { - _sizes = createCLBuffer(stencilTables->GetSizes(), clContext); - _offsets = createCLBuffer(stencilTables->GetOffsets(), clContext); - _indices = createCLBuffer(stencilTables->GetControlIndices(), + _sizes = createCLBuffer(stencilTable->GetSizes(), clContext); + _offsets = createCLBuffer(stencilTable->GetOffsets(), clContext); + _indices = createCLBuffer(stencilTable->GetControlIndices(), clContext); - _weights = createCLBuffer(stencilTables->GetWeights(), clContext); + _weights = createCLBuffer(stencilTable->GetWeights(), clContext); } else { _sizes = _offsets = _indices = _weights = NULL; } } -CLStencilTables::~CLStencilTables() { +CLStencilTable::~CLStencilTable() { if (_sizes) clReleaseMemObject(_sizes); if (_offsets) clReleaseMemObject(_offsets); if (_indices) clReleaseMemObject(_indices); diff --git a/opensubdiv/osd/clEvaluator.h b/opensubdiv/osd/clEvaluator.h index b427e082..62780fe5 100644 --- a/opensubdiv/osd/clEvaluator.h +++ b/opensubdiv/osd/clEvaluator.h @@ -34,29 +34,29 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far { - class StencilTables; + class StencilTable; } namespace Osd { -/// \brief OpenCL stencil tables +/// \brief OpenCL stencil table /// -/// This class is an OpenCL buffer representation of Far::StencilTables. +/// This class is an OpenCL buffer representation of Far::StencilTable. /// /// CLCompute consumes this table to apply stencils /// /// -class CLStencilTables { +class CLStencilTable { public: template - static CLStencilTables *Create(Far::StencilTables const *stencilTables, - DEVICE_CONTEXT context) { - return new CLStencilTables(stencilTables, context->GetContext()); + static CLStencilTable *Create(Far::StencilTable const *stencilTable, + DEVICE_CONTEXT context) { + return new CLStencilTable(stencilTable, context->GetContext()); } - CLStencilTables(Far::StencilTables const *stencilTables, - cl_context clContext); - ~CLStencilTables(); + CLStencilTable(Far::StencilTable const *stencilTable, + cl_context clContext); + ~CLStencilTable(); // interfaces needed for CLComputeKernel cl_mem GetSizesBuffer() const { return _sizes; } @@ -123,7 +123,7 @@ public: /// /// @param dstDesc vertex buffer descriptor for the output buffer /// - /// @param stencilTables stencil table to be applied. The table must have + /// @param stencilTable stencil table to be applied. The table must have /// OpenCL memory interfaces. /// /// @param instance cached compiled instance. Clients are supposed to diff --git a/opensubdiv/osd/cpuEvaluator.cpp b/opensubdiv/osd/cpuEvaluator.cpp index cd20a91c..e15f09bd 100644 --- a/opensubdiv/osd/cpuEvaluator.cpp +++ b/opensubdiv/osd/cpuEvaluator.cpp @@ -124,7 +124,7 @@ CpuEvaluator::EvalPatches(const float *src, VertexBufferDescriptor const &dstDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable) { + Far::PatchTable const *patchTable) { src += srcDesc.offset; if (dst) dst += dstDesc.offset; @@ -161,7 +161,7 @@ CpuEvaluator::EvalPatches(const float *src, VertexBufferDescriptor const &dstDtDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable) { + Far::PatchTable const *patchTable) { src += srcDesc.offset; if (dst) dst += dstDesc.offset; if (dstDs) dstDs += dstDsDesc.offset; diff --git a/opensubdiv/osd/cpuEvaluator.h b/opensubdiv/osd/cpuEvaluator.h index 6602a21b..e03be1ee 100644 --- a/opensubdiv/osd/cpuEvaluator.h +++ b/opensubdiv/osd/cpuEvaluator.h @@ -30,7 +30,7 @@ #include #include #include "../osd/vertexDescriptor.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -49,10 +49,10 @@ struct PatchCoord { /// /// @param t parametric location on the patch /// - PatchCoord(Far::PatchTables::PatchHandle handle, float s, float t) : + PatchCoord(Far::PatchTable::PatchHandle handle, float s, float t) : handle(handle), s(s), t(t) { } - Far::PatchTables::PatchHandle handle; ///< patch handle + Far::PatchTable::PatchHandle handle; ///< patch handle float s, t; ///< parametric location on patch }; @@ -302,7 +302,7 @@ public: VertexBufferDescriptor const &dstDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable, + Far::PatchTable const *patchTable, CpuEvaluator const *instance, void * deviceContext = NULL) { (void)instance; // unused @@ -366,7 +366,7 @@ public: VertexBufferDescriptor const &dstDtDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable, + Far::PatchTable const *patchTable, CpuEvaluator const *instance, void * deviceContext = NULL) { (void)instance; // unused @@ -416,7 +416,7 @@ public: VertexBufferDescriptor const &dstDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable); + Far::PatchTable const *patchTable); /// \brief Static limit eval function. It takes an array of PatchCoord /// and evaluate limit values on given PatchTable. @@ -463,7 +463,7 @@ public: VertexBufferDescriptor const &dstDtDesc, int numPatchCoords, PatchCoord const *patchCoords, - Far::PatchTables const *patchTable); + Far::PatchTable const *patchTable); /// \brief synchronize all asynchronous computation invoked on this device. static void Synchronize(void * /*deviceContext = NULL*/) { diff --git a/opensubdiv/osd/cudaEvaluator.cpp b/opensubdiv/osd/cudaEvaluator.cpp index 28ba1576..74907acd 100644 --- a/opensubdiv/osd/cudaEvaluator.cpp +++ b/opensubdiv/osd/cudaEvaluator.cpp @@ -27,7 +27,7 @@ #include #include -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" extern "C" { void CudaEvalStencils(const float *src, @@ -69,19 +69,19 @@ createCudaBuffer(std::vector const & src) { // ---------------------------------------------------------------------------- -CudaStencilTables::CudaStencilTables(Far::StencilTables const *stencilTables) { - _numStencils = stencilTables->GetNumStencils(); +CudaStencilTable::CudaStencilTable(Far::StencilTable const *stencilTable) { + _numStencils = stencilTable->GetNumStencils(); if (_numStencils > 0) { - _sizes = createCudaBuffer(stencilTables->GetSizes()); - _offsets = createCudaBuffer(stencilTables->GetOffsets()); - _indices = createCudaBuffer(stencilTables->GetControlIndices()); - _weights = createCudaBuffer(stencilTables->GetWeights()); + _sizes = createCudaBuffer(stencilTable->GetSizes()); + _offsets = createCudaBuffer(stencilTable->GetOffsets()); + _indices = createCudaBuffer(stencilTable->GetControlIndices()); + _weights = createCudaBuffer(stencilTable->GetWeights()); } else { _sizes = _offsets = _indices = _weights = NULL; } } -CudaStencilTables::~CudaStencilTables() { +CudaStencilTable::~CudaStencilTable() { if (_sizes) cudaFree(_sizes); if (_offsets) cudaFree(_offsets); if (_indices) cudaFree(_indices); diff --git a/opensubdiv/osd/cudaEvaluator.h b/opensubdiv/osd/cudaEvaluator.h index 661c5977..ee36e0b6 100644 --- a/opensubdiv/osd/cudaEvaluator.h +++ b/opensubdiv/osd/cudaEvaluator.h @@ -34,28 +34,28 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far { - class StencilTables; + class StencilTable; } namespace Osd { -/// \brief CUDA stencil tables +/// \brief CUDA stencil table /// -/// This class is a cuda buffer representation of Far::StencilTables. +/// This class is a cuda buffer representation of Far::StencilTable. /// /// CudaComputeKernel consumes this table to apply stencils /// /// -class CudaStencilTables { +class CudaStencilTable { public: - static CudaStencilTables *Create(Far::StencilTables const *stencilTables, - void *deviceContext = NULL) { + static CudaStencilTable *Create(Far::StencilTable const *stencilTable, + void *deviceContext = NULL) { (void)deviceContext; // unused - return new CudaStencilTables(stencilTables); + return new CudaStencilTable(stencilTable); } - explicit CudaStencilTables(Far::StencilTables const *stencilTables); - ~CudaStencilTables(); + explicit CudaStencilTable(Far::StencilTable const *stencilTable); + ~CudaStencilTable(); // interfaces needed for CudaCompute void *GetSizesBuffer() const { return _sizes; } @@ -92,7 +92,7 @@ public: /// /// @param dstDesc vertex buffer descriptor for the output buffer /// - /// @param stencilTables stencil table to be applied. The table must have + /// @param stencilTable stencil table to be applied. The table must have /// Cuda memory interfaces. /// /// @param instance not used in the CudaEvaluator diff --git a/opensubdiv/osd/d3d11ComputeEvaluator.cpp b/opensubdiv/osd/d3d11ComputeEvaluator.cpp index 5da28ecb..1df4c0de 100644 --- a/opensubdiv/osd/d3d11ComputeEvaluator.cpp +++ b/opensubdiv/osd/d3d11ComputeEvaluator.cpp @@ -35,7 +35,7 @@ #include #include "../far/error.h" -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -112,37 +112,37 @@ static ID3D11ShaderResourceView *createSRV(ID3D11Buffer *buffer, return srv; } -D3D11StencilTables::D3D11StencilTables(Far::StencilTables const *stencilTables, - ID3D11DeviceContext *deviceContext) +D3D11StencilTable::D3D11StencilTable(Far::StencilTable const *stencilTable, + ID3D11DeviceContext *deviceContext) { ID3D11Device *device = NULL; deviceContext->GetDevice(&device); assert(device); - _numStencils = stencilTables->GetNumStencils(); + _numStencils = stencilTable->GetNumStencils(); if (_numStencils > 0) { - std::vector const &sizes = stencilTables->GetSizes(); + std::vector const &sizes = stencilTable->GetSizes(); _sizesBuffer = createBuffer(sizes, device); - _offsetsBuffer = createBuffer(stencilTables->GetOffsets(), device); - _indicesBuffer = createBuffer(stencilTables->GetControlIndices(), device); - _weightsBuffer = createBuffer(stencilTables->GetWeights(), device); + _offsetsBuffer = createBuffer(stencilTable->GetOffsets(), device); + _indicesBuffer = createBuffer(stencilTable->GetControlIndices(), device); + _weightsBuffer = createBuffer(stencilTable->GetWeights(), device); _sizes = createSRV(_sizesBuffer, DXGI_FORMAT_R32_SINT, device, - stencilTables->GetSizes().size()); + stencilTable->GetSizes().size()); _offsets = createSRV(_offsetsBuffer, DXGI_FORMAT_R32_SINT, device, - stencilTables->GetOffsets().size()); + stencilTable->GetOffsets().size()); _indices = createSRV(_indicesBuffer, DXGI_FORMAT_R32_SINT, device, - stencilTables->GetControlIndices().size()); + stencilTable->GetControlIndices().size()); _weights= createSRV(_weightsBuffer, DXGI_FORMAT_R32_FLOAT, device, - stencilTables->GetWeights().size()); + stencilTable->GetWeights().size()); } else { _sizes = _offsets = _indices = _weights = NULL; _sizesBuffer = _offsetsBuffer = _indicesBuffer = _weightsBuffer = NULL; } } -D3D11StencilTables::~D3D11StencilTables() { +D3D11StencilTable::~D3D11StencilTable() { SAFE_RELEASE(_sizes); SAFE_RELEASE(_sizesBuffer); SAFE_RELEASE(_offsets); @@ -341,7 +341,7 @@ D3D11ComputeEvaluator::EvalStencils(ID3D11UnorderedAccessView *srcUAV, ID3D11ShaderResourceView *SRViews[] = { sizesSRV, offsetsSRV, indicesSRV, weightsSRV }; - // bind source vertex and stencil tables + // bind source vertex and stencil table deviceContext->CSSetShaderResources(1, 4, SRViews); // t1-t4 if (srcUAV == dstUAV) { @@ -356,7 +356,7 @@ D3D11ComputeEvaluator::EvalStencils(ID3D11UnorderedAccessView *srcUAV, deviceContext->Dispatch((count + _workGroupSize - 1) / _workGroupSize, 1, 1); } - // unbind stencil tables and vertexbuffers + // unbind stencil table and vertexbuffers SRViews[0] = SRViews[1] = SRViews[2] = SRViews[3] = NULL; deviceContext->CSSetShaderResources(1, 4, SRViews); diff --git a/opensubdiv/osd/d3d11ComputeEvaluator.h b/opensubdiv/osd/d3d11ComputeEvaluator.h index fd034db5..9c9ad430 100644 --- a/opensubdiv/osd/d3d11ComputeEvaluator.h +++ b/opensubdiv/osd/d3d11ComputeEvaluator.h @@ -41,35 +41,35 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far { - class StencilTables; + class StencilTable; } namespace Osd { -/// \brief D3D11 stencil tables +/// \brief D3D11 stencil table /// /// This class is a D3D11 Shader Resource View representation of -/// Far::StencilTables. +/// Far::StencilTable. /// /// D3D11ComputeEvaluator consumes this table to apply stencils /// -class D3D11StencilTables { +class D3D11StencilTable { public: template - static D3D11StencilTables *Create(Far::StencilTables const *stencilTables, + static D3D11StencilTable *Create(Far::StencilTable const *stencilTable, DEVICE_CONTEXT context) { - return new D3D11StencilTables(stencilTables, context->GetDeviceContext()); + return new D3D11StencilTable(stencilTable, context->GetDeviceContext()); } - static D3D11StencilTables *Create(Far::StencilTables const *stencilTables, + static D3D11StencilTable *Create(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext) { - return new D3D11StencilTables(stencilTables, deviceContext); + return new D3D11StencilTable(stencilTable, deviceContext); } - D3D11StencilTables(Far::StencilTables const *stencilTables, + D3D11StencilTable(Far::StencilTable const *stencilTable, ID3D11DeviceContext *deviceContext); - ~D3D11StencilTables(); + ~D3D11StencilTable(); // interfaces needed for D3D11ComputeEvaluator ID3D11ShaderResourceView *GetSizesSRV() const { return _sizes; } @@ -122,7 +122,7 @@ public: /// /// @param dstDesc vertex buffer descriptor for the output buffer /// - /// @param stencilTables stencil table to be applied. The table must have + /// @param stencilTable stencil table to be applied. The table must have /// SSBO interfaces. /// /// @param instance cached compiled instance. Clients are supposed to diff --git a/opensubdiv/osd/d3d11LegacyGregoryPatchTable.cpp b/opensubdiv/osd/d3d11LegacyGregoryPatchTable.cpp index 06b21fc6..8064edb1 100644 --- a/opensubdiv/osd/d3d11LegacyGregoryPatchTable.cpp +++ b/opensubdiv/osd/d3d11LegacyGregoryPatchTable.cpp @@ -46,7 +46,7 @@ D3D11LegacyGregoryPatchTable::~D3D11LegacyGregoryPatchTable() { } D3D11LegacyGregoryPatchTable * -D3D11LegacyGregoryPatchTable::Create(Far::PatchTables const *farPatchTables, +D3D11LegacyGregoryPatchTable::Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *pd3d11DeviceContext) { ID3D11Device *pd3d11Device = NULL; pd3d11DeviceContext->GetDevice(&pd3d11Device); @@ -54,10 +54,10 @@ D3D11LegacyGregoryPatchTable::Create(Far::PatchTables const *farPatchTables, D3D11LegacyGregoryPatchTable *result = new D3D11LegacyGregoryPatchTable(); - Far::PatchTables::VertexValenceTable const & - valenceTable = farPatchTables->GetVertexValenceTable(); - Far::PatchTables::QuadOffsetsTable const & - quadOffsetsTable = farPatchTables->GetQuadOffsetsTable(); + Far::PatchTable::VertexValenceTable const & + valenceTable = farPatchTable->GetVertexValenceTable(); + Far::PatchTable::QuadOffsetsTable const & + quadOffsetsTable = farPatchTable->GetQuadOffsetsTable(); if (not valenceTable.empty()) { D3D11_BUFFER_DESC bd; @@ -126,11 +126,11 @@ D3D11LegacyGregoryPatchTable::Create(Far::PatchTables const *farPatchTables, result->_quadOffsetsBase[1] = 0; // scan patchtable to find quadOffsetsBase. - for (int i = 0; i < farPatchTables->GetNumPatchArrays(); ++i) { + for (int i = 0; i < farPatchTable->GetNumPatchArrays(); ++i) { // GREGORY_BOUNDARY's quadoffsets come after GREGORY's. - if (farPatchTables->GetPatchArrayDescriptor(i) == + if (farPatchTable->GetPatchArrayDescriptor(i) == Far::PatchDescriptor::GREGORY) { - result->_quadOffsetsBase[1] = farPatchTables->GetNumPatches(i) * 4; + result->_quadOffsetsBase[1] = farPatchTable->GetNumPatches(i) * 4; break; } } diff --git a/opensubdiv/osd/d3d11LegacyGregoryPatchTable.h b/opensubdiv/osd/d3d11LegacyGregoryPatchTable.h index fdd16992..bdf731ed 100644 --- a/opensubdiv/osd/d3d11LegacyGregoryPatchTable.h +++ b/opensubdiv/osd/d3d11LegacyGregoryPatchTable.h @@ -27,7 +27,7 @@ #include "../version.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include "../osd/nonCopyable.h" struct ID3D11Buffer; @@ -47,12 +47,12 @@ public: template static D3D11LegacyGregoryPatchTable *Create( - Far::PatchTables const *farPatchTables, DEVICE_CONTEXT context) { - return Create(farPatchTables, context->GetDeviceContext()); + Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context) { + return Create(farPatchTable, context->GetDeviceContext()); } static D3D11LegacyGregoryPatchTable *Create( - Far::PatchTables const *farPatchTables, + Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext); void UpdateVertexBuffer(ID3D11Buffer *vbo, diff --git a/opensubdiv/osd/d3d11PatchTable.cpp b/opensubdiv/osd/d3d11PatchTable.cpp index cb886668..8b09af1f 100644 --- a/opensubdiv/osd/d3d11PatchTable.cpp +++ b/opensubdiv/osd/d3d11PatchTable.cpp @@ -25,7 +25,7 @@ #include "../osd/d3d11PatchTable.h" #include -#include "../far/patchTables.h" +#include "../far/patchTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -43,17 +43,17 @@ D3D11PatchTable::~D3D11PatchTable() { } D3D11PatchTable * -D3D11PatchTable::Create(Far::PatchTables const *farPatchTables, +D3D11PatchTable::Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *pd3d11DeviceContext) { D3D11PatchTable *instance = new D3D11PatchTable(); - if (instance->allocate(farPatchTables, pd3d11DeviceContext)) + if (instance->allocate(farPatchTable, pd3d11DeviceContext)) return instance; delete instance; return 0; } bool -D3D11PatchTable::allocate(Far::PatchTables const *farPatchTables, +D3D11PatchTable::allocate(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *pd3d11DeviceContext) { ID3D11Device *pd3d11Device = NULL; pd3d11DeviceContext->GetDevice(&pd3d11Device); @@ -63,18 +63,18 @@ D3D11PatchTable::allocate(Far::PatchTables const *farPatchTables, std::vector ppBuffer; // needs reserve? - int nPatchArrays = farPatchTables->GetNumPatchArrays(); + int nPatchArrays = farPatchTable->GetNumPatchArrays(); // for each patchArray for (int j = 0; j < nPatchArrays; ++j) { - PatchArray patchArray(farPatchTables->GetPatchArrayDescriptor(j), - farPatchTables->GetNumPatches(j), + PatchArray patchArray(farPatchTable->GetPatchArrayDescriptor(j), + farPatchTable->GetNumPatches(j), (int)buffer.size(), (int)ppBuffer.size()/3); _patchArrays.push_back(patchArray); // indices - Far::ConstIndexArray indices = farPatchTables->GetPatchArrayVertices(j); + Far::ConstIndexArray indices = farPatchTable->GetPatchArrayVertices(j); for (int k = 0; k < indices.size(); ++k) { buffer.push_back(indices[k]); } @@ -84,7 +84,7 @@ D3D11PatchTable::allocate(Far::PatchTables const *farPatchTables, // XXX: we need sharpness interface for patcharray or put sharpness // into patchParam. Far::ConstPatchParamArray patchParams = - farPatchTables->GetPatchParams(j); + farPatchTable->GetPatchParams(j); for (int k = 0; k < patchParams.size(); ++k) { float sharpness = 0.0; ppBuffer.push_back(patchParams[k].faceIndex); @@ -93,21 +93,21 @@ D3D11PatchTable::allocate(Far::PatchTables const *farPatchTables, } #else // XXX: workaround. GetPatchParamTable() will be deprecated though. - Far::PatchParamTable const & patchParamTables = - farPatchTables->GetPatchParamTable(); + Far::PatchParamTable const & patchParamTable = + farPatchTable->GetPatchParamTable(); std::vector const &sharpnessIndexTable = - farPatchTables->GetSharpnessIndexTable(); - int numPatches = farPatchTables->GetNumPatches(j); + farPatchTable->GetSharpnessIndexTable(); + int numPatches = farPatchTable->GetNumPatches(j); for (int k = 0; k < numPatches; ++k) { float sharpness = 0.0; int patchIndex = (int)ppBuffer.size()/3; if (patchIndex < (int)sharpnessIndexTable.size()) { int sharpnessIndex = sharpnessIndexTable[patchIndex]; if (sharpnessIndex >= 0) - sharpness = farPatchTables->GetSharpnessValues()[sharpnessIndex]; + sharpness = farPatchTable->GetSharpnessValues()[sharpnessIndex]; } - ppBuffer.push_back(patchParamTables[patchIndex].faceIndex); - ppBuffer.push_back(patchParamTables[patchIndex].bitField.field); + ppBuffer.push_back(patchParamTable[patchIndex].faceIndex); + ppBuffer.push_back(patchParamTable[patchIndex].bitField.field); ppBuffer.push_back(*((unsigned int *)&sharpness)); } #endif diff --git a/opensubdiv/osd/d3d11PatchTable.h b/opensubdiv/osd/d3d11PatchTable.h index 604f7404..5fed93b7 100644 --- a/opensubdiv/osd/d3d11PatchTable.h +++ b/opensubdiv/osd/d3d11PatchTable.h @@ -40,7 +40,7 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far{ - class PatchTables; + class PatchTable; }; namespace Osd { @@ -80,12 +80,12 @@ public: ~D3D11PatchTable(); template - static D3D11PatchTable *Create(Far::PatchTables const *farPatchTables, + static D3D11PatchTable *Create(Far::PatchTable const *farPatchTable, DEVICE_CONTEXT context) { - return Create(farPatchTables, context->GetDeviceContext()); + return Create(farPatchTable, context->GetDeviceContext()); } - static D3D11PatchTable *Create(Far::PatchTables const *farPatchTables, + static D3D11PatchTable *Create(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext); PatchArrayVector const &GetPatchArrays() const { @@ -103,8 +103,8 @@ public: } protected: - // allocate buffers from patchTables - bool allocate(Far::PatchTables const *farPatchTables, + // allocate buffers from patchTable + bool allocate(Far::PatchTable const *farPatchTable, ID3D11DeviceContext *deviceContext); PatchArrayVector _patchArrays; diff --git a/opensubdiv/osd/glComputeEvaluator.cpp b/opensubdiv/osd/glComputeEvaluator.cpp index 387c84fb..a43bd99b 100644 --- a/opensubdiv/osd/glComputeEvaluator.cpp +++ b/opensubdiv/osd/glComputeEvaluator.cpp @@ -30,7 +30,7 @@ #include #include "../far/error.h" -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { @@ -65,20 +65,20 @@ createSSBO(std::vector const & src) { return devicePtr; } -GLStencilTablesSSBO::GLStencilTablesSSBO( - Far::StencilTables const *stencilTables) { - _numStencils = stencilTables->GetNumStencils(); +GLStencilTableSSBO::GLStencilTableSSBO( + Far::StencilTable const *stencilTable) { + _numStencils = stencilTable->GetNumStencils(); if (_numStencils > 0) { - _sizes = createSSBO(stencilTables->GetSizes()); - _offsets = createSSBO(stencilTables->GetOffsets()); - _indices = createSSBO(stencilTables->GetControlIndices()); - _weights = createSSBO(stencilTables->GetWeights()); + _sizes = createSSBO(stencilTable->GetSizes()); + _offsets = createSSBO(stencilTable->GetOffsets()); + _indices = createSSBO(stencilTable->GetControlIndices()); + _weights = createSSBO(stencilTable->GetWeights()); } else { _sizes = _offsets = _indices = _weights = 0; } } -GLStencilTablesSSBO::~GLStencilTablesSSBO() { +GLStencilTableSSBO::~GLStencilTableSSBO() { if (_sizes) glDeleteBuffers(1, &_sizes); if (_offsets) glDeleteBuffers(1, &_offsets); if (_weights) glDeleteBuffers(1, &_weights); diff --git a/opensubdiv/osd/glComputeEvaluator.h b/opensubdiv/osd/glComputeEvaluator.h index 5fb89bf8..1e469f6f 100644 --- a/opensubdiv/osd/glComputeEvaluator.h +++ b/opensubdiv/osd/glComputeEvaluator.h @@ -34,27 +34,27 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far { - class StencilTables; + class StencilTable; } namespace Osd { -/// \brief GL stencil tables (Shader Storage buffer) +/// \brief GL stencil table (Shader Storage buffer) /// -/// This class is a GLSL SSBO representation of Far::StencilTables. +/// This class is a GLSL SSBO representation of Far::StencilTable. /// /// GLSLComputeKernel consumes this table to apply stencils /// -class GLStencilTablesSSBO { +class GLStencilTableSSBO { public: - static GLStencilTablesSSBO *Create(Far::StencilTables const *stencilTables, + static GLStencilTableSSBO *Create(Far::StencilTable const *stencilTable, void *deviceContext = NULL) { (void)deviceContext; // unused - return new GLStencilTablesSSBO(stencilTables); + return new GLStencilTableSSBO(stencilTable); } - explicit GLStencilTablesSSBO(Far::StencilTables const *stencilTables); - ~GLStencilTablesSSBO(); + explicit GLStencilTableSSBO(Far::StencilTable const *stencilTable); + ~GLStencilTableSSBO(); // interfaces needed for GLSLComputeKernel GLuint GetSizesBuffer() const { return _sizes; } @@ -190,7 +190,7 @@ public: private: GLuint _program; - GLuint _uniformSizes, // stencil tables + GLuint _uniformSizes, // stencil table _uniformOffsets, _uniformIndices, _uniformWeights, diff --git a/opensubdiv/osd/glLegacyGregoryPatchTable.cpp b/opensubdiv/osd/glLegacyGregoryPatchTable.cpp index 6e139fa3..0172fcba 100644 --- a/opensubdiv/osd/glLegacyGregoryPatchTable.cpp +++ b/opensubdiv/osd/glLegacyGregoryPatchTable.cpp @@ -45,17 +45,17 @@ GLLegacyGregoryPatchTable::~GLLegacyGregoryPatchTable() { } GLLegacyGregoryPatchTable * -GLLegacyGregoryPatchTable::Create(Far::PatchTables const *farPatchTables) { +GLLegacyGregoryPatchTable::Create(Far::PatchTable const *farPatchTable) { GLLegacyGregoryPatchTable *result = new GLLegacyGregoryPatchTable(); glGenTextures(1, &result->_vertexTextureBuffer); glGenTextures(1, &result->_vertexValenceTextureBuffer); glGenTextures(1, &result->_quadOffsetsTextureBuffer); - Far::PatchTables::VertexValenceTable const & - valenceTable = farPatchTables->GetVertexValenceTable(); - Far::PatchTables::QuadOffsetsTable const & - quadOffsetsTable = farPatchTables->GetQuadOffsetsTable(); + Far::PatchTable::VertexValenceTable const & + valenceTable = farPatchTable->GetVertexValenceTable(); + Far::PatchTable::QuadOffsetsTable const & + quadOffsetsTable = farPatchTable->GetQuadOffsetsTable(); GLuint buffers[2]; glGenBuffers(2, buffers); @@ -82,11 +82,11 @@ GLLegacyGregoryPatchTable::Create(Far::PatchTables const *farPatchTables) { result->_quadOffsetsBase[0] = 0; result->_quadOffsetsBase[1] = 0; // scan patchtable to find quadOffsetsBase. - for (int i = 0; i < farPatchTables->GetNumPatchArrays(); ++i) { + for (int i = 0; i < farPatchTable->GetNumPatchArrays(); ++i) { // GREGORY_BOUNDARY's quadoffsets come after GREGORY's. - if (farPatchTables->GetPatchArrayDescriptor(i) == + if (farPatchTable->GetPatchArrayDescriptor(i) == Far::PatchDescriptor::GREGORY) { - result->_quadOffsetsBase[1] = farPatchTables->GetNumPatches(i) * 4; + result->_quadOffsetsBase[1] = farPatchTable->GetNumPatches(i) * 4; break; } } diff --git a/opensubdiv/osd/glLegacyGregoryPatchTable.h b/opensubdiv/osd/glLegacyGregoryPatchTable.h index 221f6667..680bfaf4 100644 --- a/opensubdiv/osd/glLegacyGregoryPatchTable.h +++ b/opensubdiv/osd/glLegacyGregoryPatchTable.h @@ -27,7 +27,7 @@ #include "../version.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include "../osd/nonCopyable.h" #include "../osd/opengl.h" @@ -41,7 +41,7 @@ class GLLegacyGregoryPatchTable public: ~GLLegacyGregoryPatchTable(); - static GLLegacyGregoryPatchTable *Create(Far::PatchTables const *patchTable); + static GLLegacyGregoryPatchTable *Create(Far::PatchTable const *patchTable); void UpdateVertexBuffer(GLuint vbo); diff --git a/opensubdiv/osd/glPatchTable.cpp b/opensubdiv/osd/glPatchTable.cpp index 27f12ce2..986133d3 100644 --- a/opensubdiv/osd/glPatchTable.cpp +++ b/opensubdiv/osd/glPatchTable.cpp @@ -24,7 +24,7 @@ #include "../osd/glPatchTable.h" -#include "../far/patchTables.h" +#include "../far/patchTable.h" #include "../osd/opengl.h" namespace OpenSubdiv { @@ -42,16 +42,16 @@ GLPatchTable::~GLPatchTable() { } GLPatchTable * -GLPatchTable::Create(Far::PatchTables const *farPatchTables, +GLPatchTable::Create(Far::PatchTable const *farPatchTable, void * /*deviceContext*/) { GLPatchTable *instance = new GLPatchTable(); - if (instance->allocate(farPatchTables)) return instance; + if (instance->allocate(farPatchTable)) return instance; delete instance; return 0; } bool -GLPatchTable::allocate(Far::PatchTables const *farPatchTables) { +GLPatchTable::allocate(Far::PatchTable const *farPatchTable) { glGenBuffers(1, &_indexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); @@ -60,18 +60,18 @@ GLPatchTable::allocate(Far::PatchTables const *farPatchTables) { // needs reserve? - int nPatchArrays = farPatchTables->GetNumPatchArrays(); + int nPatchArrays = farPatchTable->GetNumPatchArrays(); // for each patchArray for (int j = 0; j < nPatchArrays; ++j) { - PatchArray patchArray(farPatchTables->GetPatchArrayDescriptor(j), - farPatchTables->GetNumPatches(j), + PatchArray patchArray(farPatchTable->GetPatchArrayDescriptor(j), + farPatchTable->GetNumPatches(j), (int)buffer.size(), (int)ppBuffer.size()/3); _patchArrays.push_back(patchArray); // indices - Far::ConstIndexArray indices = farPatchTables->GetPatchArrayVertices(j); + Far::ConstIndexArray indices = farPatchTable->GetPatchArrayVertices(j); for (int k = 0; k < indices.size(); ++k) { buffer.push_back(indices[k]); } @@ -81,7 +81,7 @@ GLPatchTable::allocate(Far::PatchTables const *farPatchTables) { // XXX: we need sharpness interface for patcharray or put sharpness // into patchParam. Far::ConstPatchParamArray patchParams = - farPatchTables->GetPatchParams(j); + farPatchTable->GetPatchParams(j); for (int k = 0; k < patchParams.size(); ++k) { float sharpness = 0.0; ppBuffer.push_back(patchParams[k].faceIndex); @@ -90,21 +90,21 @@ GLPatchTable::allocate(Far::PatchTables const *farPatchTables) { } #else // XXX: workaround. GetPatchParamTable() will be deprecated though. - Far::PatchParamTable const & patchParamTables = - farPatchTables->GetPatchParamTable(); + Far::PatchParamTable const & patchParamTable = + farPatchTable->GetPatchParamTable(); std::vector const &sharpnessIndexTable = - farPatchTables->GetSharpnessIndexTable(); - int numPatches = farPatchTables->GetNumPatches(j); + farPatchTable->GetSharpnessIndexTable(); + int numPatches = farPatchTable->GetNumPatches(j); for (int k = 0; k < numPatches; ++k) { float sharpness = 0.0; int patchIndex = (int)ppBuffer.size()/3; if (patchIndex < (int)sharpnessIndexTable.size()) { int sharpnessIndex = sharpnessIndexTable[patchIndex]; if (sharpnessIndex >= 0) - sharpness = farPatchTables->GetSharpnessValues()[sharpnessIndex]; + sharpness = farPatchTable->GetSharpnessValues()[sharpnessIndex]; } - ppBuffer.push_back(patchParamTables[patchIndex].faceIndex); - ppBuffer.push_back(patchParamTables[patchIndex].bitField.field); + ppBuffer.push_back(patchParamTable[patchIndex].faceIndex); + ppBuffer.push_back(patchParamTable[patchIndex].bitField.field); ppBuffer.push_back(*((unsigned int *)&sharpness)); } #endif diff --git a/opensubdiv/osd/glPatchTable.h b/opensubdiv/osd/glPatchTable.h index 43656ca8..4fbf1b0b 100644 --- a/opensubdiv/osd/glPatchTable.h +++ b/opensubdiv/osd/glPatchTable.h @@ -36,7 +36,7 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far{ - class PatchTables; + class PatchTable; }; namespace Osd { @@ -75,7 +75,7 @@ public: GLPatchTable(); ~GLPatchTable(); - static GLPatchTable *Create(Far::PatchTables const *farPatchTables, + static GLPatchTable *Create(Far::PatchTable const *farPatchTable, void *deviceContext = NULL); PatchArrayVector const &GetPatchArrays() const { @@ -93,8 +93,8 @@ public: } protected: - // allocate buffers from patchTables - bool allocate(Far::PatchTables const *farPatchTables); + // allocate buffers from patchTable + bool allocate(Far::PatchTable const *farPatchTable); PatchArrayVector _patchArrays; GLuint _indexBuffer; diff --git a/opensubdiv/osd/glXFBEvaluator.cpp b/opensubdiv/osd/glXFBEvaluator.cpp index 7da8bad3..807a7ec6 100644 --- a/opensubdiv/osd/glXFBEvaluator.cpp +++ b/opensubdiv/osd/glXFBEvaluator.cpp @@ -30,7 +30,7 @@ #include #include "../far/error.h" -#include "../far/stencilTables.h" +#include "../far/stencilTable.h" #if _MSC_VER #define snprintf _snprintf @@ -82,23 +82,23 @@ createGLTextureBuffer(std::vector const & src, GLenum type) { return devicePtr; } -GLStencilTablesTBO::GLStencilTablesTBO( - Far::StencilTables const *stencilTables) { +GLStencilTableTBO::GLStencilTableTBO( + Far::StencilTable const *stencilTable) { - _numStencils = stencilTables->GetNumStencils(); + _numStencils = stencilTable->GetNumStencils(); if (_numStencils > 0) { - _sizes = createGLTextureBuffer(stencilTables->GetSizes(), GL_R32UI); + _sizes = createGLTextureBuffer(stencilTable->GetSizes(), GL_R32UI); _offsets = createGLTextureBuffer( - stencilTables->GetOffsets(), GL_R32I); + stencilTable->GetOffsets(), GL_R32I); _indices = createGLTextureBuffer( - stencilTables->GetControlIndices(), GL_R32I); - _weights = createGLTextureBuffer(stencilTables->GetWeights(), GL_R32F); + stencilTable->GetControlIndices(), GL_R32I); + _weights = createGLTextureBuffer(stencilTable->GetWeights(), GL_R32F); } else { _sizes = _offsets = _indices = _weights = 0; } } -GLStencilTablesTBO::~GLStencilTablesTBO() { +GLStencilTableTBO::~GLStencilTableTBO() { if (_sizes) glDeleteTextures(1, &_sizes); if (_offsets) glDeleteTextures(1, &_offsets); if (_weights) glDeleteTextures(1, &_weights); @@ -277,7 +277,7 @@ GLXFBEvaluator::EvalStencils(GLuint srcBuffer, bindTexture(_uniformSrcBufferTexture, _srcBufferTexture, 0); - // bind stencil tables textures. + // bind stencil table textures. bindTexture(_uniformSizesTexture, sizesTexture, 1); bindTexture(_uniformOffsetsTexture, offsetsTexture, 2); bindTexture(_uniformIndicesTexture, indicesTexture, 3); diff --git a/opensubdiv/osd/glXFBEvaluator.h b/opensubdiv/osd/glXFBEvaluator.h index 205f229b..65881670 100644 --- a/opensubdiv/osd/glXFBEvaluator.h +++ b/opensubdiv/osd/glXFBEvaluator.h @@ -34,28 +34,28 @@ namespace OpenSubdiv { namespace OPENSUBDIV_VERSION { namespace Far { - class StencilTables; + class StencilTable; } namespace Osd { -/// \brief GL TextureBuffer stencil tables +/// \brief GL TextureBuffer stencil table /// -/// This class is a GL Texture Buffer representation of Far::StencilTables. +/// This class is a GL Texture Buffer representation of Far::StencilTable. /// /// GLSLTransformFeedback consumes this table to apply stencils /// /// -class GLStencilTablesTBO { +class GLStencilTableTBO { public: - static GLStencilTablesTBO *Create( - Far::StencilTables const *stencilTables, void *deviceContext = NULL) { + static GLStencilTableTBO *Create( + Far::StencilTable const *stencilTable, void *deviceContext = NULL) { (void)deviceContext; // unused - return new GLStencilTablesTBO(stencilTables); + return new GLStencilTableTBO(stencilTable); } - explicit GLStencilTablesTBO(Far::StencilTables const *stencilTables); - ~GLStencilTablesTBO(); + explicit GLStencilTableTBO(Far::StencilTable const *stencilTable); + ~GLStencilTableTBO(); // interfaces needed for GLSLTransformFeedbackKernel GLuint GetSizesTexture() const { return _sizes; } diff --git a/opensubdiv/osd/mesh.h b/opensubdiv/osd/mesh.h index e29e6cdf..00646512 100644 --- a/opensubdiv/osd/mesh.h +++ b/opensubdiv/osd/mesh.h @@ -33,9 +33,9 @@ #include #include "../far/topologyRefiner.h" -#include "../far/patchTablesFactory.h" -#include "../far/stencilTables.h" -#include "../far/stencilTablesFactory.h" +#include "../far/patchTableFactory.h" +#include "../far/stencilTable.h" +#include "../far/stencilTableFactory.h" #include "../osd/vertexDescriptor.h" @@ -87,7 +87,7 @@ public: virtual PatchTable * GetPatchTable() const = 0; - virtual Far::PatchTables const *GetFarPatchTables() const = 0; + virtual Far::PatchTable const *GetFarPatchTable() const = 0; virtual VertexBufferBinding BindVertexBuffer() = 0; @@ -114,32 +114,32 @@ protected: // --------------------------------------------------------------------------- -template -STENCIL_TABLES const * -convertToCompatibleStencilTables( - Far::StencilTables const *table, DEVICE_CONTEXT *context) { +template +STENCIL_TABLE const * +convertToCompatibleStencilTable( + Far::StencilTable const *table, DEVICE_CONTEXT *context) { if (not table) return NULL; - return STENCIL_TABLES::Create(table, context); + return STENCIL_TABLE::Create(table, context); } template <> -Far::StencilTables const * -convertToCompatibleStencilTables( - Far::StencilTables const *table, void * /*context*/) { +Far::StencilTable const * +convertToCompatibleStencilTable( + Far::StencilTable const *table, void * /*context*/) { // no need for conversion // XXX: We don't want to even copy. if (not table) return NULL; - return new Far::StencilTables(*table); + return new Far::StencilTable(*table); } template <> -Far::StencilTables const * -convertToCompatibleStencilTables( - Far::StencilTables const *table, ID3D11DeviceContext * /*context*/) { +Far::StencilTable const * +convertToCompatibleStencilTable( + Far::StencilTable const *table, ID3D11DeviceContext * /*context*/) { // no need for conversion // XXX: We don't want to even copy. if (not table) return NULL; - return new Far::StencilTables(*table); + return new Far::StencilTable(*table); } // --------------------------------------------------------------------------- @@ -231,7 +231,7 @@ static EVALUATOR *GetEvaluator( // --------------------------------------------------------------------------- template @@ -239,7 +239,7 @@ class Mesh : public MeshInterface { public: typedef VERTEX_BUFFER VertexBuffer; typedef EVALUATOR Evaluator; - typedef STENCIL_TABLES StencilTables; + typedef STENCIL_TABLE StencilTable; typedef PATCH_TABLE PatchTable; typedef DEVICE_CONTEXT DeviceContext; typedef EvaluatorCacheT EvaluatorCache; @@ -254,13 +254,13 @@ public: DeviceContext * deviceContext = NULL) : _refiner(refiner), - _farPatchTables(NULL), + _farPatchTable(NULL), _numVertices(0), _maxValence(0), _vertexBuffer(NULL), _varyingBuffer(NULL), - _vertexStencilTables(NULL), - _varyingStencilTables(NULL), + _vertexStencilTable(NULL), + _varyingStencilTable(NULL), _evaluatorCache(evaluatorCache), _patchTable(NULL), _deviceContext(deviceContext) { @@ -302,11 +302,11 @@ public: virtual ~Mesh() { delete _refiner; - delete _farPatchTables; + delete _farPatchTable; delete _vertexBuffer; delete _varyingBuffer; - delete _vertexStencilTables; - delete _varyingStencilTables; + delete _vertexStencilTable; + delete _varyingStencilTable; delete _patchTable; // deviceContext and evaluatorCache are not owned by this class. } @@ -339,7 +339,7 @@ public: Evaluator::EvalStencils(_vertexBuffer, srcDesc, _vertexBuffer, dstDesc, - _vertexStencilTables, + _vertexStencilTable, instance, _deviceContext); if (_varyingDesc.length > 0) { @@ -354,13 +354,13 @@ public: // non-interleaved Evaluator::EvalStencils(_varyingBuffer, srcDesc, _varyingBuffer, dstDesc, - _varyingStencilTables, + _varyingStencilTable, instance, _deviceContext); } else { // interleaved Evaluator::EvalStencils(_vertexBuffer, srcDesc, _vertexBuffer, dstDesc, - _varyingStencilTables, + _varyingStencilTable, instance, _deviceContext); } } @@ -374,8 +374,8 @@ public: return _patchTable; } - virtual Far::PatchTables const *GetFarPatchTables() const { - return _farPatchTables; + virtual Far::PatchTable const *GetFarPatchTable() const { + return _farPatchTable; } virtual int GetNumVertices() const { return _numVertices; } @@ -408,85 +408,85 @@ private: int level, MeshBitset bits) { assert(_refiner); - Far::StencilTablesFactory::Options options; + Far::StencilTableFactory::Options options; options.generateOffsets = true; options.generateIntermediateLevels = _refiner->IsUniform() ? false : true; - Far::StencilTables const * vertexStencils = NULL; - Far::StencilTables const * varyingStencils = NULL; + Far::StencilTable const * vertexStencils = NULL; + Far::StencilTable const * varyingStencils = NULL; if (numVertexElements>0) { - vertexStencils = Far::StencilTablesFactory::Create(*_refiner, - options); + vertexStencils = Far::StencilTableFactory::Create(*_refiner, + options); } if (numVaryingElements>0) { options.interpolationMode = - Far::StencilTablesFactory::INTERPOLATE_VARYING; + Far::StencilTableFactory::INTERPOLATE_VARYING; - varyingStencils = Far::StencilTablesFactory::Create(*_refiner, - options); + varyingStencils = Far::StencilTableFactory::Create(*_refiner, + options); } - Far::PatchTablesFactory::Options poptions(level); + Far::PatchTableFactory::Options poptions(level); poptions.generateFVarTables = bits.test(MeshFVarData); poptions.useSingleCreasePatch = bits.test(MeshUseSingleCreasePatch); if (bits.test(MeshEndCapBSplineBasis)) { poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_BSPLINE_BASIS); + Far::PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS); } else if (bits.test(MeshEndCapGregoryBasis)) { poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_GREGORY_BASIS); + Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS); // points on gregory basis endcap boundary can be shared among // adjacent patches to save some stencils. poptions.shareEndCapPatchPoints = true; } else if (bits.test(MeshEndCapLegacyGregory)) { poptions.SetEndCapType( - Far::PatchTablesFactory::Options::ENDCAP_LEGACY_GREGORY); + Far::PatchTableFactory::Options::ENDCAP_LEGACY_GREGORY); } - _farPatchTables = Far::PatchTablesFactory::Create(*_refiner, poptions); + _farPatchTable = Far::PatchTableFactory::Create(*_refiner, poptions); // if there's endcap stencils, merge it into regular stencils. - if (_farPatchTables->GetEndCapVertexStencilTables()) { + if (_farPatchTable->GetEndCapVertexStencilTable()) { // append stencils - if (Far::StencilTables const *vertexStencilsWithEndCap = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *vertexStencilsWithEndCap = + Far::StencilTableFactory::AppendEndCapStencilTable( *_refiner, vertexStencils, - _farPatchTables->GetEndCapVertexStencilTables())) { + _farPatchTable->GetEndCapVertexStencilTable())) { delete vertexStencils; vertexStencils = vertexStencilsWithEndCap; } if (varyingStencils) { - if (Far::StencilTables const *varyingStencilsWithEndCap = - Far::StencilTablesFactory::AppendEndCapStencilTables( + if (Far::StencilTable const *varyingStencilsWithEndCap = + Far::StencilTableFactory::AppendEndCapStencilTable( *_refiner, varyingStencils, - _farPatchTables->GetEndCapVaryingStencilTables())) { + _farPatchTable->GetEndCapVaryingStencilTable())) { delete varyingStencils; varyingStencils = varyingStencilsWithEndCap; } } } - _maxValence = _farPatchTables->GetMaxValence(); - _patchTable = PatchTable::Create(_farPatchTables, _deviceContext); + _maxValence = _farPatchTable->GetMaxValence(); + _patchTable = PatchTable::Create(_farPatchTable, _deviceContext); // numvertices = coarse verts + refined verts + gregory basis verts _numVertices = vertexStencils->GetNumControlVertices() + vertexStencils->GetNumStencils(); - // convert to device stenciltables if necessary. - _vertexStencilTables = - convertToCompatibleStencilTables( + // convert to device stenciltable if necessary. + _vertexStencilTable = + convertToCompatibleStencilTable( vertexStencils, _deviceContext); - _varyingStencilTables = - convertToCompatibleStencilTables( + _varyingStencilTable = + convertToCompatibleStencilTable( varyingStencils, _deviceContext); // FIXME: we do extra copyings for Far::Stencils. @@ -510,7 +510,7 @@ private: } Far::TopologyRefiner * _refiner; - Far::PatchTables * _farPatchTables; + Far::PatchTable * _farPatchTable; int _numVertices; int _maxValence; @@ -521,8 +521,8 @@ private: VertexBufferDescriptor _vertexDesc; VertexBufferDescriptor _varyingDesc; - StencilTables const * _vertexStencilTables; - StencilTables const * _varyingStencilTables; + StencilTable const * _vertexStencilTable; + StencilTable const * _varyingStencilTable; EvaluatorCache * _evaluatorCache; PatchTable *_patchTable; diff --git a/opensubdiv/vtr/fvarLevel.h b/opensubdiv/vtr/fvarLevel.h index 15ad434e..3dfcb95e 100644 --- a/opensubdiv/vtr/fvarLevel.h +++ b/opensubdiv/vtr/fvarLevel.h @@ -43,7 +43,7 @@ namespace OPENSUBDIV_VERSION { // Forward declaration of friend classes: namespace Far { class TopologyRefiner; - class PatchTablesFactory; + class PatchTableFactory; } namespace Vtr { class Refinement; @@ -90,7 +90,7 @@ protected: friend class Refinement; friend class FVarRefinement; friend class Far::TopologyRefiner; - friend class Far::PatchTablesFactory; + friend class Far::PatchTableFactory; protected: // diff --git a/opensubdiv/vtr/level.h b/opensubdiv/vtr/level.h index 8bb025b4..25748f22 100644 --- a/opensubdiv/vtr/level.h +++ b/opensubdiv/vtr/level.h @@ -45,7 +45,7 @@ namespace Far { template class TopologyRefinerFactory; class TopologyRefinerFactoryBase; class TopologyRefiner; - class PatchTablesFactory; + class PatchTableFactory; } namespace Vtr { @@ -336,7 +336,7 @@ protected: template friend class Far::TopologyRefinerFactory; friend class Far::TopologyRefinerFactoryBase; friend class Far::TopologyRefiner; - friend class Far::PatchTablesFactory; + friend class Far::PatchTableFactory; // Sizing methods used to construct a level to populate: void resizeFaces( int numFaces); diff --git a/opensubdiv/vtr/refinement.h b/opensubdiv/vtr/refinement.h index 3b780561..36ea85ed 100644 --- a/opensubdiv/vtr/refinement.h +++ b/opensubdiv/vtr/refinement.h @@ -41,7 +41,7 @@ namespace OPENSUBDIV_VERSION { namespace Far { class TopologyRefiner; - class PatchTablesFactory; + class PatchTableFactory; } namespace Vtr { @@ -164,7 +164,7 @@ protected: friend class SparseSelector; friend class Far::TopologyRefiner; - friend class Far::PatchTablesFactory; + friend class Far::PatchTableFactory; IndexArray getFaceChildFaces(Index parentFace); diff --git a/regression/osd_regression/main.cpp b/regression/osd_regression/main.cpp index f648e91a..c63ce5ae 100644 --- a/regression/osd_regression/main.cpp +++ b/regression/osd_regression/main.cpp @@ -52,7 +52,7 @@ GLFWwindow* g_window=0; #include -#include +#include #include "../../regression/common/cmp_utils.h" #include "../../regression/common/hbr_utils.h" @@ -246,19 +246,19 @@ checkVertexBuffer( //------------------------------------------------------------------------------ static void -buildStencilTables( +buildStencilTable( const FarTopologyRefiner &refiner, - Far::StencilTables const **vertexStencils, - Far::StencilTables const **varyingStencils) + Far::StencilTable const **vertexStencils, + Far::StencilTable const **varyingStencils) { - Far::StencilTablesFactory::Options soptions; + Far::StencilTableFactory::Options soptions; soptions.generateOffsets = true; soptions.generateIntermediateLevels = true; - *vertexStencils = Far::StencilTablesFactory::Create(refiner, soptions); + *vertexStencils = Far::StencilTableFactory::Create(refiner, soptions); - soptions.interpolationMode = Far::StencilTablesFactory::INTERPOLATE_VARYING; - *varyingStencils = Far::StencilTablesFactory::Create(refiner, soptions); + soptions.interpolationMode = Far::StencilTableFactory::INTERPOLATE_VARYING; + *varyingStencils = Far::StencilTableFactory::Create(refiner, soptions); } @@ -269,9 +269,9 @@ checkMeshCPU( FarTopologyRefiner *refiner, const std::vector& coarseverts, xyzmesh * refmesh) { - Far::StencilTables const *vertexStencils; - Far::StencilTables const *varyingStencils; - buildStencilTables(*refiner, &vertexStencils, &varyingStencils); + Far::StencilTable const *vertexStencils; + Far::StencilTable const *varyingStencils; + buildStencilTable(*refiner, &vertexStencils, &varyingStencils); assert(coarseverts.size() == (size_t)refiner->GetNumVerticesTotal()); @@ -303,9 +303,9 @@ checkMeshCPUGL(FarTopologyRefiner *refiner, const std::vector& coarseverts, xyzmesh * refmesh) { - Far::StencilTables const *vertexStencils; - Far::StencilTables const *varyingStencils; - buildStencilTables(*refiner, &vertexStencils, &varyingStencils); + Far::StencilTable const *vertexStencils; + Far::StencilTable const *varyingStencils; + buildStencilTable(*refiner, &vertexStencils, &varyingStencils); Osd::CpuGLVertexBuffer *vb = Osd::CpuGLVertexBuffer::Create(3, refiner->GetNumVerticesTotal()); diff --git a/tutorials/far/tutorial_4/far_tutorial_4.cpp b/tutorials/far/tutorial_4/far_tutorial_4.cpp index 8d65519b..b3815f5f 100644 --- a/tutorials/far/tutorial_4/far_tutorial_4.cpp +++ b/tutorials/far/tutorial_4/far_tutorial_4.cpp @@ -26,13 +26,13 @@ //------------------------------------------------------------------------------ // Tutorial description: // -// This tutorial shows how to create and manipulate FarStencilTables. We use the +// This tutorial shows how to create and manipulate FarStencilTable. We use the // factorized stencils to interpolate vertex primvar data buffers. // #include -#include -#include +#include +#include #include #include @@ -118,17 +118,17 @@ int main(int, char **) { refiner->RefineUniform(Far::TopologyRefiner::UniformOptions(maxlevel)); - // Use the FarStencilTables factory to create discrete stencil tables + // Use the FarStencilTable factory to create discrete stencil table // note: we only want stencils for the highest refinement level. - Far::StencilTablesFactory::Options options; + Far::StencilTableFactory::Options options; options.generateIntermediateLevels=false; options.generateOffsets=true; - Far::StencilTables const * stencilTables = - Far::StencilTablesFactory::Create(*refiner, options); + Far::StencilTable const * stencilTable = + Far::StencilTableFactory::Create(*refiner, options); // Allocate vertex primvar buffer (1 stencil for each vertex) - int nstencils = stencilTables->GetNumStencils(); + int nstencils = stencilTable->GetNumStencils(); std::vector vertexBuffer(nstencils); @@ -141,7 +141,7 @@ int main(int, char **) { // Apply stencils on the control vertex data to update the primvar data // of the refined vertices. - stencilTables->UpdateValues(controlValues, &vertexBuffer[0]); + stencilTable->UpdateValues(controlValues, &vertexBuffer[0]); } { // Visualization with Maya : print a MEL script that generates particles @@ -156,7 +156,7 @@ int main(int, char **) { } delete refiner; - delete stencilTables; + delete stencilTable; } //------------------------------------------------------------------------------ diff --git a/tutorials/far/tutorial_5/far_tutorial_5.cpp b/tutorials/far/tutorial_5/far_tutorial_5.cpp index 1724c0fb..48e1ee5d 100644 --- a/tutorials/far/tutorial_5/far_tutorial_5.cpp +++ b/tutorials/far/tutorial_5/far_tutorial_5.cpp @@ -27,13 +27,13 @@ // Tutorial description: // // This tutorial shows how to create and manipulate both 'vertex' and 'varying' -// Far::StencilTables to interpolate 2 primvar data buffers: vertex positions and +// Far::StencilTable to interpolate 2 primvar data buffers: vertex positions and // vertex colors. // #include -#include -#include +#include +#include #include #include @@ -123,8 +123,8 @@ int main(int, char **) { int nverts = refiner->GetLevel(maxlevel).GetNumVertices(); - // Use the Far::StencilTables factory to create discrete stencil tables - Far::StencilTablesFactory::Options options; + // Use the Far::StencilTable factory to create discrete stencil table + Far::StencilTableFactory::Options options; options.generateIntermediateLevels=false; // only the highest refinement level. options.generateOffsets=true; @@ -133,10 +133,10 @@ int main(int, char **) { // // Create stencils table for 'vertex' interpolation - options.interpolationMode=Far::StencilTablesFactory::INTERPOLATE_VERTEX; + options.interpolationMode=Far::StencilTableFactory::INTERPOLATE_VERTEX; - Far::StencilTables const * vertexStencils = - Far::StencilTablesFactory::Create(*refiner, options); + Far::StencilTable const * vertexStencils = + Far::StencilTableFactory::Create(*refiner, options); assert(nverts==vertexStencils->GetNumStencils()); // Allocate vertex primvar buffer (1 stencil for each vertex) @@ -150,10 +150,10 @@ int main(int, char **) { // // Create stencils table for 'varying' interpolation - options.interpolationMode=Far::StencilTablesFactory::INTERPOLATE_VARYING; + options.interpolationMode=Far::StencilTableFactory::INTERPOLATE_VARYING; - Far::StencilTables const * varyingStencils = - Far::StencilTablesFactory::Create(*refiner, options); + Far::StencilTable const * varyingStencils = + Far::StencilTableFactory::Create(*refiner, options); assert(nverts==varyingStencils->GetNumStencils()); // Allocate varying primvar buffer (1 stencil for each vertex) diff --git a/tutorials/far/tutorial_6/far_tutorial_6.cpp b/tutorials/far/tutorial_6/far_tutorial_6.cpp index fce5d6ed..0fbabfc5 100644 --- a/tutorials/far/tutorial_6/far_tutorial_6.cpp +++ b/tutorials/far/tutorial_6/far_tutorial_6.cpp @@ -41,7 +41,7 @@ // #include -#include +#include #include #include #include @@ -155,14 +155,14 @@ int main(int, char **) { refiner->Interpolate(&verts[0], &verts[g_nverts]); - // Generate a set of Far::PatchTables that we will use to evaluate the + // Generate a set of Far::PatchTable that we will use to evaluate the // surface limit Far::EndCapGregoryBasisPatchFactory endcapFactory(*refiner); - Far::PatchTables const * patchTables = - Far::PatchTablesFactory::Create(*refiner, Far::PatchTablesFactory::Options()); + Far::PatchTable const * patchTable = + Far::PatchTableFactory::Create(*refiner, Far::PatchTableFactory::Options()); // Create a Far::PatchMap to help locating patches in the table - Far::PatchMap patchmap(*patchTables); + Far::PatchMap patchmap(*patchTable); // Create a Far::PtexIndices to help find indices of ptex faces. Far::PtexIndices ptexIndices(*refiner); @@ -185,14 +185,14 @@ int main(int, char **) { t = (float)rand()/(float)RAND_MAX; // Locate the patch corresponding to the face ptex idx and (s,t) - Far::PatchTables::PatchHandle const * handle = + Far::PatchTable::PatchHandle const * handle = patchmap.FindPatch(face, s, t); assert(handle); // Evaluate the patch weights, identify the CVs and compute the limit frame: - patchTables->EvaluateBasis(*handle, s, t, pWeights, dsWeights, dtWeights); + patchTable->EvaluateBasis(*handle, s, t, pWeights, dsWeights, dtWeights); - Far::ConstIndexArray cvs = patchTables->GetPatchVertices(*handle); + Far::ConstIndexArray cvs = patchTable->GetPatchVertices(*handle); LimitFrame & dst = samples[count]; dst.Clear(); diff --git a/tutorials/far/tutorial_7/far_tutorial_7.cpp b/tutorials/far/tutorial_7/far_tutorial_7.cpp index 8d58cb30..066b9b0c 100644 --- a/tutorials/far/tutorial_7/far_tutorial_7.cpp +++ b/tutorials/far/tutorial_7/far_tutorial_7.cpp @@ -26,12 +26,12 @@ //------------------------------------------------------------------------------ // Tutorial description: // -// This tutorial shows how to create and manipulate tables of cascading stencils. +// This tutorial shows how to create and manipulate table of cascading stencils. // // We initalize a Far::TopologyRefiner initalized with a cube and apply uniform -// refinement. We then use a Far::StencilTablesFactory to generate stencil -// tables. We set the factory Options to not factorize intermediate levels, -// thus giving tables of "cascading" stencils. +// refinement. We then use a Far::StencilTableFactory to generate a stencil +// table. We set the factory Options to not factorize intermediate levels, +// thus giving a table of "cascading" stencils. // // We then apply the stencils to the vertex position primvar data, and insert // a hierarchical edit at level 1. This edit is smoothed by the application @@ -42,8 +42,8 @@ // #include -#include -#include +#include +#include #include #include @@ -131,17 +131,17 @@ int main(int, char **) { int maxlevel = 4; refiner->RefineUniform(Far::TopologyRefiner::UniformOptions(maxlevel)); - // Use the FarStencilTables factory to create cascading stencil tables + // Use the FarStencilTable factory to create cascading stencil table // note: we want stencils for the each refinement level // "cascade" mode is achieved by setting "factorizeIntermediateLevels" // to false - Far::StencilTablesFactory::Options options; + Far::StencilTableFactory::Options options; options.generateIntermediateLevels=true; options.factorizeIntermediateLevels=false; options.generateOffsets=true; - Far::StencilTables const * stencilTables = - Far::StencilTablesFactory::Create(*refiner, options); + Far::StencilTable const * stencilTable = + Far::StencilTableFactory::Create(*refiner, options); std::vector vertexBuffer(refiner->GetNumVerticesTotal()-g_nverts); @@ -160,7 +160,7 @@ int main(int, char **) { start = end; end += nverts; - stencilTables->UpdateValues(srcVerts, destVerts, start, end); + stencilTable->UpdateValues(srcVerts, destVerts, start, end); // apply 2 hierarchical edits on level 1 vertices if (level==1) { @@ -210,7 +210,7 @@ int main(int, char **) { } delete refiner; - delete stencilTables; + delete stencilTable; } //------------------------------------------------------------------------------ diff --git a/tutorials/osd/tutorial_0/osd_tutorial_0.cpp b/tutorials/osd/tutorial_0/osd_tutorial_0.cpp index 0e2fbcbf..bddbe337 100644 --- a/tutorials/osd/tutorial_0/osd_tutorial_0.cpp +++ b/tutorials/osd/tutorial_0/osd_tutorial_0.cpp @@ -31,7 +31,7 @@ // #include -#include +#include #include #include @@ -75,22 +75,22 @@ int main(int, char **) { // // Setup phase // - Far::StencilTables const * stencilTables = NULL; + Far::StencilTable const * stencilTable = NULL; { // Setup Context Far::TopologyRefiner const * refiner = createTopologyRefiner(maxlevel); - // Setup a factory to create FarStencilTables (for more details see + // Setup a factory to create FarStencilTable (for more details see // Far tutorials) - Far::StencilTablesFactory::Options options; + Far::StencilTableFactory::Options options; options.generateOffsets=true; options.generateIntermediateLevels=false; - stencilTables = Far::StencilTablesFactory::Create(*refiner, options); + stencilTable = Far::StencilTableFactory::Create(*refiner, options); nCoarseVerts = refiner->GetLevel(0).GetNumVertices(); - nRefinedVerts = stencilTables->GetNumStencils(); + nRefinedVerts = stencilTable->GetNumStencils(); - // We are done with Far: cleanup tables + // We are done with Far: cleanup table delete refiner; } @@ -113,7 +113,7 @@ int main(int, char **) { // Launch the computation Osd::CpuEvaluator::EvalStencils(vbuffer, srcDesc, vbuffer, dstDesc, - stencilTables); + stencilTable); } { // Visualization with Maya : print a MEL script that generates particles @@ -128,7 +128,7 @@ int main(int, char **) { printf("-c 1;\n"); } - delete stencilTables; + delete stencilTable; delete vbuffer; }