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 {
56  };
57 
58  struct Options {
59 
61  generateOffsets(false),
62  generateControlVerts(false),
65  maxLevel(10),
66  fvarChannel(0) { }
67 
68  unsigned int interpolationMode : 2,
69  generateOffsets : 1,
73  maxLevel : 4;
76  unsigned int fvarChannel;
77  };
79 
91  static StencilTable const * Create(TopologyRefiner const & refiner,
92  Options options = Options());
93 
94 
107  static StencilTable const * Create(int numTables, StencilTable const ** tables);
108 
109 
125  TopologyRefiner const &refiner,
126  StencilTable const *baseStencilTable,
127  StencilTable const *localPointStencilTable,
128  bool factorize = true);
129 
148  TopologyRefiner const &refiner,
149  StencilTable const *baseStencilTable,
150  StencilTable const *localPointStencilTable,
151  int channel = 0,
152  bool factorize = true);
153 
154 private:
155 
156  // Generate stencils for the coarse control-vertices (single weight = 1.0f)
157  static void generateControlVertStencils(int numControlVerts, Stencil & dst);
158 
159  // Internal method to splice local point stencils
160  static StencilTable const * appendLocalPointStencilTable(
161  TopologyRefiner const &refiner,
162  StencilTable const * baseStencilTable,
163  StencilTable const * localPointStencilTable,
164  int channel,
165  bool factorize);
166 };
167 
180 
181 public:
182 
184  struct LocationArray {
185 
186  LocationArray() : ptexIdx(-1), numLocations(0), s(0), t(0) { }
187 
188  int ptexIdx,
189  numLocations;
190 
191  float const * s,
192  * t;
193  };
194 
195  typedef std::vector<LocationArray> LocationArrayVec;
196 
197  struct Options {
198 
200  generate2ndDerivatives(false) { }
201 
202  unsigned int generate1stDerivatives : 1,
204  };
205 
224  static LimitStencilTable const * Create(TopologyRefiner const & refiner,
225  LocationArrayVec const & locationArrays,
226  StencilTable const * cvStencils=0,
227  PatchTable const * patchTable=0,
228  Options options=Options());
229 
230 };
231 
232 
233 } // end namespace Far
234 
235 } // end namespace OPENSUBDIV_VERSION
236 using namespace OPENSUBDIV_VERSION;
237 
238 } // end namespace OpenSubdiv
239 
240 #endif // OPENSUBDIV3_FAR_STENCILTABLE_FACTORY_H
unsigned int generate2ndDerivatives
Generate weights for 2nd derivatives.
Container for arrays of parametric patches.
Definition: patchTable.h:55
unsigned int generateControlVerts
generate stencils for control-vertices
static StencilTable const * Create(TopologyRefiner const &refiner, Options options=Options())
Instantiates StencilTable from TopologyRefiner that have been refined uniformly or adaptively...
static StencilTable const * AppendLocalPointStencilTableFaceVarying(TopologyRefiner const &refiner, StencilTable const *baseStencilTable, StencilTable const *localPointStencilTable, int channel=0, bool factorize=true)
Utility function for stencil splicing for local point face-varying stencils.
unsigned int maxLevel
generate stencils up to &#39;maxLevel&#39;
Stores topology data for a specified set of refinement options.
unsigned int generateIntermediateLevels
vertices at all levels or highest only
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.
Table of limit subdivision stencils.
Definition: stencilTable.h:333
static LimitStencilTable const * Create(TopologyRefiner const &refiner, LocationArrayVec const &locationArrays, StencilTable const *cvStencils=0, PatchTable const *patchTable=0, Options options=Options())
Instantiates LimitStencilTable from a TopologyRefiner that has been refined either uniformly or adapt...
unsigned int generateOffsets
populate optional "_offsets" field
unsigned int generate1stDerivatives
Generate weights for 1st derivatives.