renaming (2/2) PatchTables and StencilTables to PatchTable and StencilTable

replace all occurrences reffering PatchTables, StencilTables, and their factories.
This commit is contained in:
Takahito Tejima 2015-05-22 11:50:01 -07:00
parent e6f951c010
commit a7c5179ef9
72 changed files with 968 additions and 968 deletions

View File

@ -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 <subdivision_surfaces.html#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 <MESH> 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.

View File

@ -63,8 +63,8 @@
<li><a href="far_overview.html">Far</a></li>
<ul>
<li><a href="far_overview.html#far-topologyrefiner">Topology Refiner</a></li>
<li><a href="far_overview.html#far-patchtables">Patch Tables</a></li>
<li><a href="far_overview.html#far-stenciltables">Stencil Tables</a></li>
<li><a href="far_overview.html#far-patchtable">Patch Table</a></li>
<li><a href="far_overview.html#far-stenciltable">Stencil Table</a></li>
</ul>
<li><a href="vtr_overview.html">Vtr</a></li>
<li><a href="sdc_overview.html">Sdc</a></li>

View File

@ -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.
----

View File

@ -89,17 +89,17 @@ or in your local ``<repository root>/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] <far_tutorial_4.html>`__
|
| **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] <far_tutorial_5.html>`__
|
| **Tutorial 6**
| This tutorial shows how to interpolate surface limits at arbitrary
parametric locations using feature adaptive Far::PatchTables. `[code] <far_tutorial_6.html>`__
parametric locations using feature adaptive Far::PatchTable. `[code] <far_tutorial_6.html>`__
| |far_tut_6|
|
| **Tutorial 7**

View File

@ -25,7 +25,7 @@
#ifndef OPENSUBDIV_EXAMPLES_COMMON_PATCH_COLORS_H
#define OPENSUBDIV_EXAMPLES_COMMON_PATCH_COLORS_H
#include <far/patchTables.h>
#include <far/patchTable.h>
// returns a unique color for each type of feature-adaptive patches
float const * getAdaptivePatchColor(OpenSubdiv::Far::PatchDescriptor const & desc);

View File

