25 #ifndef OPENSUBDIV3_FAR_PATCH_TABLE_H 26 #define OPENSUBDIV3_FAR_PATCH_TABLE_H 28 #include "../version.h" 30 #include "../far/patchDescriptor.h" 31 #include "../far/patchParam.h" 32 #include "../far/stencilTable.h" 34 #include "../sdc/options.h" 39 namespace OPENSUBDIV_VERSION {
85 return (
int)_patchVerts.size();
172 template <
class T>
void 177 return _localPointStencils;
192 template <
class T>
void 197 return _localPointVaryingStencils;
214 template <
class T>
void 219 if (channel >= 0 && channel < (
int)_localPointFaceVaryingStencils.size()) {
220 return _localPointFaceVaryingStencils[channel];
242 return _vertexValenceTable;
358 return _quadOffsetsTable;
393 void EvaluateBasis(PatchHandle
const & handle,
float u,
float v,
394 float wP[],
float wDu[] = 0,
float wDv[] = 0,
395 float wDuu[] = 0,
float wDuv[] = 0,
float wDvv[] = 0)
const;
420 float wP[],
float wDu[] = 0,
float wDv[] = 0,
421 float wDuu[] = 0,
float wDuv[] = 0,
float wDvv[] = 0)
const;
448 float wP[],
float wDu[] = 0,
float wDv[] = 0,
449 float wDuu[] = 0,
float wDuv[] = 0,
float wDvv[] = 0,
450 int channel = 0)
const;
476 PatchArray & getPatchArray(
Index arrayIndex);
477 PatchArray
const & getPatchArray(
Index arrayIndex)
const;
479 void reservePatchArrays(
int numPatchArrays);
483 IndexArray getPatchArrayVertices(
int arrayIndex);
491 IndexArray getPatchArrayVaryingVertices(
int arrayIndex);
493 void allocateVaryingVertices(
495 void populateVaryingVertices();
501 struct FVarPatchChannel;
502 typedef std::vector<FVarPatchChannel> FVarPatchChannelVector;
504 FVarPatchChannel & getFVarPatchChannel(
int channel);
505 FVarPatchChannel
const & getFVarPatchChannel(
int channel)
const;
507 void allocateFVarPatchChannels(
int numChannels);
508 void allocateFVarPatchChannelValues(
512 void setFVarPatchChannelLinearInterpolation(
519 PatchParam getPatchFVarPatchParam(
int patch,
int channel)
const;
530 PatchArrayVector _patchArrays;
532 std::vector<Index> _patchVerts;
553 std::vector<Index> _varyingVerts;
559 FVarPatchChannelVector _fvarChannels;
561 std::vector<StencilTable const *> _localPointFaceVaryingStencils;
567 std::vector<Index> _sharpnessIndices;
568 std::vector<float> _sharpnessValues;
574 if (_localPointStencils) {
582 if (_localPointVaryingStencils) {
590 if (channel >= 0 && channel < (
int)_localPointFaceVaryingStencils.size()) {
591 if (_localPointFaceVaryingStencils[channel]) {
592 _localPointFaceVaryingStencils[channel]->UpdateValues(src, dst);
601 using namespace OPENSUBDIV_VERSION;
void EvaluateBasisVarying(PatchHandle const &handle, float u, float v, float wP[], float wDu[]=0, float wDv[]=0, float wDuu[]=0, float wDuv[]=0, float wDvv[]=0) const
Evaluate basis functions for a varying value and derivatives at a given (u,v) parametric location of ...
int GetNumControlVerticesTotal() const
Returns the total number of control vertex indices in the table.
int GetNumLocalPointsFaceVarying(int channel=0) const
Returns the number of local face-varying points for channel.
Describes the type of a patch.
int GetNumLocalPoints() const
Returns the number of local vertex points.
PatchVertsTable const & GetPatchControlVerticesTable() const
Get the table of patch control vertices.
Vtr::ConstArray< unsigned int > ConstQuadOffsetsArray
Accessors for the gregory patch evaluation buffers. These methods will be deprecated.
void EvaluateBasisFaceVarying(PatchHandle const &handle, float u, float v, float wP[], float wDu[]=0, float wDv[]=0, float wDuu[]=0, float wDuv[]=0, float wDvv[]=0, int channel=0) const
Evaluate basis functions for a face-varying value and derivatives at a given (u,v) parametric locatio...
VertexValenceTable const & GetVertexValenceTable() const
Returns the 'VertexValences' table (vertex neighborhoods table)
ConstIndexArray GetPatchArrayVaryingVertices(int array) const
Returns the varying vertex indices for the patches in array.
Container for arrays of parametric patches.
std::vector< Index > const & GetSharpnessIndexTable() const
Returns a sharpness index table for each patch (if exists)
QuadOffsetsTable const & GetQuadOffsetsTable() const
Returns the quad-offsets table.
PatchParamArray getPatchParams(int arrayIndex)
ConstPatchParamArray const GetPatchParams(int array) const
Returns the PatchParams for the patches in array.
PatchTable(PatchTable const &src)
Copy constructor.
void EvaluateBasis(PatchHandle const &handle, float u, float v, float wP[], float wDu[]=0, float wDv[]=0, float wDuu[]=0, float wDuv[]=0, float wDvv[]=0) const
Evaluate basis functions for position and derivatives at a given (u,v) parametric location of a patch...
float GetSingleCreasePatchSharpnessValue(PatchHandle const &handle) const
Returns the crease sharpness for the patch identified by handle if it is a single-crease patch...
Index getPatchIndex(int array, int patch) const
PatchParamTable const & GetPatchParamTable() const
Returns the PatchParamTable (PatchParams order matches patch array sorting)
PatchDescriptor GetPatchDescriptor(PatchHandle const &handle) const
Returns the PatchDescriptor for the patch identified by handle.
bool IsFeatureAdaptive() const
True if the patches are of feature adaptive types.
int GetNumPatchArrays() const
Returns the number of patch arrays in the table.
ConstPatchParamArray GetFVarPatchParams(int channel=0) const
Returns an array of face-varying patch param for channel.
std::vector< PatchParam > PatchParamTable
ConstIndexArray GetVaryingVertices() const
Returns an array of varying vertex indices for the patches.
std::vector< PatchArray > PatchArrayVector
int GetNumLocalPointsVarying() const
Returns the number of local varying points.
void ComputeLocalPointValues(T const *src, T *dst) const
Updates local point vertex values.
Factory for constructing a PatchTable from a TopologyRefiner.
ConstPatchParamArray GetPatchArrayFVarPatchParams(int array, int channel=0) const
Returns the face-varying for a given patch in array in channel.
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel=0) const
Deprecated.
Index * getSharpnessIndices(Index arrayIndex)
An quadtree-based map connecting coarse faces to their sub-patches.
int GetNumControlVertices(int array) const
Returns the number of control vertices in array.
void ComputeLocalPointValuesFaceVarying(T const *src, T *dst, int channel=0) const
Updates local point face-varying values.
int GetNumPatchesTotal() const
Returns the total number of patches stored in the table.
StencilTable const * GetLocalPointVaryingStencilTable() const
Returns the stencil table to compute local point varying values.
Handle that can be used as unique patch identifier within PatchTable.
int GetMaxValence() const
Returns max vertex valence.
StencilTable const * GetLocalPointStencilTable() const
Returns the stencil table to compute local point vertex values.
ConstIndexArray GetPatchVaryingVertices(PatchHandle const &handle) const
Returns the varying vertex indices for a given patch.
PatchDescriptor GetPatchArrayDescriptor(int array) const
Returns the PatchDescriptor for the patches in array.
Table of subdivision stencils.
std::vector< unsigned int > QuadOffsetsTable
void UpdateValues(T const *controlValues, T *values, Index start=-1, Index end=-1) const
Updates point values based on the control values.
int GetNumPatches(int array) const
Returns the number of patches in array.
ConstIndexArray GetPatchArrayFVarValues(int array, int channel=0) const
Returns the value indices for the patches in array in channel.
ConstIndexArray GetPatchFVarValues(PatchHandle const &handle, int channel=0) const
Returns the value indices for a given patch in channel.
ConstIndexArray GetPatchArrayVertices(int array) const
Returns the control vertex indices for the patches in array.
void print() const
debug helper
PatchParam GetPatchParam(PatchHandle const &handle) const
Returns a PatchParam for the patch identified by handle.
int GetNumPtexFaces() const
Returns the total number of ptex faces in the mesh.
PatchDescriptor GetVaryingPatchDescriptor() const
Returns the varying patch descriptor.
int GetNumFVarChannels() const
Returns the number of face-varying channels.
std::vector< Index > VertexValenceTable
std::vector< Index > PatchVertsTable
ConstQuadOffsetsArray GetPatchQuadOffsets(PatchHandle const &handle) const
Returns the 'QuadOffsets' for the Gregory patch identified by handle.
float * getSharpnessValues(Index arrayIndex)
std::vector< float > const & GetSharpnessValues() const
Returns sharpness values table.
PatchParam GetPatchFVarPatchParam(PatchHandle const &handle, int channel=0) const
Returns the value indices for a given patch in channel.
ConstIndexArray GetFVarValues(int channel=0) const
Returns an array of value indices for the patches in channel.
void ComputeLocalPointValuesVarying(T const *src, T *dst) const
Updates local point varying values.
ConstIndexArray GetPatchVertices(PatchHandle const &handle) const
Returns the control vertex indices for the patch identified by handle.
PatchDescriptor GetFVarPatchDescriptor(int channel=0) const
Returns the patch descriptor for channel.
StencilTable const * GetLocalPointFaceVaryingStencilTable(int channel=0) const
Returns the stencil table to compute local point face-varying values.