- Main Page
- Namespaces
- Classes
- Files

- File List

mesh.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_OSD_MESH_H
26 #define OPENSUBDIV3_OSD_MESH_H
27
28 #include "../version.h"
29
30 #include <bitset>
31 #include <cassert>
32 #include <cstring>
33 #include <vector>
34
35 #include "../far/topologyRefiner.h"
36 #include "../far/patchTableFactory.h"
37 #include "../far/stencilTable.h"
38 #include "../far/stencilTableFactory.h"
39
40 #include "../osd/bufferDescriptor.h"
41
42 struct ID3D11DeviceContext;
43
44 namespace OpenSubdiv {
45 namespace OPENSUBDIV_VERSION {
46
47 namespace Osd {
48
49 enum MeshBits {
50 MeshAdaptive = 0,
51 MeshInterleaveVarying = 1,
52 MeshFVarData = 2,
53 MeshUseSingleCreasePatch = 3,
54 MeshEndCapBSplineBasis = 4, // exclusive
55 MeshEndCapGregoryBasis = 5, // exclusive
56 MeshEndCapLegacyGregory = 6, // exclusive
57 NUM_MESH_BITS = 7,
58 };
59 typedef std::bitset<NUM_MESH_BITS> MeshBitset;
60
61 // ---------------------------------------------------------------------------
62
63 template <class PATCH_TABLE>
64 class MeshInterface {
65 public:
66 typedef PATCH_TABLE PatchTable;
67 typedef typename PatchTable::VertexBufferBinding VertexBufferBinding;
68
69 public:
70 MeshInterface() { }
71
72 virtual ~MeshInterface() { }
73
74 virtual int GetNumVertices() const = 0;
75
76 virtual int GetMaxValence() const = 0;
77
78 virtual void UpdateVertexBuffer(float const *vertexData,
79 int startVertex, int numVerts) = 0;
80
81 virtual void UpdateVaryingBuffer(float const *varyingData,
82 int startVertex, int numVerts) = 0;
83
84 virtual void Refine() = 0;
85
86 virtual void Synchronize() = 0;
87
88 virtual PatchTable * GetPatchTable() const = 0;
89
90 virtual Far::PatchTable const *GetFarPatchTable() const = 0;
91
92 virtual VertexBufferBinding BindVertexBuffer() = 0;
93
94 virtual VertexBufferBinding BindVaryingBuffer() = 0;
95
96 protected:
97 static inline void refineMesh(Far::TopologyRefiner & refiner,
98 int level, bool adaptive,
99 bool singleCreasePatch) {
100 if (adaptive) {
101 Far::TopologyRefiner::AdaptiveOptions options(level);
102 options.useSingleCreasePatch = singleCreasePatch;
103 refiner.RefineAdaptive(options);
104 } else {
105 // This dependency on FVar channels should not be necessary
106 bool fullTopologyInLastLevel = refiner.GetNumFVarChannels()>0;
107
108 Far::TopologyRefiner::UniformOptions options(level);
109 options.fullTopologyInLastLevel = fullTopologyInLastLevel;
110 refiner.RefineUniform(options);
111 }
112 }
113 };
114
115 // ---------------------------------------------------------------------------
116
117 template <typename STENCIL_TABLE, typename SRC_STENCIL_TABLE,
118 typename DEVICE_CONTEXT>
119 STENCIL_TABLE const *
120 convertToCompatibleStencilTable(
121 SRC_STENCIL_TABLE const *table, DEVICE_CONTEXT *context) {
122 if (not table) return NULL;
123 return STENCIL_TABLE::Create(table, context);
124 }
125
126 template <>
127 inline Far::StencilTable const *
128 convertToCompatibleStencilTable<Far::StencilTable, Far::StencilTable, void>(
129 Far::StencilTable const *table, void * /*context*/) {
130 // no need for conversion
131 // XXX: We don't want to even copy.
132 if (not table) return NULL;
133 return new Far::StencilTable(*table);
134 }
135
136 template <>
137 inline Far::LimitStencilTable const *
138 convertToCompatibleStencilTable<Far::LimitStencilTable, Far::LimitStencilTable, void>(
139 Far::LimitStencilTable const *table, void * /*context*/) {
140 // no need for conversion
141 // XXX: We don't want to even copy.
142 if (not table) return NULL;
143 return new Far::LimitStencilTable(*table);
144 }
145
146 template <>
147 inline Far::StencilTable const *
148 convertToCompatibleStencilTable<Far::StencilTable, Far::StencilTable, ID3D11DeviceContext>(
149 Far::StencilTable const *table, ID3D11DeviceContext * /*context*/) {
150 // no need for conversion
151 // XXX: We don't want to even copy.
152 if (not table) return NULL;
153 return new Far::StencilTable(*table);
154 }
155
156 // ---------------------------------------------------------------------------
157
158 // Osd evaluator cache: for the GPU backends require compiled instance
159 // (GLXFB, GLCompue, CL)
160 //
161 // note: this is just an example usage and client applications are supposed
162 // to implement their own structure for Evaluator instance.
163 //
164 template <typename EVALUATOR>
165 class EvaluatorCacheT {
166 public:
167 ~EvaluatorCacheT() {
168 for(typename Evaluators::iterator it = _evaluators.begin();
169 it != _evaluators.end(); ++it) {
170 delete it->evaluator;
171 }
172 }
173
174 // XXX: FIXME, linear search
175 struct Entry {
176 Entry(BufferDescriptor const &srcDescArg,
177 BufferDescriptor const &dstDescArg,
178 BufferDescriptor const &duDescArg,
179 BufferDescriptor const &dvDescArg,
180 EVALUATOR *evalArg) : srcDesc(srcDescArg), dstDesc(dstDescArg),
181 duDesc(duDescArg), dvDesc(dvDescArg), evaluator(evalArg) {}
182 BufferDescriptor srcDesc, dstDesc, duDesc, dvDesc;
183 EVALUATOR *evaluator;
184 };
185 typedef std::vector<Entry> Evaluators;
186
187 template <typename DEVICE_CONTEXT>
188 EVALUATOR *GetEvaluator(BufferDescriptor const &srcDesc,
189 BufferDescriptor const &dstDesc,
190 DEVICE_CONTEXT *deviceContext) {
191 return GetEvaluator(srcDesc, dstDesc,
192 BufferDescriptor(),
193 BufferDescriptor(),
194 deviceContext);
195 }
196
197 template <typename DEVICE_CONTEXT>
198 EVALUATOR *GetEvaluator(BufferDescriptor const &srcDesc,
199 BufferDescriptor const &dstDesc,
200 BufferDescriptor const &duDesc,
201 BufferDescriptor const &dvDesc,
202 DEVICE_CONTEXT *deviceContext) {
203
204 for(typename Evaluators::iterator it = _evaluators.begin();
205 it != _evaluators.end(); ++it) {
206 if (isEqual(srcDesc, it->srcDesc) &&
207 isEqual(dstDesc, it->dstDesc) &&
208 isEqual(duDesc, it->duDesc) &&
209 isEqual(dvDesc, it->dvDesc)) {
210 return it->evaluator;
211 }
212 }
213 EVALUATOR *e = EVALUATOR::Create(srcDesc, dstDesc,
214 duDesc, dvDesc,
215 deviceContext);
216 _evaluators.push_back(Entry(srcDesc, dstDesc, duDesc, dvDesc, e));
217 return e;
218 }
219
220 private:
221 static bool isEqual(BufferDescriptor const &a,
222 BufferDescriptor const &b) {
223 int offsetA = a.stride ? (a.offset % a.stride) : 0;
224 int offsetB = b.stride ? (b.offset % b.stride) : 0;
225
226 // Note: XFB kernel needs to be configured with the local offset
227 // of the dstDesc to skip preceding primvars.
228 return (offsetA == offsetB &&
229 a.length == b.length &&
230 a.stride == b.stride);
231 }
232
233 Evaluators _evaluators;
234 };
235
237
238 // template helpers to see if the evaluator is instantiatable or not.
239 template <typename EVALUATOR>
240 struct instantiatable
241 {
242 typedef char yes[1];
243 typedef char no[2];
244 template <typename C> static yes &chk(typename C::Instantiatable *t=0);
245 template <typename C> static no &chk(...);
246 static bool const value = sizeof(chk<EVALUATOR>(0)) == sizeof(yes);
247 };
248 template <bool C, typename T=void>
249 struct enable_if { typedef T type; };
250 template <typename T>
251 struct enable_if<false, T> { };
252
254
255 // extract a kernel from cache if available
256 template <typename EVALUATOR, typename DEVICE_CONTEXT>
257 static EVALUATOR *GetEvaluator(
258 EvaluatorCacheT<EVALUATOR> *cache,
259 BufferDescriptor const &srcDesc,
260 BufferDescriptor const &dstDesc,
261 BufferDescriptor const &duDesc,
262 BufferDescriptor const &dvDesc,
263 DEVICE_CONTEXT deviceContext,
264 typename enable_if<instantiatable<EVALUATOR>::value, void>::type*t=0) {
265 (void)t;
266 if (cache == NULL) return NULL;
267 return cache->GetEvaluator(srcDesc, dstDesc, duDesc, dvDesc, deviceContext);
268 }
269
270 template <typename EVALUATOR, typename DEVICE_CONTEXT>
271 static EVALUATOR *GetEvaluator(
272 EvaluatorCacheT<EVALUATOR> *cache,
273 BufferDescriptor const &srcDesc,
274 BufferDescriptor const &dstDesc,
275 DEVICE_CONTEXT deviceContext,
276 typename enable_if<instantiatable<EVALUATOR>::value, void>::type*t=0) {
277 (void)t;
278 if (cache == NULL) return NULL;
279 return cache->GetEvaluator(srcDesc, dstDesc,
280 BufferDescriptor(),
281 BufferDescriptor(),
282 deviceContext);
283 }
284
285 // fallback
286 template <typename EVALUATOR, typename DEVICE_CONTEXT>
287 static EVALUATOR *GetEvaluator(
288 EvaluatorCacheT<EVALUATOR> *,
289 BufferDescriptor const &,
290 BufferDescriptor const &,
291 BufferDescriptor const &,
292 BufferDescriptor const &,
293 DEVICE_CONTEXT,
294 typename enable_if<!instantiatable<EVALUATOR>::value, void>::type*t=0) {
295 (void)t;
296 return NULL;
297 }
298
299 template <typename EVALUATOR, typename DEVICE_CONTEXT>
300 static EVALUATOR *GetEvaluator(
301 EvaluatorCacheT<EVALUATOR> *,
302 BufferDescriptor const &,
303 BufferDescriptor const &,
304 DEVICE_CONTEXT,
305 typename enable_if<!instantiatable<EVALUATOR>::value, void>::type*t=0) {
306 (void)t;
307 return NULL;
308 }
309
310 // ---------------------------------------------------------------------------
311
312 template <typename VERTEX_BUFFER,
313 typename STENCIL_TABLE,
314 typename EVALUATOR,
315 typename PATCH_TABLE,
316 typename DEVICE_CONTEXT = void>
317 class Mesh : public MeshInterface<PATCH_TABLE> {
318 public:
319 typedef VERTEX_BUFFER VertexBuffer;
320 typedef EVALUATOR Evaluator;
321 typedef STENCIL_TABLE StencilTable;
322 typedef PATCH_TABLE PatchTable;
323 typedef DEVICE_CONTEXT DeviceContext;
324 typedef EvaluatorCacheT<Evaluator> EvaluatorCache;
325 typedef typename PatchTable::VertexBufferBinding VertexBufferBinding;
326
327 Mesh(Far::TopologyRefiner * refiner,
328 int numVertexElements,
329 int numVaryingElements,
330 int level,
331 MeshBitset bits = MeshBitset(),
332 EvaluatorCache * evaluatorCache = NULL,
333 DeviceContext * deviceContext = NULL) :
334
335 _refiner(refiner),
336 _farPatchTable(NULL),
337 _numVertices(0),
338 _maxValence(0),
339 _vertexBuffer(NULL),
340 _varyingBuffer(NULL),
341 _vertexStencilTable(NULL),
342 _varyingStencilTable(NULL),
343 _evaluatorCache(evaluatorCache),
344 _patchTable(NULL),
345 _deviceContext(deviceContext) {
346
347 assert(_refiner);
348
349 MeshInterface<PATCH_TABLE>::refineMesh(
350 *_refiner, level,
351 bits.test(MeshAdaptive),
352 bits.test(MeshUseSingleCreasePatch));
353
354 int vertexBufferStride = numVertexElements +
355 (bits.test(MeshInterleaveVarying) ? numVaryingElements : 0);
356 int varyingBufferStride =
357 (bits.test(MeshInterleaveVarying) ? 0 : numVaryingElements);
358
359 initializeContext(numVertexElements,
360 numVaryingElements,
361 level, bits);
362
363 initializeVertexBuffers(_numVertices,
364 vertexBufferStride,
365 varyingBufferStride);
366
367 // configure vertex buffer descriptor
368 _vertexDesc =
369 BufferDescriptor(0, numVertexElements, vertexBufferStride);
370 if (bits.test(MeshInterleaveVarying)) {
371 _varyingDesc = BufferDescriptor(
372 numVertexElements, numVaryingElements, vertexBufferStride);
373 } else {
374 _varyingDesc = BufferDescriptor(
375 0, numVaryingElements, varyingBufferStride);
376 }
377 }
378
379 virtual ~Mesh() {
380 delete _refiner;
381 delete _farPatchTable;
382 delete _vertexBuffer;
383 delete _varyingBuffer;
384 delete _vertexStencilTable;
385 delete _varyingStencilTable;
386 delete _patchTable;
387 // deviceContext and evaluatorCache are not owned by this class.
388 }
389
390 virtual void UpdateVertexBuffer(float const *vertexData,
391 int startVertex, int numVerts) {
392 _vertexBuffer->UpdateData(vertexData, startVertex, numVerts,
393 _deviceContext);
394 }
395
396 virtual void UpdateVaryingBuffer(float const *varyingData,
397 int startVertex, int numVerts) {
398 _varyingBuffer->UpdateData(varyingData, startVertex, numVerts,
399 _deviceContext);
400 }
401
402 virtual void Refine() {
403
404 int numControlVertices = _refiner->GetLevel(0).GetNumVertices();
405
406 BufferDescriptor srcDesc = _vertexDesc;
407 BufferDescriptor dstDesc(srcDesc);
408 dstDesc.offset += numControlVertices * dstDesc.stride;
409
410 // note that the _evaluatorCache can be NULL and thus
411 // the evaluatorInstance can be NULL
412 // (for uninstantiatable kernels CPU,TBB etc)
413 Evaluator const *instance = GetEvaluator<Evaluator>(
414 _evaluatorCache, srcDesc, dstDesc,
415 _deviceContext);
416
417 Evaluator::EvalStencils(_vertexBuffer, srcDesc,
418 _vertexBuffer, dstDesc,
419 _vertexStencilTable,
420 instance, _deviceContext);
421
422 if (_varyingDesc.length > 0) {
423 BufferDescriptor vSrcDesc = _varyingDesc;
424 BufferDescriptor vDstDesc(vSrcDesc);
425 vDstDesc.offset += numControlVertices * vDstDesc.stride;
426
427 instance = GetEvaluator<Evaluator>(
428 _evaluatorCache, vSrcDesc, vDstDesc,
429 _deviceContext);
430
431 if (_varyingBuffer) {
432 // non-interleaved
433 Evaluator::EvalStencils(_varyingBuffer, vSrcDesc,
434 _varyingBuffer, vDstDesc,
435 _varyingStencilTable,
436 instance, _deviceContext);
437 } else {
438 // interleaved
439 Evaluator::EvalStencils(_vertexBuffer, vSrcDesc,
440 _vertexBuffer, vDstDesc,
441 _varyingStencilTable,
442 instance, _deviceContext);
443 }
444 }
445 }
446
447 virtual void Synchronize() {
448 Evaluator::Synchronize(_deviceContext);
449 }
450
451 virtual PatchTable * GetPatchTable() const {
452 return _patchTable;
453 }
454
455 virtual Far::PatchTable const *GetFarPatchTable() const {
456 return _farPatchTable;
457 }
458
459 virtual int GetNumVertices() const { return _numVertices; }
460
461 virtual int GetMaxValence() const { return _maxValence; }
462
463 virtual VertexBufferBinding BindVertexBuffer() {
464 return _vertexBuffer->BindVBO(_deviceContext);
465 }
466
467 virtual VertexBufferBinding BindVaryingBuffer() {
468 return _varyingBuffer->BindVBO(_deviceContext);
469 }
470
471 virtual VertexBuffer * GetVertexBuffer() {
472 return _vertexBuffer;
473 }
474
475 virtual VertexBuffer * GetVaryingBuffer() {
476 return _varyingBuffer;
477 }
478
479 virtual Far::TopologyRefiner const * GetTopologyRefiner() const {
480 return _refiner;
481 }
482
483 private:
484 void initializeContext(int numVertexElements,
485 int numVaryingElements,
486 int level, MeshBitset bits) {
487 assert(_refiner);
488
489 Far::StencilTableFactory::Options options;
490 options.generateOffsets = true;
491 options.generateIntermediateLevels =
492 _refiner->IsUniform() ? false : true;
493
494 Far::StencilTable const * vertexStencils = NULL;
495 Far::StencilTable const * varyingStencils = NULL;
496
497 if (numVertexElements>0) {
498
499 vertexStencils = Far::StencilTableFactory::Create(*_refiner,
500 options);
501 }
502
503 if (numVaryingElements>0) {
504
505 options.interpolationMode =
506 Far::StencilTableFactory::INTERPOLATE_VARYING;
507
508 varyingStencils = Far::StencilTableFactory::Create(*_refiner,
509 options);
510 }
511
512 Far::PatchTableFactory::Options poptions(level);
513 poptions.generateFVarTables = bits.test(MeshFVarData);
514 poptions.useSingleCreasePatch = bits.test(MeshUseSingleCreasePatch);
515
516 if (bits.test(MeshEndCapBSplineBasis)) {
517 poptions.SetEndCapType(
518 Far::PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS);
519 } else if (bits.test(MeshEndCapGregoryBasis)) {
520 poptions.SetEndCapType(
521 Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS);
522 // points on gregory basis endcap boundary can be shared among
523 // adjacent patches to save some stencils.
524 poptions.shareEndCapPatchPoints = true;
525 } else if (bits.test(MeshEndCapLegacyGregory)) {
526 poptions.SetEndCapType(
527 Far::PatchTableFactory::Options::ENDCAP_LEGACY_GREGORY);
528 }
529
530 _farPatchTable = Far::PatchTableFactory::Create(*_refiner, poptions);
531
532 // if there's endcap stencils, merge it into regular stencils.
533 if (_farPatchTable->GetLocalPointStencilTable()) {
534 // append stencils
535 if (Far::StencilTable const *vertexStencilsWithLocalPoints =
536 Far::StencilTableFactory::AppendLocalPointStencilTable(
537 *_refiner,
538 vertexStencils,
539 _farPatchTable->GetLocalPointStencilTable())) {
540 delete vertexStencils;
541 vertexStencils = vertexStencilsWithLocalPoints;
542 }
543 if (varyingStencils) {
544 if (Far::StencilTable const *varyingStencilsWithLocalPoints =
545 Far::StencilTableFactory::AppendLocalPointStencilTable(
546 *_refiner,
547 varyingStencils,
548 _farPatchTable->GetLocalPointVaryingStencilTable())) {
549 delete varyingStencils;
550 varyingStencils = varyingStencilsWithLocalPoints;
551 }
552 }
553 }
554
555 _maxValence = _farPatchTable->GetMaxValence();
556 _patchTable = PatchTable::Create(_farPatchTable, _deviceContext);
557
558 // numvertices = coarse verts + refined verts + gregory basis verts
559 _numVertices = vertexStencils->GetNumControlVertices()
560 + vertexStencils->GetNumStencils();
561
562 // convert to device stenciltable if necessary.
563 _vertexStencilTable =
564 convertToCompatibleStencilTable<StencilTable>(
565 vertexStencils, _deviceContext);
566 _varyingStencilTable =
567 convertToCompatibleStencilTable<StencilTable>(
568 varyingStencils, _deviceContext);
569
570 // FIXME: we do extra copyings for Far::Stencils.
571 delete vertexStencils;
572 delete varyingStencils;
573 }
574
575 void initializeVertexBuffers(int numVertices,
576 int numVertexElements,
577 int numVaryingElements) {
578
579 if (numVertexElements) {
580 _vertexBuffer = VertexBuffer::Create(numVertexElements,
581 numVertices, _deviceContext);
582 }
583
584 if (numVaryingElements) {
585 _varyingBuffer = VertexBuffer::Create(numVaryingElements,
586 numVertices, _deviceContext);
587 }
588 }
589
590 Far::TopologyRefiner * _refiner;
591 Far::PatchTable * _farPatchTable;
592
593 int _numVertices;
594 int _maxValence;
595
596 VertexBuffer * _vertexBuffer;
597 VertexBuffer * _varyingBuffer;
598
599 BufferDescriptor _vertexDesc;
600 BufferDescriptor _varyingDesc;
601
602 StencilTable const * _vertexStencilTable;
603 StencilTable const * _varyingStencilTable;
604 EvaluatorCache * _evaluatorCache;
605
606 PatchTable *_patchTable;
607 DeviceContext *_deviceContext;
608 };
609
610 } // end namespace Osd
611
612 } // end namespace OPENSUBDIV_VERSION
613 using namespace OPENSUBDIV_VERSION;
614
615 } // end namespace OpenSubdiv
616
617 #endif // OPENSUBDIV3_OSD_MESH_H
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::~Mesh
virtual ~Mesh()
Definition: mesh.h:379
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::StencilTable
STENCIL_TABLE StencilTable
Definition: mesh.h:321
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::refineMesh
static void refineMesh(Far::TopologyRefiner &refiner, int level, bool adaptive, bool singleCreasePatch)
Definition: mesh.h:97
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::Mesh
Mesh(Far::TopologyRefiner *refiner, int numVertexElements, int numVaryingElements, int level, MeshBitset bits=MeshBitset(), EvaluatorCache *evaluatorCache=NULL, DeviceContext *deviceContext=NULL)
Definition: mesh.h:327
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::UpdateVertexBuffer
virtual void UpdateVertexBuffer(float const *vertexData, int startVertex, int numVerts)=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshBits
MeshBits
Definition: mesh.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTableFactory::Options
Definition: patchTableFactory.h:79
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshFVarData
Definition: mesh.h:52
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTableFactory::Create
static PatchTable * Create(TopologyRefiner const &refiner, Options options=Options())
Factory constructor for PatchTable.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::BufferDescriptor::stride
int stride
stride to the next element
Definition: bufferDescriptor.h:102
OpenSubdiv::OPENSUBDIV_VERSION::Osd::BufferDescriptor
BufferDescriptor is a struct which describes buffer elements in interleaved data buffers. Almost all Osd Evaluator APIs take BufferDescriptors along with device-specific buffer objects.
Definition: bufferDescriptor.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::AppendLocalPointStencilTable
static StencilTable const * AppendLocalPointStencilTable(TopologyRefiner const &refiner, StencilTable const *baseStencilTable, StencilTable const *localPointStencilTable, bool factorize=true)
Utility function for stencil splicing for local point stencils.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::BindVaryingBuffer
virtual VertexBufferBinding BindVaryingBuffer()=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::srcDesc
BufferDescriptor srcDesc
Definition: mesh.h:182
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::EvaluatorCache
EvaluatorCacheT< Evaluator > EvaluatorCache
Definition: mesh.h:324
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::GetMaxValence
int GetMaxValence() const
Returns max vertex valence.
Definition: patchTable.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::AdaptiveOptions
Adaptive refinement options.
Definition: topologyRefiner.h:133
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetVertexBuffer
virtual VertexBuffer * GetVertexBuffer()
Definition: mesh.h:471
OpenSubdiv
Definition: error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshBitset
std::bitset< NUM_MESH_BITS > MeshBitset
Definition: mesh.h:59
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::GetNumFVarChannels
int GetNumFVarChannels() const
Returns the number of face-varying channels in the tables.
Definition: topologyRefiner.h:240
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::VertexBufferBinding
PatchTable::VertexBufferBinding VertexBufferBinding
Definition: mesh.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::~EvaluatorCacheT
~EvaluatorCacheT()
Definition: mesh.h:167
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshEndCapLegacyGregory
Definition: mesh.h:56
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::UpdateVaryingBuffer
virtual void UpdateVaryingBuffer(float const *varyingData, int startVertex, int numVerts)=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::NUM_MESH_BITS
Definition: mesh.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshAdaptive
Definition: mesh.h:50
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::IsUniform
bool IsUniform() const
Returns true if uniform subdivision has been applied.
Definition: topologyRefiner.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::generateOffsets
unsigned int generateOffsets
populate optional "_offsets" field
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Create
static StencilTable const * Create(TopologyRefiner const &refiner, Options options=Options())
Instantiates StencilTable from TopologyRefiner that have been refined uniformly or adaptively...
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::GetLocalPointVaryingStencilTable
StencilTable const * GetLocalPointVaryingStencilTable() const
Returns the varying stencil table for the change of basis patch points.
Definition: patchTable.h:182
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::GetNumVertices
virtual int GetNumVertices() const =0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::dvDesc
BufferDescriptor dvDesc
Definition: mesh.h:182
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::GetNumControlVertices
int GetNumControlVertices() const
Returns the number of control vertices indexed in the table.
Definition: stencilTable.h:144
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::Evaluator
EVALUATOR Evaluator
Definition: mesh.h:320
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::GetPatchTable
virtual PatchTable * GetPatchTable() const =0
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyLevel::GetNumVertices
int GetNumVertices() const
Return the number of vertices in this level.
Definition: topologyLevel.h:60
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::Refine
virtual void Refine()
Definition: mesh.h:402
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::interpolationMode
unsigned int interpolationMode
interpolation mode
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::GetEvaluator
EVALUATOR * GetEvaluator(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, DEVICE_CONTEXT *deviceContext)
Definition: mesh.h:188
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::BindVertexBuffer
virtual VertexBufferBinding BindVertexBuffer()
Definition: mesh.h:463
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::PatchTable
PATCH_TABLE PatchTable
Definition: mesh.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::BindVertexBuffer
virtual VertexBufferBinding BindVertexBuffer()=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::Synchronize
virtual void Synchronize()=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::dstDesc
BufferDescriptor dstDesc
Definition: mesh.h:182
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::RefineUniform
void RefineUniform(UniformOptions options)
Refine the topology uniformly.
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::GetLevel
TopologyLevel const & GetLevel(int level) const
Returns a handle to access data specific to a particular level.
Definition: topologyRefiner.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::generateIntermediateLevels
unsigned int generateIntermediateLevels
vertices at all levels or highest only
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::GetFarPatchTable
virtual Far::PatchTable const * GetFarPatchTable() const =0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::DeviceContext
DEVICE_CONTEXT DeviceContext
Definition: mesh.h:323
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::UniformOptions::fullTopologyInLastLevel
unsigned int fullTopologyInLastLevel
Definition: topologyRefiner.h:111
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable
Table of subdivision stencils.
Definition: stencilTable.h:125
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshEndCapGregoryBasis
Definition: mesh.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::VertexBuffer
VERTEX_BUFFER VertexBuffer
Definition: mesh.h:319
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::evaluator
EVALUATOR * evaluator
Definition: mesh.h:183
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::duDesc
BufferDescriptor duDesc
Definition: mesh.h:182
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::GetLocalPointStencilTable
StencilTable const * GetLocalPointStencilTable() const
Returns the stencil table to get change of basis patch points.
Definition: patchTable.h:176
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::RefineAdaptive
void RefineAdaptive(AdaptiveOptions options)
Feature Adaptive topology refinement (restricted to scheme Catmark)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::PatchTable
PATCH_TABLE PatchTable
Definition: mesh.h:322
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh
Definition: mesh.h:317
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetTopologyRefiner
virtual Far::TopologyRefiner const * GetTopologyRefiner() const
Definition: mesh.h:479
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::VertexBufferBinding
PatchTable::VertexBufferBinding VertexBufferBinding
Definition: mesh.h:325
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition: patchTable.h:56
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner
Stores topology data for a specified set of refinement options.
Definition: topologyRefiner.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options
Definition: stencilTableFactory.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::MeshInterface
MeshInterface()
Definition: mesh.h:70
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::UpdateVertexBuffer
virtual void UpdateVertexBuffer(float const *vertexData, int startVertex, int numVerts)
Definition: mesh.h:390
OpenSubdiv::OPENSUBDIV_VERSION::Osd::BufferDescriptor::length
int length
number or length of the data
Definition: bufferDescriptor.h:100
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetMaxValence
virtual int GetMaxValence() const
Definition: mesh.h:461
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTableFactory::Options::ENDCAP_LEGACY_GREGORY
use legacy (2.x) Gregory patches (4 cp + valence table) as end-caps
Definition: patchTableFactory.h:86
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Evaluators
std::vector< Entry > Evaluators
Definition: mesh.h:185
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT
Definition: mesh.h:165
OpenSubdiv::OPENSUBDIV_VERSION::Osd::BufferDescriptor::offset
int offset
offset to desired element data
Definition: bufferDescriptor.h:98
OpenSubdiv::OPENSUBDIV_VERSION::Osd::convertToCompatibleStencilTable
STENCIL_TABLE const * convertToCompatibleStencilTable(SRC_STENCIL_TABLE const *table, DEVICE_CONTEXT *context)
Definition: mesh.h:120
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry::Entry
Entry(BufferDescriptor const &srcDescArg, BufferDescriptor const &dstDescArg, BufferDescriptor const &duDescArg, BufferDescriptor const &dvDescArg, EVALUATOR *evalArg)
Definition: mesh.h:176
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::AdaptiveOptions::useSingleCreasePatch
unsigned int useSingleCreasePatch
Definition: topologyRefiner.h:141
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner::UniformOptions
Uniform refinement options.
Definition: topologyRefiner.h:104
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::BindVaryingBuffer
virtual VertexBufferBinding BindVaryingBuffer()
Definition: mesh.h:467
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::GetMaxValence
virtual int GetMaxValence() const =0
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS
use Gregory basis patches (20 cp) as end-caps
Definition: patchTableFactory.h:85
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::Refine
virtual void Refine()=0
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface::~MeshInterface
virtual ~MeshInterface()
Definition: mesh.h:72
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterface
Definition: mesh.h:64
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::Entry
Definition: mesh.h:175
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::Synchronize
virtual void Synchronize()
Definition: mesh.h:447
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable::GetNumStencils
int GetNumStencils() const
Returns the number of stencils in the table.
Definition: stencilTable.h:139
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetPatchTable
virtual PatchTable * GetPatchTable() const
Definition: mesh.h:451
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshInterleaveVarying
Definition: mesh.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::UpdateVaryingBuffer
virtual void UpdateVaryingBuffer(float const *varyingData, int startVertex, int numVerts)
Definition: mesh.h:396
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshUseSingleCreasePatch
Definition: mesh.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Osd::MeshEndCapBSplineBasis
Definition: mesh.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetVaryingBuffer
virtual VertexBuffer * GetVaryingBuffer()
Definition: mesh.h:475
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetFarPatchTable
virtual Far::PatchTable const * GetFarPatchTable() const
Definition: mesh.h:455
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS
use BSpline basis patches (16 cp) as end-caps
Definition: patchTableFactory.h:84
OpenSubdiv::OPENSUBDIV_VERSION::Osd::Mesh::GetNumVertices
virtual int GetNumVertices() const
Definition: mesh.h:459
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable
Table of limit subdivision stencils.
Definition: stencilTable.h:287
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::INTERPOLATE_VARYING
Definition: stencilTableFactory.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Osd::EvaluatorCacheT::GetEvaluator
EVALUATOR * GetEvaluator(BufferDescriptor const &srcDesc, BufferDescriptor const &dstDesc, BufferDescriptor const &duDesc, BufferDescriptor const &dvDesc, DEVICE_CONTEXT *deviceContext)
Definition: mesh.h:198