Loading...
Searching...
No Matches
stencilTable.h
Go to the documentation of this file.
//
// 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.
//
#ifndef OPENSUBDIV3_FAR_STENCILTABLE_H
#define OPENSUBDIV3_FAR_STENCILTABLE_H
#include "../version.h"
#include "../far/types.h"
#include <cassert>
#include <cstring>
#include <vector>
#include <iostream>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far {
// Forward declarations for friends:
class PatchTableBuilder;
template <typename REAL> class StencilTableFactoryReal;
template <typename REAL> class LimitStencilTableFactoryReal;
template <typename REAL>
class StencilReal {
public:
StencilReal() {}
StencilReal(int * size, Index * indices, REAL * weights)
: _size(size), _indices(indices), _weights(weights) { }
StencilReal(StencilReal const & other) {
_size = other._size;
_indices = other._indices;
_weights = other._weights;
}
int GetSize() const {
return *_size;
}
int * GetSizePtr() const {
return _size;
}
Index const * GetVertexIndices() const {
return _indices;
}
REAL const * GetWeights() const {
return _weights;
}
void Next() {
int stride = *_size;
++_size;
_indices += stride;
_weights += stride;
}
protected:
friend class StencilTableFactoryReal<REAL>;
friend class LimitStencilTableFactoryReal<REAL>;
int * _size;
Index * _indices;
REAL * _weights;
};
class Stencil : public StencilReal<float> {
protected:
typedef StencilReal<float> BaseStencil;
public:
Stencil() : BaseStencil() { }
Stencil(BaseStencil const & other) : BaseStencil(other) { }
Stencil(int * size, Index * indices, float * weights)
: BaseStencil(size, indices, weights) { }
};
template <typename REAL>
class StencilTableReal {
protected:
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);
public:
virtual ~StencilTableReal() {};
int GetNumStencils() const {
return (int)_sizes.size();
}
int GetNumControlVertices() const {
return _numControlVertices;
}
StencilReal<REAL> GetStencil(Index i) const;
std::vector<int> const & GetSizes() const {
return _sizes;
}
std::vector<Index> const & GetOffsets() const {
return _offsets;
}
std::vector<Index> const & GetControlIndices() const {
return _indices;
}
std::vector<REAL> const & GetWeights() const {
return _weights;
}
StencilReal<REAL> operator[] (Index index) const;
template <class T, class U>
void UpdateValues(T const &srcValues, U &dstValues, Index start=-1, Index end=-1) const {
this->update(srcValues, dstValues, _weights, start, end);
}
template <class T1, class T2, class U>
void UpdateValues(T1 const &srcBase, int numBase, T2 const &srcRef,
U &dstValues, Index start=-1, Index end=-1) const {
this->update(srcBase, numBase, srcRef, dstValues, _weights, start, end);
}
// Pointer interface for backward compatibility
template <class T, class U>
void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const {
this->update(src, dst, _weights, start, end);
}
template <class T1, class T2, class U>
void UpdateValues(T1 const *srcBase, int numBase, T2 const *srcRef,
U *dst, Index start=-1, Index end=-1) const {
this->update(srcBase, numBase, srcRef, dst, _weights, start, end);
}
void Clear();
protected:
// Update values by applying cached stencil weights to new control values
template <class T, class U>
void update( T const &srcValues, U &dstValues,
std::vector<REAL> const & valueWeights, Index start, Index end) const;
template <class T1, class T2, class U>
void update( T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues,
std::vector<REAL> const & valueWeights, Index start, Index end) const;
// Populate the offsets table from the stencil sizes in _sizes (factory helper)
void generateOffsets();
// Resize the table arrays (factory helper)
void resize(int nstencils, int nelems);
// Reserves the table arrays (factory helper)
void reserve(int nstencils, int nelems);
// Reallocates the table arrays to remove excess capacity (factory helper)
void shrinkToFit();
// Performs any final operations on internal tables (factory helper)
void finalize();
protected:
StencilTableReal() : _numControlVertices(0) {}
StencilTableReal(int numControlVerts)
: _numControlVertices(numControlVerts)
{ }
friend class StencilTableFactoryReal<REAL>;
friend class Far::PatchTableBuilder;
int _numControlVertices; // number of control vertices
std::vector<int> _sizes; // number of coefficients for each stencil
std::vector<Index> _offsets, // offset to the start of each stencil
_indices; // indices of contributing coarse vertices
std::vector<REAL> _weights; // stencil weight coefficients
};
class StencilTable : public StencilTableReal<float> {
protected:
typedef StencilTableReal<float> BaseTable;
public:
Stencil GetStencil(Index index) const {
return Stencil(BaseTable::GetStencil(index));
}
Stencil operator[] (Index index) const {
return Stencil(BaseTable::GetStencil(index));
}
protected:
StencilTable() : BaseTable() { }
StencilTable(int numControlVerts) : BaseTable(numControlVerts) { }
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)
: BaseTable(numControlVerts, offsets,
sizes, sources, weights, includeCoarseVerts, firstOffset) { }
};
template <typename REAL>
class LimitStencilReal : public StencilReal<REAL> {
public:
LimitStencilReal( int* size,
Index * indices,
REAL * weights,
REAL * duWeights=0,
REAL * dvWeights=0,
REAL * duuWeights=0,
REAL * duvWeights=0,
REAL * dvvWeights=0)
: StencilReal<REAL>(size, indices, weights),
_duWeights(duWeights),
_dvWeights(dvWeights),
_duuWeights(duuWeights),
_duvWeights(duvWeights),
_dvvWeights(dvvWeights) {
}
REAL const * GetDuWeights() const {
return _duWeights;
}
REAL const * GetDvWeights() const {
return _dvWeights;
}
REAL const * GetDuuWeights() const {
return _duuWeights;
}
REAL const * GetDuvWeights() const {
return _duvWeights;
}
REAL const * GetDvvWeights() const {
return _dvvWeights;
}
void Next() {
int stride = *this->_size;
++this->_size;
this->_indices += stride;
this->_weights += stride;
if (_duWeights) _duWeights += stride;
if (_dvWeights) _dvWeights += stride;
if (_duuWeights) _duuWeights += stride;
if (_duvWeights) _duvWeights += stride;
if (_dvvWeights) _dvvWeights += stride;
}
private:
friend class StencilTableFactoryReal<REAL>;
friend class LimitStencilTableFactoryReal<REAL>;
REAL * _duWeights, // pointer to stencil u derivative limit weights
* _dvWeights, // pointer to stencil v derivative limit weights
* _duuWeights, // pointer to stencil uu derivative limit weights
* _duvWeights, // pointer to stencil uv derivative limit weights
* _dvvWeights; // pointer to stencil vv derivative limit weights
};
class LimitStencil : public LimitStencilReal<float> {
protected:
typedef LimitStencilReal<float> BaseStencil;
public:
LimitStencil(BaseStencil const & other) : BaseStencil(other) { }
LimitStencil(int* size, Index * indices, float * weights,
float * duWeights=0, float * dvWeights=0,
float * duuWeights=0, float * duvWeights=0, float * dvvWeights=0)
: BaseStencil(size, indices, weights,
duWeights, dvWeights, duuWeights, duvWeights, dvvWeights) { }
};
template <typename REAL>
class LimitStencilTableReal : public StencilTableReal<REAL> {
protected:
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);
public:
LimitStencilReal<REAL> GetLimitStencil(Index i) const;
LimitStencilReal<REAL> operator[] (Index index) const;
std::vector<REAL> const & GetDuWeights() const {
return _duWeights;
}
std::vector<REAL> const & GetDvWeights() const {
return _dvWeights;
}
std::vector<REAL> const & GetDuuWeights() const {
return _duuWeights;
}
std::vector<REAL> const & GetDuvWeights() const {
return _duvWeights;
}
std::vector<REAL> const & GetDvvWeights() const {
return _dvvWeights;
}
template <class T, class U>
void UpdateDerivs(T const & srcValues, U & uderivs, U & vderivs,
int start=-1, int end=-1) const {
this->update(srcValues, uderivs, _duWeights, start, end);
this->update(srcValues, vderivs, _dvWeights, start, end);
}
template <class T1, class T2, class U>
void UpdateDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
U & uderivs, U & vderivs, int start=-1, int end=-1) const {
this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
}
// Pointer interface for backward compatibility
template <class T, class U>
void UpdateDerivs(T const *src, U *uderivs, U *vderivs,
int start=-1, int end=-1) const {
this->update(src, uderivs, _duWeights, start, end);
this->update(src, vderivs, _dvWeights, start, end);
}
template <class T1, class T2, class U>
void UpdateDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
U *uderivs, U *vderivs, int start=-1, int end=-1) const {
this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
}
template <class T, class U>
void Update2ndDerivs(T const & srcValues,
U & uuderivs, U & uvderivs, U & vvderivs,
int start=-1, int end=-1) const {
this->update(srcValues, uuderivs, _duuWeights, start, end);
this->update(srcValues, uvderivs, _duvWeights, start, end);
this->update(srcValues, vvderivs, _dvvWeights, start, end);
}
template <class T1, class T2, class U>
void Update2ndDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
U & uuderivs, U & uvderivs, U & vvderivs, int start=-1, int end=-1) const {
this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
}
// Pointer interface for backward compatibility
template <class T, class U>
void Update2ndDerivs(T const *src, T *uuderivs, U *uvderivs, U *vvderivs,
int start=-1, int end=-1) const {
this->update(src, uuderivs, _duuWeights, start, end);
this->update(src, uvderivs, _duvWeights, start, end);
this->update(src, vvderivs, _dvvWeights, start, end);
}
template <class T1, class T2, class U>
void Update2ndDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
U *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const {
this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
}
void Clear();
private:
friend class LimitStencilTableFactoryReal<REAL>;
// Resize the table arrays (factory helper)
void resize(int nstencils, int nelems);
private:
std::vector<REAL> _duWeights, // u derivative limit stencil weights
_dvWeights, // v derivative limit stencil weights
_duuWeights, // uu derivative limit stencil weights
_duvWeights, // uv derivative limit stencil weights
_dvvWeights; // vv derivative limit stencil weights
};
class LimitStencilTable : public LimitStencilTableReal<float> {
protected:
typedef LimitStencilTableReal<float> BaseTable;
public:
LimitStencil GetLimitStencil(Index index) const {
return LimitStencil(BaseTable::GetLimitStencil(index));
}
LimitStencil operator[] (Index index) const {
return LimitStencil(BaseTable::GetLimitStencil(index));
}
protected:
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)
: BaseTable(numControlVerts,
offsets, sizes, sources, weights,
duWeights, dvWeights, duuWeights, duvWeights, dvvWeights,
includeCoarseVerts, firstOffset) { }
};
// Update values by applying cached stencil weights to new control values
template <typename REAL>
template <class T1, class T2, class U> void
StencilTableReal<REAL>::update(T1 const &srcBase, int numBase,
T2 const &srcRef, U &dstValues,
std::vector<REAL> const &valueWeights, Index start, Index end) const {
int const * sizes = &_sizes.at(0);
Index const * indices = &_indices.at(0);
REAL const * weights = &valueWeights.at(0);
if (start > 0) {
assert(start < (Index)_offsets.size());
sizes += start;
indices += _offsets[start];
weights += _offsets[start];
} else {
start = 0;
}
int nstencils = ((end < start) ? GetNumStencils() : end) - start;
for (int i = 0; i < nstencils; ++i, ++sizes) {
dstValues[start + i].Clear();
for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
if (*indices < numBase) {
dstValues[start + i].AddWithWeight(srcBase[*indices], *weights);
} else {
dstValues[start + i].AddWithWeight(srcRef[*indices - numBase], *weights);
}
}
}
}
template <typename REAL>
template <class T, class U> void
StencilTableReal<REAL>::update(T const &srcValues, U &dstValues,
std::vector<REAL> const &valueWeights, Index start, Index end) const {
int const * sizes = &_sizes.at(0);
Index const * indices = &_indices.at(0);
REAL const * weights = &valueWeights.at(0);
if (start > 0) {
assert(start < (Index)_offsets.size());
sizes += start;
indices += _offsets[start];
weights += _offsets[start];
} else {
start = 0;
}
int nstencils = ((end < start) ? GetNumStencils() : end) - start;
for (int i = 0; i < nstencils; ++i, ++sizes) {
dstValues[start + i].Clear();
for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
dstValues[start + i].AddWithWeight(srcValues[*indices], *weights);
}
}
}
template <typename REAL>
inline void
StencilTableReal<REAL>::generateOffsets() {
Index offset=0;
int noffsets = (int)_sizes.size();
_offsets.resize(noffsets);
for (int i=0; i<(int)_sizes.size(); ++i ) {
_offsets[i]=offset;
offset+=_sizes[i];
}
}
template <typename REAL>
inline void
StencilTableReal<REAL>::resize(int nstencils, int nelems) {
_sizes.resize(nstencils);
_indices.resize(nelems);
_weights.resize(nelems);
}
template <typename REAL>
inline void
StencilTableReal<REAL>::reserve(int nstencils, int nelems) {
_sizes.reserve(nstencils);
_indices.reserve(nelems);
_weights.reserve(nelems);
}
template <typename REAL>
inline void
StencilTableReal<REAL>::shrinkToFit() {
std::vector<int>(_sizes).swap(_sizes);
std::vector<Index>(_indices).swap(_indices);
std::vector<REAL>(_weights).swap(_weights);
}
template <typename REAL>
inline void
StencilTableReal<REAL>::finalize() {
shrinkToFit();
generateOffsets();
}
// Returns a Stencil at index i in the table
template <typename REAL>
inline StencilReal<REAL>
StencilTableReal<REAL>::GetStencil(Index i) const {
assert((! _offsets.empty()) && i<(int)_offsets.size());
Index ofs = _offsets[i];
return StencilReal<REAL>(const_cast<int*>(&_sizes[i]),
const_cast<Index*>(&_indices[ofs]),
const_cast<REAL*>(&_weights[ofs]));
}
template <typename REAL>
inline StencilReal<REAL>
StencilTableReal<REAL>::operator[] (Index index) const {
return GetStencil(index);
}
template <typename REAL>
inline void
LimitStencilTableReal<REAL>::resize(int nstencils, int nelems) {
StencilTableReal<REAL>::resize(nstencils, nelems);
_duWeights.resize(nelems);
_dvWeights.resize(nelems);
}
// Returns a LimitStencil at index i in the table
template <typename REAL>
inline LimitStencilReal<REAL>
LimitStencilTableReal<REAL>::GetLimitStencil(Index i) const {
assert((! this->GetOffsets().empty()) && i<(int)this->GetOffsets().size());
Index ofs = this->GetOffsets()[i];
if (!_duWeights.empty() && !_dvWeights.empty() &&
!_duuWeights.empty() && !_duvWeights.empty() && !_dvvWeights.empty()) {
return LimitStencilReal<REAL>(
const_cast<int *>(&this->GetSizes()[i]),
const_cast<Index *>(&this->GetControlIndices()[ofs]),
const_cast<REAL *>(&this->GetWeights()[ofs]),
const_cast<REAL *>(&GetDuWeights()[ofs]),
const_cast<REAL *>(&GetDvWeights()[ofs]),
const_cast<REAL *>(&GetDuuWeights()[ofs]),
const_cast<REAL *>(&GetDuvWeights()[ofs]),
const_cast<REAL *>(&GetDvvWeights()[ofs]) );
} else if (!_duWeights.empty() && !_dvWeights.empty()) {
return LimitStencilReal<REAL>(
const_cast<int *>(&this->GetSizes()[i]),
const_cast<Index *>(&this->GetControlIndices()[ofs]),
const_cast<REAL *>(&this->GetWeights()[ofs]),
const_cast<REAL *>(&GetDuWeights()[ofs]),
const_cast<REAL *>(&GetDvWeights()[ofs]) );
} else {
return LimitStencilReal<REAL>(
const_cast<int *>(&this->GetSizes()[i]),
const_cast<Index *>(&this->GetControlIndices()[ofs]),
const_cast<REAL *>(&this->GetWeights()[ofs]) );
}
}
template <typename REAL>
inline LimitStencilReal<REAL>
LimitStencilTableReal<REAL>::operator[] (Index index) const {
return GetLimitStencil(index);
}
} // end namespace Far
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif // OPENSUBDIV3_FAR_STENCILTABLE_H
OpenSubdiv
Definition error.h:30
OpenSubdiv::OPENSUBDIV_VERSION
Definition error.h:31
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition error.h:33
OpenSubdiv::OPENSUBDIV_VERSION::Far::Index
Vtr::Index Index
Definition types.h:41
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactoryReal
A specialized factory for StencilTable.
Definition stencilTableFactory.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactoryReal
A specialized factory for LimitStencilTable.
Definition stencilTableFactory.h:209
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal
Vertex stencil descriptor.
Definition stencilTable.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal()
Default constructor.
Definition stencilTable.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_size
int * _size
Definition stencilTable.h:109
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal(int *size, Index *indices, REAL *weights)
Constructor.
Definition stencilTable.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::Next
void Next()
Advance to the next stencil in the table.
Definition stencilTable.h:98
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal(StencilReal const &other)
Copy constructor.
Definition stencilTable.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_indices
Index * _indices
Definition stencilTable.h:110
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetVertexIndices
Index const * GetVertexIndices() const
Returns the control vertices' indices.
Definition stencilTable.h:88
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetSize
int GetSize() const
Returns the size of the stencil.
Definition stencilTable.h:78
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_weights
float * _weights
Definition stencilTable.h:111
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetSizePtr
int * GetSizePtr() const
Returns the size of the stencil as a pointer.
Definition stencilTable.h:83
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetWeights
REAL const * GetWeights() const
Returns the interpolation weights.
Definition stencilTable.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil
Vertex stencil class wrapping the template for compatibility.
Definition stencilTable.h:116
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil(BaseStencil const &other)
Definition stencilTable.h:122
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil(int *size, Index *indices, float *weights)
Definition stencilTable.h:123
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::BaseStencil
StencilReal< float > BaseStencil
Definition stencilTable.h:118
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil()
Definition stencilTable.h:121
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetNumControlVertices
int GetNumControlVertices() const
Returns the number of control vertices indexed in the table.
Definition stencilTable.h:161
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_sizes
std::vector< int > _sizes
Definition stencilTable.h:265
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::update
void update(T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues, std::vector< REAL > const &valueWeights, Index start, Index end) const
Definition stencilTable.h:618
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::UpdateValues
void UpdateValues(T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues, Index start=-1, Index end=-1) const
Definition stencilTable.h:210
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetControlIndices
std::vector< Index > const & GetControlIndices() const
Returns the indices of the control vertices.
Definition stencilTable.h:179
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::finalize
void finalize()
Definition stencilTable.h:714
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::operator[]
StencilReal< REAL > operator[](Index index) const
Returns the stencil at index i in the table.
Definition stencilTable.h:734
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_numControlVertices
int _numControlVertices
Definition stencilTable.h:263
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::update
void update(T const &srcValues, U &dstValues, std::vector< REAL > const &valueWeights, Index start, Index end) const
Definition stencilTable.h:650
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetSizes
std::vector< int > const & GetSizes() const
Returns the number of control vertices of each stencil in the table.
Definition stencilTable.h:169
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetNumStencils
int GetNumStencils() const
Returns the number of stencils in the table.
Definition stencilTable.h:156
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::~StencilTableReal
virtual ~StencilTableReal()
Definition stencilTable.h:153
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetOffsets
std::vector< Index > const & GetOffsets() const
Returns the offset to a given stencil (factory may leave empty)
Definition stencilTable.h:174
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetStencil
StencilReal< REAL > GetStencil(Index i) const
Returns a Stencil at index i in the table.
Definition stencilTable.h:722
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::shrinkToFit
void shrinkToFit()
Definition stencilTable.h:706
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::generateOffsets
void generateOffsets()
Definition stencilTable.h:678
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::Clear
void Clear()
Clears the stencils from the table.
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_offsets
std::vector< Index > _offsets
Definition stencilTable.h:266
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_weights
std::vector< float > _weights
Definition stencilTable.h:268
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::resize
void resize(int nstencils, int nelems)
Definition stencilTable.h:690
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetWeights
std::vector< REAL > const & GetWeights() const
Returns the stencil interpolation weights.
Definition stencilTable.h:184
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::UpdateValues
void UpdateValues(T1 const *srcBase, int numBase, T2 const *srcRef, U *dst, Index start=-1, Index end=-1) const
Definition stencilTable.h:221
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::StencilTableReal
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)
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_indices
std::vector< Index > _indices
Definition stencilTable.h:267
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::StencilTableReal
StencilTableReal()
Definition stencilTable.h:255
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::reserve
void reserve(int nstencils, int nelems)
Definition stencilTable.h:698
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::UpdateValues
void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const
Definition stencilTable.h:217
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::UpdateValues
void UpdateValues(T const &srcValues, U &dstValues, Index start=-1, Index end=-1) const
Updates point values based on the control values.
Definition stencilTable.h:205
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::StencilTable
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)
Definition stencilTable.h:288
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::StencilTable
StencilTable(int numControlVerts)
Definition stencilTable.h:287
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::BaseTable
StencilTableReal< float > BaseTable
Definition stencilTable.h:275
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::GetStencil
Stencil GetStencil(Index index) const
Definition stencilTable.h:278
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::operator[]
Stencil operator[](Index index) const
Definition stencilTable.h:281
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::StencilTable
StencilTable()
Definition stencilTable.h:286
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal
Limit point stencil descriptor.
Definition stencilTable.h:303
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuvWeights
REAL const * GetDuvWeights() const
Returns the uv derivative weights.
Definition stencilTable.h:356
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDvWeights
REAL const * GetDvWeights() const
Returns the v derivative weights.
Definition stencilTable.h:346
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::Next
void Next()
Advance to the next stencil in the table.
Definition stencilTable.h:366
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDvvWeights
REAL const * GetDvvWeights() const
Returns the vv derivative weights.
Definition stencilTable.h:361
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::LimitStencilReal
LimitStencilReal(int *size, Index *indices, REAL *weights, REAL *duWeights=0, REAL *dvWeights=0, REAL *duuWeights=0, REAL *duvWeights=0, REAL *dvvWeights=0)
Constructor.
Definition stencilTable.h:324
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuWeights
REAL const * GetDuWeights() const
Returns the u derivative weights.
Definition stencilTable.h:341
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuuWeights
REAL const * GetDuuWeights() const
Returns the uu derivative weights.
Definition stencilTable.h:351
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil
Limit point stencil class wrapping the template for compatibility.
Definition stencilTable.h:392
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil::LimitStencil
LimitStencil(BaseStencil const &other)
Definition stencilTable.h:397
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil::BaseStencil
LimitStencilReal< float > BaseStencil
Definition stencilTable.h:394
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil::LimitStencil
LimitStencil(int *size, Index *indices, float *weights, float *duWeights=0, float *dvWeights=0, float *duuWeights=0, float *duvWeights=0, float *dvvWeights=0)
Definition stencilTable.h:398
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuuWeights
std::vector< REAL > const & GetDuuWeights() const
Returns the 'uu' derivative stencil interpolation weights.
Definition stencilTable.h:444
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::operator[]
LimitStencilReal< REAL > operator[](Index index) const
Returns the limit stencil at index i in the table.
Definition stencilTable.h:782
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDvvWeights
std::vector< REAL > const & GetDvvWeights() const
Returns the 'vv' derivative stencil interpolation weights.
Definition stencilTable.h:454
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::UpdateDerivs
void UpdateDerivs(T const *src, U *uderivs, U *vderivs, int start=-1, int end=-1) const
Definition stencilTable.h:493
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::Update2ndDerivs
void Update2ndDerivs(T const *src, T *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const
Definition stencilTable.h:548
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDvWeights
std::vector< REAL > const & GetDvWeights() const
Returns the 'v' derivative stencil interpolation weights.
Definition stencilTable.h:439
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::Update2ndDerivs
void Update2ndDerivs(T1 const *srcBase, int numBase, T2 const *srcRef, U *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const
Definition stencilTable.h:556
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::UpdateDerivs
void UpdateDerivs(T const &srcValues, U &uderivs, U &vderivs, int start=-1, int end=-1) const
Updates derivative values based on the control values.
Definition stencilTable.h:476
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetLimitStencil
LimitStencilReal< REAL > GetLimitStencil(Index i) const
Returns a LimitStencil at index i in the table.
Definition stencilTable.h:749
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::LimitStencilTableReal
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)
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::Update2ndDerivs
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.
Definition stencilTable.h:528
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuWeights
std::vector< REAL > const & GetDuWeights() const
Returns the 'u' derivative stencil interpolation weights.
Definition stencilTable.h:434
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::Clear
void Clear()
Clears the stencils from the table.
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::Update2ndDerivs
void Update2ndDerivs(T1 const &srcBase, int numBase, T2 const &srcRef, U &uuderivs, U &uvderivs, U &vvderivs, int start=-1, int end=-1) const
Definition stencilTable.h:538
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuvWeights
std::vector< REAL > const & GetDuvWeights() const
Returns the 'uv' derivative stencil interpolation weights.
Definition stencilTable.h:449
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::UpdateDerivs
void UpdateDerivs(T1 const &srcBase, int numBase, T2 const &srcRef, U &uderivs, U &vderivs, int start=-1, int end=-1) const
Definition stencilTable.h:484
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::UpdateDerivs
void UpdateDerivs(T1 const *srcBase, int numBase, T2 const *srcRef, U *uderivs, U *vderivs, int start=-1, int end=-1) const
Definition stencilTable.h:500
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::BaseTable
LimitStencilTableReal< float > BaseTable
Definition stencilTable.h:585
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::GetLimitStencil
LimitStencil GetLimitStencil(Index index) const
Definition stencilTable.h:588
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::LimitStencilTable
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)
Definition stencilTable.h:596
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::operator[]
LimitStencil operator[](Index index) const
Definition stencilTable.h:591
types.h