2014-09-19 00:48:34 +00:00
|
|
|
//
|
|
|
|
// Copyright 2013 Pixar
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
#include "../far/patchTable.h"
|
2015-05-20 22:44:29 +00:00
|
|
|
#include "../far/patchBasis.h"
|
2014-09-19 00:48:34 +00:00
|
|
|
|
|
|
|
#include <cstring>
|
2015-02-26 21:57:47 +00:00
|
|
|
#include <cstdio>
|
2014-09-19 00:48:34 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2014-10-09 21:48:50 +00:00
|
|
|
namespace Far {
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::PatchTable(int maxvalence) :
|
2015-04-23 23:58:45 +00:00
|
|
|
_maxValence(maxvalence),
|
2018-07-28 21:56:43 +00:00
|
|
|
_localPointStencils(),
|
|
|
|
_localPointVaryingStencils(),
|
|
|
|
_varyingDesc(Far::PatchDescriptor::QUADS),
|
|
|
|
_vertexPrecisionIsDouble(false),
|
|
|
|
_varyingPrecisionIsDouble(false),
|
|
|
|
_faceVaryingPrecisionIsDouble(false) {
|
2015-04-18 00:36:55 +00:00
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
|
|
|
|
// Copy constructor
|
|
|
|
// XXXX manuelk we need to eliminate this constructor (C++11 smart pointers)
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::PatchTable(PatchTable const & src) :
|
2014-11-25 20:41:19 +00:00
|
|
|
_maxValence(src._maxValence),
|
|
|
|
_numPtexFaces(src._numPtexFaces),
|
|
|
|
_patchArrays(src._patchArrays),
|
|
|
|
_patchVerts(src._patchVerts),
|
|
|
|
_paramTable(src._paramTable),
|
|
|
|
_quadOffsetsTable(src._quadOffsetsTable),
|
|
|
|
_vertexValenceTable(src._vertexValenceTable),
|
2016-09-29 16:51:19 +00:00
|
|
|
_localPointStencils(src._localPointStencils),
|
|
|
|
_localPointVaryingStencils(src._localPointVaryingStencils),
|
|
|
|
_varyingDesc(src._varyingDesc),
|
2015-02-26 21:57:47 +00:00
|
|
|
_fvarChannels(src._fvarChannels),
|
2014-11-25 20:41:19 +00:00
|
|
|
_sharpnessIndices(src._sharpnessIndices),
|
2018-07-28 21:56:43 +00:00
|
|
|
_sharpnessValues(src._sharpnessValues),
|
|
|
|
_vertexPrecisionIsDouble(src._vertexPrecisionIsDouble),
|
|
|
|
_varyingPrecisionIsDouble(src._varyingPrecisionIsDouble),
|
|
|
|
_faceVaryingPrecisionIsDouble(src._faceVaryingPrecisionIsDouble) {
|
2015-04-23 23:58:45 +00:00
|
|
|
|
2018-07-28 21:56:43 +00:00
|
|
|
if (src._localPointStencils.IsSet()) {
|
|
|
|
_localPointStencils = src._localPointStencils.Clone();
|
2015-04-23 23:58:45 +00:00
|
|
|
}
|
2018-07-28 21:56:43 +00:00
|
|
|
if (src._localPointVaryingStencils.IsSet()) {
|
|
|
|
_localPointVaryingStencils = src._localPointVaryingStencils.Clone();
|
2015-04-23 23:58:45 +00:00
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
if (! src._localPointFaceVaryingStencils.empty()) {
|
|
|
|
_localPointFaceVaryingStencils.resize(src._localPointFaceVaryingStencils.size());
|
|
|
|
for (int fvc=0; fvc<(int)_localPointFaceVaryingStencils.size(); ++fvc) {
|
2018-07-28 21:56:43 +00:00
|
|
|
_localPointFaceVaryingStencils[fvc] = src._localPointFaceVaryingStencils[fvc].Clone();
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::~PatchTable() {
|
2018-07-28 21:56:43 +00:00
|
|
|
_localPointStencils.Delete();
|
|
|
|
_localPointVaryingStencils.Delete();
|
2016-07-19 23:39:33 +00:00
|
|
|
for (int fvc=0; fvc<(int)_localPointFaceVaryingStencils.size(); ++fvc) {
|
2018-07-28 21:56:43 +00:00
|
|
|
_localPointFaceVaryingStencils[fvc].Delete();
|
|
|
|
}
|
2014-11-11 19:27:25 +00:00
|
|
|
}
|
|
|
|
|
2014-10-09 21:48:50 +00:00
|
|
|
//
|
2014-11-25 20:41:19 +00:00
|
|
|
// PatchArrays
|
2014-10-09 21:48:50 +00:00
|
|
|
//
|
2015-05-22 18:50:01 +00:00
|
|
|
struct PatchTable::PatchArray {
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray(PatchDescriptor d, int np, Index v, Index p, Index qo) :
|
|
|
|
desc(d), numPatches(np), vertIndex(v),
|
|
|
|
patchIndex(p), quadOffsetIndex (qo) { }
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
void print() const;
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchDescriptor desc; // type of patches in the array
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
int numPatches; // number of patches in the array
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
Index vertIndex, // index to the first control vertex
|
2016-07-19 23:39:33 +00:00
|
|
|
patchIndex, // absolute index of the first patch in the array
|
2014-11-25 20:41:19 +00:00
|
|
|
quadOffsetIndex; // index of the first quad offset entry
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
};
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
// debug helper
|
|
|
|
void
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::PatchArray::print() const {
|
2015-02-26 21:57:47 +00:00
|
|
|
desc.print();
|
|
|
|
printf(" numPatches=%d vertIndex=%d patchIndex=%d "
|
|
|
|
"quadOffsetIndex=%d\n", numPatches, vertIndex, patchIndex,
|
|
|
|
quadOffsetIndex);
|
|
|
|
}
|
2015-05-22 18:50:01 +00:00
|
|
|
inline PatchTable::PatchArray &
|
|
|
|
PatchTable::getPatchArray(Index arrayIndex) {
|
2014-11-25 20:41:19 +00:00
|
|
|
assert(arrayIndex<(Index)GetNumPatchArrays());
|
|
|
|
return _patchArrays[arrayIndex];
|
|
|
|
}
|
2015-05-22 18:50:01 +00:00
|
|
|
inline PatchTable::PatchArray const &
|
|
|
|
PatchTable::getPatchArray(Index arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
assert(arrayIndex<(Index)GetNumPatchArrays());
|
|
|
|
return _patchArrays[arrayIndex];
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
void
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::reservePatchArrays(int numPatchArrays) {
|
2014-11-25 20:41:19 +00:00
|
|
|
_patchArrays.reserve(numPatchArrays);
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
//
|
|
|
|
// FVarPatchChannel
|
|
|
|
//
|
|
|
|
// Stores a record for each patch in the primitive :
|
|
|
|
//
|
2015-05-22 18:50:01 +00:00
|
|
|
// - Each patch in the PatchTable has a corresponding patch in each
|
2015-02-26 21:57:47 +00:00
|
|
|
// face-varying patch channel. Patch vertex indices are sorted in the same
|
2015-05-22 18:50:01 +00:00
|
|
|
// patch-type order as PatchTable::PTables. Face-varying data for a patch
|
2015-02-26 21:57:47 +00:00
|
|
|
// 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
|
|
|
|
//
|
2015-06-02 21:58:35 +00:00
|
|
|
// - Unlike "vertex" patches, there are no transition masks required
|
2015-02-26 21:57:47 +00:00
|
|
|
// for face-varying patches.
|
|
|
|
//
|
2015-06-02 21:58:35 +00:00
|
|
|
// - Face-varying patches still require boundary edge masks.
|
2015-02-26 21:57:47 +00:00
|
|
|
//
|
|
|
|
// - currently most patches with sharp boundaries but smooth interiors have
|
|
|
|
// to be isolated to level 10 : we need a special type of bicubic patch
|
|
|
|
// similar to single-crease to resolve this condition without requiring
|
|
|
|
// isolation if possible
|
|
|
|
//
|
2015-05-22 18:50:01 +00:00
|
|
|
struct PatchTable::FVarPatchChannel {
|
2015-02-26 21:57:47 +00:00
|
|
|
|
|
|
|
Sdc::Options::FVarLinearInterpolation interpolation;
|
|
|
|
|
2018-09-13 23:51:53 +00:00
|
|
|
PatchDescriptor regDesc;
|
|
|
|
PatchDescriptor irregDesc;
|
|
|
|
|
|
|
|
int stride;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
|
|
|
std::vector<Index> patchValues;
|
2016-09-29 16:38:32 +00:00
|
|
|
std::vector<PatchParam> patchParam;
|
2015-02-26 21:57:47 +00:00
|
|
|
};
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
void
|
|
|
|
PatchTable::allocateVaryingVertices(
|
|
|
|
PatchDescriptor desc, int numPatches) {
|
|
|
|
_varyingDesc = desc;
|
|
|
|
_varyingVerts.resize(numPatches*desc.GetNumControlVertices());
|
|
|
|
}
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
inline PatchTable::FVarPatchChannel &
|
|
|
|
PatchTable::getFVarPatchChannel(int channel) {
|
2016-07-19 23:39:33 +00:00
|
|
|
assert(channel>=0 && channel<(int)_fvarChannels.size());
|
2015-02-26 21:57:47 +00:00
|
|
|
return _fvarChannels[channel];
|
|
|
|
}
|
2015-05-22 18:50:01 +00:00
|
|
|
inline PatchTable::FVarPatchChannel const &
|
|
|
|
PatchTable::getFVarPatchChannel(int channel) const {
|
2016-07-19 23:39:33 +00:00
|
|
|
assert(channel>=0 && channel<(int)_fvarChannels.size());
|
2015-02-26 21:57:47 +00:00
|
|
|
return _fvarChannels[channel];
|
|
|
|
}
|
|
|
|
void
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::allocateFVarPatchChannels(int numChannels) {
|
2015-02-26 21:57:47 +00:00
|
|
|
_fvarChannels.resize(numChannels);
|
|
|
|
}
|
|
|
|
void
|
2015-06-02 20:51:32 +00:00
|
|
|
PatchTable::allocateFVarPatchChannelValues(
|
2018-09-13 23:51:53 +00:00
|
|
|
PatchDescriptor regDesc, PatchDescriptor irregDesc,
|
|
|
|
int numPatches, int channel) {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel & c = getFVarPatchChannel(channel);
|
2018-09-13 23:51:53 +00:00
|
|
|
c.regDesc = regDesc;
|
|
|
|
c.irregDesc = irregDesc;
|
|
|
|
|
|
|
|
c.stride = std::max(regDesc.GetNumControlVertices(),
|
|
|
|
irregDesc.GetNumControlVertices());
|
|
|
|
|
|
|
|
c.patchValues.resize(numPatches * c.stride);
|
2016-08-19 00:21:59 +00:00
|
|
|
c.patchParam.resize(numPatches);
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
|
|
|
void
|
2015-06-02 20:51:32 +00:00
|
|
|
PatchTable::setFVarPatchChannelLinearInterpolation(
|
|
|
|
Sdc::Options::FVarLinearInterpolation interpolation, int channel) {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel & c = getFVarPatchChannel(channel);
|
|
|
|
c.interpolation = interpolation;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2015-05-22 18:50:01 +00:00
|
|
|
// PatchTable
|
2015-02-26 21:57:47 +00:00
|
|
|
//
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
inline int
|
|
|
|
getPatchSize(PatchDescriptor desc) {
|
2015-04-08 01:34:05 +00:00
|
|
|
return desc.GetNumControlVertices();
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
void
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::pushPatchArray(PatchDescriptor desc, int npatches,
|
2014-11-25 20:41:19 +00:00
|
|
|
Index * vidx, Index * pidx, Index * qoidx) {
|
|
|
|
|
|
|
|
if (npatches>0) {
|
|
|
|
_patchArrays.push_back(PatchArray(
|
|
|
|
desc, npatches, *vidx, *pidx, qoidx ? *qoidx : 0));
|
|
|
|
int nverts = getPatchSize(desc);
|
|
|
|
*vidx += npatches * nverts;
|
|
|
|
*pidx += npatches;
|
|
|
|
if (qoidx) {
|
|
|
|
*qoidx += (desc.GetType() == PatchDescriptor::GREGORY) ?
|
|
|
|
npatches*nverts : 0;
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::getPatchIndex(int arrayIndex, int patchIndex) const {
|
2015-01-28 23:50:23 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
assert(patchIndex<pa.numPatches);
|
|
|
|
return pa.patchIndex + patchIndex;
|
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
Index *
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::getSharpnessIndices(int arrayIndex) {
|
2014-11-25 20:41:19 +00:00
|
|
|
return &_sharpnessIndices[getPatchArray(arrayIndex).patchIndex];
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
float *
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::getSharpnessValues(int arrayIndex) {
|
2014-11-25 20:41:19 +00:00
|
|
|
return &_sharpnessValues[getPatchArray(arrayIndex).patchIndex];
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchDescriptor
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchDescriptor(PatchHandle const & handle) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
return getPatchArray(handle.arrayIndex).desc;
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchDescriptor
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchArrayDescriptor(int arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
return getPatchArray(arrayIndex).desc;
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetNumPatchArrays() const {
|
2014-11-25 20:41:19 +00:00
|
|
|
return (int)_patchArrays.size();
|
|
|
|
}
|
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetNumPatches(int arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
return getPatchArray(arrayIndex).numPatches;
|
|
|
|
}
|
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetNumPatchesTotal() const {
|
2015-02-26 21:57:47 +00:00
|
|
|
// there is one PatchParam record for each patch in the mesh
|
|
|
|
return (int)_paramTable.size();
|
|
|
|
}
|
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetNumControlVertices(int arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
return pa.numPatches * getPatchSize(pa.desc);
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
Index
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::findPatchArray(PatchDescriptor desc) {
|
2015-02-26 21:57:47 +00:00
|
|
|
for (int i=0; i<(int)_patchArrays.size(); ++i) {
|
|
|
|
if (_patchArrays[i].desc==desc)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return Vtr::INDEX_INVALID;
|
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
IndexArray
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::getPatchArrayVertices(int arrayIndex) {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
int size = getPatchSize(pa.desc);
|
|
|
|
assert(pa.vertIndex<(Index)_patchVerts.size());
|
|
|
|
return IndexArray(&_patchVerts[pa.vertIndex], pa.numPatches * size);
|
|
|
|
}
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchArrayVertices(int arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
int size = getPatchSize(pa.desc);
|
|
|
|
assert(pa.vertIndex<(Index)_patchVerts.size());
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstIndexArray(&_patchVerts[pa.vertIndex], pa.numPatches * size);
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchVertices(PatchHandle const & handle) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(handle.arrayIndex);
|
2015-04-08 01:34:05 +00:00
|
|
|
Index vert = pa.vertIndex + handle.vertIndex;
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstIndexArray(&_patchVerts[vert], getPatchSize(pa.desc));
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchVertices(int arrayIndex, int patchIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
int size = getPatchSize(pa.desc);
|
|
|
|
assert((pa.vertIndex + patchIndex*size)<(Index)_patchVerts.size());
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstIndexArray(&_patchVerts[pa.vertIndex + patchIndex*size], size);
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchParam
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchParam(PatchHandle const & handle) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
assert(handle.patchIndex < (Index)_paramTable.size());
|
|
|
|
return _paramTable[handle.patchIndex];
|
|
|
|
}
|
|
|
|
PatchParam
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchParam(int arrayIndex, int patchIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
assert((pa.patchIndex + patchIndex) < (int)_paramTable.size());
|
|
|
|
return _paramTable[pa.patchIndex + patchIndex];
|
|
|
|
}
|
|
|
|
PatchParamArray
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::getPatchParams(int arrayIndex) {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
return PatchParamArray(&_paramTable[pa.patchIndex], pa.numPatches);
|
|
|
|
}
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstPatchParamArray const
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetPatchParams(int arrayIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
2014-12-15 18:23:13 +00:00
|
|
|
return ConstPatchParamArray(&_paramTable[pa.patchIndex], pa.numPatches);
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
float
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetSingleCreasePatchSharpnessValue(PatchHandle const & handle) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
assert((handle.patchIndex) < (int)_sharpnessIndices.size());
|
|
|
|
Index index = _sharpnessIndices[handle.patchIndex];
|
|
|
|
if (index == Vtr::INDEX_INVALID) {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
assert(index < (Index)_sharpnessValues.size());
|
|
|
|
return _sharpnessValues[index];
|
|
|
|
}
|
|
|
|
float
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetSingleCreasePatchSharpnessValue(int arrayIndex, int patchIndex) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
assert((pa.patchIndex + patchIndex) < (int)_sharpnessIndices.size());
|
|
|
|
Index index = _sharpnessIndices[pa.patchIndex + patchIndex];
|
|
|
|
if (index == Vtr::INDEX_INVALID) {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
assert(index < (Index)_sharpnessValues.size());
|
|
|
|
return _sharpnessValues[index];
|
|
|
|
}
|
2014-10-13 15:52:09 +00:00
|
|
|
|
2015-05-29 19:41:11 +00:00
|
|
|
int
|
|
|
|
PatchTable::GetNumLocalPoints() const {
|
2018-07-28 21:56:43 +00:00
|
|
|
return _localPointStencils.IsSet() ? _localPointStencils.Size() : 0;
|
2015-05-29 19:41:11 +00:00
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
int
|
|
|
|
PatchTable::GetNumLocalPointsVarying() const {
|
2018-07-28 21:56:43 +00:00
|
|
|
return _localPointVaryingStencils.IsSet() ? _localPointVaryingStencils.Size() : 0;
|
2016-07-19 23:39:33 +00:00
|
|
|
}
|
|
|
|
int
|
|
|
|
PatchTable::GetNumLocalPointsFaceVarying(int channel) const {
|
2018-07-28 21:56:43 +00:00
|
|
|
if (channel>=0 && channel<(int)_localPointFaceVaryingStencils.size()) {
|
|
|
|
return _localPointFaceVaryingStencils[channel].IsSet() ?
|
|
|
|
_localPointFaceVaryingStencils[channel].Size() : 0;
|
2016-07-19 23:39:33 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2015-05-29 19:41:11 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::ConstQuadOffsetsArray
|
|
|
|
PatchTable::GetPatchQuadOffsets(PatchHandle const & handle) const {
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray const & pa = getPatchArray(handle.arrayIndex);
|
2014-12-15 18:23:13 +00:00
|
|
|
return Vtr::ConstArray<unsigned int>(&_quadOffsetsTable[pa.quadOffsetIndex + handle.vertIndex], 4);
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
|
|
|
bool
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::IsFeatureAdaptive() const {
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-04-23 23:58:45 +00:00
|
|
|
// XXX:
|
|
|
|
// revisit this function, since we'll add uniform cubic patches later.
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
for (int i=0; i<GetNumPatchArrays(); ++i) {
|
|
|
|
PatchDescriptor const & desc = _patchArrays[i].desc;
|
2016-02-19 09:02:07 +00:00
|
|
|
if (desc.GetType()>=PatchDescriptor::REGULAR &&
|
2014-11-25 20:41:19 +00:00
|
|
|
desc.GetType()<=PatchDescriptor::GREGORY_BASIS) {
|
|
|
|
return true;
|
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
return false;
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
|
|
|
|
2016-09-29 16:51:19 +00:00
|
|
|
PatchDescriptor
|
|
|
|
PatchTable::GetVaryingPatchDescriptor() const {
|
|
|
|
return _varyingDesc;
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
ConstIndexArray
|
|
|
|
PatchTable::GetPatchVaryingVertices(PatchHandle const & handle) const {
|
2016-09-29 16:51:19 +00:00
|
|
|
if (_varyingVerts.empty()) {
|
|
|
|
return ConstIndexArray();
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
int numVaryingCVs = _varyingDesc.GetNumControlVertices();
|
|
|
|
Index start = handle.patchIndex * numVaryingCVs;
|
|
|
|
return ConstIndexArray(&_varyingVerts[start], numVaryingCVs);
|
|
|
|
}
|
|
|
|
ConstIndexArray
|
|
|
|
PatchTable::GetPatchVaryingVertices(int array, int patch) const {
|
2016-09-29 16:51:19 +00:00
|
|
|
if (_varyingVerts.empty()) {
|
|
|
|
return ConstIndexArray();
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
PatchArray const & pa = getPatchArray(array);
|
|
|
|
int numVaryingCVs = _varyingDesc.GetNumControlVertices();
|
|
|
|
Index start = (pa.patchIndex + patch) * numVaryingCVs;
|
|
|
|
return ConstIndexArray(&_varyingVerts[start], numVaryingCVs);
|
|
|
|
}
|
|
|
|
ConstIndexArray
|
|
|
|
PatchTable::GetPatchArrayVaryingVertices(int array) const {
|
2016-09-29 16:51:19 +00:00
|
|
|
if (_varyingVerts.empty()) {
|
|
|
|
return ConstIndexArray();
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
PatchArray const & pa = getPatchArray(array);
|
|
|
|
int numVaryingCVs = _varyingDesc.GetNumControlVertices();
|
|
|
|
Index start = pa.patchIndex * numVaryingCVs;
|
|
|
|
Index count = pa.numPatches * numVaryingCVs;
|
|
|
|
return ConstIndexArray(&_varyingVerts[start], count);
|
|
|
|
}
|
|
|
|
ConstIndexArray
|
|
|
|
PatchTable::GetVaryingVertices() const {
|
2016-09-29 16:51:19 +00:00
|
|
|
if (_varyingVerts.empty()) {
|
|
|
|
return ConstIndexArray();
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
return ConstIndexArray(&_varyingVerts[0], (int)_varyingVerts.size());
|
|
|
|
}
|
|
|
|
IndexArray
|
|
|
|
PatchTable::getPatchArrayVaryingVertices(int arrayIndex) {
|
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
int numVaryingCVs = _varyingDesc.GetNumControlVertices();
|
|
|
|
Index start = pa.patchIndex * numVaryingCVs;
|
|
|
|
return IndexArray(&_varyingVerts[start], pa.numPatches * numVaryingCVs);
|
|
|
|
}
|
2016-08-24 21:02:57 +00:00
|
|
|
void
|
|
|
|
PatchTable::populateVaryingVertices() {
|
|
|
|
// In order to support evaluation of varying data we need to access
|
|
|
|
// the varying values indexed by the zero ring vertices of the vertex
|
|
|
|
// patch. This indexing is redundant for triangles and quads and
|
|
|
|
// could be made redunant for other patch types if we reorganized
|
|
|
|
// the vertex patch indices so that the zero ring indices always occured
|
|
|
|
// first. This will also need to be updated when we add support for
|
|
|
|
// triangle patches.
|
|
|
|
int numVaryingCVs = _varyingDesc.GetNumControlVertices();
|
|
|
|
for (int arrayIndex=0; arrayIndex<(int)_patchArrays.size(); ++arrayIndex) {
|
|
|
|
PatchArray const & pa = getPatchArray(arrayIndex);
|
|
|
|
PatchDescriptor::Type patchType = pa.desc.GetType();
|
|
|
|
for (int patch=0; patch<pa.numPatches; ++patch) {
|
|
|
|
ConstIndexArray vertexCVs = GetPatchVertices(arrayIndex, patch);
|
|
|
|
int start = (pa.patchIndex + patch) * numVaryingCVs;
|
|
|
|
if (patchType == PatchDescriptor::REGULAR) {
|
|
|
|
_varyingVerts[start+0] = vertexCVs[5];
|
|
|
|
_varyingVerts[start+1] = vertexCVs[6];
|
|
|
|
_varyingVerts[start+2] = vertexCVs[10];
|
|
|
|
_varyingVerts[start+3] = vertexCVs[9];
|
|
|
|
} else if (patchType == PatchDescriptor::GREGORY_BASIS) {
|
|
|
|
_varyingVerts[start+0] = vertexCVs[0];
|
|
|
|
_varyingVerts[start+1] = vertexCVs[5];
|
|
|
|
_varyingVerts[start+2] = vertexCVs[10];
|
|
|
|
_varyingVerts[start+3] = vertexCVs[15];
|
|
|
|
} else if (patchType == PatchDescriptor::QUADS) {
|
|
|
|
_varyingVerts[start+0] = vertexCVs[0];
|
|
|
|
_varyingVerts[start+1] = vertexCVs[1];
|
|
|
|
_varyingVerts[start+2] = vertexCVs[2];
|
|
|
|
_varyingVerts[start+3] = vertexCVs[3];
|
|
|
|
} else if (patchType == PatchDescriptor::TRIANGLES) {
|
|
|
|
_varyingVerts[start+0] = vertexCVs[0];
|
|
|
|
_varyingVerts[start+1] = vertexCVs[1];
|
|
|
|
_varyingVerts[start+2] = vertexCVs[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
int
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetNumFVarChannels() const {
|
2015-02-26 21:57:47 +00:00
|
|
|
return (int)_fvarChannels.size();
|
|
|
|
}
|
|
|
|
Sdc::Options::FVarLinearInterpolation
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::GetFVarChannelLinearInterpolation(int channel) const {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
|
|
|
return c.interpolation;
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
PatchDescriptor
|
2018-09-13 23:51:53 +00:00
|
|
|
PatchTable::GetFVarPatchDescriptorRegular(int channel) const {
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
|
|
|
return c.regDesc;
|
|
|
|
}
|
|
|
|
PatchDescriptor
|
|
|
|
PatchTable::GetFVarPatchDescriptorIrregular(int channel) const {
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
|
|
|
return c.irregDesc;
|
|
|
|
}
|
|
|
|
PatchDescriptor
|
2016-10-15 02:50:21 +00:00
|
|
|
PatchTable::GetFVarPatchDescriptor(int channel) const {
|
2016-07-19 23:39:33 +00:00
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2018-09-13 23:51:53 +00:00
|
|
|
return c.irregDesc;
|
2016-07-19 23:39:33 +00:00
|
|
|
}
|
2015-02-26 21:57:47 +00:00
|
|
|
ConstIndexArray
|
2015-06-02 16:13:17 +00:00
|
|
|
PatchTable::GetFVarValues(int channel) const {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2015-02-27 23:52:12 +00:00
|
|
|
return ConstIndexArray(&c.patchValues[0], (int)c.patchValues.size());
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
2018-09-13 23:51:53 +00:00
|
|
|
int
|
|
|
|
PatchTable::GetFVarValueStride(int channel) const {
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
|
|
|
return c.stride;
|
|
|
|
}
|
2015-02-26 21:57:47 +00:00
|
|
|
IndexArray
|
2015-06-02 16:13:17 +00:00
|
|
|
PatchTable::getFVarValues(int channel) {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel & c = getFVarPatchChannel(channel);
|
2015-02-27 23:52:12 +00:00
|
|
|
return IndexArray(&c.patchValues[0], (int)c.patchValues.size());
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
|
|
|
ConstIndexArray
|
2015-06-02 20:51:32 +00:00
|
|
|
PatchTable::getPatchFVarValues(int patch, int channel) const {
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2016-10-10 21:27:41 +00:00
|
|
|
int ncvsThisPatch = c.patchParam[patch].IsRegular()
|
2018-09-13 23:51:53 +00:00
|
|
|
? c.regDesc.GetNumControlVertices()
|
|
|
|
: c.irregDesc.GetNumControlVertices();
|
|
|
|
return ConstIndexArray(&c.patchValues[patch * c.stride], ncvsThisPatch);
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
|
|
|
ConstIndexArray
|
2015-06-02 20:51:32 +00:00
|
|
|
PatchTable::GetPatchFVarValues(PatchHandle const & handle, int channel) const {
|
|
|
|
return getPatchFVarValues(handle.patchIndex, channel);
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
|
|
|
ConstIndexArray
|
2015-06-02 20:51:32 +00:00
|
|
|
PatchTable::GetPatchFVarValues(int arrayIndex, int patchIndex, int channel) const {
|
|
|
|
return getPatchFVarValues(getPatchIndex(arrayIndex, patchIndex), channel);
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
ConstIndexArray
|
|
|
|
PatchTable::GetPatchArrayFVarValues(int array, int channel) const {
|
|
|
|
PatchArray const & pa = getPatchArray(array);
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2018-09-13 23:51:53 +00:00
|
|
|
int ncvs = c.stride;
|
2016-07-19 23:39:33 +00:00
|
|
|
int start = pa.patchIndex * ncvs;
|
|
|
|
int count = pa.numPatches * ncvs;
|
|
|
|
return ConstIndexArray(&c.patchValues[start], count);
|
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam
|
2016-08-19 00:21:59 +00:00
|
|
|
PatchTable::getPatchFVarPatchParam(int patch, int channel) const {
|
|
|
|
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
|
|
|
return c.patchParam[patch];
|
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam
|
2016-08-19 00:21:59 +00:00
|
|
|
PatchTable::GetPatchFVarPatchParam(PatchHandle const & handle, int channel) const {
|
|
|
|
return getPatchFVarPatchParam(handle.patchIndex, channel);
|
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam
|
2016-08-19 00:21:59 +00:00
|
|
|
PatchTable::GetPatchFVarPatchParam(int arrayIndex, int patchIndex, int channel) const {
|
|
|
|
return getPatchFVarPatchParam(getPatchIndex(arrayIndex, patchIndex), channel);
|
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
ConstPatchParamArray
|
2016-10-12 00:07:14 +00:00
|
|
|
PatchTable::GetPatchArrayFVarPatchParams(int array, int channel) const {
|
2016-08-19 00:21:59 +00:00
|
|
|
PatchArray const & pa = getPatchArray(array);
|
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2016-09-29 16:38:32 +00:00
|
|
|
return ConstPatchParamArray(&c.patchParam[pa.patchIndex], pa.numPatches);
|
2016-08-19 00:21:59 +00:00
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
ConstPatchParamArray
|
2016-10-12 00:07:14 +00:00
|
|
|
PatchTable::GetFVarPatchParams(int channel) const {
|
2016-08-19 00:21:59 +00:00
|
|
|
FVarPatchChannel const & c = getFVarPatchChannel(channel);
|
2016-09-29 16:38:32 +00:00
|
|
|
return ConstPatchParamArray(&c.patchParam[0], (int)c.patchParam.size());
|
2016-08-19 00:21:59 +00:00
|
|
|
}
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParamArray
|
2016-10-12 00:07:14 +00:00
|
|
|
PatchTable::getFVarPatchParams(int channel) {
|
2016-08-19 00:21:59 +00:00
|
|
|
FVarPatchChannel & c = getFVarPatchChannel(channel);
|
2016-09-29 16:38:32 +00:00
|
|
|
return PatchParamArray(&c.patchParam[0], (int)c.patchParam.size());
|
2016-08-19 00:21:59 +00:00
|
|
|
}
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
void
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable::print() const {
|
|
|
|
printf("patchTable (0x%p)\n", this);
|
2015-02-26 21:57:47 +00:00
|
|
|
printf(" numPatches = %d\n", GetNumPatchesTotal());
|
|
|
|
for (int i=0; i<GetNumPatchArrays(); ++i) {
|
|
|
|
printf(" patchArray %d:\n", i);
|
|
|
|
PatchArray const & pa = getPatchArray(i);
|
|
|
|
pa.print();
|
2014-10-09 21:48:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-20 22:44:29 +00:00
|
|
|
//
|
2016-07-19 23:39:33 +00:00
|
|
|
// Evaluate basis functions for vertex and derivatives at (s,t):
|
2015-05-20 22:44:29 +00:00
|
|
|
//
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
2015-05-20 22:44:29 +00:00
|
|
|
void
|
2016-07-19 23:39:33 +00:00
|
|
|
PatchTable::EvaluateBasis(
|
2018-07-28 21:43:32 +00:00
|
|
|
PatchHandle const & handle, REAL s, REAL t,
|
|
|
|
REAL wP[], REAL wDs[], REAL wDt[],
|
|
|
|
REAL wDss[], REAL wDst[], REAL wDtt[]) const {
|
2015-05-20 22:44:29 +00:00
|
|
|
|
|
|
|
PatchDescriptor::Type patchType = GetPatchArrayDescriptor(handle.arrayIndex).GetType();
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam const & param = _paramTable[handle.patchIndex];
|
2015-05-20 22:44:29 +00:00
|
|
|
|
|
|
|
if (patchType == PatchDescriptor::REGULAR) {
|
2015-08-12 00:21:55 +00:00
|
|
|
internal::GetBSplineWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
2015-05-20 22:44:29 +00:00
|
|
|
} else if (patchType == PatchDescriptor::GREGORY_BASIS) {
|
2015-08-12 00:21:55 +00:00
|
|
|
internal::GetGregoryWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
2015-05-20 22:44:29 +00:00
|
|
|
} else if (patchType == PatchDescriptor::QUADS) {
|
2015-08-12 00:21:55 +00:00
|
|
|
internal::GetBilinearWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
2015-05-20 22:44:29 +00:00
|
|
|
} else {
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
//
|
|
|
|
// Evaluate basis functions for varying and derivatives at (s,t):
|
|
|
|
//
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
2016-07-19 23:39:33 +00:00
|
|
|
void
|
|
|
|
PatchTable::EvaluateBasisVarying(
|
2018-07-28 21:43:32 +00:00
|
|
|
PatchHandle const & handle, REAL s, REAL t,
|
|
|
|
REAL wP[], REAL wDs[], REAL wDt[],
|
|
|
|
REAL wDss[], REAL wDst[], REAL wDtt[]) const {
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam const & param = _paramTable[handle.patchIndex];
|
2016-07-19 23:39:33 +00:00
|
|
|
|
|
|
|
internal::GetBilinearWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Evaluate basis functions for face-varying and derivatives at (s,t):
|
|
|
|
//
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
2016-07-19 23:39:33 +00:00
|
|
|
void
|
|
|
|
PatchTable::EvaluateBasisFaceVarying(
|
2018-07-28 21:43:32 +00:00
|
|
|
PatchHandle const & handle, REAL s, REAL t,
|
|
|
|
REAL wP[], REAL wDs[], REAL wDt[],
|
|
|
|
REAL wDss[], REAL wDst[], REAL wDtt[],
|
2016-07-19 23:39:33 +00:00
|
|
|
int channel) const {
|
|
|
|
|
2016-10-10 21:27:41 +00:00
|
|
|
PatchParam param = getPatchFVarPatchParam(handle.patchIndex, channel);
|
2016-08-31 20:05:55 +00:00
|
|
|
PatchDescriptor::Type patchType = param.IsRegular()
|
2018-09-13 23:51:53 +00:00
|
|
|
? GetFVarPatchDescriptorRegular(channel).GetType()
|
|
|
|
: GetFVarPatchDescriptorIrregular(channel).GetType();
|
2016-07-19 23:39:33 +00:00
|
|
|
|
|
|
|
if (patchType == PatchDescriptor::REGULAR) {
|
|
|
|
internal::GetBSplineWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
|
|
|
} else if (patchType == PatchDescriptor::GREGORY_BASIS) {
|
|
|
|
internal::GetGregoryWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
|
|
|
} else if (patchType == PatchDescriptor::QUADS) {
|
|
|
|
internal::GetBilinearWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);
|
|
|
|
} else {
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-28 21:43:32 +00:00
|
|
|
//
|
|
|
|
// Explicit instantiation of EvaluateBasis...() methods for float and double:
|
|
|
|
//
|
|
|
|
template void PatchTable::EvaluateBasis<float>(PatchHandle const & handle,
|
|
|
|
float s, float t, float wP[], float wDs[], float wDt[],
|
|
|
|
float wDss[], float wDst[], float wDtt[]) const;
|
|
|
|
template void PatchTable::EvaluateBasisVarying<float>(PatchHandle const & handle,
|
|
|
|
float s, float t, float wP[], float wDs[], float wDt[],
|
|
|
|
float wDss[], float wDst[], float wDtt[]) const;
|
|
|
|
template void PatchTable::EvaluateBasisFaceVarying<float>(PatchHandle const & handle,
|
|
|
|
float s, float t, float wP[], float wDs[], float wDt[],
|
|
|
|
float wDss[], float wDst[], float wDtt[], int channel) const;
|
|
|
|
|
|
|
|
template void PatchTable::EvaluateBasis<double>(PatchHandle const & handle,
|
|
|
|
double s, double t, double wP[], double wDs[], double wDt[],
|
|
|
|
double wDss[], double wDst[], double wDtt[]) const;
|
|
|
|
template void PatchTable::EvaluateBasisVarying<double>(PatchHandle const & handle,
|
|
|
|
double s, double t, double wP[], double wDs[], double wDt[],
|
|
|
|
double wDss[], double wDst[], double wDtt[]) const;
|
|
|
|
template void PatchTable::EvaluateBasisFaceVarying<double>(PatchHandle const & handle,
|
|
|
|
double s, double t, double wP[], double wDs[], double wDt[],
|
|
|
|
double wDss[], double wDst[], double wDtt[], int channel) const;
|
2015-05-29 19:41:11 +00:00
|
|
|
|
2014-09-19 00:48:34 +00:00
|
|
|
} // end namespace Far
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
} // end namespace OpenSubdiv
|