stencilTableFactory.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_FACTORY_H
26 #define OPENSUBDIV3_FAR_STENCILTABLE_FACTORY_H
27 
28 #include "../version.h"
29 
30 #include "../far/patchTable.h"
31 
32 #include <vector>
33 
34 namespace OpenSubdiv {
35 namespace OPENSUBDIV_VERSION {
36 
37 namespace Far {
38 
39 class TopologyRefiner;
40 
41 class Stencil;
42 class StencilTable;
43 class LimitStencil;
44 class LimitStencilTable;
45 
49 
50 public:
51 
52  enum Mode {
55  };
56 
57  struct Options {
58 
60  generateOffsets(false),
61  generateControlVerts(false),
64  maxLevel(10) { }
65 
66  unsigned int interpolationMode : 2,
67  generateOffsets : 1,
71  maxLevel : 4;
74  };
75 
87  static StencilTable const * Create(TopologyRefiner const & refiner,
88  Options options = Options());
89 
90 
103  static StencilTable const * Create(int numTables, StencilTable const ** tables);
104 
105 
121  TopologyRefiner const &refiner,
122  StencilTable const *baseStencilTable,
123  StencilTable const *localPointStencilTable,
124  bool factorize = true);
125 
126 private:
127 
128  // Generate stencils for the coarse control-vertices (single weight = 1.0f)
129  static void generateControlVertStencils(int numControlVerts, Stencil & dst);
130 };
131 
144 
145 public:
146 
148  struct LocationArray {
149 
150  LocationArray() : ptexIdx(-1), numLocations(0), s(0), t(0) { }
151 
152  int ptexIdx,
153  numLocations;
154 
155  float const * s,
156  * t;
157  };
158 
159  typedef std::vector<LocationArray> LocationArrayVec;
160 
177  static LimitStencilTable const * Create(TopologyRefiner const & refiner,
178  LocationArrayVec const & locationArrays,
179  StencilTable const * cvStencils=0,
180  PatchTable const * patchTable=0);
181 };
182 
183 
184 } // end namespace Far
185 
186 } // end namespace OPENSUBDIV_VERSION
187 using namespace OPENSUBDIV_VERSION;
188 
189 } // end namespace OpenSubdiv
190 
191 #endif // OPENSUBDIV3_FAR_STENCILTABLE_FACTORY_H
unsigned int maxLevel
generate stencils up to 'maxLevel'
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.
unsigned int generateControlVerts
generate stencils for control-vertices
unsigned int generateOffsets
populate optional "_offsets" field
static StencilTable const * Create(TopologyRefiner const &refiner, Options options=Options())
Instantiates StencilTable from TopologyRefiner that have been refined uniformly or adaptively...
unsigned int generateIntermediateLevels
vertices at all levels or highest only
static LimitStencilTable const * Create(TopologyRefiner const &refiner, LocationArrayVec const &locationArrays, StencilTable const *cvStencils=0, PatchTable const *patchTable=0)
Instantiates LimitStencilTable from a TopologyRefiner that has been refined either uniformly or adapt...
Container for arrays of parametric patches.
Definition: patchTable.h:56
Stores topology data for a specified set of refinement options.
Table of limit subdivision stencils.
Definition: stencilTable.h:285