@ -737,7 +737,7 @@ createOsdMesh(int level, int kernel) {
if (g_kernel == kCPU) {
g_mesh = new Osd::Mesh<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::CpuEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -749,7 +749,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_OPENMP
} else if (kernel == kOPENMP) {
g_mesh = new Osd::Mesh<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::OmpEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -761,7 +761,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_TBB
} else if (kernel == kTBB) {
g_mesh = new Osd::Mesh<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::TbbEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -774,7 +774,7 @@ createOsdMesh(int level, int kernel) {
} else if(kernel == kCL) {
static Osd::EvaluatorCacheT<Osd::CLEvaluator> clEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::CLD3D11VertexBuffer,
Osd::CLStencilTables,
Osd::CLStencilTable,
Osd::CLEvaluator,
Osd::D3D11PatchTable,
CLD3D11DeviceContext>(
@ -788,7 +788,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_CUDA
} else if (g_kernel == kCUDA) {
g_mesh = new Osd::Mesh<Osd::CudaD3D11VertexBuffer,
Osd::CudaStencilTables,
Osd::CudaStencilTable,
Osd::CudaEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -800,7 +800,7 @@ createOsdMesh(int level, int kernel) {
} else if (g_kernel == kDirectCompute) {
static Osd::EvaluatorCacheT<Osd::D3D11ComputeEvaluator> d3d11ComputeEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::D3D11VertexBuffer,
Osd::D3D11StencilTables,
Osd::D3D11StencilTable,
Osd::D3D11ComputeEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(

View File

@ -322,7 +322,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
if (g_kernel == kCPU) {
g_mesh = new Osd::Mesh<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::CpuEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -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<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::OmpEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -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<Osd::CpuD3D11VertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::TbbEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -359,7 +359,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
} else if(kernel == kCL) {
static Osd::EvaluatorCacheT<Osd::CLEvaluator> clEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::CLD3D11VertexBuffer,
Osd::CLStencilTables,
Osd::CLStencilTable,
Osd::CLEvaluator,
Osd::D3D11PatchTable,
CLD3D11DeviceContext>(
@ -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<Osd::CudaD3D11VertexBuffer,
Osd::CudaStencilTables,
Osd::CudaStencilTable,
Osd::CudaEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -385,7 +385,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
} else if (g_kernel == kDirectCompute) {
static Osd::EvaluatorCacheT<Osd::D3D11ComputeEvaluator> d3d11ComputeEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::D3D11VertexBuffer,
Osd::D3D11StencilTables,
Osd::D3D11StencilTable,
Osd::D3D11ComputeEvaluator,
Osd::D3D11PatchTable,
ID3D11DeviceContext>(
@ -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;

View File

@ -50,9 +50,9 @@ GLFWmonitor* g_primary=0;
#include <far/gregoryBasis.h>
#include <far/endCapGregoryBasisPatchFactory.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 <common/vtr_utils.h>
@ -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<Vertex> 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<cvs.size(); ++i) {
@ -381,7 +381,7 @@ createPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables,
//------------------------------------------------------------------------------
// generate display vert IDs for the selected Far FVar patch
static void
createFVarPatchNumbers(OpenSubdiv::Far::PatchTables const & patchTables,
createFVarPatchNumbers(OpenSubdiv::Far::PatchTable const & patchTable,
std::vector<Vertex> 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<patchTables.GetNumPatchesTotal()) {
if (patch>=0 and patch<patchTable.GetNumPatchesTotal()) {
OpenSubdiv::Far::PatchTables::PatchHandle handle;
OpenSubdiv::Far::PatchTable::PatchHandle handle;
handle.patchIndex = patch;
OpenSubdiv::Far::ConstIndexArray const cvs =
patchTables.GetFVarPatchValues(channel, handle);
patchTable.GetFVarPatchValues(channel, handle);
for (int i=0; i<cvs.size(); ++i) {
snprintf(buf, 16, "%d", i);
g_font->Print3D(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<Vertex> 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<Vertex> 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<npatches; ++patch) {
@ -450,14 +450,14 @@ createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner,
for (int j=0; j<tessFactor; ++j, ++vert) {
handle.patchIndex = patch;
// To be replaced with EvaluateBasis() for the appropriate channel:
//patchTables.EvaluateFaceVarying(channel, handle, uvs[i], uvs[j], fvarBuffer, *vert);
//patchTable.EvaluateFaceVarying(channel, handle, uvs[i], uvs[j], fvarBuffer, *vert);
}
}
}
GLMesh::Options options;
options.edgeColorMode = GLMesh::EDGECOLOR_BY_PATCHTYPE;
fvarWire.InitializeFVar(options, refiner, &patchTables, channel, tessFactor, (float *)(&verts[0]));
fvarWire.InitializeFVar(options, refiner, &patchTable, channel, tessFactor, (float *)(&verts[0]));
}
}
@ -467,17 +467,17 @@ createFVarPatches(OpenSubdiv::Far::TopologyRefiner const & refiner,
static GLMesh gregoryWire;
static void
createGregoryBasis(OpenSubdiv::Far::PatchTables const & patchTables,
createGregoryBasis(OpenSubdiv::Far::PatchTable const & patchTable,
std::vector<Vertex> 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<Vertex> 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<Vertex> 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;
}
//------------------------------------------------------------------------------

View File

@ -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<float> & 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; patch<npatches; ++patch) {
if (options.edgeColorMode==EDGECOLOR_BY_PATCHTYPE) {
handle.patchIndex = patch;
OpenSubdiv::Far::PatchDescriptor::Type type =
patchTables->GetFVarPatchType(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<float> & 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<patchTables.GetNumPatches(array); ++patch) {
for (int patch=0; patch<patchTable.GetNumPatches(array); ++patch) {
OpenSubdiv::Far::ConstIndexArray const cvs =
patchTables.GetPatchVertices(array, patch);
patchTable.GetPatchVertices(array, patch);
int const * edgeList=getEdgeList(ncvs);
@ -679,7 +679,7 @@ GLMesh::initializeBuffers(Options options, TopologyRefiner const & refiner,
{ // face color component ------------------------------
int nfaces = patchTables.GetNumPatchesTotal();
int nfaces = patchTable.GetNumPatchesTotal();
std::vector<float> & 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<patchTables.GetNumPatches(array); ++patch, ++face) {
for (int patch=0; patch<patchTable.GetNumPatches(array); ++patch, ++face) {
OpenSubdiv::Far::ConstIndexArray const cvs =
patchTables.GetPatchVertices(array, patch);
patchTable.GetPatchVertices(array, patch);
if (desc.GetType()==Descriptor::REGULAR) {
eao[face*4 ] = cvs[ 5];

View File

@ -27,7 +27,7 @@
#include <common/vtr_utils.h>
#include <common/hbr_utils.h>
#include <far/patchTables.h>
#include <far/patchTable.h>
#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();

View File

@ -50,8 +50,8 @@ GLFWmonitor* g_primary=0;
#include <far/gregoryBasis.h>
#include <far/endCapGregoryBasisPatchFactory.h>
#include <far/topologyRefiner.h>
#include <far/stencilTablesFactory.h>
#include <far/patchTablesFactory.h>
#include <far/stencilTableFactory.h>
#include <far/patchTableFactory.h>
#include <far/patchMap.h>
#include <far/error.h>
@ -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<Osd::PatchCoord> 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

View File

@ -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<float> const & fvarSrcData) {
Release();
OpenSubdiv::Far::ConstIndexArray indices =
patchTables->GetFVarPatchesValues(0);
patchTable->GetFVarPatchesValues(0);
// expand fvardata to per-patch array
std::vector<float> data;
@ -407,7 +407,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, Scheme scheme = kCatmark)
delete g_mesh;
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
OpenSubdiv::Far::StencilTables,
OpenSubdiv::Far::StencilTable,
OpenSubdiv::Osd::CpuEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
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;

View File

@ -232,7 +232,7 @@ createOsdMesh(std::string const &kernel,
{
if (kernel == "CPU") {
return new Osd::Mesh<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::CpuEvaluator,
Osd::GLPatchTable>(
refiner,
@ -242,7 +242,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_OPENMP
} else if (kernel == "OPENMP") {
return new Osd::Mesh<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::OmpEvaluator,
Osd::GLPatchTable>(
refiner,
@ -253,7 +253,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_TBB
} else if (kernel == "TBB") {
return new Osd::Mesh<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::TbbEvaluator,
Osd::GLPatchTable>(
refiner,
@ -264,7 +264,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_OPENCL
} else if(kernel == "CL") {
return new Osd::Mesh<Osd::CLGLVertexBuffer,
Osd::CLStencilTables,
Osd::CLStencilTable,
Osd::CLEvaluator,
Osd::GLPatchTable,
CLDeviceContext>(
@ -278,7 +278,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_CUDA
} else if(kernel == "CUDA") {
return new Osd::Mesh<Osd::CudaGLVertexBuffer,
Osd::CudaStencilTables,
Osd::CudaStencilTable,
Osd::CudaEvaluator,
Osd::GLPatchTable>(
refiner,
@ -289,7 +289,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK
} else if(kernel == "XFB") {
return new Osd::Mesh<Osd::GLVertexBuffer,
Osd::GLStencilTablesTBO,
Osd::GLStencilTableTBO,
Osd::GLXFBEvaluator,
Osd::GLPatchTable>(
refiner,
@ -300,7 +300,7 @@ createOsdMesh(std::string const &kernel,
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
} else if(kernel == "GLSL") {
return new Osd::Mesh<Osd::GLVertexBuffer,
Osd::GLStencilTablesSSBO,
Osd::GLStencilTableSSBO,
Osd::GLComputeEvaluator,
Osd::GLPatchTable>(
refiner,

View File

@ -238,7 +238,7 @@ createOsdMesh() {
bits.set(OpenSubdiv::Osd::MeshAdaptive, doAdaptive);
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
OpenSubdiv::Far::StencilTables,
OpenSubdiv::Far::StencilTable,
OpenSubdiv::Osd::CpuEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner, 3, 0, g_level, bits);

View File

@ -939,7 +939,7 @@ createOsdMesh(int level, int kernel) {
if (kernel == kCPU) {
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
OpenSubdiv::Far::StencilTables,
OpenSubdiv::Far::StencilTable,
OpenSubdiv::Osd::CpuEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,
@ -949,7 +949,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_OPENMP
} else if (kernel == kOPENMP) {
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
OpenSubdiv::Far::StencilTables,
OpenSubdiv::Far::StencilTable,
OpenSubdiv::Osd::OmpEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,
@ -960,7 +960,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_TBB
} else if (kernel == kTBB) {
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CpuGLVertexBuffer,
OpenSubdiv::Far::StencilTables,
OpenSubdiv::Far::StencilTable,
OpenSubdiv::Osd::TbbEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,
@ -972,7 +972,7 @@ createOsdMesh(int level, int kernel) {
} else if (kernel == kCL) {
static OpenSubdiv::Osd::EvaluatorCacheT<OpenSubdiv::Osd::CLEvaluator> clEvaluatorCache;
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CLGLVertexBuffer,
OpenSubdiv::Osd::CLStencilTables,
OpenSubdiv::Osd::CLStencilTable,
OpenSubdiv::Osd::CLEvaluator,
OpenSubdiv::Osd::GLPatchTable,
CLDeviceContext>(
@ -986,7 +986,7 @@ createOsdMesh(int level, int kernel) {
#ifdef OPENSUBDIV_HAS_CUDA
} else if (kernel == kCUDA) {
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::CudaGLVertexBuffer,
OpenSubdiv::Osd::CudaStencilTables,
OpenSubdiv::Osd::CudaStencilTable,
OpenSubdiv::Osd::CudaEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,
@ -998,7 +998,7 @@ createOsdMesh(int level, int kernel) {
} else if (kernel == kGLSL) {
static OpenSubdiv::Osd::EvaluatorCacheT<OpenSubdiv::Osd::GLXFBEvaluator> glXFBEvaluatorCache;
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::GLVertexBuffer,
OpenSubdiv::Osd::GLStencilTablesTBO,
OpenSubdiv::Osd::GLStencilTableTBO,
OpenSubdiv::Osd::GLXFBEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,
@ -1011,7 +1011,7 @@ createOsdMesh(int level, int kernel) {
} else if (kernel == kGLSLCompute) {
static OpenSubdiv::Osd::EvaluatorCacheT<OpenSubdiv::Osd::GLComputeEvaluator> glComputeEvaluatorCache;
g_mesh = new OpenSubdiv::Osd::Mesh<OpenSubdiv::Osd::GLVertexBuffer,
OpenSubdiv::Osd::GLStencilTablesSSBO,
OpenSubdiv::Osd::GLStencilTableSSBO,
OpenSubdiv::Osd::GLComputeEvaluator,
OpenSubdiv::Osd::GLPatchTable>(
refiner,

View File

@ -43,7 +43,7 @@ GLFWwindow* g_window=0;
GLFWmonitor* g_primary=0;
#include <far/error.h>
#include <far/stencilTables.h>
#include <far/stencilTable.h>
#include <far/ptexIndices.h>
#include <osd/mesh.h>
@ -891,31 +891,31 @@ rebuildTopology() {
if (g_kernel == kCPU) {
g_scene = new Scene<Osd::CpuEvaluator,
Osd::CpuGLVertexBuffer,
Far::StencilTables>(g_options);
Far::StencilTable>(g_options);
#ifdef OPENSUBDIV_HAS_OPENMP
} else if (g_kernel == kOPENMP) {
g_scene = new Scene<Osd::OmpEvaluator,
Osd::CpuGLVertexBuffer,
Far::StencilTables>(g_options);
Far::StencilTable>(g_options);
#endif
#ifdef OPENSUBDIV_HAS_TBB
} else if (g_kernel == kTBB) {
g_scene = new Scene<Osd::TbbEvaluator,
Osd::CpuGLVertexBuffer,
Far::StencilTables>(g_options);
Far::StencilTable>(g_options);
#endif
#ifdef OPENSUBDIV_HAS_CUDA
} else if (g_kernel == kCUDA) {
g_scene = new Scene<Osd::CudaEvaluator,
Osd::CudaGLVertexBuffer,
Osd::CudaStencilTables>(g_options);
Osd::CudaStencilTable>(g_options);
#endif
#ifdef OPENSUBDIV_HAS_OPENCL
} else if (g_kernel == kCL) {
static Osd::EvaluatorCacheT<Osd::CLEvaluator> clEvaluatorCache;
g_scene = new Scene<Osd::CLEvaluator,
Osd::CLGLVertexBuffer,
Osd::CLStencilTables,
Osd::CLStencilTable,
CLDeviceContext>(g_options, &clEvaluatorCache,
&g_clDeviceContext);
#endif
@ -924,14 +924,14 @@ rebuildTopology() {
static Osd::EvaluatorCacheT<Osd::GLXFBEvaluator> glXFBEvaluatorCache;
g_scene = new Scene<Osd::GLXFBEvaluator,
Osd::GLVertexBuffer,
Osd::GLStencilTablesTBO>(g_options, &glXFBEvaluatorCache);
Osd::GLStencilTableTBO>(g_options, &glXFBEvaluatorCache);
#endif
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
} else if (g_kernel == kGLSLCompute) {
static Osd::EvaluatorCacheT<Osd::GLComputeEvaluator> glComputeEvaluatorCache;
g_scene = new Scene<Osd::GLComputeEvaluator,
Osd::GLVertexBuffer,
Osd::GLStencilTablesSSBO>(g_options, &glComputeEvaluatorCache);
Osd::GLStencilTableSSBO>(g_options, &glComputeEvaluatorCache);
#endif
}

View File

@ -29,17 +29,17 @@
template <class EVALUATOR,
class VERTEX_BUFFER,
class STENCIL_TABLES,
class STENCIL_TABLE,
class DEVICE_CONTEXT=void>
class MeshRefiner {
public:
typedef EVALUATOR Evaluator;
typedef STENCIL_TABLES StencilTables;
typedef STENCIL_TABLE StencilTable;
typedef DEVICE_CONTEXT DeviceContext;
typedef OpenSubdiv::Osd::EvaluatorCacheT<Evaluator> 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<StencilTables>(
_vertexStencils = OpenSubdiv::Osd::convertToCompatibleStencilTable<StencilTable>(
vertexStencils, deviceContext);
_varyingStencils = OpenSubdiv::Osd::convertToCompatibleStencilTables<StencilTables>(
_varyingStencils = OpenSubdiv::Osd::convertToCompatibleStencilTable<StencilTable>(
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;
};

View File

@ -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 =

View File

@ -24,8 +24,8 @@
#include <limits>
#include <common/vtr_utils.h>
#include <far/patchTablesFactory.h>
#include <far/stencilTablesFactory.h>
#include <far/patchTableFactory.h>
#include <far/stencilTableFactory.h>
#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<int> const &sharpnessIndexTable =
patchTables->GetSharpnessIndexTable();
patchTable->GetSharpnessIndexTable();
std::vector<float> 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

View File

@ -26,7 +26,7 @@
#define OPENSUBDIV_EXAMPLES_GL_SHARE_TOPOLOGY_SCENE_BASE_H
#include <far/patchDescriptor.h>
#include <far/patchTables.h>
#include <far/patchTable.h>
#include <osd/vertexDescriptor.h>
#include <osd/opengl.h>
@ -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<Object> _objects;
std::vector<Topology> _topologies;
std::vector<OpenSubdiv::Far::PatchTables const *> _patchTables;
std::vector<OpenSubdiv::Far::PatchTable const *> _patchTables;
GLuint _indexBuffer;
GLuint _patchParamTexture;
BatchVector _batches;

View File

@ -48,9 +48,9 @@ GLFWmonitor* g_primary=0;
#include "../common/glUtils.h"
#include "../common/glHud.h"
#include <far/patchTablesFactory.h>
#include <far/patchTableFactory.h>
#include <far/ptexIndices.h>
#include <far/stencilTablesFactory.h>
#include <far/stencilTableFactory.h>
#include <osd/cpuGLVertexBuffer.h>
#include <osd/cpuVertexBuffer.h>
@ -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;

View File

@ -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<float> const & fvarSrcData) {
Release();
OpenSubdiv::Far::ConstIndexArray indices =
patchTables->GetFVarPatchesValues(0);
patchTable->GetFVarPatchesValues(0);
// expand fvardata to per-patch array
std::vector<float> data;
@ -582,7 +582,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
if (kernel == kCPU) {
g_mesh = new Osd::Mesh<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::CpuEvaluator,
Osd::GLPatchTable>(
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<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::OmpEvaluator,
Osd::GLPatchTable>(
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<Osd::CpuGLVertexBuffer,
Far::StencilTables,
Far::StencilTable,
Osd::TbbEvaluator,
Osd::GLPatchTable>(
refiner,
@ -616,7 +616,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
// CLKernel
static Osd::EvaluatorCacheT<Osd::CLEvaluator> clEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::CLGLVertexBuffer,
Osd::CLStencilTables,
Osd::CLStencilTable,
Osd::CLEvaluator,
Osd::GLPatchTable,
CLDeviceContext>(
@ -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<Osd::CudaGLVertexBuffer,
Osd::CudaStencilTables,
Osd::CudaStencilTable,
Osd::CudaEvaluator,
Osd::GLPatchTable>(
refiner,
@ -642,7 +642,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
} else if(kernel == kGLSL) {
static Osd::EvaluatorCacheT<Osd::GLXFBEvaluator> glXFBEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::GLVertexBuffer,
Osd::GLStencilTablesTBO,
Osd::GLStencilTableTBO,
Osd::GLXFBEvaluator,
Osd::GLPatchTable>(
refiner,
@ -655,7 +655,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level, int kernel, Scheme scheme=
} else if(kernel == kGLSLCompute) {
static Osd::EvaluatorCacheT<Osd::GLComputeEvaluator> glComputeEvaluatorCache;
g_mesh = new Osd::Mesh<Osd::GLVertexBuffer,
Osd::GLStencilTablesSSBO,
Osd::GLStencilTableSSBO,
Osd::GLComputeEvaluator,
Osd::GLPatchTable>(
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));

View File

@ -61,7 +61,7 @@
// OpenSubdiv includes
#include <far/topologyRefinerFactory.h>
#include <far/stencilTablesFactory.h>
#include <far/stencilTableFactory.h>
#include <osd/mesh.h>
#include <osd/cpuVertexBuffer.h>

View File

@ -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 <cassert>

View File

@ -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:

View File

@ -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 <cassert>
@ -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);

View File

@ -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:

View File

@ -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
@ -117,7 +117,7 @@ EndCapLegacyGregoryPatchFactory::Finalize(
quadOffsetsTable->resize(numTotalGregoryPatches*4);
if (numTotalGregoryPatches > 0) {
PatchTables::QuadOffsetsTable::value_type *p =
PatchTable::QuadOffsetsTable::value_type *p =
&((*quadOffsetsTable)[0]);
for (size_t i = 0; i < numGregoryPatches; ++i) {
getQuadOffsets(level, _gregoryFaceIndices[i], p);
@ -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;

View File

@ -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:

View File

@ -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

View File

@ -241,7 +241,7 @@ public:
typedef std::vector<GregoryBasis::Point> PointsVector;
static StencilTables *CreateStencilTables(PointsVector const &stencils);
static StencilTable *CreateStencilTable(PointsVector const &stencils);
private:

View File

@ -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<narrays; ++parray) {
ConstPatchParamArray params = patchTables.GetPatchParams(parray);
ConstPatchParamArray params = patchTable.GetPatchParams(parray);
int ringsize = patchTables.GetPatchArrayDescriptor(parray).GetNumControlVertices();
int ringsize = patchTable.GetPatchArrayDescriptor(parray).GetNumControlVertices();
for (Index j=0; j < patchTables.GetNumPatches(parray); ++j) {
for (Index j=0; j < patchTable.GetNumPatches(parray); ++j) {
Handle & h = _handles[current];
@ -107,9 +107,9 @@ PatchMap::initialize( PatchTables const & patchTables ) {
// populate the quadtree from the FarPatchArrays sub-patches
for (Index parray=0, handleIndex=0; parray<narrays; ++parray) {
ConstPatchParamArray params = patchTables.GetPatchParams(parray);
ConstPatchParamArray params = patchTable.GetPatchParams(parray);
for (int i=0; i < patchTables.GetNumPatches(parray); ++i, ++handleIndex) {
for (int i=0; i < patchTable.GetNumPatches(parray); ++i, ++handleIndex) {
PatchParam::BitField bits = params[i].bitField;

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/patchTables.h"
#include "../far/patchTable.h"
#include <cassert>
@ -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 {

View File

@ -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 <cstring>
@ -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<Index> 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<Index> 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<pa.numPatches);
return pa.patchIndex + patchIndex;
}
Index *
PatchTables::getSharpnessIndices(int arrayIndex) {
PatchTable::getSharpnessIndices(int arrayIndex) {
return &_sharpnessIndices[getPatchArray(arrayIndex).patchIndex];
}
float *
PatchTables::getSharpnessValues(int arrayIndex) {
PatchTable::getSharpnessValues(int arrayIndex) {
return &_sharpnessValues[getPatchArray(arrayIndex).patchIndex];
}
PatchDescriptor
PatchTables::GetPatchDescriptor(PatchHandle const & handle) const {
PatchTable::GetPatchDescriptor(PatchHandle const & handle) const {
return getPatchArray(handle.arrayIndex).desc;
}
PatchDescriptor
PatchTables::GetPatchArrayDescriptor(int arrayIndex) const {
PatchTable::GetPatchArrayDescriptor(int arrayIndex) const {
return getPatchArray(arrayIndex).desc;
}
int
PatchTables::GetNumPatchArrays() const {
PatchTable::GetNumPatchArrays() const {
return (int)_patchArrays.size();
}
int
PatchTables::GetNumPatches(int arrayIndex) const {
PatchTable::GetNumPatches(int arrayIndex) const {
return getPatchArray(arrayIndex).numPatches;
}
int
PatchTables::GetNumPatchesTotal() const {
PatchTable::GetNumPatchesTotal() const {
// there is one PatchParam record for each patch in the mesh
return (int)_paramTable.size();
}
int
PatchTables::GetNumControlVertices(int arrayIndex) const {
PatchTable::GetNumControlVertices(int arrayIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
return pa.numPatches * getPatchSize(pa.desc);
}
Index
PatchTables::findPatchArray(PatchDescriptor desc) {
PatchTable::findPatchArray(PatchDescriptor desc) {
for (int i=0; i<(int)_patchArrays.size(); ++i) {
if (_patchArrays[i].desc==desc)
return i;
@ -324,14 +324,14 @@ PatchTables::findPatchArray(PatchDescriptor desc) {
return Vtr::INDEX_INVALID;
}
IndexArray
PatchTables::getPatchArrayVertices(int arrayIndex) {
PatchTable::getPatchArrayVertices(int arrayIndex) {
PatchArray const & pa = getPatchArray(arrayIndex);
int size = getPatchSize(pa.desc);
assert(pa.vertIndex<(Index)_patchVerts.size());
return IndexArray(&_patchVerts[pa.vertIndex], pa.numPatches * size);
}
ConstIndexArray
PatchTables::GetPatchArrayVertices(int arrayIndex) const {
PatchTable::GetPatchArrayVertices(int arrayIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
int size = getPatchSize(pa.desc);
assert(pa.vertIndex<(Index)_patchVerts.size());
@ -339,13 +339,13 @@ PatchTables::GetPatchArrayVertices(int arrayIndex) const {
}
ConstIndexArray
PatchTables::GetPatchVertices(PatchHandle const & handle) const {
PatchTable::GetPatchVertices(PatchHandle const & handle) const {
PatchArray const & pa = getPatchArray(handle.arrayIndex);
Index vert = pa.vertIndex + handle.vertIndex;
return ConstIndexArray(&_patchVerts[vert], getPatchSize(pa.desc));
}
ConstIndexArray
PatchTables::GetPatchVertices(int arrayIndex, int patchIndex) const {
PatchTable::GetPatchVertices(int arrayIndex, int patchIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
int size = getPatchSize(pa.desc);
assert((pa.vertIndex + patchIndex*size)<(Index)_patchVerts.size());
@ -353,29 +353,29 @@ PatchTables::GetPatchVertices(int arrayIndex, int patchIndex) const {
}
PatchParam
PatchTables::GetPatchParam(PatchHandle const & handle) const {
PatchTable::GetPatchParam(PatchHandle const & handle) const {
assert(handle.patchIndex < (Index)_paramTable.size());
return _paramTable[handle.patchIndex];
}
PatchParam
PatchTables::GetPatchParam(int arrayIndex, int patchIndex) const {
PatchTable::GetPatchParam(int arrayIndex, int patchIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
assert((pa.patchIndex + patchIndex) < (int)_paramTable.size());
return _paramTable[pa.patchIndex + patchIndex];
}
PatchParamArray
PatchTables::getPatchParams(int arrayIndex) {
PatchTable::getPatchParams(int arrayIndex) {
PatchArray const & pa = getPatchArray(arrayIndex);
return PatchParamArray(&_paramTable[pa.patchIndex], pa.numPatches);
}
ConstPatchParamArray const
PatchTables::GetPatchParams(int arrayIndex) const {
PatchTable::GetPatchParams(int arrayIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
return ConstPatchParamArray(&_paramTable[pa.patchIndex], pa.numPatches);
}
float
PatchTables::GetSingleCreasePatchSharpnessValue(PatchHandle const & handle) const {
PatchTable::GetSingleCreasePatchSharpnessValue(PatchHandle const & handle) const {
assert((handle.patchIndex) < (int)_sharpnessIndices.size());
Index index = _sharpnessIndices[handle.patchIndex];
if (index == Vtr::INDEX_INVALID) {
@ -385,7 +385,7 @@ PatchTables::GetSingleCreasePatchSharpnessValue(PatchHandle const & handle) cons
return _sharpnessValues[index];
}
float
PatchTables::GetSingleCreasePatchSharpnessValue(int arrayIndex, int patchIndex) const {
PatchTable::GetSingleCreasePatchSharpnessValue(int arrayIndex, int patchIndex) const {
PatchArray const & pa = getPatchArray(arrayIndex);
assert((pa.patchIndex + patchIndex) < (int)_sharpnessIndices.size());
Index index = _sharpnessIndices[pa.patchIndex + patchIndex];
@ -396,13 +396,13 @@ PatchTables::GetSingleCreasePatchSharpnessValue(int arrayIndex, int patchIndex)
return _sharpnessValues[index];
}
PatchTables::ConstQuadOffsetsArray
PatchTables::GetPatchQuadOffsets(PatchHandle const & handle) const {
PatchTable::ConstQuadOffsetsArray
PatchTable::GetPatchQuadOffsets(PatchHandle const & handle) const {
PatchArray const & pa = getPatchArray(handle.arrayIndex);
return Vtr::ConstArray<unsigned int>(&_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<PatchDescriptor::Type>
PatchTables::getFVarPatchTypes(int channel) {
PatchTable::getFVarPatchTypes(int channel) {
FVarPatchChannel & c = getFVarPatchChannel(channel);
return Vtr::Array<PatchDescriptor::Type>(&c.patchTypes[0],
(int)c.patchTypes.size());
}
Vtr::ConstArray<PatchDescriptor::Type>
PatchTables::GetFVarPatchTypes(int channel) const {
PatchTable::GetFVarPatchTypes(int channel) const {
FVarPatchChannel const & c = getFVarPatchChannel(channel);
if (c.patchesType!=PatchDescriptor::NON_PATCH) {
return Vtr::ConstArray<PatchDescriptor::Type>(&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<GetNumPatchArrays(); ++i) {
printf(" patchArray %d:\n", i);
@ -512,7 +512,7 @@ PatchTables::print() const {
// Evaluate basis functions for position and first derivatives at (s,t):
//
void
PatchTables::EvaluateBasis(PatchHandle const & handle, float s, float t,
PatchTable::EvaluateBasis(PatchHandle const & handle, float s, float t,
float wP[], float wDs[], float wDt[]) const {
PatchDescriptor::Type patchType = GetPatchArrayDescriptor(handle.arrayIndex).GetType();

View File

@ -22,14 +22,14 @@
// language governing permissions and limitations under the Apache License.
//
#ifndef OPENSUBDIV3_FAR_PATCH_TABLES_H
#define OPENSUBDIV3_FAR_PATCH_TABLES_H
#ifndef OPENSUBDIV3_FAR_PATCH_TABLE_H
#define OPENSUBDIV3_FAR_PATCH_TABLE_H
#include "../version.h"
#include "../far/patchDescriptor.h"
#include "../far/patchParam.h"
#include "../far/stencilTables.h"
#include "../far/stencilTable.h"
#include "../sdc/options.h"
@ -46,26 +46,26 @@ namespace Far {
/// \brief Container for arrays of parametric patches
///
/// PatchTables contain topology and parametric information about the patches
/// generated by the Refinement process. Patches in the tables are sorted into
/// PatchTable contain topology and parametric information about the patches
/// generated by the Refinement process. Patches in the table are sorted into
/// arrays based on their PatchDescriptor Type.
///
/// Note : PatchTables can be accessed either using a PatchHandle or a
/// Note : PatchTable can be accessed either using a PatchHandle or a
/// combination of array and patch indices.
///
/// XXXX manuelk we should add a PatchIterator that can dereference into
/// a PatchHandle for fast linear traversal of the tables
/// a PatchHandle for fast linear traversal of the table
///
class PatchTables {
class PatchTable {
public:
/// \brief Handle that can be used as unique patch identifier within PatchTables
/// \brief Handle that can be used as unique patch identifier within PatchTable
class PatchHandle {
// XXXX manuelk members will eventually be made private
public:
friend class PatchTables;
friend class PatchTable;
friend class PatchMap;
Index arrayIndex, // Array index of the patch
@ -76,20 +76,20 @@ public:
public:
/// \brief Copy constructor
PatchTables(PatchTables const & src);
PatchTable(PatchTable const & src);
/// \brief Destructor
~PatchTables();
~PatchTable();
/// \brief True if the patches are of feature adaptive types
bool IsFeatureAdaptive() const;
/// \brief Returns the total number of control vertex indices in the tables
/// \brief Returns the total number of control vertex indices in the table
int GetNumControlVerticesTotal() const {
return (int)_patchVerts.size();
}
/// \brief Returns the total number of patches stored in the tables
/// \brief Returns the total number of patches stored in the table
int GetNumPatchesTotal() const;
/// \brief Returns max vertex valence
@ -172,16 +172,16 @@ public:
return _vertexValenceTable;
}
/// \brief Returns the basis conversion stencil tables to get endcap patch points.
/// \brief Returns the basis conversion stencil table to get endcap patch points.
/// This stencil is relative to the max level refined vertices.
StencilTables const *GetEndCapVertexStencilTables() const {
return _vertexStencilTables;
StencilTable const *GetEndCapVertexStencilTable() const {
return _vertexStencilTable;
}
/// \brief Returns the varying stencil tables for the endcap patches
/// which has same ordering as the endcap vertex stencil tables.
StencilTables const *GetEndCapVaryingStencilTables() const {
return _varyingStencilTables;
/// \brief Returns the varying stencil table for the endcap patches
/// which has same ordering as the endcap vertex stencil table.
StencilTable const *GetEndCapVaryingStencilTable() const {
return _varyingStencilTable;
}
//@}
@ -304,10 +304,10 @@ public:
protected:
friend class PatchTablesFactory;
friend class PatchTableFactory;
// Factory constructor
PatchTables(int maxvalence);
PatchTable(int maxvalence);
Index getPatchIndex(int array, int patch) const;
@ -386,8 +386,8 @@ private:
//
QuadOffsetsTable _quadOffsetsTable; // Quad offsets (for Gregory patches)
VertexValenceTable _vertexValenceTable; // Vertex valence table (for Gregory patches)
StencilTables const * _vertexStencilTables; // endcap basis conversion stencils
StencilTables const * _varyingStencilTables; // endcap varying stencils (for convenience)
StencilTable const * _vertexStencilTable; // endcap basis conversion stencils
StencilTable const * _varyingStencilTable; // endcap varying stencils (for convenience)
//
// Face-varying data
@ -410,4 +410,4 @@ using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif /* OPENSUBDIV3_FAR_PATCH_TABLES */
#endif /* OPENSUBDIV3_FAR_PATCH_TABLE */

View File

@ -21,7 +21,7 @@
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "../far/patchTablesFactory.h"
#include "../far/patchTableFactory.h"
#include "../far/error.h"
#include "../far/ptexIndices.h"
#include "../far/topologyRefiner.h"
@ -91,12 +91,12 @@ typedef PatchTypes<Far::Index **> 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; i<tables->GetNumPatchArrays(); ++i) {
npatches += tables->GetNumPatches(i);
ncvs += tables->GetNumControlVertices(i);
for (int i=0; i<table->GetNumPatchArrays(); ++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<PatchDescriptor::Type> 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<float> & 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; vert<fvalues.size(); ++vert) {
assert((levelVertOffset + fvalues[vert]) < (int)tables->getFVarPatchesValues(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; i<descs.size(); ++i) {
PatchDescriptor desc = descs[i];
context.tables->pushPatchArray(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()]);
}
}

View File

@ -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<T>::AdaptiveFlags, this struct aggregates all of the face tags
// supporting feature adaptive refinement. For now it is not used elsewhere and can
@ -125,15 +125,15 @@ 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,
static PatchTable * Create(TopologyRefiner const & refiner,
Options options=Options());
private:
@ -145,10 +145,10 @@ private:
//
// Methods for allocating and managing the patch table data arrays:
//
static PatchTables * createUniform(TopologyRefiner const & refiner,
static PatchTable * createUniform(TopologyRefiner const & refiner,
Options options);
static PatchTables * createAdaptive(TopologyRefiner const & refiner,
static PatchTable * createAdaptive(TopologyRefiner const & refiner,
Options options);
//
@ -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 */

View File

@ -25,7 +25,7 @@
#ifndef OPENSUBDIV3_FAR_PROTOSTENCIL_H
#define OPENSUBDIV3_FAR_PROTOSTENCIL_H
#include "../far/stencilTables.h"
#include "../far/stencilTable.h"
#include <cstring>
#include <map>
@ -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<table.GetNumStencils());

View File

@ -22,8 +22,8 @@
// language governing permissions and limitations under the Apache License.
//
#ifndef OPENSUBDIV3_FAR_STENCILTABLES_H
#define OPENSUBDIV3_FAR_STENCILTABLES_H
#ifndef OPENSUBDIV3_FAR_STENCILTABLE_H
#define OPENSUBDIV3_FAR_STENCILTABLE_H
#include "../version.h"
@ -39,7 +39,7 @@ namespace Far {
/// \brief Vertex stencil descriptor
///
/// Allows access and manipulation of a single stencil in a StencilTables.
/// Allows access and manipulation of a single stencil in a StencilTable.
///
class Stencil {
@ -100,8 +100,8 @@ public:
}
protected:
friend class StencilTablesFactory;
friend class LimitStencilTablesFactory;
friend class StencilTableFactory;
friend class LimitStencilTableFactory;
int * _size;
Index * _indices;
@ -120,7 +120,7 @@ protected:
/// recomputed simply by applying the blending weights to the series of coarse
/// control vertices.
///
class StencilTables {
class StencilTable {
public:
@ -134,7 +134,7 @@ public:
return _numControlVertices;
}
/// \brief Returns a Stencil at index i in the tables
/// \brief Returns a Stencil at index i in the table
Stencil GetStencil(Index i) const;
/// \brief Returns the number of control vertices of each stencil in the table
@ -157,7 +157,7 @@ public:
return _weights;
}
/// \brief Returns the stencil at index i in the tables
/// \brief Returns the stencil at index i in the table
Stencil operator[] (Index index) const;
/// \brief Updates point values based on the control values
@ -202,9 +202,9 @@ protected:
void resize(int nstencils, int nelems);
protected:
StencilTables() : _numControlVertices(0) {}
StencilTable() : _numControlVertices(0) {}
friend class StencilTablesFactory;
friend class StencilTableFactory;
// XXX: temporarily, GregoryBasis class will go away.
friend class GregoryBasis;
@ -267,8 +267,8 @@ public:
private:
friend class StencilTablesFactory;
friend class LimitStencilTablesFactory;
friend class StencilTableFactory;
friend class LimitStencilTableFactory;
float * _duWeights, // pointer to stencil u derivative limit weights
* _dvWeights; // pointer to stencil v derivative limit weights
@ -277,7 +277,7 @@ private:
/// \brief Table of limit subdivision stencils.
///
///
class LimitStencilTables : public StencilTables {
class LimitStencilTable : public StencilTable {
public:
@ -318,13 +318,13 @@ public:
/// \brief Clears the stencils from the table
void Clear() {
StencilTables::Clear();
StencilTable::Clear();
_duWeights.clear();
_dvWeights.clear();
}
private:
friend class LimitStencilTablesFactory;
friend class LimitStencilTableFactory;
// Resize the table arrays (factory helper)
void resize(int nstencils, int nelems);
@ -337,7 +337,7 @@ private:
// Update values by appling cached stencil weights to new control values
template <class T> void
StencilTables::update(T const *controlValues, T *values,
StencilTable::update(T const *controlValues, T *values,
std::vector<float> 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

View File

@ -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; i<numTables; ++i) {
StencilTables const * st = tables[i];
StencilTable const * st = tables[i];
// allow the tables could have a null entry.
if (!st) continue;
@ -227,14 +227,14 @@ StencilTablesFactory::Create(int numTables, StencilTables const ** tables) {
return NULL;
}
StencilTables * result = new StencilTables;
StencilTable * result = new StencilTable;
result->resize(nstencils, nelems);
int * sizes = &result->_sizes[0];
Index * indices = &result->_indices[0];
float * weights = &result->_weights[0];
for (int i=0; i<numTables; ++i) {
StencilTables const * st = tables[i];
StencilTable const * st = tables[i];
if (!st) continue;
int st_nstencils = st->GetNumStencils(),
@ -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) {

View File

@ -27,7 +27,7 @@
#include "../version.h"
#include "../far/patchTables.h"
#include "../far/patchTable.h"
#include <vector>
@ -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<LocationArray> 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);
};

View File

@ -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;

View File

@ -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<T> const & src, cl_context clContext) {
// ----------------------------------------------------------------------------
CLStencilTables::CLStencilTables(Far::StencilTables const *stencilTables,
CLStencilTable::CLStencilTable(Far::StencilTable const *stencilTable,
cl_context clContext) {
_numStencils = stencilTables->GetNumStencils();
_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);

View File

@ -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 <typename DEVICE_CONTEXT>
static CLStencilTables *Create(Far::StencilTables const *stencilTables,
static CLStencilTable *Create(Far::StencilTable const *stencilTable,
DEVICE_CONTEXT context) {
return new CLStencilTables(stencilTables, context->GetContext());
return new CLStencilTable(stencilTable, context->GetContext());
}
CLStencilTables(Far::StencilTables const *stencilTables,
CLStencilTable(Far::StencilTable const *stencilTable,
cl_context clContext);
~CLStencilTables();
~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

View File

@ -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;

View File

@ -30,7 +30,7 @@
#include <cstddef>
#include <vector>
#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*/) {

View File

@ -27,7 +27,7 @@
#include <cuda_runtime.h>
#include <vector>
#include "../far/stencilTables.h"
#include "../far/stencilTable.h"
extern "C" {
void CudaEvalStencils(const float *src,
@ -69,19 +69,19 @@ createCudaBuffer(std::vector<T> 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);

View File

@ -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,
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

View File

@ -35,7 +35,7 @@
#include <D3Dcompiler.h>
#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,
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<int> const &sizes = stencilTables->GetSizes();
std::vector<int> 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);

View File

@ -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 <typename DEVICE_CONTEXT>
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

View File

@ -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;
}
}

View File

@ -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<typename DEVICE_CONTEXT>
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,

View File

@ -25,7 +25,7 @@
#include "../osd/d3d11PatchTable.h"
#include <D3D11.h>
#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<unsigned int> 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<Far::Index> 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

View File

@ -40,7 +40,7 @@ namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far{
class PatchTables;
class PatchTable;
};
namespace Osd {
@ -80,12 +80,12 @@ public:
~D3D11PatchTable();
template<typename DEVICE_CONTEXT>
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;

View File

@ -30,7 +30,7 @@
#include <vector>
#include "../far/error.h"
#include "../far/stencilTables.h"
#include "../far/stencilTable.h"
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
@ -65,20 +65,20 @@ createSSBO(std::vector<T> 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);

View File

@ -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,

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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<Far::Index> 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

View File

@ -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;

View File

@ -30,7 +30,7 @@
#include <cstdio>
#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<T> 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);

View File

@ -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; }

View File

@ -33,9 +33,9 @@
#include <vector>
#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 <typename STENCIL_TABLES, typename DEVICE_CONTEXT>
STENCIL_TABLES const *
convertToCompatibleStencilTables(
Far::StencilTables const *table, DEVICE_CONTEXT *context) {
template <typename STENCIL_TABLE, typename DEVICE_CONTEXT>
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, void>(
Far::StencilTables const *table, void * /*context*/) {
Far::StencilTable const *
convertToCompatibleStencilTable<Far::StencilTable, void>(
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, ID3D11DeviceContext>(
Far::StencilTables const *table, ID3D11DeviceContext * /*context*/) {
Far::StencilTable const *
convertToCompatibleStencilTable<Far::StencilTable, ID3D11DeviceContext>(
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 <typename VERTEX_BUFFER,
typename STENCIL_TABLES,
typename STENCIL_TABLE,
typename EVALUATOR,
typename PATCH_TABLE,
typename DEVICE_CONTEXT = void>
@ -239,7 +239,7 @@ class Mesh : public MeshInterface<PATCH_TABLE> {
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<Evaluator> 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,
vertexStencils = Far::StencilTableFactory::Create(*_refiner,
options);
}
if (numVaryingElements>0) {
options.interpolationMode =
Far::StencilTablesFactory::INTERPOLATE_VARYING;
Far::StencilTableFactory::INTERPOLATE_VARYING;
varyingStencils = Far::StencilTablesFactory::Create(*_refiner,
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<StencilTables>(
// convert to device stenciltable if necessary.
_vertexStencilTable =
convertToCompatibleStencilTable<StencilTable>(
vertexStencils, _deviceContext);
_varyingStencilTables =
convertToCompatibleStencilTables<StencilTables>(
_varyingStencilTable =
convertToCompatibleStencilTable<StencilTable>(
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;

View File

@ -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:
//

View File

@ -45,7 +45,7 @@ namespace Far {
template <class MESH> class TopologyRefinerFactory;
class TopologyRefinerFactoryBase;
class TopologyRefiner;
class PatchTablesFactory;
class PatchTableFactory;
}
namespace Vtr {
@ -336,7 +336,7 @@ protected:
template <class MESH> 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);

View File

@ -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);

View File

@ -52,7 +52,7 @@ GLFWwindow* g_window=0;
#include <osd/cpuGLVertexBuffer.h>
#include <far/stencilTablesFactory.h>
#include <far/stencilTableFactory.h>
#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<xyzVV>& 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<xyzVV>& 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());

View File

@ -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 <opensubdiv/far/topologyRefinerFactory.h>
#include <opensubdiv/far/stencilTables.h>
#include <opensubdiv/far/stencilTablesFactory.h>
#include <opensubdiv/far/stencilTable.h>
#include <opensubdiv/far/stencilTableFactory.h>
#include <cstdio>
#include <cstring>
@ -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<Vertex> 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;
}
//------------------------------------------------------------------------------

View File

@ -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 <opensubdiv/far/topologyRefinerFactory.h>
#include <opensubdiv/far/stencilTables.h>
#include <opensubdiv/far/stencilTablesFactory.h>
#include <opensubdiv/far/stencilTable.h>
#include <opensubdiv/far/stencilTableFactory.h>
#include <cstdio>
#include <cstring>
@ -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)

View File

@ -41,7 +41,7 @@
//
#include <opensubdiv/far/topologyRefinerFactory.h>
#include <opensubdiv/far/patchTablesFactory.h>
#include <opensubdiv/far/patchTableFactory.h>
#include <opensubdiv/far/endCapGregoryBasisPatchFactory.h>
#include <opensubdiv/far/patchMap.h>
#include <opensubdiv/far/ptexIndices.h>
@ -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();

View File

@ -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 <opensubdiv/far/topologyRefinerFactory.h>
#include <opensubdiv/far/stencilTables.h>
#include <opensubdiv/far/stencilTablesFactory.h>
#include <opensubdiv/far/stencilTable.h>
#include <opensubdiv/far/stencilTableFactory.h>
#include <cstdio>
#include <cstring>
@ -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<Vertex> 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;
}
//------------------------------------------------------------------------------

View File

@ -31,7 +31,7 @@
//
#include <opensubdiv/far/topologyRefinerFactory.h>
#include <opensubdiv/far/stencilTablesFactory.h>
#include <opensubdiv/far/stencilTableFactory.h>
#include <opensubdiv/osd/cpuEvaluator.h>
#include <opensubdiv/osd/cpuVertexBuffer.h>
@ -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;
}