| OpenSubdiv

Loading...
Searching...
No Matches
stencilTable.h
Go to the documentation of this file.
1//
2// Copyright 2013 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24
25#ifndef OPENSUBDIV3_FAR_STENCILTABLE_H
26#define OPENSUBDIV3_FAR_STENCILTABLE_H
27
28#include "../version.h"
29
30#include "../far/types.h"
31
32#include <cassert>
33#include <cstring>
34#include <vector>
35#include <iostream>
36
37 namespace OpenSubdiv {
38 namespace OPENSUBDIV_VERSION {
39
40 namespace Far {
41
42// Forward declarations for friends:
43 class PatchTableBuilder;
44
45 template <typename REAL> class StencilTableFactoryReal;
46 template <typename REAL> class LimitStencilTableFactoryReal;
47
52 template <typename REAL>
53 class StencilReal {
54 public:
55
57 StencilReal() {}
58
67 StencilReal(int * size, Index * indices, REAL * weights)
68 : _size(size), _indices(indices), _weights(weights) { }
69
71 StencilReal(StencilReal const & other) {
72 _size = other._size;
73 _indices = other._indices;
74 _weights = other._weights;
75 }
76
78 int GetSize() const {
79 return *_size;
80 }
81
83 int * GetSizePtr() const {
84 return _size;
85 }
86
88 Index const * GetVertexIndices() const {
89 return _indices;
90 }
91
93 REAL const * GetWeights() const {
94 return _weights;
95 }
96
98 void Next() {
99 int stride = *_size;
100 ++_size;
101 _indices += stride;
102 _weights += stride;
103 }
104
105 protected:
106 friend class StencilTableFactoryReal<REAL>;
107 friend class LimitStencilTableFactoryReal<REAL>;
108
109 int * _size;
110 Index * _indices;
111 REAL * _weights;
112};
113
116 class Stencil : public StencilReal<float> {
117 protected:
118 typedef StencilReal<float> BaseStencil;
119
120 public:
121 Stencil() : BaseStencil() { }
122 Stencil(BaseStencil const & other) : BaseStencil(other) { }
123 Stencil(int * size, Index * indices, float * weights)
124 : BaseStencil(size, indices, weights) { }
125};
126
127
140 template <typename REAL>
141 class StencilTableReal {
142 protected:
143 StencilTableReal(int numControlVerts,
144 std::vector<int> const& offsets,
145 std::vector<int> const& sizes,
146 std::vector<int> const& sources,
147 std::vector<REAL> const& weights,
148 bool includeCoarseVerts,
149 size_t firstOffset);
150
151 public:
152
153 virtual ~StencilTableReal() {};
154
156 int GetNumStencils() const {
157 return (int)_sizes.size();
158 }
159
161 int GetNumControlVertices() const {
162 return _numControlVertices;
163 }
164
166 StencilReal<REAL> GetStencil(Index i) const;
167
169 std::vector<int> const & GetSizes() const {
170 return _sizes;
171 }
172
174 std::vector<Index> const & GetOffsets() const {
175 return _offsets;
176 }
177
179 std::vector<Index> const & GetControlIndices() const {
180 return _indices;
181 }
182
184 std::vector<REAL> const & GetWeights() const {
185 return _weights;
186 }
187
189 StencilReal<REAL> operator[] (Index index) const;
190
204 template <class T, class U>
205 void UpdateValues(T const &srcValues, U &dstValues, Index start=-1, Index end=-1) const {
206 this->update(srcValues, dstValues, _weights, start, end);
207 }
208
209 template <class T1, class T2, class U>
210 void UpdateValues(T1 const &srcBase, int numBase, T2 const &srcRef,
211 U &dstValues, Index start=-1, Index end=-1) const {
212 this->update(srcBase, numBase, srcRef, dstValues, _weights, start, end);
213 }
214
215 // Pointer interface for backward compatibility
216 template <class T, class U>
217 void UpdateValues(T const *src, U *dst, Index start=-1, Index end=-1) const {
218 this->update(src, dst, _weights, start, end);
219 }
220 template <class T1, class T2, class U>
221 void UpdateValues(T1 const *srcBase, int numBase, T2 const *srcRef,
222 U *dst, Index start=-1, Index end=-1) const {
223 this->update(srcBase, numBase, srcRef, dst, _weights, start, end);
224 }
225
227 void Clear();
228
229 protected:
230
231 // Update values by applying cached stencil weights to new control values
232 template <class T, class U>
233 void update( T const &srcValues, U &dstValues,
234 std::vector<REAL> const & valueWeights, Index start, Index end) const;
235 template <class T1, class T2, class U>
236 void update( T1 const &srcBase, int numBase, T2 const &srcRef, U &dstValues,
237 std::vector<REAL> const & valueWeights, Index start, Index end) const;
238
239 // Populate the offsets table from the stencil sizes in _sizes (factory helper)
240 void generateOffsets();
241
242 // Resize the table arrays (factory helper)
243 void resize(int nstencils, int nelems);
244
245 // Reserves the table arrays (factory helper)
246 void reserve(int nstencils, int nelems);
247
248 // Reallocates the table arrays to remove excess capacity (factory helper)
249 void shrinkToFit();
250
251 // Performs any final operations on internal tables (factory helper)
252 void finalize();
253
254 protected:
255 StencilTableReal() : _numControlVertices(0) {}
256 StencilTableReal(int numControlVerts)
257 : _numControlVertices(numControlVerts)
258 { }
259
260 friend class StencilTableFactoryReal<REAL>;
261 friend class Far::PatchTableBuilder;
262
263 int _numControlVertices; // number of control vertices
264
265 std::vector<int> _sizes; // number of coefficients for each stencil
266 std::vector<Index> _offsets, // offset to the start of each stencil
267 _indices; // indices of contributing coarse vertices
268 std::vector<REAL> _weights; // stencil weight coefficients
269};
270
273 class StencilTable : public StencilTableReal<float> {
274 protected:
275 typedef StencilTableReal<float> BaseTable;
276
277 public:
278 Stencil GetStencil(Index index) const {
279 return Stencil(BaseTable::GetStencil(index));
280 }
281 Stencil operator[] (Index index) const {
282 return Stencil(BaseTable::GetStencil(index));
283 }
284
285 protected:
286 StencilTable() : BaseTable() { }
287 StencilTable(int numControlVerts) : BaseTable(numControlVerts) { }
288 StencilTable(int numControlVerts,
289 std::vector<int> const& offsets,
290 std::vector<int> const& sizes,
291 std::vector<int> const& sources,
292 std::vector<float> const& weights,
293 bool includeCoarseVerts,
294 size_t firstOffset)
295 : BaseTable(numControlVerts, offsets,
296 sizes, sources, weights, includeCoarseVerts, firstOffset) { }
297};
298
299
302 template <typename REAL>
303 class LimitStencilReal : public StencilReal<REAL> {
304 public:
305
324 LimitStencilReal( int* size,
325 Index * indices,
326 REAL * weights,
327 REAL * duWeights=0,
328 REAL * dvWeights=0,
329 REAL * duuWeights=0,
330 REAL * duvWeights=0,
331 REAL * dvvWeights=0)
332 : StencilReal<REAL>(size, indices, weights),
333 _duWeights(duWeights),
334 _dvWeights(dvWeights),
335 _duuWeights(duuWeights),
336 _duvWeights(duvWeights),
337 _dvvWeights(dvvWeights) {
338 }
339
341 REAL const * GetDuWeights() const {
342 return _duWeights;
343 }
344
346 REAL const * GetDvWeights() const {
347 return _dvWeights;
348 }
349
351 REAL const * GetDuuWeights() const {
352 return _duuWeights;
353 }
354
356 REAL const * GetDuvWeights() const {
357 return _duvWeights;
358 }
359
361 REAL const * GetDvvWeights() const {
362 return _dvvWeights;
363 }
364
366 void Next() {
367 int stride = *this->_size;
368 ++this->_size;
369 this->_indices += stride;
370 this->_weights += stride;
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;
376 }
377
378 private:
379
380 friend class StencilTableFactoryReal<REAL>;
381 friend class LimitStencilTableFactoryReal<REAL>;
382
383 REAL * _duWeights, // pointer to stencil u derivative limit weights
384 * _dvWeights, // pointer to stencil v derivative limit weights
385 * _duuWeights, // pointer to stencil uu derivative limit weights
386 * _duvWeights, // pointer to stencil uv derivative limit weights
387 * _dvvWeights; // pointer to stencil vv derivative limit weights
388};
389
392 class LimitStencil : public LimitStencilReal<float> {
393 protected:
394 typedef LimitStencilReal<float> BaseStencil;
395
396 public:
397 LimitStencil(BaseStencil const & other) : BaseStencil(other) { }
398 LimitStencil(int* size, Index * indices, float * weights,
399 float * duWeights=0, float * dvWeights=0,
400 float * duuWeights=0, float * duvWeights=0, float * dvvWeights=0)
401 : BaseStencil(size, indices, weights,
402 duWeights, dvWeights, duuWeights, duvWeights, dvvWeights) { }
403};
404
405
408 template <typename REAL>
409 class LimitStencilTableReal : public StencilTableReal<REAL> {
410 protected:
411 LimitStencilTableReal(
412 int numControlVerts,
413 std::vector<int> const& offsets,
414 std::vector<int> const& sizes,
415 std::vector<int> const& sources,
416 std::vector<REAL> const& weights,
417 std::vector<REAL> const& duWeights,
418 std::vector<REAL> const& dvWeights,
419 std::vector<REAL> const& duuWeights,
420 std::vector<REAL> const& duvWeights,
421 std::vector<REAL> const& dvvWeights,
422 bool includeCoarseVerts,
423 size_t firstOffset);
424
425 public:
426
428 LimitStencilReal<REAL> GetLimitStencil(Index i) const;
429
431 LimitStencilReal<REAL> operator[] (Index index) const;
432
434 std::vector<REAL> const & GetDuWeights() const {
435 return _duWeights;
436 }
437
439 std::vector<REAL> const & GetDvWeights() const {
440 return _dvWeights;
441 }
442
444 std::vector<REAL> const & GetDuuWeights() const {
445 return _duuWeights;
446 }
447
449 std::vector<REAL> const & GetDuvWeights() const {
450 return _duvWeights;
451 }
452
454 std::vector<REAL> const & GetDvvWeights() const {
455 return _dvvWeights;
456 }
457
475 template <class T, class U>
476 void UpdateDerivs(T const & srcValues, U & uderivs, U & vderivs,
477 int start=-1, int end=-1) const {
478
479 this->update(srcValues, uderivs, _duWeights, start, end);
480 this->update(srcValues, vderivs, _dvWeights, start, end);
481 }
482
483 template <class T1, class T2, class U>
484 void UpdateDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
485 U & uderivs, U & vderivs, int start=-1, int end=-1) const {
486
487 this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
488 this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
489 }
490
491 // Pointer interface for backward compatibility
492 template <class T, class U>
493 void UpdateDerivs(T const *src, U *uderivs, U *vderivs,
494 int start=-1, int end=-1) const {
495
496 this->update(src, uderivs, _duWeights, start, end);
497 this->update(src, vderivs, _dvWeights, start, end);
498 }
499 template <class T1, class T2, class U>
500 void UpdateDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
501 U *uderivs, U *vderivs, int start=-1, int end=-1) const {
502
503 this->update(srcBase, numBase, srcRef, uderivs, _duWeights, start, end);
504 this->update(srcBase, numBase, srcRef, vderivs, _dvWeights, start, end);
505 }
506
527 template <class T, class U>
528 void Update2ndDerivs(T const & srcValues,
529 U & uuderivs, U & uvderivs, U & vvderivs,
530 int start=-1, int end=-1) const {
531
532 this->update(srcValues, uuderivs, _duuWeights, start, end);
533 this->update(srcValues, uvderivs, _duvWeights, start, end);
534 this->update(srcValues, vvderivs, _dvvWeights, start, end);
535 }
536
537 template <class T1, class T2, class U>
538 void Update2ndDerivs(T1 const & srcBase, int numBase, T2 const & srcRef,
539 U & uuderivs, U & uvderivs, U & vvderivs, int start=-1, int end=-1) const {
540
541 this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
542 this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
543 this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
544 }
545
546 // Pointer interface for backward compatibility
547 template <class T, class U>
548 void Update2ndDerivs(T const *src, T *uuderivs, U *uvderivs, U *vvderivs,
549 int start=-1, int end=-1) const {
550
551 this->update(src, uuderivs, _duuWeights, start, end);
552 this->update(src, uvderivs, _duvWeights, start, end);
553 this->update(src, vvderivs, _dvvWeights, start, end);
554 }
555 template <class T1, class T2, class U>
556 void Update2ndDerivs(T1 const *srcBase, int numBase, T2 const *srcRef,
557 U *uuderivs, U *uvderivs, U *vvderivs, int start=-1, int end=-1) const {
558
559 this->update(srcBase, numBase, srcRef, uuderivs, _duuWeights, start, end);
560 this->update(srcBase, numBase, srcRef, uvderivs, _duvWeights, start, end);
561 this->update(srcBase, numBase, srcRef, vvderivs, _dvvWeights, start, end);
562 }
563
565 void Clear();
566
567 private:
568 friend class LimitStencilTableFactoryReal<REAL>;
569
570 // Resize the table arrays (factory helper)
571 void resize(int nstencils, int nelems);
572
573 private:
574 std::vector<REAL> _duWeights, // u derivative limit stencil weights
575 _dvWeights, // v derivative limit stencil weights
576 _duuWeights, // uu derivative limit stencil weights
577 _duvWeights, // uv derivative limit stencil weights
578 _dvvWeights; // vv derivative limit stencil weights
579};
580
583 class LimitStencilTable : public LimitStencilTableReal<float> {
584 protected:
585 typedef LimitStencilTableReal<float> BaseTable;
586
587 public:
588 LimitStencil GetLimitStencil(Index index) const {
589 return LimitStencil(BaseTable::GetLimitStencil(index));
590 }
591 LimitStencil operator[] (Index index) const {
592 return LimitStencil(BaseTable::GetLimitStencil(index));
593 }
594
595 protected:
596 LimitStencilTable(int numControlVerts,
597 std::vector<int> const& offsets,
598 std::vector<int> const& sizes,
599 std::vector<int> const& sources,
600 std::vector<float> const& weights,
601 std::vector<float> const& duWeights,
602 std::vector<float> const& dvWeights,
603 std::vector<float> const& duuWeights,
604 std::vector<float> const& duvWeights,
605 std::vector<float> const& dvvWeights,
606 bool includeCoarseVerts,
607 size_t firstOffset)
608 : BaseTable(numControlVerts,
609 offsets, sizes, sources, weights,
610 duWeights, dvWeights, duuWeights, duvWeights, dvvWeights,
611 includeCoarseVerts, firstOffset) { }
612};
613
614
615// Update values by applying cached stencil weights to new control values
616 template <typename REAL>
617 template <class T1, class T2, class U> void
618 StencilTableReal<REAL>::update(T1 const &srcBase, int numBase,
619 T2 const &srcRef, U &dstValues,
620 std::vector<REAL> const &valueWeights, Index start, Index end) const {
621
622 int const * sizes = &_sizes.at(0);
623 Index const * indices = &_indices.at(0);
624 REAL const * weights = &valueWeights.at(0);
625
626 if (start > 0) {
627 assert(start < (Index)_offsets.size());
628 sizes += start;
629 indices += _offsets[start];
630 weights += _offsets[start];
631 } else {
632 start = 0;
633 }
634
635 int nstencils = ((end < start) ? GetNumStencils() : end) - start;
636
637 for (int i = 0; i < nstencils; ++i, ++sizes) {
638 dstValues[start + i].Clear();
639 for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
640 if (*indices < numBase) {
641 dstValues[start + i].AddWithWeight(srcBase[*indices], *weights);
642 } else {
643 dstValues[start + i].AddWithWeight(srcRef[*indices - numBase], *weights);
644 }
645 }
646 }
647}
648 template <typename REAL>
649 template <class T, class U> void
650 StencilTableReal<REAL>::update(T const &srcValues, U &dstValues,
651 std::vector<REAL> const &valueWeights, Index start, Index end) const {
652
653 int const * sizes = &_sizes.at(0);
654 Index const * indices = &_indices.at(0);
655 REAL const * weights = &valueWeights.at(0);
656
657 if (start > 0) {
658 assert(start < (Index)_offsets.size());
659 sizes += start;
660 indices += _offsets[start];
661 weights += _offsets[start];
662 } else {
663 start = 0;
664 }
665
666 int nstencils = ((end < start) ? GetNumStencils() : end) - start;
667
668 for (int i = 0; i < nstencils; ++i, ++sizes) {
669 dstValues[start + i].Clear();
670 for (int j = 0; j < *sizes; ++j, ++indices, ++weights) {
671 dstValues[start + i].AddWithWeight(srcValues[*indices], *weights);
672 }
673 }
674}
675
676 template <typename REAL>
677 inline void
678 StencilTableReal<REAL>::generateOffsets() {
679 Index offset=0;
680 int noffsets = (int)_sizes.size();
681 _offsets.resize(noffsets);
682 for (int i=0; i<(int)_sizes.size(); ++i ) {
683 _offsets[i]=offset;
684 offset+=_sizes[i];
685 }
686}
687
688 template <typename REAL>
689 inline void
690 StencilTableReal<REAL>::resize(int nstencils, int nelems) {
691 _sizes.resize(nstencils);
692 _indices.resize(nelems);
693 _weights.resize(nelems);
694}
695
696 template <typename REAL>
697 inline void
698 StencilTableReal<REAL>::reserve(int nstencils, int nelems) {
699 _sizes.reserve(nstencils);
700 _indices.reserve(nelems);
701 _weights.reserve(nelems);
702}
703
704 template <typename REAL>
705 inline void
706 StencilTableReal<REAL>::shrinkToFit() {
707 std::vector<int>(_sizes).swap(_sizes);
708 std::vector<Index>(_indices).swap(_indices);
709 std::vector<REAL>(_weights).swap(_weights);
710}
711
712 template <typename REAL>
713 inline void
714 StencilTableReal<REAL>::finalize() {
715 shrinkToFit();
716 generateOffsets();
717}
718
719// Returns a Stencil at index i in the table
720 template <typename REAL>
721 inline StencilReal<REAL>
722 StencilTableReal<REAL>::GetStencil(Index i) const {
723 assert((! _offsets.empty()) && i<(int)_offsets.size());
724
725 Index ofs = _offsets[i];
726
727 return StencilReal<REAL>(const_cast<int*>(&_sizes[i]),
728 const_cast<Index*>(&_indices[ofs]),
729 const_cast<REAL*>(&_weights[ofs]));
730}
731
732 template <typename REAL>
733 inline StencilReal<REAL>
734 StencilTableReal<REAL>::operator[] (Index index) const {
735 return GetStencil(index);
736}
737
738 template <typename REAL>
739 inline void
740LimitStencilTableReal<REAL>::resize(int nstencils, int nelems) {
741 StencilTableReal<REAL>::resize(nstencils, nelems);
742 _duWeights.resize(nelems);
743 _dvWeights.resize(nelems);
744}
745
746// Returns a LimitStencil at index i in the table
747 template <typename REAL>
748 inline LimitStencilReal<REAL>
749 LimitStencilTableReal<REAL>::GetLimitStencil(Index i) const {
750 assert((! this->GetOffsets().empty()) && i<(int)this->GetOffsets().size());
751
752 Index ofs = this->GetOffsets()[i];
753
754 if (!_duWeights.empty() && !_dvWeights.empty() &&
755 !_duuWeights.empty() && !_duvWeights.empty() && !_dvvWeights.empty()) {
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 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()) {
766 return LimitStencilReal<REAL>(
767 const_cast<int *>(&this->GetSizes()[i]),
768 const_cast<Index *>(&this->GetControlIndices()[ofs]),
769 const_cast<REAL *>(&this->GetWeights()[ofs]),
770 const_cast<REAL *>(&GetDuWeights()[ofs]),
771 const_cast<REAL *>(&GetDvWeights()[ofs]) );
772 } else {
773 return LimitStencilReal<REAL>(
774 const_cast<int *>(&this->GetSizes()[i]),
775 const_cast<Index *>(&this->GetControlIndices()[ofs]),
776 const_cast<REAL *>(&this->GetWeights()[ofs]) );
777 }
778}
779
780 template <typename REAL>
781 inline LimitStencilReal<REAL>
782 LimitStencilTableReal<REAL>::operator[] (Index index) const {
783 return GetLimitStencil(index);
784}
785
786} // end namespace Far
787
788} // end namespace OPENSUBDIV_VERSION
789 using namespace OPENSUBDIV_VERSION;
790
791} // end namespace OpenSubdiv
792
793#endif // OPENSUBDIV3_FAR_STENCILTABLE_H
OpenSubdiv
Definition limits.h:32
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:33
OpenSubdiv::OPENSUBDIV_VERSION::Far
Definition refinerSurfaceFactory.h:36
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