| OpenSubdiv

Loading...
Searching...
No Matches
stencilTable.h
Go to the documentation of this file.
1//
2// Copyright 2013 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7
8#ifndef OPENSUBDIV3_FAR_STENCILTABLE_H
9#define OPENSUBDIV3_FAR_STENCILTABLE_H
10
11#include "../version.h"
12
13#include "../far/types.h"
14
15#include <cassert>
16#include <cstring>
17#include <vector>
18#include <iostream>
19
20 namespace OpenSubdiv {
21 namespace OPENSUBDIV_VERSION {
22
23 namespace Far {
24
25// Forward declarations for friends:
26 class PatchTableBuilder;
27
28 template <typename REAL> class StencilTableFactoryReal;
29 template <typename REAL> class LimitStencilTableFactoryReal;
30
35 template <typename REAL>
36 class StencilReal {
37 public:
38
40 StencilReal() {}
41
50 StencilReal(int * size, Index * indices, REAL * weights)
51 : _size(size), _indices(indices), _weights(weights) { }
52
54 StencilReal(StencilReal const & other) {
55 _size = other._size;
56 _indices = other._indices;
57 _weights = other._weights;
58 }
59
61 int GetSize() const {
62 return *_size;
63 }
64
66 int * GetSizePtr() const {
67 return _size;
68 }
69
71 Index const * GetVertexIndices() const {
72 return _indices;
73 }
74
76 REAL const * GetWeights() const {
77 return _weights;
78 }
79
81 void Next() {
82 int stride = *_size;
83 ++_size;
84 _indices += stride;
85 _weights += stride;
86 }
87
88 protected:
89 friend class StencilTableFactoryReal<REAL>;
90 friend class LimitStencilTableFactoryReal<REAL>;
91
92 int * _size;
93 Index * _indices;
94 REAL * _weights;
95};
96
99 class Stencil : public StencilReal<float> {
100 protected:
101 typedef StencilReal<float> BaseStencil;
102
103 public:
104 Stencil() : BaseStencil() { }
105 Stencil(BaseStencil const & other) : BaseStencil(other) { }
106 Stencil(int * size, Index * indices, float * weights)
107 : BaseStencil(size, indices, weights) { }
108};
109
110
123 template <typename REAL>
124 class StencilTableReal {
125 protected:
126 StencilTableReal(int numControlVerts,
127 std::vector<int> const& offsets,
128 std::vector<int> const& sizes,
129 std::vector<int> const& sources,
130 std::vector<REAL> const& weights,
131 bool includeCoarseVerts,
132 size_t firstOffset);
133
134 public:
135
136 virtual ~StencilTableReal() {};
137
139 int GetNumStencils() const {
140 return (int)_sizes.size();
141 }
142
144 int GetNumControlVertices() const {
145 return _numControlVertices;
146 }
147
149 StencilReal<REAL> GetStencil(Index i) const;
150
152 std::vector<int> const & GetSizes() const {
153 return _sizes;
154 }
155
157 std::vector<Index> const & GetOffsets() const {
158 return _offsets;
159 }
160
162 std::vector<Index> const & GetControlIndices() const {
163 return _indices;
164 }
165
167 std::vector<REAL> const & GetWeights() const {
168 return _weights;
169 }
170
172 StencilReal<REAL> operator[] (Index index) const;
173
187 template <class T, class U>
188 void UpdateValues(T const &srcValues, U &dstValues, Index start=-1, Index end=-1) const {
189 this->update(srcValues, dstValues, _weights, start, end);
190 }
191
192 template <class T1, class T2, class U>
193 void UpdateValues(T1 const &srcBase, int numBase, T2 const &srcRef,
194 U &dstValues, Index start=-1, Index end=-1) const {
195 this->update(srcBase, numBase, srcRef, dstValues, _weights, start, end);
196 }
197
198 // Pointer interface for backward compatibility
199 template <class T, class U>
200 void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const {
201 this->update(src, dst, _weights, start, end);
202 }
203 template <class T1, class T2, class U>
204 void UpdateValues(T1 const *srcBase, int numBase, T2 const *srcRef,
205 U *dst, Index start=-1, Index end=-1) const {
206 this->update(srcBase, numBase, srcRef, dst, _weights, start, end);
207 }
208
210 void Clear();
211
212 protected:
213
214 // Update values by applying cached stencil weights to new control values
215 template <class T, class U>
216 void update( T const &srcValues, U &dstValues,
217 std::vector<REAL> const & valueWeights, Index start, Index end) const;
218 template <class T1, class T2, class U>
219 void update( T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues,
220 std::vector<REAL> const & valueWeights, Index start, Index end) const;
221
222 // Populate the offsets table from the stencil sizes in _sizes (factory helper)
223 void generateOffsets();
224
225 // Resize the table arrays (factory helper)
226 void resize(int nstencils, int nelems);
227
228 // Reserves the table arrays (factory helper)
229 void reserve(int nstencils, int nelems);
230
231 // Reallocates the table arrays to remove excess capacity (factory helper)
232 void shrinkToFit();
233
234 // Performs any final operations on internal tables (factory helper)
235 void finalize();
236
237 protected:
238 StencilTableReal() : _numControlVertices(0) {}
239 StencilTableReal(int numControlVerts)
240 : _numControlVertices(numControlVerts)
241 { }
242
243 friend class StencilTableFactoryReal<REAL>;
244 friend class Far::PatchTableBuilder;
245
246 int _numControlVertices; // number of control vertices
247
248 std::vector<int> _sizes; // number of coefficients for each stencil
249 std::vector<Index> _offsets, // offset to the start of each stencil
250 _indices; // indices of contributing coarse vertices
251 std::vector<REAL> _weights; // stencil weight coefficients
252};
253
256 class StencilTable : public StencilTableReal<float> {
257 protected:
258 typedef StencilTableReal<float> BaseTable;
259
260 public:
261 Stencil GetStencil(Index index) const {
262 return Stencil(BaseTable::GetStencil(index));
263 }
264 Stencil operator[] (Index index) const {
265 return Stencil(BaseTable::GetStencil(index));
266 }
267
268 protected:
269 StencilTable() : BaseTable() { }
270 StencilTable(int numControlVerts) : BaseTable(numControlVerts) { }
271 StencilTable(int numControlVerts,
272 std::vector<int> const& offsets,
273 std::vector<int> const& sizes,
274 std::vector<int> const& sources,
275 std::vector<float> const& weights,
276 bool includeCoarseVerts,
277 size_t firstOffset)
278 : BaseTable(numControlVerts, offsets,
279 sizes, sources, weights, includeCoarseVerts, firstOffset) { }
280};
281
282
285 template <typename REAL>
286 class LimitStencilReal : public StencilReal<REAL> {
287 public:
288
307 LimitStencilReal( int* size,
308 Index * indices,
309 REAL * weights,
310 REAL * duWeights=0,
311 REAL * dvWeights=0,
312 REAL * duuWeights=0,
313 REAL * duvWeights=0,
314 REAL * dvvWeights=0)
315 : StencilReal<REAL>(size, indices, weights),
316 _duWeights(duWeights),
317 _dvWeights(dvWeights),
318 _duuWeights(duuWeights),
319 _duvWeights(duvWeights),
320 _dvvWeights(dvvWeights) {
321 }
322
324 REAL const * GetDuWeights() const {
325 return _duWeights;
326 }
327
329 REAL const * GetDvWeights() const {
330 return _dvWeights;
331 }
332
334 REAL const * GetDuuWeights() const {
335 return _duuWeights;
336 }
337
339 REAL const * GetDuvWeights() const {
340 return _duvWeights;
341 }
342
344 REAL const * GetDvvWeights() const {
345 return _dvvWeights;
346 }
347
349 void Next() {
350 int stride = *this->_size;
351 ++this->_size;
352 this->_indices += stride;
353 this->_weights += stride;
354 if (_duWeights) _duWeights += stride;
355 if (_dvWeights) _dvWeights += stride;
356 if (_duuWeights) _duuWeights += stride;
357 if (_duvWeights) _duvWeights += stride;
358 if (_dvvWeights) _dvvWeights += stride;
359 }
360
361 private:
362
363 friend class StencilTableFactoryReal<REAL>;
364 friend class LimitStencilTableFactoryReal<REAL>;
365
366 REAL * _duWeights, // pointer to stencil u derivative limit weights
367 * _dvWeights, // pointer to stencil v derivative limit weights
368 * _duuWeights, // pointer to stencil uu derivative limit weights
369 * _duvWeights, // pointer to stencil uv derivative limit weights
370 * _dvvWeights; // pointer to stencil vv derivative limit weights
371};
372
375 class LimitStencil : public LimitStencilReal<float> {
376 protected:
377 typedef LimitStencilReal<float> BaseStencil;
378
379 public:
380 LimitStencil(BaseStencil const & other) : BaseStencil(other) { }
381 LimitStencil(int* size, Index * indices, float * weights,
382 float * duWeights=0, float * dvWeights=0,
383 float * duuWeights=0, float * duvWeights=0, float * dvvWeights=0)
384 : BaseStencil(size, indices, weights,
385 duWeights, dvWeights, duuWeights, duvWeights, dvvWeights) { }
386};
387
388
391 template <typename REAL>
392 class LimitStencilTableReal : public StencilTableReal<REAL> {
393 protected:
394 LimitStencilTableReal(
395 int numControlVerts,
396 std::vector<int> const& offsets,
397 std::vector<int> const& sizes,
398 std::vector<int> const& sources,
399 std::vector<REAL> const& weights,
400 std::vector<REAL> const& duWeights,
401 std::vector<REAL> const& dvWeights,
402 std::vector<REAL> const& duuWeights,
403 std::vector<REAL> const& duvWeights,
404 std::vector<REAL> const& dvvWeights,
405 bool includeCoarseVerts,
406 size_t firstOffset);
407
408 public:
409
411 LimitStencilReal<REAL> GetLimitStencil(Index i) const;
412
414 LimitStencilReal<REAL> operator[] (Index index) const;
415
417 std::vector<REAL> const & GetDuWeights() const {
418 return _duWeights;
419 }
420
422 std::vector<REAL> const & GetDvWeights() const {
423 return _dvWeights;
424 }
425
427 std::vector<REAL> const & GetDuuWeights() const {
428 return _duuWeights;
429 }
430
432 std::vector<REAL> const & GetDuvWeights() const {
433 return _duvWeights;
434 }
435
437 std::vector<REAL> const & GetDvvWeights() const {
438 return _dvvWeights;
439 }
440
458 template <class T, class U>
459 void UpdateDerivs(T const & srcValues, U & uderivs, U & vderivs,
460 int start=-1, int end=-1) const {
461
462 this->update(srcValues, uderivs, _duWeights, start, end);
463 this->update(srcValues, vderivs, _dvWeights, start, end);
464 }
465
466 template <class T1, class T2, class U>
467 void UpdateDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
468 U & uderivs, U & vderivs, int start=-1, int end=-1) const {
469
470 this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
471 this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
472 }
473
474 // Pointer interface for backward compatibility
475 template <class T, class U>
476 void UpdateDerivs(T const *src, U *uderivs, U *vderivs,
477 int start=-1, int end=-1) const {
478
479 this->update(src, uderivs, _duWeights, start, end);
480 this->update(src, vderivs, _dvWeights, start, end);
481 }
482 template <class T1, class T2, class U>
483 void UpdateDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
484 U *uderivs, U *vderivs, int start=-1, int end=-1) const {
485
486 this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
487 this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
488 }
489
510 template <class T, class U>
511 void Update2ndDerivs(T const & srcValues,
512 U & uuderivs, U & uvderivs, U & vvderivs,
513 int start=-1, int end=-1) const {
514
515 this->update(srcValues, uuderivs, _duuWeights, start, end);
516 this->update(srcValues, uvderivs, _duvWeights, start, end);
517 this->update(srcValues, vvderivs, _dvvWeights, start, end);
518 }
519
520 template <class T1, class T2, class U>
521 void Update2ndDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
522 U & uuderivs, U & uvderivs, U & vvderivs, int start=-1, int end=-1) const {
523
524 this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
525 this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
526 this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
527 }
528
529 // Pointer interface for backward compatibility
530 template <class T, class U>
531 void Update2ndDerivs(T const *src, T *uuderivs, U *uvderivs, U *vvderivs,
532 int start=-1, int end=-1) const {
533
534 this->update(src, uuderivs, _duuWeights, start, end);
535 this->update(src, uvderivs, _duvWeights, start, end);
536 this->update(src, vvderivs, _dvvWeights, start, end);
537 }
538 template <class T1, class T2, class U>
539 void Update2ndDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
540 U *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const {
541
542 this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
543 this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
544 this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
545 }
546
548 void Clear();
549
550 private:
551 friend class LimitStencilTableFactoryReal<REAL>;
552
553 // Resize the table arrays (factory helper)
554 void resize(int nstencils, int nelems);
555
556 private:
557 std::vector<REAL> _duWeights, // u derivative limit stencil weights
558 _dvWeights, // v derivative limit stencil weights
559 _duuWeights, // uu derivative limit stencil weights
560 _duvWeights, // uv derivative limit stencil weights
561 _dvvWeights; // vv derivative limit stencil weights
562};
563
566 class LimitStencilTable : public LimitStencilTableReal<float> {
567 protected:
568 typedef LimitStencilTableReal<float> BaseTable;
569
570 public:
571 LimitStencil GetLimitStencil(Index index) const {
572 return LimitStencil(BaseTable::GetLimitStencil(index));
573 }
574 LimitStencil operator[] (Index index) const {
575 return LimitStencil(BaseTable::GetLimitStencil(index));
576 }
577
578 protected:
579 LimitStencilTable(int numControlVerts,
580 std::vector<int> const& offsets,
581 std::vector<int> const& sizes,
582 std::vector<int> const& sources,
583 std::vector<float> const& weights,
584 std::vector<float> const& duWeights,
585 std::vector<float> const& dvWeights,
586 std::vector<float> const& duuWeights,
587 std::vector<float> const& duvWeights,
588 std::vector<float> const& dvvWeights,
589 bool includeCoarseVerts,
590 size_t firstOffset)
591 : BaseTable(numControlVerts,
592 offsets, sizes, sources, weights,
593 duWeights, dvWeights, duuWeights, duvWeights, dvvWeights,
594 includeCoarseVerts, firstOffset) { }
595};
596
597
598// Update values by applying cached stencil weights to new control values
599 template <typename REAL>
600 template <class T1, class T2, class U> void
601 StencilTableReal<REAL>::update(T1 const &srcBase, int numBase,
602 T2 const &srcRef, U &dstValues,
603 std::vector<REAL> const &valueWeights, Index start, Index end) const {
604
605 int const * sizes = &_sizes.at(0);
606 Index const * indices = &_indices.at(0);
607 REAL const * weights = &valueWeights.at(0);
608
609 if (start > 0) {
610 assert(start < (Index)_offsets.size());
611 sizes += start;
612 indices += _offsets[start];
613 weights += _offsets[start];
614 } else {
615 start = 0;
616 }
617
618 int nstencils = ((end < start) ? GetNumStencils() : end) - start;
619
620 for (int i = 0; i < nstencils; ++i, ++sizes) {
621 dstValues[start + i].Clear();
622 for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
623 if (*indices < numBase) {
624 dstValues[start + i].AddWithWeight(srcBase[*indices], *weights);
625 } else {
626 dstValues[start + i].AddWithWeight(srcRef[*indices - numBase], *weights);
627 }
628 }
629 }
630}
631 template <typename REAL>
632 template <class T, class U> void
633 StencilTableReal<REAL>::update(T const &srcValues, U &dstValues,
634 std::vector<REAL> const &valueWeights, Index start, Index end) const {
635
636 int const * sizes = &_sizes.at(0);
637 Index const * indices = &_indices.at(0);
638 REAL const * weights = &valueWeights.at(0);
639
640 if (start > 0) {
641 assert(start < (Index)_offsets.size());
642 sizes += start;
643 indices += _offsets[start];
644 weights += _offsets[start];
645 } else {
646 start = 0;
647 }
648
649 int nstencils = ((end < start) ? GetNumStencils() : end) - start;
650
651 for (int i = 0; i < nstencils; ++i, ++sizes) {
652 dstValues[start + i].Clear();
653 for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
654 dstValues[start + i].AddWithWeight(srcValues[*indices], *weights);
655 }
656 }
657}
658
659 template <typename REAL>
660 inline void
661 StencilTableReal<REAL>::generateOffsets() {
662 Index offset=0;
663 int noffsets = (int)_sizes.size();
664 _offsets.resize(noffsets);
665 for (int i=0; i<(int)_sizes.size(); ++i ) {
666 _offsets[i]=offset;
667 offset+=_sizes[i];
668 }
669}
670
671 template <typename REAL>
672 inline void
673 StencilTableReal<REAL>::resize(int nstencils, int nelems) {
674 _sizes.resize(nstencils);
675 _indices.resize(nelems);
676 _weights.resize(nelems);
677}
678
679 template <typename REAL>
680 inline void
681 StencilTableReal<REAL>::reserve(int nstencils, int nelems) {
682 _sizes.reserve(nstencils);
683 _indices.reserve(nelems);
684 _weights.reserve(nelems);
685}
686
687 template <typename REAL>
688 inline void
689 StencilTableReal<REAL>::shrinkToFit() {
690 std::vector<int>(_sizes).swap(_sizes);
691 std::vector<Index>(_indices).swap(_indices);
692 std::vector<REAL>(_weights).swap(_weights);
693}
694
695 template <typename REAL>
696 inline void
697 StencilTableReal<REAL>::finalize() {
698 shrinkToFit();
699 generateOffsets();
700}
701
702// Returns a Stencil at index i in the table
703 template <typename REAL>
704 inline StencilReal<REAL>
705 StencilTableReal<REAL>::GetStencil(Index i) const {
706 assert((! _offsets.empty()) && i<(int)_offsets.size());
707
708 Index ofs = _offsets[i];
709
710 return StencilReal<REAL>(const_cast<int*>(&_sizes[i]),
711 const_cast<Index*>(&_indices[ofs]),
712 const_cast<REAL*>(&_weights[ofs]));
713}
714
715 template <typename REAL>
716 inline StencilReal<REAL>
717 StencilTableReal<REAL>::operator[] (Index index) const {
718 return GetStencil(index);
719}
720
721 template <typename REAL>
722 inline void
723LimitStencilTableReal<REAL>::resize(int nstencils, int nelems) {
724 StencilTableReal<REAL>::resize(nstencils, nelems);
725 _duWeights.resize(nelems);
726 _dvWeights.resize(nelems);
727}
728
729// Returns a LimitStencil at index i in the table
730 template <typename REAL>
731 inline LimitStencilReal<REAL>
732 LimitStencilTableReal<REAL>::GetLimitStencil(Index i) const {
733 assert((! this->GetOffsets().empty()) && i<(int)this->GetOffsets().size());
734
735 Index ofs = this->GetOffsets()[i];
736
737 if (!_duWeights.empty() && !_dvWeights.empty() &&
738 !_duuWeights.empty() && !_duvWeights.empty() && !_dvvWeights.empty()) {
739 return LimitStencilReal<REAL>(
740 const_cast<int *>(&this->GetSizes()[i]),
741 const_cast<Index *>(&this->GetControlIndices()[ofs]),
742 const_cast<REAL *>(&this->GetWeights()[ofs]),
743 const_cast<REAL *>(&GetDuWeights()[ofs]),
744 const_cast<REAL *>(&GetDvWeights()[ofs]),
745 const_cast<REAL *>(&GetDuuWeights()[ofs]),
746 const_cast<REAL *>(&GetDuvWeights()[ofs]),
747 const_cast<REAL *>(&GetDvvWeights()[ofs]) );
748 } else if (!_duWeights.empty() && !_dvWeights.empty()) {
749 return LimitStencilReal<REAL>(
750 const_cast<int *>(&this->GetSizes()[i]),
751 const_cast<Index *>(&this->GetControlIndices()[ofs]),
752 const_cast<REAL *>(&this->GetWeights()[ofs]),
753 const_cast<REAL *>(&GetDuWeights()[ofs]),
754 const_cast<REAL *>(&GetDvWeights()[ofs]) );
755 } else {
756 return LimitStencilReal<REAL>(
757 const_cast<int *>(&this->GetSizes()[i]),
758 const_cast<Index *>(&this->GetControlIndices()[ofs]),
759 const_cast<REAL *>(&this->GetWeights()[ofs]) );
760 }
761}
762
763 template <typename REAL>
764 inline LimitStencilReal<REAL>
765 LimitStencilTableReal<REAL>::operator[] (Index index) const {
766 return GetLimitStencil(index);
767}
768
769} // end namespace Far
770
771} // end namespace OPENSUBDIV_VERSION
772 using namespace OPENSUBDIV_VERSION;
773
774} // end namespace OpenSubdiv
775
776#endif // OPENSUBDIV3_FAR_STENCILTABLE_H
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:19
OpenSubdiv::OPENSUBDIV_VERSION::Far::Index
Vtr::Index Index
Definition types.h:24
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactoryReal
A specialized factory for StencilTable.
Definition stencilTableFactory.h:34
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactoryReal
A specialized factory for LimitStencilTable.
Definition stencilTableFactory.h:192
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal
Vertex stencil descriptor.
Definition stencilTable.h:36
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal()
Default constructor.
Definition stencilTable.h:40
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_size
int * _size
Definition stencilTable.h:92
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal(int *size, Index *indices, REAL *weights)
Constructor.
Definition stencilTable.h:50
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::Next
void Next()
Advance to the next stencil in the table.
Definition stencilTable.h:81
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::StencilReal
StencilReal(StencilReal const &other)
Copy constructor.
Definition stencilTable.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_indices
Index * _indices
Definition stencilTable.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetVertexIndices
Index const * GetVertexIndices() const
Returns the control vertices' indices.
Definition stencilTable.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetSize
int GetSize() const
Returns the size of the stencil.
Definition stencilTable.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal< float >::_weights
float * _weights
Definition stencilTable.h:94
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetSizePtr
int * GetSizePtr() const
Returns the size of the stencil as a pointer.
Definition stencilTable.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilReal::GetWeights
REAL const * GetWeights() const
Returns the interpolation weights.
Definition stencilTable.h:76
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil
Vertex stencil class wrapping the template for compatibility.
Definition stencilTable.h:99
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil(BaseStencil const &other)
Definition stencilTable.h:105
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil(int *size, Index *indices, float *weights)
Definition stencilTable.h:106
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::BaseStencil
StencilReal< float > BaseStencil
Definition stencilTable.h:101
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil::Stencil
Stencil()
Definition stencilTable.h:104
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetNumControlVertices
int GetNumControlVertices() const
Returns the number of control vertices indexed in the table.
Definition stencilTable.h:144
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_sizes
std::vector< int > _sizes
Definition stencilTable.h:248
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:601
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:193
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetControlIndices
std::vector< Index > const & GetControlIndices() const
Returns the indices of the control vertices.
Definition stencilTable.h:162
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::finalize
void finalize()
Definition stencilTable.h:697
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::operator[]
StencilReal< REAL > operator[](Index index) const
Returns the stencil at index i in the table.
Definition stencilTable.h:717
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_numControlVertices
int _numControlVertices
Definition stencilTable.h:246
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:633
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:152
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetNumStencils
int GetNumStencils() const
Returns the number of stencils in the table.
Definition stencilTable.h:139
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::~StencilTableReal
virtual ~StencilTableReal()
Definition stencilTable.h:136
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:157
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetStencil
StencilReal< REAL > GetStencil(Index i) const
Returns a Stencil at index i in the table.
Definition stencilTable.h:705
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::shrinkToFit
void shrinkToFit()
Definition stencilTable.h:689
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::generateOffsets
void generateOffsets()
Definition stencilTable.h:661
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:249
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal< float >::_weights
std::vector< float > _weights
Definition stencilTable.h:251
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::resize
void resize(int nstencils, int nelems)
Definition stencilTable.h:673
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::GetWeights
std::vector< REAL > const & GetWeights() const
Returns the stencil interpolation weights.
Definition stencilTable.h:167
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:204
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:250
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::StencilTableReal
StencilTableReal()
Definition stencilTable.h:238
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::reserve
void reserve(int nstencils, int nelems)
Definition stencilTable.h:681
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableReal::UpdateValues
void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const
Definition stencilTable.h:200
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:188
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:271
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::StencilTable
StencilTable(int numControlVerts)
Definition stencilTable.h:270
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::BaseTable
StencilTableReal< float > BaseTable
Definition stencilTable.h:258
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::GetStencil
Stencil GetStencil(Index index) const
Definition stencilTable.h:261
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::operator[]
Stencil operator[](Index index) const
Definition stencilTable.h:264
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::StencilTable
StencilTable()
Definition stencilTable.h:269
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal
Limit point stencil descriptor.
Definition stencilTable.h:286
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuvWeights
REAL const * GetDuvWeights() const
Returns the uv derivative weights.
Definition stencilTable.h:339
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDvWeights
REAL const * GetDvWeights() const
Returns the v derivative weights.
Definition stencilTable.h:329
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::Next
void Next()
Advance to the next stencil in the table.
Definition stencilTable.h:349
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDvvWeights
REAL const * GetDvvWeights() const
Returns the vv derivative weights.
Definition stencilTable.h:344
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:307
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuWeights
REAL const * GetDuWeights() const
Returns the u derivative weights.
Definition stencilTable.h:324
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilReal::GetDuuWeights
REAL const * GetDuuWeights() const
Returns the uu derivative weights.
Definition stencilTable.h:334
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil
Limit point stencil class wrapping the template for compatibility.
Definition stencilTable.h:375
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil::LimitStencil
LimitStencil(BaseStencil const &other)
Definition stencilTable.h:380
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencil::BaseStencil
LimitStencilReal< float > BaseStencil
Definition stencilTable.h:377
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:381
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuuWeights
std::vector< REAL > const & GetDuuWeights() const
Returns the 'uu' derivative stencil interpolation weights.
Definition stencilTable.h:427
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:765
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDvvWeights
std::vector< REAL > const & GetDvvWeights() const
Returns the 'vv' derivative stencil interpolation weights.
Definition stencilTable.h:437
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:476
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:531
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDvWeights
std::vector< REAL > const & GetDvWeights() const
Returns the 'v' derivative stencil interpolation weights.
Definition stencilTable.h:422
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:539
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:459
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetLimitStencil
LimitStencilReal< REAL > GetLimitStencil(Index i) const
Returns a LimitStencil at index i in the table.
Definition stencilTable.h:732
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:511
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuWeights
std::vector< REAL > const & GetDuWeights() const
Returns the 'u' derivative stencil interpolation weights.
Definition stencilTable.h:417
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:521
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableReal::GetDuvWeights
std::vector< REAL > const & GetDuvWeights() const
Returns the 'uv' derivative stencil interpolation weights.
Definition stencilTable.h:432
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:467
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:483
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::BaseTable
LimitStencilTableReal< float > BaseTable
Definition stencilTable.h:568
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::GetLimitStencil
LimitStencil GetLimitStencil(Index index) const
Definition stencilTable.h:571
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:579
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable::operator[]
LimitStencil operator[](Index index) const
Definition stencilTable.h:574
types.h