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"
38 namespace OpenSubdiv {
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;
ConstIndexArray GetPatchArrayVaryingVertices(int array) const
Returns the varying vertex indices for the patches in array.
int GetNumFVarChannels() const
Returns the number of face-varying channels.
std::vector< PatchArray > PatchArrayVector
ConstIndexArray GetFVarValues(int channel=0) const
Returns an array of value indices for the patches in channel.
void ComputeLocalPointValuesFaceVarying(T const *src, T *dst, int channel=0) const
Updates local point face-varying values.
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...
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...
PatchParamTable const & GetPatchParamTable() const
Returns the PatchParamTable (PatchParams order matches patch array sorting)
float GetSingleCreasePatchSharpnessValue(PatchHandle const &handle) const
Returns the crease sharpness for the patch identified by handle if it is a single-crease patch...
friend class PatchTableBuilder
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 ...
ConstIndexArray GetPatchVaryingVertices(PatchHandle const &handle) const
Returns the varying vertex indices for a given patch.
PatchVertsTable const & GetPatchControlVerticesTable() const
Get the table of patch control vertices.
ConstPatchParamArray const GetPatchParams(int array) const
Returns the PatchParams for the patches in array.
Vtr::ConstArray< unsigned int > ConstQuadOffsetsArray
Accessors for the gregory patch evaluation buffers. These methods will be deprecated.
PatchDescriptor GetFVarPatchDescriptor(int channel=0) const
Returns the patch descriptor for channel.
StencilTable const * GetLocalPointVaryingStencilTable() const
Returns the stencil table to compute local point varying values.
PatchDescriptor GetVaryingPatchDescriptor() const
Returns the varying patch descriptor.
ConstIndexArray GetVaryingVertices() const
Returns an array of varying vertex indices for the patches.
void UpdateValues(T const *controlValues, T *values, Index start=-1, Index end=-1) const
Updates point values based on the control values.
int GetNumControlVerticesTotal() const
Returns the total number of control vertex indices in the table.
ConstQuadOffsetsArray GetPatchQuadOffsets(PatchHandle const &handle) const
Returns the 'QuadOffsets' for the Gregory patch identified by handle.
Index * getSharpnessIndices(Index arrayIndex)
Table of subdivision stencils.
StencilTable const * GetLocalPointFaceVaryingStencilTable(int channel=0) const
Returns the stencil table to compute local point face-varying values.
Index getPatchIndex(int array, int patch) const
void print() const
debug helper
float * getSharpnessValues(Index arrayIndex)
Container for arrays of parametric patches.
ConstIndexArray GetPatchArrayFVarValues(int array, int channel=0) const
Returns the value indices for the patches in array in channel.
PatchTable(PatchTable const &src)
Copy constructor.
std::vector< Index > const & GetSharpnessIndexTable() const
Returns a sharpness index table for each patch (if exists)
void ComputeLocalPointValuesVarying(T const *src, T *dst) const
Updates local point varying values.
QuadOffsetsTable const & GetQuadOffsetsTable() const
Returns the quad-offsets table.
int GetNumLocalPoints() const
Returns the number of local vertex points.
ConstPatchParamArray GetPatchArrayFVarPatchParams(int array, int channel=0) const
Returns the face-varying for a given patch in array in channel.
int GetNumPtexFaces() const
Returns the total number of ptex faces in the mesh.
StencilTable const * GetLocalPointStencilTable() const
Returns the stencil table to compute local point vertex values.
bool IsFeatureAdaptive() const
True if the patches are of feature adaptive types.
std::vector< Index > VertexValenceTable
int GetNumPatches(int array) const
Returns the number of patches in array.
std::vector< unsigned int > QuadOffsetsTable
Describes the type of a patch.
int GetNumPatchesTotal() const
Returns the total number of patches stored in the table.
ConstIndexArray GetPatchFVarValues(PatchHandle const &handle, int channel=0) const
Returns the value indices for a given patch in channel.
ConstIndexArray GetPatchVertices(PatchHandle const &handle) const
Returns the control vertex indices for the patch identified by handle.
int GetNumLocalPointsFaceVarying(int channel=0) const
Returns the number of local face-varying points for channel.
PatchParam GetPatchFVarPatchParam(PatchHandle const &handle, int channel=0) const
Returns the value indices for a given patch in channel.
int GetNumControlVertices(int array) const
Returns the number of control vertices in array.
An quadtree-based map connecting coarse faces to their sub-patches.
int GetNumLocalPointsVarying() const
Returns the number of local varying points.
VertexValenceTable const & GetVertexValenceTable() const
Returns the 'VertexValences' table (vertex neighborhoods table)
void ComputeLocalPointValues(T const *src, T *dst) const
Updates local point vertex values.
int GetNumPatchArrays() const
Returns the number of patch arrays in the table.
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel=0) const
Deprecated.
PatchParam GetPatchParam(PatchHandle const &handle) const
Returns a PatchParam for the patch identified by handle.
ConstPatchParamArray GetFVarPatchParams(int channel=0) const
Returns an array of face-varying patch param for channel.
ConstIndexArray GetPatchArrayVertices(int array) const
Returns the control vertex indices for the patches in array.
int GetMaxValence() const
Returns max vertex valence.
std::vector< Index > PatchVertsTable
PatchParamArray getPatchParams(int arrayIndex)
std::vector< float > const & GetSharpnessValues() const
Returns sharpness values table.
PatchDescriptor GetPatchArrayDescriptor(int array) const
Returns the PatchDescriptor for the patches in array.
Handle that can be used as unique patch identifier within PatchTable.
std::vector< PatchParam > PatchParamTable
PatchDescriptor GetPatchDescriptor(PatchHandle const &handle) const
Returns the PatchDescriptor for the patch identified by handle.