OpenSubdiv
Loading...
Searching...
No Matches
patchTableFactory.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_PATCH_TABLE_FACTORY_H
9#define OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H
10
11#include "../version.h"
12
14#include "../far/patchTable.h"
15
16namespace OpenSubdiv {
17namespace OPENSUBDIV_VERSION {
18
19namespace Far {
20
24public:
25
28 struct Options {
29
45
66
69
71 void SetEndCapType(EndCapType e) { endCapType = e & 0x7; }
72
74 void SetMaxIsolationLevel(unsigned int level) { maxIsolationLevel = level & 0xf; }
75
77 template <typename REAL> void SetPatchPrecision();
78
80 template <typename REAL> void SetFVarPatchPrecision();
81
92
93 unsigned int generateAllLevels : 1,
97
101
102 // end-capping
106
107 // varying
110
111 // face-varying
113
114 // precision
117
118 // legacy behaviors (default to true)
121
123 int const * fvarChannelIndices;
124 };
125
158 static PatchTable * Create(TopologyRefiner const & refiner,
159 Options options = Options(),
160 ConstIndexArray selectedFaces = ConstIndexArray());
161
162public:
163 // PatchFaceTag
164 //
165 // This simple struct was previously used within the factory to take inventory of
166 // various kinds of patches to fully allocate buffers prior to populating them. It
167 // was not intended to be exposed as part of the public interface.
168 //
169 // It is no longer used internally and is being kept here to respect preservation
170 // of the public interface, but it will be deprecated at the earliest opportunity.
171 //
174 //
176 public:
177 unsigned int _hasPatch : 1;
178 unsigned int _isRegular : 1;
179 unsigned int _transitionMask : 4;
180 unsigned int _boundaryMask : 4;
181 unsigned int _boundaryIndex : 2;
182 unsigned int _boundaryCount : 3;
183 unsigned int _hasBoundaryEdge : 3;
184 unsigned int _isSingleCrease : 1;
185
186 void clear();
187 void assignBoundaryPropertiesFromEdgeMask(int boundaryEdgeMask);
188 void assignBoundaryPropertiesFromVertexMask(int boundaryVertexMask);
189 void assignTransitionPropertiesFromEdgeMask(int boundaryVertexMask);
190 };
191 typedef std::vector<PatchFaceTag> PatchTagVector;
192};
193
194
199 fvarPatchPrecisionDouble = false;
200}
201
203 patchPrecisionDouble = true;
204}
206 fvarPatchPrecisionDouble = true;
207}
208
209
210} // end namespace Far
211
212} // end namespace OPENSUBDIV_VERSION
213using namespace OPENSUBDIV_VERSION;
214
215} // end namespace OpenSubdiv
216
217
218#endif /* OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H */
Vtr::ConstIndexArray ConstIndexArray
Definition types.h:30
Container for arrays of parametric patches.
Definition patchTable.h:38
Factory for constructing a PatchTable from a TopologyRefiner.
static PatchTable * Create(TopologyRefiner const &refiner, Options options=Options(), ConstIndexArray selectedFaces=ConstIndexArray())
Instantiates a PatchTable from a client-provided TopologyRefiner.
unsigned int generateVaryingTables
Generate varying patch tables.
unsigned int generateLegacySharpCornerPatches
Generate sharp regular patches at smooth corners (legacy)
TopologyRefiner::AdaptiveOptions GetRefineAdaptiveOptions() const
Determine adaptive refinement options to match assigned patch options.
unsigned int maxIsolationLevel
Cap adaptive feature isolation to the given level (max. 10)
unsigned int generateFVarLegacyLinearPatches
Generate all linear face-varying patches (legacy)
void SetPatchPrecision()
Set precision of vertex patches.
unsigned int fvarPatchPrecisionDouble
Generate double-precision stencils for face-varying patches.
void SetMaxIsolationLevel(unsigned int level)
Set maximum isolation level.
int const * fvarChannelIndices
List containing the indices of the channels selected for the factory.
unsigned int generateVaryingLocalPoints
Generate local points with varying patches.
unsigned int includeFVarBaseLevelIndices
Include base level in face-varying patch point indices (Uniform mode only)
unsigned int generateAllLevels
Generate levels from 'firstLevel' to 'maxLevel' (Uniform mode only)
unsigned int patchPrecisionDouble
Generate double-precision stencils for vertex patches.
unsigned int generateFVarTables
Generate face-varying patch tables.
unsigned int includeBaseLevelIndices
Include base level in patch point indices (Uniform mode only)
void SetFVarPatchPrecision()
Set precision of face-varying patches.
int numFVarChannels
Number of channel indices and interpolation modes passed.
unsigned int triangulateQuads
Triangulate 'QUADS' primitives (Uniform mode only)
EndCapType
Choice for approximating irregular patches (end-caps)
@ ENDCAP_LEGACY_GREGORY
legacy option for 2.x style Gregory patches (Catmark only)
@ ENDCAP_GREGORY_BASIS
use Gregory patches (highest quality, recommended default)
@ ENDCAP_BILINEAR_BASIS
use linear patches (simple quads or tris)
@ ENDCAP_BSPLINE_BASIS
use BSpline-like patches (same patch type as regular)
Obsolete internal struct not intended for public use – due to be deprecated.
Stores topology data for a specified set of refinement options.