2012-12-11 01:15:13 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// Copyright 2013 Pixar
|
2012-12-11 01:15:13 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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:
|
2012-12-11 01:15:13 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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.
|
2012-12-11 01:15:13 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// You may obtain a copy of the Apache License at
|
2012-12-11 01:15:13 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2013-07-18 21:19:50 +00:00
|
|
|
//
|
2013-09-26 19:04:57 +00:00
|
|
|
// 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.
|
2012-12-11 01:15:13 +00:00
|
|
|
//
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
#ifndef OPENSUBDIV3_FAR_PATCH_TABLE_H
|
|
|
|
#define OPENSUBDIV3_FAR_PATCH_TABLE_H
|
2012-12-11 01:15:13 +00:00
|
|
|
|
|
|
|
#include "../version.h"
|
2013-03-25 14:32:17 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
#include "../far/patchDescriptor.h"
|
2015-05-20 22:44:29 +00:00
|
|
|
#include "../far/patchParam.h"
|
2015-05-22 18:50:01 +00:00
|
|
|
#include "../far/stencilTable.h"
|
2015-02-26 21:57:47 +00:00
|
|
|
|
|
|
|
#include "../sdc/options.h"
|
2013-05-17 16:47:44 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
#include <vector>
|
2012-12-11 01:15:13 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
namespace Far {
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Container for arrays of parametric patches
|
2012-12-11 01:15:13 +00:00
|
|
|
///
|
2015-08-12 18:03:27 +00:00
|
|
|
/// PatchTable contains topology and parametric information about the patches
|
2015-05-22 18:50:01 +00:00
|
|
|
/// generated by the Refinement process. Patches in the table are sorted into
|
2014-11-25 20:41:19 +00:00
|
|
|
/// arrays based on their PatchDescriptor Type.
|
2012-12-11 01:15:13 +00:00
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
/// Note : PatchTable can be accessed either using a PatchHandle or a
|
2015-02-26 21:57:47 +00:00
|
|
|
/// combination of array and patch indices.
|
|
|
|
///
|
|
|
|
/// XXXX manuelk we should add a PatchIterator that can dereference into
|
2015-05-22 18:50:01 +00:00
|
|
|
/// a PatchHandle for fast linear traversal of the table
|
2015-02-26 21:57:47 +00:00
|
|
|
///
|
2015-05-22 18:50:01 +00:00
|
|
|
class PatchTable {
|
2012-12-11 01:15:13 +00:00
|
|
|
|
|
|
|
public:
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
/// \brief Handle that can be used as unique patch identifier within PatchTable
|
2014-11-25 20:41:19 +00:00
|
|
|
class PatchHandle {
|
2015-02-26 21:57:47 +00:00
|
|
|
// XXXX manuelk members will eventually be made private
|
2014-11-25 20:41:19 +00:00
|
|
|
public:
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
friend class PatchTable;
|
2014-11-25 20:41:19 +00:00
|
|
|
friend class PatchMap;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
Index arrayIndex, // Array index of the patch
|
|
|
|
patchIndex, // Absolute Index of the patch
|
|
|
|
vertIndex; // Relative offset to the first CV of the patch in array
|
2013-05-09 00:06:59 +00:00
|
|
|
};
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-10-09 21:48:50 +00:00
|
|
|
public:
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Copy constructor
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable(PatchTable const & src);
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Destructor
|
2015-05-22 18:50:01 +00:00
|
|
|
~PatchTable();
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief True if the patches are of feature adaptive types
|
|
|
|
bool IsFeatureAdaptive() const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
/// \brief Returns the total number of control vertex indices in the table
|
2014-11-25 20:41:19 +00:00
|
|
|
int GetNumControlVerticesTotal() const {
|
|
|
|
return (int)_patchVerts.size();
|
|
|
|
}
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
/// \brief Returns the total number of patches stored in the table
|
2014-11-25 20:41:19 +00:00
|
|
|
int GetNumPatchesTotal() const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Returns max vertex valence
|
|
|
|
int GetMaxValence() const { return _maxValence; }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Returns the total number of ptex faces in the mesh
|
|
|
|
int GetNumPtexFaces() const { return _numPtexFaces; }
|
2014-02-25 01:12:39 +00:00
|
|
|
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//@{
|
|
|
|
/// @name Individual patches
|
|
|
|
///
|
|
|
|
/// \anchor individual_patches
|
|
|
|
///
|
|
|
|
/// \brief Accessors for individual patches
|
|
|
|
///
|
2013-05-10 17:44:03 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the PatchDescriptor for the patch identified by \p handle
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchDescriptor GetPatchDescriptor(PatchHandle const & handle) const;
|
2013-05-09 20:14:02 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the control vertex indices for the patch identified by \p handle
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray GetPatchVertices(PatchHandle const & handle) const;
|
2013-05-09 20:14:02 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns a PatchParam for the patch identified by \p handle
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchParam GetPatchParam(PatchHandle const & handle) const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the control vertex indices for \p patch in \p array
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray GetPatchVertices(int array, int patch) const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the PatchParam for \p patch in \p array
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchParam GetPatchParam(int array, int patch) const;
|
|
|
|
//@}
|
2013-05-09 16:23:01 +00:00
|
|
|
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//@{
|
|
|
|
/// @name Arrays of patches
|
|
|
|
///
|
|
|
|
/// \anchor arrays_of_patches
|
|
|
|
///
|
|
|
|
/// \brief Accessors for arrays of patches of the same type
|
|
|
|
///
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Returns the number of patch arrays in the table
|
|
|
|
int GetNumPatchArrays() const;
|
2013-05-09 20:14:02 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the number of patches in \p array
|
2014-11-25 20:41:19 +00:00
|
|
|
int GetNumPatches(int array) const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the number of control vertices in \p array
|
2014-11-25 20:41:19 +00:00
|
|
|
int GetNumControlVertices(int array) const;
|
2012-12-11 01:15:13 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the PatchDescriptor for the patches in \p array
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchDescriptor GetPatchArrayDescriptor(int array) const;
|
2014-09-19 00:48:34 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the control vertex indices for the patches in \p array
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstIndexArray GetPatchArrayVertices(int array) const;
|
2012-12-11 01:15:13 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the PatchParams for the patches in \p array
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstPatchParamArray const GetPatchParams(int array) const;
|
2014-11-25 20:41:19 +00:00
|
|
|
//@}
|
2012-12-11 01:15:13 +00:00
|
|
|
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//@{
|
2016-07-19 23:39:33 +00:00
|
|
|
/// @name Change of basis patches
|
2014-09-05 22:07:46 +00:00
|
|
|
///
|
2015-05-29 19:41:11 +00:00
|
|
|
/// \anchor change_of_basis_patches
|
2014-09-05 22:07:46 +00:00
|
|
|
///
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Accessors for change of basis patches
|
2014-09-05 22:07:46 +00:00
|
|
|
///
|
2015-05-29 19:41:11 +00:00
|
|
|
///
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the number of local vertex points.
|
2015-05-29 19:41:11 +00:00
|
|
|
int GetNumLocalPoints() const;
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the stencil table to compute local point vertex values
|
2018-07-28 21:56:43 +00:00
|
|
|
StencilTable const *GetLocalPointStencilTable() const;
|
|
|
|
|
|
|
|
/// \brief Returns the stencil table to compute local point vertex values
|
|
|
|
template <typename REAL>
|
|
|
|
StencilTableReal<REAL> const *GetLocalPointStencilTable() const;
|
|
|
|
|
|
|
|
/// \brief Tests the precision of the stencil table to compute local point
|
|
|
|
/// vertex values
|
|
|
|
template <typename REAL> bool IsLocalPointStencilPrecision() const;
|
2015-05-29 19:41:11 +00:00
|
|
|
|
2018-09-13 19:50:00 +00:00
|
|
|
/// \brief Updates local point vertex values.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param src Buffer with primvar data for the base and refined
|
2018-09-13 19:50:00 +00:00
|
|
|
/// vertex values
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
/// @param dst Destination buffer for the computed local point
|
2018-09-13 19:50:00 +00:00
|
|
|
/// vertex values
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2018-09-13 19:50:00 +00:00
|
|
|
/// For more flexibility computing local vertex points, retrieval of
|
|
|
|
/// the local point stencil table and use of its public methods is
|
|
|
|
/// recommended or often required.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
template <class T> void
|
2018-09-13 19:50:00 +00:00
|
|
|
ComputeLocalPointValues(T const *src, T *dst) const;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2018-09-13 19:50:00 +00:00
|
|
|
|
|
|
|
/// \brief Returns the number of local varying points.
|
|
|
|
int GetNumLocalPointsVarying() const;
|
2018-09-11 23:13:06 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the stencil table to compute local point varying values
|
2018-07-28 21:56:43 +00:00
|
|
|
StencilTable const *GetLocalPointVaryingStencilTable() const;
|
|
|
|
|
|
|
|
/// \brief Returns the stencil table to compute local point varying values
|
|
|
|
template <typename REAL>
|
|
|
|
StencilTableReal<REAL> const *GetLocalPointVaryingStencilTable() const;
|
|
|
|
|
|
|
|
/// \brief Tests the precision of the stencil table to compute local point
|
|
|
|
/// varying values
|
|
|
|
template <typename REAL> bool IsLocalPointVaryingStencilPrecision() const;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2018-09-13 19:50:00 +00:00
|
|
|
/// \brief Updates local point varying values.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param src Buffer with primvar data for the base and refined
|
2018-09-13 19:50:00 +00:00
|
|
|
/// varying values
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
/// @param dst Destination buffer for the computed local point
|
2018-09-13 19:50:00 +00:00
|
|
|
/// varying values
|
2016-10-12 00:07:14 +00:00
|
|
|
///
|
2018-09-13 19:50:00 +00:00
|
|
|
/// For more flexibility computing local varying points, retrieval of
|
|
|
|
/// the local point varying stencil table and use of its public methods
|
|
|
|
/// is recommended or often required.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
template <class T> void
|
2018-09-13 19:50:00 +00:00
|
|
|
ComputeLocalPointValuesVarying(T const *src, T *dst) const;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2018-09-13 19:50:00 +00:00
|
|
|
|
|
|
|
/// \brief Returns the number of local face-varying points for \p channel
|
|
|
|
int GetNumLocalPointsFaceVarying(int channel = 0) const;
|
2018-09-11 23:13:06 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the stencil table to compute local point face-varying values
|
2018-07-28 21:56:43 +00:00
|
|
|
StencilTable const *GetLocalPointFaceVaryingStencilTable(int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief Returns the stencil table to compute local point face-varying values
|
|
|
|
template <typename REAL>
|
|
|
|
StencilTableReal<REAL> const * GetLocalPointFaceVaryingStencilTable(int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief Tests the precision of the stencil table to compute local point
|
|
|
|
/// face-varying values
|
|
|
|
template <typename REAL> bool IsLocalPointFaceVaryingStencilPrecision() const;
|
2018-09-13 19:50:00 +00:00
|
|
|
|
|
|
|
/// \brief Updates local point face-varying values.
|
|
|
|
///
|
|
|
|
/// @param src Buffer with primvar data for the base and refined
|
|
|
|
/// face-varying values
|
|
|
|
///
|
|
|
|
/// @param dst Destination buffer for the computed local point
|
|
|
|
/// face-varying values
|
|
|
|
///
|
|
|
|
/// @param channel face-varying channel
|
|
|
|
///
|
|
|
|
/// For more flexibility computing local face-varying points, retrieval
|
|
|
|
/// of the local point face-varying stencil table and use of its public
|
|
|
|
/// methods is recommended or often required.
|
|
|
|
///
|
|
|
|
template <class T> void
|
|
|
|
ComputeLocalPointValuesFaceVarying(T const *src, T *dst, int channel = 0) const;
|
2015-05-29 19:41:11 +00:00
|
|
|
//@}
|
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2015-05-29 19:41:11 +00:00
|
|
|
//@{
|
|
|
|
/// @name Legacy gregory patch evaluation buffers
|
|
|
|
|
|
|
|
/// \brief Accessors for the gregory patch evaluation buffers.
|
|
|
|
/// These methods will be deprecated.
|
|
|
|
///
|
2014-12-15 18:23:13 +00:00
|
|
|
typedef Vtr::ConstArray<unsigned int> ConstQuadOffsetsArray;
|
2013-05-09 16:23:01 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the 'QuadOffsets' for the Gregory patch identified by \p handle
|
2014-12-15 18:23:13 +00:00
|
|
|
ConstQuadOffsetsArray GetPatchQuadOffsets(PatchHandle const & handle) const;
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
typedef std::vector<Index> VertexValenceTable;
|
2012-12-11 01:15:13 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
/// \brief Returns the 'VertexValences' table (vertex neighborhoods table)
|
|
|
|
VertexValenceTable const & GetVertexValenceTable() const {
|
|
|
|
return _vertexValenceTable;
|
|
|
|
}
|
|
|
|
//@}
|
2013-03-23 01:20:50 +00:00
|
|
|
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//@{
|
|
|
|
/// @name Single-crease patches
|
|
|
|
///
|
|
|
|
/// \anchor single_crease_patches
|
|
|
|
///
|
|
|
|
/// \brief Accessors for single-crease patch edge sharpness
|
|
|
|
///
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the crease sharpness for the patch identified by \p handle
|
2014-11-25 20:41:19 +00:00
|
|
|
/// if it is a single-crease patch, or 0.0f
|
|
|
|
float GetSingleCreasePatchSharpnessValue(PatchHandle const & handle) const;
|
2014-03-25 02:13:40 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the crease sharpness for the \p patch in \p array
|
2014-11-25 20:41:19 +00:00
|
|
|
/// if it is a single-crease patch, or 0.0f
|
|
|
|
float GetSingleCreasePatchSharpnessValue(int array, int patch) const;
|
|
|
|
//@}
|
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
//@{
|
|
|
|
/// @name Varying data
|
|
|
|
///
|
|
|
|
/// \anchor varying_data
|
|
|
|
///
|
|
|
|
/// \brief Accessors for varying data
|
|
|
|
///
|
|
|
|
|
2016-09-29 16:51:19 +00:00
|
|
|
/// \brief Returns the varying patch descriptor
|
|
|
|
PatchDescriptor GetVaryingPatchDescriptor() const;
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the varying vertex indices for a given patch
|
|
|
|
ConstIndexArray GetPatchVaryingVertices(PatchHandle const & handle) const;
|
|
|
|
|
|
|
|
/// \brief Returns the varying vertex indices for a given patch
|
|
|
|
ConstIndexArray GetPatchVaryingVertices(int array, int patch) const;
|
|
|
|
|
|
|
|
/// \brief Returns the varying vertex indices for the patches in \p array
|
|
|
|
ConstIndexArray GetPatchArrayVaryingVertices(int array) const;
|
|
|
|
|
|
|
|
/// \brief Returns an array of varying vertex indices for the patches.
|
|
|
|
ConstIndexArray GetVaryingVertices() const;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//@{
|
2015-02-26 21:57:47 +00:00
|
|
|
/// @name Face-varying channels
|
2014-11-25 20:41:19 +00:00
|
|
|
///
|
2015-02-26 21:57:47 +00:00
|
|
|
/// \anchor face_varying_channels
|
2014-09-05 22:07:46 +00:00
|
|
|
///
|
2015-02-26 21:57:47 +00:00
|
|
|
/// \brief Accessors for face-varying channels
|
2014-09-05 22:07:46 +00:00
|
|
|
///
|
2014-04-05 02:10:34 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
/// \brief Returns the number of face-varying channels
|
|
|
|
int GetNumFVarChannels() const;
|
2014-04-05 02:10:34 +00:00
|
|
|
|
2018-09-13 23:51:53 +00:00
|
|
|
/// \brief Returns the regular patch descriptor for \p channel
|
|
|
|
PatchDescriptor GetFVarPatchDescriptorRegular(int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief Returns the irregular patch descriptor for \p channel
|
|
|
|
PatchDescriptor GetFVarPatchDescriptorIrregular(int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief Returns the default/irregular patch descriptor for \p channel
|
2016-10-15 02:50:21 +00:00
|
|
|
PatchDescriptor GetFVarPatchDescriptor(int channel = 0) const;
|
2014-04-05 02:10:34 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the value indices for a given patch in \p channel
|
2015-06-02 20:51:32 +00:00
|
|
|
ConstIndexArray GetPatchFVarValues(PatchHandle const & handle, int channel = 0) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the value indices for a given patch in \p channel
|
2015-06-02 20:51:32 +00:00
|
|
|
ConstIndexArray GetPatchFVarValues(int array, int patch, int channel = 0) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Returns the value indices for the patches in \p array in \p channel
|
|
|
|
ConstIndexArray GetPatchArrayFVarValues(int array, int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief Returns an array of value indices for the patches in \p channel
|
2015-06-02 20:51:32 +00:00
|
|
|
ConstIndexArray GetFVarValues(int channel = 0) const;
|
2016-08-19 00:21:59 +00:00
|
|
|
|
2018-09-13 23:51:53 +00:00
|
|
|
/// \brief Returns the stride between patches in the value index array of \p channel
|
|
|
|
int GetFVarValueStride(int channel = 0) const;
|
|
|
|
|
2016-08-19 00:21:59 +00:00
|
|
|
/// \brief Returns the value indices for a given patch in \p channel
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam GetPatchFVarPatchParam(PatchHandle const & handle, int channel = 0) const;
|
2016-08-19 00:21:59 +00:00
|
|
|
|
|
|
|
/// \brief Returns the face-varying params for a given patch \p channel
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam GetPatchFVarPatchParam(int array, int patch, int channel = 0) const;
|
2016-08-19 00:21:59 +00:00
|
|
|
|
|
|
|
/// \brief Returns the face-varying for a given patch in \p array in \p channel
|
2016-10-12 00:07:14 +00:00
|
|
|
ConstPatchParamArray GetPatchArrayFVarPatchParams(int array, int channel = 0) const;
|
2016-08-19 00:21:59 +00:00
|
|
|
|
|
|
|
/// \brief Returns an array of face-varying patch param for \p channel
|
2016-10-12 00:07:14 +00:00
|
|
|
ConstPatchParamArray GetFVarPatchParams(int channel = 0) const;
|
2016-10-18 00:52:20 +00:00
|
|
|
|
|
|
|
/// \brief Deprecated @see PatchTable#GetFVarPatchDescriptor
|
|
|
|
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel = 0) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/// @name Direct accessors
|
|
|
|
///
|
|
|
|
/// \warning These direct accessors are left for convenience, but they are
|
|
|
|
/// likely going to be deprecated in future releases
|
|
|
|
///
|
|
|
|
|
|
|
|
typedef std::vector<Index> PatchVertsTable;
|
|
|
|
|
|
|
|
/// \brief Get the table of patch control vertices
|
|
|
|
PatchVertsTable const & GetPatchControlVerticesTable() const { return _patchVerts; }
|
|
|
|
|
|
|
|
/// \brief Returns the PatchParamTable (PatchParams order matches patch array sorting)
|
|
|
|
PatchParamTable const & GetPatchParamTable() const { return _paramTable; }
|
|
|
|
|
|
|
|
/// \brief Returns a sharpness index table for each patch (if exists)
|
|
|
|
std::vector<Index> const &GetSharpnessIndexTable() const { return _sharpnessIndices; }
|
|
|
|
|
|
|
|
/// \brief Returns sharpness values table
|
|
|
|
std::vector<float> const &GetSharpnessValues() const { return _sharpnessValues; }
|
|
|
|
|
|
|
|
typedef std::vector<unsigned int> QuadOffsetsTable;
|
|
|
|
|
|
|
|
/// \brief Returns the quad-offsets table
|
|
|
|
QuadOffsetsTable const & GetQuadOffsetsTable() const {
|
|
|
|
return _quadOffsetsTable;
|
|
|
|
}
|
2014-11-25 20:41:19 +00:00
|
|
|
//@}
|
2014-04-05 02:10:34 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
/// debug helper
|
|
|
|
void print() const;
|
|
|
|
|
2014-10-02 23:09:17 +00:00
|
|
|
public:
|
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
//@{
|
2015-05-20 22:44:29 +00:00
|
|
|
/// @name Evaluation methods
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Evaluate basis functions for position and derivatives at a
|
2016-10-18 00:52:20 +00:00
|
|
|
/// given (u,v) parametric location of a patch.
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-02-15 15:48:39 +00:00
|
|
|
/// @param handle A patch handle identifying the sub-patch containing the
|
2016-10-18 00:52:20 +00:00
|
|
|
/// (u,v) location
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param u Patch coordinate (in base face normalized space)
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param v Patch coordinate (in base face normalized space)
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2015-05-20 22:44:29 +00:00
|
|
|
/// @param wP Weights (evaluated basis functions) for the position
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
|
2014-10-02 23:09:17 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
|
|
|
void EvaluateBasis(PatchHandle const & handle, REAL u, REAL v,
|
|
|
|
REAL wP[], REAL wDu[] = 0, REAL wDv[] = 0,
|
|
|
|
REAL wDuu[] = 0, REAL wDuv[] = 0, REAL wDvv[] = 0) const;
|
|
|
|
|
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
2016-10-18 00:52:20 +00:00
|
|
|
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;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2018-07-28 21:43:32 +00:00
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
|
|
|
void EvaluateBasis(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[] = 0, double wDv[] = 0,
|
|
|
|
double wDuu[] = 0, double wDuv[] = 0, double wDvv[] = 0) const;
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Evaluate basis functions for a varying value and
|
2016-10-18 00:52:20 +00:00
|
|
|
/// derivatives at a given (u,v) parametric location of a patch.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2015-08-12 19:36:58 +00:00
|
|
|
/// @param handle A patch handle identifying the sub-patch containing the
|
2016-10-18 00:52:20 +00:00
|
|
|
/// (u,v) location
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param u Patch coordinate (in base face normalized space)
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param v Patch coordinate (in base face normalized space)
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
/// @param wP Weights (evaluated basis functions) for the position
|
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
|
|
|
void EvaluateBasisVarying(PatchHandle const & handle, REAL u, REAL v,
|
|
|
|
REAL wP[], REAL wDu[] = 0, REAL wDv[] = 0,
|
|
|
|
REAL wDuu[] = 0, REAL wDuv[] = 0, REAL wDvv[] = 0) const;
|
|
|
|
|
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
2016-10-18 00:52:20 +00:00
|
|
|
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;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2018-07-28 21:43:32 +00:00
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
|
|
|
void EvaluateBasisVarying(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[] = 0, double wDv[] = 0,
|
|
|
|
double wDuu[] = 0, double wDuv[] = 0, double wDvv[] = 0) const;
|
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
/// \brief Evaluate basis functions for a face-varying value and
|
2016-10-18 00:52:20 +00:00
|
|
|
/// derivatives at a given (u,v) parametric location of a patch.
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-02-15 15:48:39 +00:00
|
|
|
/// @param handle A patch handle identifying the sub-patch containing the
|
2016-10-18 00:52:20 +00:00
|
|
|
/// (u,v) location
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param u Patch coordinate (in base face normalized space)
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param v Patch coordinate (in base face normalized space)
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
/// @param wP Weights (evaluated basis functions) for the position
|
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
2016-10-18 00:52:20 +00:00
|
|
|
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
|
2016-07-19 23:39:33 +00:00
|
|
|
///
|
|
|
|
/// @param channel face-varying channel
|
|
|
|
///
|
2018-07-28 21:43:32 +00:00
|
|
|
template <typename REAL>
|
|
|
|
void EvaluateBasisFaceVarying(PatchHandle const & handle, REAL u, REAL v,
|
|
|
|
REAL wP[], REAL wDu[] = 0, REAL wDv[] = 0,
|
|
|
|
REAL wDuu[] = 0, REAL wDuv[] = 0, REAL wDvv[] = 0,
|
|
|
|
int channel = 0) const;
|
|
|
|
|
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
2016-10-18 00:52:20 +00:00
|
|
|
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,
|
2016-07-19 23:39:33 +00:00
|
|
|
int channel = 0) const;
|
2018-07-28 21:43:32 +00:00
|
|
|
|
|
|
|
/// \brief An overloaded version to assist template parameter resolution
|
|
|
|
/// when explicitly declaring unused array arguments as 0.
|
|
|
|
void EvaluateBasisFaceVarying(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[] = 0, double wDv[] = 0,
|
|
|
|
double wDuu[] = 0, double wDuv[] = 0, double wDvv[] = 0,
|
|
|
|
int channel = 0) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
//@}
|
2014-09-19 00:48:34 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
protected:
|
|
|
|
|
2018-05-09 00:24:14 +00:00
|
|
|
friend class PatchTableBuilder;
|
2014-12-25 21:03:53 +00:00
|
|
|
|
|
|
|
// Factory constructor
|
2015-05-22 18:50:01 +00:00
|
|
|
PatchTable(int maxvalence);
|
2014-12-25 21:03:53 +00:00
|
|
|
|
2015-01-28 23:50:23 +00:00
|
|
|
Index getPatchIndex(int array, int patch) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchParamArray getPatchParams(int arrayIndex);
|
|
|
|
|
|
|
|
Index * getSharpnessIndices(Index arrayIndex);
|
|
|
|
float * getSharpnessValues(Index arrayIndex);
|
|
|
|
|
2014-09-19 00:48:34 +00:00
|
|
|
private:
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//
|
|
|
|
// Patch arrays
|
|
|
|
//
|
2014-10-09 21:48:50 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
struct PatchArray;
|
2015-02-26 21:57:47 +00:00
|
|
|
typedef std::vector<PatchArray> PatchArrayVector;
|
2013-05-09 00:06:59 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
PatchArray & getPatchArray(Index arrayIndex);
|
|
|
|
PatchArray const & getPatchArray(Index arrayIndex) const;
|
2014-11-11 19:27:25 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
void reservePatchArrays(int numPatchArrays);
|
|
|
|
void pushPatchArray(PatchDescriptor desc, int npatches,
|
|
|
|
Index * vidx, Index * pidx, Index * qoidx=0);
|
|
|
|
|
|
|
|
IndexArray getPatchArrayVertices(int arrayIndex);
|
|
|
|
|
|
|
|
Index findPatchArray(PatchDescriptor desc);
|
2014-11-11 19:27:25 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
|
|
|
|
//
|
2016-07-19 23:39:33 +00:00
|
|
|
// Varying patch arrays
|
|
|
|
//
|
|
|
|
IndexArray getPatchArrayVaryingVertices(int arrayIndex);
|
|
|
|
|
|
|
|
void allocateVaryingVertices(
|
|
|
|
PatchDescriptor desc, int numPatches);
|
2016-08-24 21:02:57 +00:00
|
|
|
void populateVaryingVertices();
|
2016-07-19 23:39:33 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Face-varying patch channels
|
2015-02-26 21:57:47 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
struct FVarPatchChannel;
|
|
|
|
typedef std::vector<FVarPatchChannel> FVarPatchChannelVector;
|
|
|
|
|
2015-06-04 02:23:50 +00:00
|
|
|
FVarPatchChannel & getFVarPatchChannel(int channel);
|
|
|
|
FVarPatchChannel const & getFVarPatchChannel(int channel) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
|
|
|
void allocateFVarPatchChannels(int numChannels);
|
2015-06-02 20:51:32 +00:00
|
|
|
void 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
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
// deprecated
|
2015-06-02 20:51:32 +00:00
|
|
|
void setFVarPatchChannelLinearInterpolation(
|
2015-06-04 02:23:50 +00:00
|
|
|
Sdc::Options::FVarLinearInterpolation interpolation, int channel);
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2015-06-04 02:23:50 +00:00
|
|
|
IndexArray getFVarValues(int channel);
|
|
|
|
ConstIndexArray getPatchFVarValues(int patch, int channel) const;
|
2015-02-26 21:57:47 +00:00
|
|
|
|
2016-10-12 00:07:14 +00:00
|
|
|
PatchParamArray getFVarPatchParams(int channel);
|
2016-09-29 16:38:32 +00:00
|
|
|
PatchParam getPatchFVarPatchParam(int patch, int channel) const;
|
2016-08-19 00:21:59 +00:00
|
|
|
|
2018-07-28 21:56:43 +00:00
|
|
|
private:
|
|
|
|
//
|
|
|
|
// Private class to manage stencil table pointers of varying precision
|
|
|
|
//
|
|
|
|
// This implementation is still up for debate -- could be improved or
|
|
|
|
// could be entirely replaced...
|
|
|
|
//
|
|
|
|
class StencilTableHandler {
|
|
|
|
private:
|
|
|
|
typedef StencilTableReal<float> float_type;
|
|
|
|
typedef StencilTableReal<double> double_type;
|
|
|
|
|
|
|
|
void init() { _fPtr = 0, _isDouble = false; }
|
|
|
|
void init(float_type * ptr) { _fPtr = ptr, _isDouble = false; }
|
|
|
|
void init(double_type * ptr) { _dPtr = ptr, _isDouble = true; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
StencilTableHandler() { init(); }
|
|
|
|
StencilTableHandler(float_type * ptr) { init(ptr); }
|
|
|
|
StencilTableHandler(double_type * ptr) { init(ptr); }
|
|
|
|
|
|
|
|
// Generic accessor and modifiers:
|
|
|
|
template <typename REAL> StencilTableReal<REAL> * Get() const;
|
|
|
|
|
|
|
|
void Set(float_type * ptr) { init(ptr); }
|
|
|
|
void Set(double_type * ptr) { init(ptr); }
|
|
|
|
|
|
|
|
// Other utilities
|
|
|
|
bool IsSet() const { return _fPtr != 0; }
|
|
|
|
bool IsDouble() const { return _isDouble; }
|
|
|
|
void Clear() { init(); }
|
|
|
|
|
|
|
|
int Size() const {
|
|
|
|
return _isDouble ? _dPtr->GetNumStencils() : _fPtr->GetNumStencils();
|
|
|
|
}
|
|
|
|
void Delete() {
|
|
|
|
if (_isDouble) delete _dPtr;
|
|
|
|
else delete _fPtr;
|
|
|
|
}
|
|
|
|
StencilTableHandler Clone() const {
|
|
|
|
return _isDouble ? StencilTableHandler(new double_type(*_dPtr))
|
|
|
|
: StencilTableHandler(new float_type(*_fPtr));
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
union {
|
|
|
|
float_type * _fPtr;
|
|
|
|
double_type * _dPtr;
|
|
|
|
};
|
|
|
|
bool _isDouble;
|
|
|
|
};
|
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
private:
|
2014-11-25 20:41:19 +00:00
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
//
|
|
|
|
// Topology
|
|
|
|
//
|
2012-12-11 01:15:13 +00:00
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
int _maxValence, // highest vertex valence found in the mesh
|
|
|
|
_numPtexFaces; // total number of ptex faces
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
PatchArrayVector _patchArrays; // Vector of descriptors for arrays of patches
|
2014-11-25 20:41:19 +00:00
|
|
|
|
|
|
|
std::vector<Index> _patchVerts; // Indices of the control vertices of the patches
|
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
PatchParamTable _paramTable; // PatchParam bitfields (one per patch)
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
//
|
2015-04-23 23:58:45 +00:00
|
|
|
// Extraordinary vertex closed-form evaluation / endcap basis conversion
|
|
|
|
//
|
|
|
|
// XXXtakahito: these data will probably be replaced with mask coefficient or something
|
|
|
|
// SchemeWorker populates.
|
2014-11-11 19:27:25 +00:00
|
|
|
//
|
2014-11-25 20:41:19 +00:00
|
|
|
QuadOffsetsTable _quadOffsetsTable; // Quad offsets (for Gregory patches)
|
2014-11-11 19:27:25 +00:00
|
|
|
VertexValenceTable _vertexValenceTable; // Vertex valence table (for Gregory patches)
|
2018-07-28 21:56:43 +00:00
|
|
|
|
|
|
|
StencilTableHandler _localPointStencils; // local point conversion stencils
|
|
|
|
StencilTableHandler _localPointVaryingStencils; // local point varying stencils
|
2014-02-25 01:12:39 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
//
|
|
|
|
// Varying data
|
|
|
|
//
|
|
|
|
|
|
|
|
PatchDescriptor _varyingDesc;
|
|
|
|
|
|
|
|
std::vector<Index> _varyingVerts;
|
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
//
|
|
|
|
// Face-varying data
|
|
|
|
//
|
2013-03-08 01:50:15 +00:00
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
FVarPatchChannelVector _fvarChannels;
|
2014-10-13 15:52:09 +00:00
|
|
|
|
2018-07-28 21:56:43 +00:00
|
|
|
std::vector<StencilTableHandler> _localPointFaceVaryingStencils;
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2014-11-11 19:27:25 +00:00
|
|
|
//
|
|
|
|
// 'single-crease' patch sharpness tables
|
|
|
|
//
|
2014-10-13 15:52:09 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
std::vector<Index> _sharpnessIndices; // Indices of single-crease sharpness (one per patch)
|
|
|
|
std::vector<float> _sharpnessValues; // Sharpness values.
|
2018-07-28 21:56:43 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Precision -- only applies to local-point stencil tables
|
|
|
|
//
|
|
|
|
unsigned int _vertexPrecisionIsDouble : 1;
|
|
|
|
unsigned int _varyingPrecisionIsDouble : 1;
|
|
|
|
unsigned int _faceVaryingPrecisionIsDouble : 1;
|
2012-12-11 01:15:13 +00:00
|
|
|
};
|
|
|
|
|
2018-07-28 21:56:43 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Template specializations for float/double -- to be defined before used:
|
|
|
|
//
|
|
|
|
template <> inline StencilTableReal<float> *
|
|
|
|
PatchTable::StencilTableHandler::Get<float>() const { return _fPtr; }
|
|
|
|
|
|
|
|
template <> inline StencilTableReal<double> *
|
|
|
|
PatchTable::StencilTableHandler::Get<double>() const { return _dPtr; }
|
|
|
|
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointStencilPrecision<float>() const {
|
|
|
|
return !_vertexPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointVaryingStencilPrecision<float>() const {
|
|
|
|
return !_varyingPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointFaceVaryingStencilPrecision<float>() const {
|
|
|
|
return !_faceVaryingPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointStencilPrecision<double>() const {
|
|
|
|
return _vertexPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointVaryingStencilPrecision<double>() const {
|
|
|
|
return _varyingPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
template <> inline bool
|
|
|
|
PatchTable::IsLocalPointFaceVaryingStencilPrecision<double>() const {
|
|
|
|
return _faceVaryingPrecisionIsDouble;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// StencilTable access -- backward compatible and generic:
|
|
|
|
//
|
|
|
|
inline StencilTable const *
|
|
|
|
PatchTable::GetLocalPointStencilTable() const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointStencilPrecision<float>());
|
2018-07-28 21:56:43 +00:00
|
|
|
return static_cast<StencilTable const *>(_localPointStencils.Get<float>());
|
|
|
|
}
|
|
|
|
inline StencilTable const *
|
|
|
|
PatchTable::GetLocalPointVaryingStencilTable() const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointVaryingStencilPrecision<float>());
|
2018-07-28 21:56:43 +00:00
|
|
|
return static_cast<StencilTable const *>(
|
|
|
|
_localPointVaryingStencils.Get<float>());
|
|
|
|
}
|
|
|
|
inline StencilTable const *
|
|
|
|
PatchTable::GetLocalPointFaceVaryingStencilTable(int channel) const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointFaceVaryingStencilPrecision<float>());
|
2018-07-28 21:56:43 +00:00
|
|
|
if (channel >= 0 && channel < (int)_localPointFaceVaryingStencils.size()) {
|
|
|
|
return static_cast<StencilTable const *>(
|
|
|
|
_localPointFaceVaryingStencils[channel].Get<float>());
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename REAL>
|
|
|
|
inline StencilTableReal<REAL> const *
|
|
|
|
PatchTable::GetLocalPointStencilTable() const {
|
|
|
|
assert(IsLocalPointStencilPrecision<REAL>());
|
|
|
|
return _localPointStencils.Get<REAL>();
|
|
|
|
}
|
|
|
|
template <typename REAL>
|
|
|
|
inline StencilTableReal<REAL> const *
|
|
|
|
PatchTable::GetLocalPointVaryingStencilTable() const {
|
|
|
|
assert(IsLocalPointVaryingStencilPrecision<REAL>());
|
|
|
|
return _localPointVaryingStencils.Get<REAL>();
|
|
|
|
}
|
|
|
|
template <typename REAL>
|
|
|
|
inline StencilTableReal<REAL> const *
|
|
|
|
PatchTable::GetLocalPointFaceVaryingStencilTable(int channel) const {
|
|
|
|
assert(IsLocalPointFaceVaryingStencilPrecision<REAL>());
|
|
|
|
if (channel >= 0 && channel < (int)_localPointFaceVaryingStencils.size()) {
|
|
|
|
return _localPointFaceVaryingStencils[channel].Get<REAL>();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Computation of local point values:
|
|
|
|
//
|
2015-05-29 19:41:11 +00:00
|
|
|
template <class T>
|
|
|
|
inline void
|
|
|
|
PatchTable::ComputeLocalPointValues(T const *src, T *dst) const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointStencilPrecision<float>());
|
2018-07-28 21:56:43 +00:00
|
|
|
if (_localPointStencils.IsSet()) {
|
2018-09-13 19:50:00 +00:00
|
|
|
_localPointStencils.Get<float>()->UpdateValues(src, dst);
|
2018-09-11 23:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-29 19:41:11 +00:00
|
|
|
|
2016-07-19 23:39:33 +00:00
|
|
|
template <class T>
|
|
|
|
inline void
|
|
|
|
PatchTable::ComputeLocalPointValuesVarying(T const *src, T *dst) const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointVaryingStencilPrecision<float>());
|
2018-07-28 21:56:43 +00:00
|
|
|
if (_localPointVaryingStencils.IsSet()) {
|
2018-09-13 19:50:00 +00:00
|
|
|
_localPointVaryingStencils.Get<float>()->UpdateValues(src, dst);
|
2018-09-11 23:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
inline void
|
|
|
|
PatchTable::ComputeLocalPointValuesFaceVarying(T const *src, T *dst, int channel) const {
|
2018-09-13 19:50:00 +00:00
|
|
|
assert(IsLocalPointFaceVaryingStencilPrecision<float>());
|
2016-07-19 23:39:33 +00:00
|
|
|
if (channel >= 0 && channel < (int)_localPointFaceVaryingStencils.size()) {
|
2018-07-28 21:56:43 +00:00
|
|
|
if (_localPointFaceVaryingStencils[channel].IsSet()) {
|
2018-09-13 19:50:00 +00:00
|
|
|
_localPointFaceVaryingStencils[channel].Get<float>()->UpdateValues(src, dst);
|
2018-09-11 23:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-07-19 23:39:33 +00:00
|
|
|
|
2018-07-28 21:56:43 +00:00
|
|
|
|
2018-07-28 21:43:32 +00:00
|
|
|
//
|
|
|
|
// Basis evaluation overloads
|
|
|
|
//
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasis(PatchHandle const & handle, float u, float v,
|
|
|
|
float wP[], float wDu[], float wDv[],
|
|
|
|
float wDuu[], float wDuv[], float wDvv[]) const {
|
|
|
|
|
|
|
|
EvaluateBasis<float>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
}
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasis(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[], double wDv[],
|
|
|
|
double wDuu[], double wDuv[], double wDvv[]) const {
|
|
|
|
|
|
|
|
EvaluateBasis<double>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasisVarying(PatchHandle const & handle, float u, float v,
|
|
|
|
float wP[], float wDu[], float wDv[],
|
|
|
|
float wDuu[], float wDuv[], float wDvv[]) const {
|
|
|
|
|
|
|
|
EvaluateBasisVarying<float>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
}
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasisVarying(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[], double wDv[],
|
|
|
|
double wDuu[], double wDuv[], double wDvv[]) const {
|
|
|
|
|
|
|
|
EvaluateBasisVarying<double>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasisFaceVarying(PatchHandle const & handle, float u, float v,
|
|
|
|
float wP[], float wDu[], float wDv[],
|
|
|
|
float wDuu[], float wDuv[], float wDvv[], int channel) const {
|
|
|
|
|
|
|
|
EvaluateBasisFaceVarying<float>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv, channel);
|
|
|
|
}
|
|
|
|
inline void
|
|
|
|
PatchTable::EvaluateBasisFaceVarying(PatchHandle const & handle, double u, double v,
|
|
|
|
double wP[], double wDu[], double wDv[],
|
|
|
|
double wDuu[], double wDuv[], double wDvv[], int channel) const {
|
|
|
|
|
|
|
|
EvaluateBasisFaceVarying<double>(handle, u, v, wP, wDu, wDv, wDuu, wDuv, wDvv, channel);
|
|
|
|
}
|
2015-05-29 19:41:11 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
} // end namespace Far
|
2013-03-23 01:20:50 +00:00
|
|
|
|
2012-12-11 01:15:13 +00:00
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
2015-05-22 18:50:01 +00:00
|
|
|
#endif /* OPENSUBDIV3_FAR_PATCH_TABLE */
|