All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
patchTablesFactory.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 FAR_PATCH_TABLES_FACTORY_H
26 #define FAR_PATCH_TABLES_FACTORY_H
27 
28 #include "../version.h"
29 
30 #include "../far/patchTables.h"
31 
32 namespace OpenSubdiv {
33 namespace OPENSUBDIV_VERSION {
34 
35 // Forward declarations (for internal implementation purposes):
36 namespace Vtr { class Level; }
37 
38 namespace Far {
39 
40 class TopologyRefiner;
41 template <typename T> struct PatchTypes;
42 struct PatchFaceTag;
43 
44 
51 
52 public:
53 
54  struct Options {
55 
57  triangulateQuads(false),
58  generateFVarTables(false) { }
59 
61  triangulateQuads : 1,
62  generateFVarTables : 1;
63  };
64 
73  static PatchTables * Create(TopologyRefiner const & refiner, Options options=Options());
74 
75 private:
76 
79 
80  static PatchTables * createUniform( TopologyRefiner const & refiner, Options options );
81 
82  static PatchTables * createAdaptive( TopologyRefiner const & refiner, Options options );
83 
84  // High-level methods for identifying and populating patches associated with faces:
85  static void identifyAdaptivePatches( TopologyRefiner const & refiner,
86  PatchTypes<int> & patchInventory,
87  std::vector<PatchFaceTag> & patchTags);
88 
89  static void populateAdaptivePatches( TopologyRefiner const & refiner,
90  PatchTypes<int> const & patchInventory,
91  std::vector<PatchFaceTag> const & patchTags,
92  PatchTables * tables);
93 
94  // Methods for allocating and managing the patch table data arrays:
95  static void allocateTables( PatchTables * tables, int nlevels );
96 
97  static FVarPatchTables * allocateFVarTables( TopologyRefiner const & refiner,
98  PatchTables const & tables,
99  Options options );
100 
101  static void pushPatchArray( PatchTables::Descriptor desc,
103  int npatches, int * voffset, int * poffset, int * qoffset );
104 
105  static PatchParam * computePatchParam( TopologyRefiner const & refiner, int level,
106  int face, int rotation, PatchParam * coord );
107 
108  static void getQuadOffsets(Vtr::Level const & level, int face, unsigned int * result);
109 
110 private:
111 };
112 
113 } // end namespace Far
114 
115 } // end namespace OPENSUBDIV_VERSION
116 using namespace OPENSUBDIV_VERSION;
117 
118 } // end namespace OpenSubdiv
119 
120 #endif /* FAR_PATCH_TABLES_FACTORY_H */
121 
int triangulateQuads
Triangulate &#39;QUADS&#39; primitives (Uniform mode only)
static PatchTables * Create(TopologyRefiner const &refiner, Options options=Options())
Factory constructor for PatchTables.
Container for patch vertex indices tables.
Definition: patchTables.h:49
Local patch parameterization descriptor.
Definition: patchParam.h:59
int generateAllLevels
Include levels from &#39;firstLevel&#39; to &#39;maxLevel&#39; (Uniform mode only)
Stores topology data for a specified set of refinement options.
A specialized factory for feature adaptive PatchTables.