All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
type.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_TYPE_H
25 #define SDC_TYPE_H
26 
27 #include "../version.h"
28 
29 namespace OpenSubdiv {
30 namespace OPENSUBDIV_VERSION {
31 
32 namespace Sdc {
33 
34 //
35 // Enumerated type for all subdivisions schemes supported by OpenSubdiv:
36 //
37 // Questions:
38 // In general, scoping of enumeration names is an issue given the lack of nested
39 // namespaces. Originally I gave all other types a qualifying prefix to avoid conflicts
40 // but these names didn't seem to warrant it, but I added one later.
41 //
42 // Note there is a similar Scheme enum in FarSubdivisionTables that includes UNKNOWN=0
43 // along with the same three constants.
44 //
45 enum Type {
49 };
50 
51 
52 //
53 // Traits associated with all types -- these are specialized and instantiated for
54 // each of the supported types.
55 //
56 // Traits do not vary with the topology or any options applied to the scheme. They
57 // are intended to help construct more general queries about a subdivision scheme
58 // in a context where its details may be less well understood. They serve little
59 // purpose in code specialized to the particular scheme, i.e. in code already
60 // specialized for Catmark, the values for these traits for the Catmark scheme are
61 // typically known and their usage well understood.
62 //
63 // Question:
64 // Do we really need/want these TypeTraits, or will static methods on another
65 // class specialized for the type suffice, i.e. Scheme<SCHEME_TYPE>?
66 // If yes, there will be little in here other than Sdc::Type, which we may want
67 // to merge into <sdc/options.h>.
68 //
69 enum Split {
70  SPLIT_TO_QUADS, // used by Catmark and Bilinear
71  SPLIT_TO_TRIS, // used by Loop
72  SPLIT_HYBRID // not currently used (potential future extension)
73 };
74 
75 template <Type SCHEME_TYPE>
76 struct TypeTraits {
77 
78  static Type GetType() {
79  return SCHEME_TYPE;
80  }
81 
82  static Split TopologicalSplitType();
83  static int LocalNeighborhoodSize();
84  static int RegularVertexValence();
85  static int RegularFaceValence();
86  static char const* Label();
87 };
88 
89 
90 } // end namespace sdc
91 
92 } // end namespace OPENSUBDIV_VERSION
93 using namespace OPENSUBDIV_VERSION;
94 } // end namespace OpenSubdiv
95 
96 #endif /* SDC_TYPE_H */
97