25#ifndef OPENSUBDIV3_FAR_STENCILTABLE_H
26#define OPENSUBDIV3_FAR_STENCILTABLE_H
28#include "../version.h"
30#include "../far/types.h"
38namespace OPENSUBDIV_VERSION {
43class PatchTableBuilder;
45template <
typename REAL>
class StencilTableFactoryReal;
46template <
typename REAL>
class LimitStencilTableFactoryReal;
52template <
typename REAL>
140template <
typename REAL>
144 std::vector<int>
const&
offsets,
145 std::vector<int>
const&
sizes,
146 std::vector<int>
const&
sources,
147 std::vector<REAL>
const&
weights,
157 return (
int)
_sizes.size();
204 template <
class T,
class U>
209 template <
class T1,
class T2,
class U>
216 template <
class T,
class U>
220 template <
class T1,
class T2,
class U>
232 template <
class T,
class U>
235 template <
class T1,
class T2,
class U>
289 std::vector<int>
const&
offsets,
290 std::vector<int>
const&
sizes,
291 std::vector<int>
const&
sources,
292 std::vector<float>
const&
weights,
302template <
typename REAL>
367 int stride = *this->
_size;
371 if (_duWeights) _duWeights += stride;
372 if (_dvWeights) _dvWeights += stride;
373 if (_duuWeights) _duuWeights += stride;
374 if (_duvWeights) _duvWeights += stride;
375 if (_dvvWeights) _dvvWeights += stride;
408template <
typename REAL>
413 std::vector<int>
const&
offsets,
414 std::vector<int>
const&
sizes,
415 std::vector<int>
const&
sources,
416 std::vector<REAL>
const&
weights,
475 template <
class T,
class U>
477 int start=-1,
int end=-1)
const {
483 template <
class T1,
class T2,
class U>
492 template <
class T,
class U>
494 int start=-1,
int end=-1)
const {
499 template <
class T1,
class T2,
class U>
527 template <
class T,
class U>
530 int start=-1,
int end=-1)
const {
537 template <
class T1,
class T2,
class U>
547 template <
class T,
class U>
549 int start=-1,
int end=-1)
const {
555 template <
class T1,
class T2,
class U>
574 std::vector<REAL> _duWeights,
597 std::vector<int>
const&
offsets,
598 std::vector<int>
const&
sizes,
599 std::vector<int>
const&
sources,
600 std::vector<float>
const&
weights,
616template <
typename REAL>
617template <
class T1,
class T2,
class U>
void
648template <
typename REAL>
649template <
class T,
class U>
void
676template <
typename REAL>
688template <
typename REAL>
696template <
typename REAL>
704template <
typename REAL>
712template <
typename REAL>
720template <
typename REAL>
732template <
typename REAL>
738template <
typename REAL>
742 _duWeights.resize(
nelems);
743 _dvWeights.resize(
nelems);
747template <
typename REAL>
748inline LimitStencilReal<REAL>
754 if (!_duWeights.empty() && !_dvWeights.empty() &&
755 !_duuWeights.empty() && !_duvWeights.empty() && !_dvvWeights.empty()) {
757 const_cast<int *
>(&this->
GetSizes()[i]),
760 const_cast<REAL *
>(&GetDuWeights()[
ofs]),
761 const_cast<REAL *
>(&GetDvWeights()[
ofs]),
762 const_cast<REAL *
>(&GetDuuWeights()[
ofs]),
763 const_cast<REAL *
>(&GetDuvWeights()[
ofs]),
764 const_cast<REAL *
>(&GetDvvWeights()[
ofs]) );
765 }
else if (!_duWeights.empty() && !_dvWeights.empty()) {
767 const_cast<int *
>(&this->
GetSizes()[i]),
770 const_cast<REAL *
>(&GetDuWeights()[
ofs]),
771 const_cast<REAL *
>(&GetDvWeights()[
ofs]) );
774 const_cast<int *
>(&this->
GetSizes()[i]),
780template <
typename REAL>
783 return GetLimitStencil(index);
789using namespace OPENSUBDIV_VERSION;
A specialized factory for StencilTable.
A specialized factory for LimitStencilTable.
Vertex stencil descriptor.
StencilReal()
Default constructor.
StencilReal(int *size, Index *indices, REAL *weights)
Constructor.
void Next()
Advance to the next stencil in the table.
StencilReal(StencilReal const &other)
Copy constructor.
Index const * GetVertexIndices() const
Returns the control vertices' indices.
int GetSize() const
Returns the size of the stencil.
int * GetSizePtr() const
Returns the size of the stencil as a pointer.
REAL const * GetWeights() const
Returns the interpolation weights.
Vertex stencil class wrapping the template for compatibility.
Stencil(BaseStencil const &other)
Stencil(int *size, Index *indices, float *weights)
StencilReal< float > BaseStencil
Table of subdivision stencils.
int GetNumControlVertices() const
Returns the number of control vertices indexed in the table.
std::vector< int > _sizes
friend class Far::PatchTableBuilder
void update(T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues, std::vector< REAL > const &valueWeights, Index start, Index end) const
void UpdateValues(T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues, Index start=-1, Index end=-1) const
std::vector< Index > const & GetControlIndices() const
Returns the indices of the control vertices.
StencilReal< REAL > operator[](Index index) const
Returns the stencil at index i in the table.
void update(T const &srcValues, U &dstValues, std::vector< REAL > const &valueWeights, Index start, Index end) const
std::vector< int > const & GetSizes() const
Returns the number of control vertices of each stencil in the table.
int GetNumStencils() const
Returns the number of stencils in the table.
virtual ~StencilTableReal()
std::vector< Index > const & GetOffsets() const
Returns the offset to a given stencil (factory may leave empty)
StencilReal< REAL > GetStencil(Index i) const
Returns a Stencil at index i in the table.
void Clear()
Clears the stencils from the table.
std::vector< Index > _offsets
std::vector< REAL > _weights
void resize(int nstencils, int nelems)
std::vector< REAL > const & GetWeights() const
Returns the stencil interpolation weights.
void UpdateValues(T1 const *srcBase, int numBase, T2 const *srcRef, U *dst, Index start=-1, Index end=-1) const
StencilTableReal(int numControlVerts, std::vector< int > const &offsets, std::vector< int > const &sizes, std::vector< int > const &sources, std::vector< REAL > const &weights, bool includeCoarseVerts, size_t firstOffset)
std::vector< Index > _indices
void reserve(int nstencils, int nelems)
void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const
void UpdateValues(T const &srcValues, U &dstValues, Index start=-1, Index end=-1) const
Updates point values based on the control values.
Stencil table class wrapping the template for compatibility.
StencilTable(int numControlVerts, std::vector< int > const &offsets, std::vector< int > const &sizes, std::vector< int > const &sources, std::vector< float > const &weights, bool includeCoarseVerts, size_t firstOffset)
StencilTable(int numControlVerts)
StencilTableReal< float > BaseTable
Stencil GetStencil(Index index) const
Stencil operator[](Index index) const
Limit point stencil descriptor.
REAL const * GetDuvWeights() const
Returns the uv derivative weights.
REAL const * GetDvWeights() const
Returns the v derivative weights.
void Next()
Advance to the next stencil in the table.
REAL const * GetDvvWeights() const
Returns the vv derivative weights.
LimitStencilReal(int *size, Index *indices, REAL *weights, REAL *duWeights=0, REAL *dvWeights=0, REAL *duuWeights=0, REAL *duvWeights=0, REAL *dvvWeights=0)
Constructor.
REAL const * GetDuWeights() const
Returns the u derivative weights.
REAL const * GetDuuWeights() const
Returns the uu derivative weights.
Limit point stencil class wrapping the template for compatibility.
LimitStencil(BaseStencil const &other)
LimitStencilReal< float > BaseStencil
LimitStencil(int *size, Index *indices, float *weights, float *duWeights=0, float *dvWeights=0, float *duuWeights=0, float *duvWeights=0, float *dvvWeights=0)
Table of limit subdivision stencils.
std::vector< REAL > const & GetDuuWeights() const
Returns the 'uu' derivative stencil interpolation weights.
LimitStencilReal< REAL > operator[](Index index) const
Returns the limit stencil at index i in the table.
std::vector< REAL > const & GetDvvWeights() const
Returns the 'vv' derivative stencil interpolation weights.
void UpdateDerivs(T const *src, U *uderivs, U *vderivs, int start=-1, int end=-1) const
void Update2ndDerivs(T const *src, T *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const
std::vector< REAL > const & GetDvWeights() const
Returns the 'v' derivative stencil interpolation weights.
void Update2ndDerivs(T1 const *srcBase, int numBase, T2 const *srcRef, U *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const
void UpdateDerivs(T const &srcValues, U &uderivs, U &vderivs, int start=-1, int end=-1) const
Updates derivative values based on the control values.
LimitStencilReal< REAL > GetLimitStencil(Index i) const
Returns a LimitStencil at index i in the table.
LimitStencilTableReal(int numControlVerts, std::vector< int > const &offsets, std::vector< int > const &sizes, std::vector< int > const &sources, std::vector< REAL > const &weights, std::vector< REAL > const &duWeights, std::vector< REAL > const &dvWeights, std::vector< REAL > const &duuWeights, std::vector< REAL > const &duvWeights, std::vector< REAL > const &dvvWeights, bool includeCoarseVerts, size_t firstOffset)
void Update2ndDerivs(T const &srcValues, U &uuderivs, U &uvderivs, U &vvderivs, int start=-1, int end=-1) const
Updates 2nd derivative values based on the control values.
std::vector< REAL > const & GetDuWeights() const
Returns the 'u' derivative stencil interpolation weights.
void Clear()
Clears the stencils from the table.
void Update2ndDerivs(T1 const &srcBase, int numBase, T2 const &srcRef, U &uuderivs, U &uvderivs, U &vvderivs, int start=-1, int end=-1) const
std::vector< REAL > const & GetDuvWeights() const
Returns the 'uv' derivative stencil interpolation weights.
void UpdateDerivs(T1 const &srcBase, int numBase, T2 const &srcRef, U &uderivs, U &vderivs, int start=-1, int end=-1) const
void UpdateDerivs(T1 const *srcBase, int numBase, T2 const *srcRef, U *uderivs, U *vderivs, int start=-1, int end=-1) const
Limit stencil table class wrapping the template for compatibility.
LimitStencilTableReal< float > BaseTable
LimitStencil GetLimitStencil(Index index) const
LimitStencilTable(int numControlVerts, std::vector< int > const &offsets, std::vector< int > const &sizes, std::vector< int > const &sources, std::vector< float > const &weights, std::vector< float > const &duWeights, std::vector< float > const &dvWeights, std::vector< float > const &duuWeights, std::vector< float > const &duvWeights, std::vector< float > const &dvvWeights, bool includeCoarseVerts, size_t firstOffset)
LimitStencil operator[](Index index) const