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 the shape of a particular limit surface, including the
40 // "shape" of primitive variable data associated with it.
41 //
42 // The intent is that these sets of options be defined at a high-level and propagated
43 // into the lowest-level computation in support of each subdivision scheme. Ideally
44 // it remains a set of bit-fields (essentially an int) and so remains light weight and
45 // easily passed down by value.
46 //
47 // ALPHA NOTES:
48 // Several of these options are being reconsidered in light of the divergence of
49 // OSD 3.0 from Hbr. In some cases the options can be expressed more clearly and free
50 // of any RenderMan legacy for future use. Details are noted below:
51 // "CreasingMethod"
52 // - note the change from the default "Normal" method to "Uniform"
53 // "VVarBoundaryInterpolation"
54 // - both name and enumerations being reconsidered
55 // - the "VVar" prefix was misguided on my part (barfowl)
56 // - "boundary interpolation" is a potential misnomer as it only affects corners
57 // - its effect is to sharpen edges/corners, but edges are always sharpened
58 // - the "None" case serves no purpose (and would be discouraged)
59 // "FVarLinearInterpolation":
60 // - this replaces the combination of the "face varying boundary interpolation"
61 // enum and "propagate corner" boolean
62 // - functional equivalence with previous modes is as follows:
63 // LINEAR_NONE == "edge only" (smooth everywhere)
64 // LINEAR_CORNERS_ONLY == (no prior equivalent)
65 // LINEAR_CORNERS_PLUS1 == "edge and corner"
66 // LINEAR_CORNERS_PLUS2 == "edge and corner" with "propagate corners"
67 // LINEAR_BOUNDARIES == "always sharp"
68 // LINEAR_ALL == "bilinear"
69 // - the new "corner only" mode will sharpen corners and NEVER sharpen smooth
70 // boundaries, which we believe to be expected when sharping corners -- the
71 // old "edge and corner" mode would sharpen boundaries under some situations
72 // (e.g. more than three fvar values at a vertex)
73 // "TriangleSubdivision":
74 // - hoping we can get rid of this due to lack of interest/use
75 // - specific to Catmark and only at level 0
76 // "NonManifoldInterpolation":
77 // - hoping we can get rid of this due to lack of interest/use
78 //
79 class Options {
80 public:
85  };
93  };
97  };
102  };
107  };
108 
109 public:
110 
111  // Trivial constructor and destructor:
112  Options() : _vvarBoundInterp(VVAR_BOUNDARY_NONE),
113  _fvarLinInterp(FVAR_LINEAR_ALL),
114  _nonManInterp(NON_MANIFOLD_NONE),
115  _creasingMethod(CREASE_UNIFORM),
116  _triangleSub(TRI_SUB_NORMAL),
117  _hbrCompatible(false) { }
118  ~Options() { }
119 
120  //
121  // Trivial get/set methods:
122  //
124  void SetVVarBoundaryInterpolation(VVarBoundaryInterpolation b) { _vvarBoundInterp = b; }
125 
127  void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = b; }
128 
129  CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
130  void SetCreasingMethod(CreasingMethod c) { _creasingMethod = c; }
131 
134 
136  void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = t; }
137 
138  //
139  // This may be premature, but it is useful to have some kind of flag so that users can be assured
140  // the options and meshes they specify are compliant with Hbr, RenderMan, etc. How to measure that
141  // is still ill-defined given versions of Hbr, prMan will evolve...
142  //
143  bool GetHbrCompatibility() const { return _hbrCompatible; }
144  void SetHbrCompatibility(bool onOrOff) { _hbrCompatible = onOrOff; }
145 
146 private:
147  // Bitfield members:
148  unsigned int _vvarBoundInterp : 2;
149  unsigned int _fvarLinInterp : 3;
150  unsigned int _nonManInterp : 2;
151  unsigned int _creasingMethod : 2;
152  unsigned int _triangleSub : 2;
153  unsigned int _hbrCompatible : 1;
154 };
155 
156 } // end namespace sdc
157 
158 } // end namespace OPENSUBDIV_VERSION
159 using namespace OPENSUBDIV_VERSION;
160 } // end namespace OpenSubdiv
161 
162 #endif /* SDC_OPTIONS_H */
163 
FVarLinearInterpolation GetFVarLinearInterpolation() const
Definition: options.h:126
void SetVVarBoundaryInterpolation(VVarBoundaryInterpolation b)
Definition: options.h:124
NonManifoldInterpolation GetNonManifoldInterpolation() const
Definition: options.h:132
void SetFVarLinearInterpolation(FVarLinearInterpolation b)
Definition: options.h:127
CreasingMethod GetCreasingMethod() const
Definition: options.h:129
VVarBoundaryInterpolation GetVVarBoundaryInterpolation() const
Definition: options.h:123
void SetCreasingMethod(CreasingMethod c)
Definition: options.h:130
TriangleSubdivision GetTriangleSubdivision() const
Definition: options.h:135
void SetTriangleSubdivision(TriangleSubdivision t)
Definition: options.h:136
void SetNonManifoldInterpolation(NonManifoldInterpolation n)
Definition: options.h:133