All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
patchTableFactory.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_PATCH_TABLE_FACTORY_H
26 #define OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H
27 
28 #include "../version.h"
29 
30 #include "../far/patchTable.h"
31 
32 namespace OpenSubdiv {
33 namespace OPENSUBDIV_VERSION {
34 
35 namespace Far {
36 
37 // Forward declarations (for internal implementation purposes):
38 class TopologyRefiner;
39 
43 public:
44 
47  struct Options {
48 
49  enum EndCapType {
55  };
56 
57  Options(unsigned int maxIsolation=10) :
58  generateAllLevels(false),
59  triangulateQuads(false),
60  useSingleCreasePatch(false),
61  useInfSharpPatch(false),
62  maxIsolationLevel(maxIsolation),
65  generateFVarTables(false),
68  numFVarChannels(-1),
70  { }
71 
74 
77 
78  unsigned int generateAllLevels : 1,
79  triangulateQuads : 1,
81  useInfSharpPatch : 1,
82  maxIsolationLevel : 4,
83 
84  // end-capping
85  endCapType : 3,
87 
89  // face-varying
90  generateFVarTables : 1,
91 
92  // legacy behaviors (default to true)
95 
97  int const * fvarChannelIndices;
98  };
99 
126  static PatchTable * Create(TopologyRefiner const & refiner,
127  Options options=Options());
128 
129 public:
130  // PatchFaceTag
131  // This simple struct was previously used within the factory to take inventory of
132  // various kinds of patches to fully allocate buffers prior to populating them. It
133  // was not intended to be exposed as part of the public interface.
134  //
135  // It is no longer used internally and is being kept here to respect preservation
136  // of the public interface, but it will be deprecated at the earliest opportunity.
137  //
138  struct PatchFaceTag {
139  public:
140  unsigned int _hasPatch : 1;
141  unsigned int _isRegular : 1;
142  unsigned int _transitionMask : 4;
143  unsigned int _boundaryMask : 4;
144  unsigned int _boundaryIndex : 2;
145  unsigned int _boundaryCount : 3;
146  unsigned int _hasBoundaryEdge : 3;
147  unsigned int _isSingleCrease : 1;
148 
149  void clear();
150  void assignBoundaryPropertiesFromEdgeMask(int boundaryEdgeMask);
151  void assignBoundaryPropertiesFromVertexMask(int boundaryVertexMask);
152  void assignTransitionPropertiesFromEdgeMask(int boundaryVertexMask);
153  };
154  typedef std::vector<PatchFaceTag> PatchTagVector;
155 };
156 
157 } // end namespace Far
158 
159 } // end namespace OPENSUBDIV_VERSION
160 using namespace OPENSUBDIV_VERSION;
161 
162 } // end namespace OpenSubdiv
163 
164 
165 #endif /* OPENSUBDIV3_FAR_PATCH_TABLE_FACTORY_H */
unsigned int maxIsolationLevel
Cap adaptive feature isolation to the given level (max. 10)
unsigned int generateLegacySharpCornerPatches
Generate sharp regular patches at smooth corners (legacy)
unsigned int generateFVarLegacyLinearPatches
Generate all linear face-varying patches (legacy)
Factory for constructing a PatchTable from a TopologyRefiner.
static PatchTable * Create(TopologyRefiner const &refiner, Options options=Options())
Instantiates a PatchTable from a client-provided TopologyRefiner.
Container for arrays of parametric patches.
Definition: patchTable.h:55
int numFVarChannels
Number of channel indices and interpolation modes passed.
EndCapType GetEndCapType() const
Get endcap patch type.
void SetEndCapType(EndCapType e)
Set endcap patch type.
unsigned int triangulateQuads
Triangulate 'QUADS' primitives (Uniform mode only)
use legacy (2.x) Gregory patches (4 cp + valence table) as end-caps
unsigned int generateFVarTables
Generate face-varying patch tables.
unsigned int generateAllLevels
Include levels from 'firstLevel' to 'maxLevel' (Uniform mode only)
unsigned int useInfSharpPatch
Use infinitely-sharp patch.
Stores topology data for a specified set of refinement options.
int const * fvarChannelIndices
List containing the indices of the channels selected for the factory.