opensubdiv/far/stencilTableFactory.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List

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
48 class StencilTableFactory {
49
50 public:
51
52 enum Mode {
53 INTERPOLATE_VERTEX=0,
54 INTERPOLATE_VARYING
55 };
56
57 struct Options {
58
59 Options() : interpolationMode(INTERPOLATE_VERTEX),
60 generateOffsets(false),
61 generateControlVerts(false),
62 generateIntermediateLevels(true),
63 factorizeIntermediateLevels(true),
64 maxLevel(10) { }
65
66 unsigned int interpolationMode : 2,
67 generateOffsets : 1,
68 generateControlVerts : 1,
69 generateIntermediateLevels : 1,
70 factorizeIntermediateLevels : 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
120 static StencilTable const * AppendLocalPointStencilTable(
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
143 class LimitStencilTableFactory {
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
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::factorizeIntermediateLevels
unsigned int factorizeIntermediateLevels
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::maxLevel
unsigned int maxLevel
generate stencils up to &#39;maxLevel&#39;
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::AppendLocalPointStencilTable
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.
OpenSubdiv
Definition: error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::generateControlVerts
unsigned int generateControlVerts
generate stencils for control-vertices
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::generateOffsets
unsigned int generateOffsets
populate optional "_offsets" field
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Create
static StencilTable const * Create(TopologyRefiner const &refiner, Options options=Options())
Instantiates StencilTable from TopologyRefiner that have been refined uniformly or adaptively...
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory
A specialized factory for StencilTable.
Definition: stencilTableFactory.h:48
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::interpolationMode
unsigned int interpolationMode
interpolation mode
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory::LocationArray::t
float const * t
array of v coordinates
Definition: stencilTableFactory.h:155
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::generateIntermediateLevels
unsigned int generateIntermediateLevels
vertices at all levels or highest only
Definition: stencilTableFactory.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTable
Table of subdivision stencils.
Definition: stencilTable.h:125
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options::Options
Options()
Definition: stencilTableFactory.h:59
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::INTERPOLATE_VERTEX
Definition: stencilTableFactory.h:53
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory
A specialized factory for LimitStencilTable.
Definition: stencilTableFactory.h:143
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition: patchTable.h:56
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory::LocationArray::ptexIdx
int ptexIdx
ptex face index
Definition: stencilTableFactory.h:152
OpenSubdiv::OPENSUBDIV_VERSION::Far::TopologyRefiner
Stores topology data for a specified set of refinement options.
Definition: topologyRefiner.h:49
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Options
Definition: stencilTableFactory.h:57
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::Mode
Mode
Definition: stencilTableFactory.h:52
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory::LocationArrayVec
std::vector< LocationArray > LocationArrayVec
Definition: stencilTableFactory.h:159
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory::LocationArray::LocationArray
LocationArray()
Definition: stencilTableFactory.h:150
OpenSubdiv::OPENSUBDIV_VERSION::Far::Stencil
Vertex stencil descriptor.
Definition: stencilTable.h:46
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTableFactory::LocationArray
Descriptor for limit surface locations.
Definition: stencilTableFactory.h:148
OpenSubdiv::OPENSUBDIV_VERSION::Far::LimitStencilTable
Table of limit subdivision stencils.
Definition: stencilTable.h:287
OpenSubdiv::OPENSUBDIV_VERSION::Far::StencilTableFactory::INTERPOLATE_VARYING
Definition: stencilTableFactory.h:54