All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
options.h
Go to the documentation of this file.
1 //
2 // Copyright 2014 DreamWorks Animation LLC.
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 #ifndef SDC_OPTIONS_H
25 #define SDC_OPTIONS_H
26 
27 #include "../version.h"
28 
29 namespace OpenSubdiv {
30 namespace OPENSUBDIV_VERSION {
31 
32 namespace Sdc {
33 
34 //
35 // This header contains all supported options that can be applied to a subdivision
36 // scheme to affect the shape of the limit surface. These differ from approximations
37 // that may be applied at a higher level, i.e. options to limit the level of feature
38 // adaptive subdivision, options to ignore fractional creasing, or creasing entirely,
39 // etc. These options define a particular limit surface.
40 //
41 // The intent is that these sets of options be defined at a high-level and propagated
42 // into the lowest-level computation in support of each subdivision scheme. Ideally
43 // it remains a set of bit-fields (essentially an int) and so remains light weight and
44 // easily passed down by value.
45 //
46 // Questions:
47 // Should the individual enum's be nested within the class or independent?
48 //
49 // Note:
50 // A case can be made that the CreaseMethod enum is better defined as part of the
51 // Crease class, but the goal is to try and put them all in one place. We could define
52 // it there and aggregate it into Options here, but we need to be careful about the
53 // possibility of circular dependencies (nesting types in classes inhibits forward
54 // declaration).
55 //
56 class Options {
57 public:
58 
59  // XXXX
60  // Manuel suggested "VertexBoundaryInterpolation" here, but when used, that sounded
61  // too much like boundary interpolation specific to a vertex -- I went with the VVar
62  // and FVar naming here instead (abbreviating the FaceVaryingBoundaryInterpolation
63  // that was suggested)...
64  //
69  };
70 
76  };
77 
78  //
79  // Tony has expressed a preference of UNIFORM vs NORMAL here, which diverges from
80  // Hbr/RenderMan, but makes a lot more sense as it allows us to distinguish between
81  // uniform and non-uniform creasing computations (with uniform being trivial).
82  //
86  };
87 
88  //
89  // Is it possible to get rid of this entirely? It is specific to Catmark, seems to
90  // be little used and only applies to the first level of subdivision. Getting rid
91  // of the code that supports this (though it is localized) would be a relief...
92  //
97  };
98 
99  //
100  // This is speculative for now and included for illustration purposes -- the simplest
101  // set of interpolation rules for non-manifold features is to make them infinitely
102  // sharp, which fits into existing evaluation schemes. Allowing them to be smooth is
103  // less well-defined and requires additional cases in the masks to properly support.
104  //
109  };
110 
111 public:
112 
113  // Trivial constructor and destructor:
114  Options() : _vvarBoundInterp(VVAR_BOUNDARY_NONE),
115  _fvarBoundInterp(FVAR_BOUNDARY_BILINEAR),
116  _nonManInterp(NON_MANIFOLD_NONE),
117  _creasingMethod(CREASE_UNIFORM),
118  _triangleSub(TRI_SUB_NORMAL),
119  _hbrCompatible(false) { }
120  ~Options() { }
121 
122  //
123  // Trivial get/set methods:
124  //
126  void SetVVarBoundaryInterpolation(VVarBoundaryInterpolation b) { _vvarBoundInterp = b; }
127 
129  void SetFVarBoundaryInterpolation(FVarBoundaryInterpolation b) { _fvarBoundInterp = b; }
130 
131  CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
132  void SetCreasingMethod(CreasingMethod c) { _creasingMethod = c; }
133 
136 
138  void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = t; }
139 
140  //
141  // This may be premature, but it is useful to have some kind of flag so that users can be assured
142  // the options and meshes they specify are compliant with Hbr, RenderMan, etc. How to measure that
143  // is still ill-defined given versions of Hbr, prMan will evolve...
144  //
145  bool GetHbrCompatibility() const { return _hbrCompatible; }
146  void SetHbrCompatibility(bool onOrOff) { _hbrCompatible = onOrOff; }
147 
148 private:
149  // Bitfield members:
150  unsigned int _vvarBoundInterp : 2;
151  unsigned int _fvarBoundInterp : 2;
152  unsigned int _nonManInterp : 2;
153  unsigned int _creasingMethod : 2;
154  unsigned int _triangleSub : 2;
155  unsigned int _hbrCompatible : 1;
156 };
157 
158 } // end namespace sdc
159 
160 } // end namespace OPENSUBDIV_VERSION
161 using namespace OPENSUBDIV_VERSION;
162 } // end namespace OpenSubdiv
163 
164 #endif /* SDC_OPTIONS_H */
165 
FVarBoundaryInterpolation GetFVarBoundaryInterpolation() const
Definition: options.h:128
void SetVVarBoundaryInterpolation(VVarBoundaryInterpolation b)
Definition: options.h:126
void SetCreasingMethod(CreasingMethod c)
Definition: options.h:132
CreasingMethod GetCreasingMethod() const
Definition: options.h:131
void SetFVarBoundaryInterpolation(FVarBoundaryInterpolation b)
Definition: options.h:129
void SetTriangleSubdivision(TriangleSubdivision t)
Definition: options.h:138
void SetNonManifoldInterpolation(NonManifoldInterpolation n)
Definition: options.h:135
VVarBoundaryInterpolation GetVVarBoundaryInterpolation() const
Definition: options.h:125
TriangleSubdivision GetTriangleSubdivision() const
Definition: options.h:137
NonManifoldInterpolation GetNonManifoldInterpolation() const
Definition: options.h:134