HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_Types.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GT_Types.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_Types__
12 #define __GT_Types__
13 
14 #include "GT_API.h"
15 #include <SYS/SYS_Types.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_Options.h>
18 
20 {
32 
34 };
35 
36 enum GT_Type
37 {
38  GT_TYPE_NONE = -1, // Implicit type based on data
39  GT_TYPE_POINT, // Position
40  GT_TYPE_HPOINT, // Homogeneous position
41  GT_TYPE_VECTOR, // Direction vector
42  GT_TYPE_NORMAL, // Normal
43  GT_TYPE_COLOR, // Color
44  GT_TYPE_QUATERNION, // Quaternion
45  GT_TYPE_MATRIX3, // 3x3 Matrix
46  GT_TYPE_MATRIX, // Matrix
47  GT_TYPE_ST, // Parametric interval
48  GT_TYPE_HIDDEN, // "Private" (hidden)
49  GT_TYPE_BOX2, // 2x2 Bounding box
50  GT_TYPE_BOX, // 3x3 Bounding box
51  GT_TYPE_TEXTURE, // Texture coordinate
52  GT_TYPE_INDEXPAIR, // Capture index/weight pair
53 };
54 
56 {
58 
66 
68 };
69 
70 // Breakpoint curve parameterization
72 {
78 };
79 
80 /// Subdivision schemes
82 {
84 
88 };
89 
91 {
93 
98 
102 
104 };
105 
107 {
108  GT_INDEXING_SMALL, // Use small data types for indexing (i.e. int32)
109  GT_INDEXING_LARGE, // Use large data types for indexing (i.e. int64)
110  GT_INDEXING_QUICK, // Perform a quick check to see which indexing to use
111  GT_INDEXING_CHECK, // Check, perhaps using a more expensive test
112 };
113 
115 {
116  GT_CACHE_DETAIL_DELETE, // Delete all references to detail
117  GT_CACHE_ATTRIBUTE_CHANGE, // Attribute value change
118  GT_CACHE_ATTRIBUTE_CREATE, // Attribute created
119  GT_CACHE_ATTRIBUTE_DELETE, // Attribute deleted
120  GT_CACHE_INDEXMAP_CHANGE, // Index map change (grow/shrink)
121  GT_CACHE_GROUP_CHANGE, // Group was changed
122  GT_CACHE_GROUP_CREATE, // New group added
123  GT_CACHE_GROUP_DELETE, // Group deleted
124 };
125 
128 using GT_Size = int64;
129 using GT_Offset = int64;
130 
131 template <typename T> constexpr GT_Storage
133 
134 template <> constexpr GT_Storage GTstorage<uint8>() { return GT_STORE_UINT8; }
135 template <> constexpr GT_Storage GTstorage<int8>() { return GT_STORE_INT8; }
136 template <> constexpr GT_Storage GTstorage<int16>() { return GT_STORE_INT16; }
137 template <> constexpr GT_Storage GTstorage<int32>() { return GT_STORE_INT32; }
138 template <> constexpr GT_Storage GTstorage<int64>() { return GT_STORE_INT64; }
139 template <> constexpr GT_Storage GTstorage<fpreal16>() { return GT_STORE_REAL16; }
140 template <> constexpr GT_Storage GTstorage<fpreal32>() { return GT_STORE_REAL32; }
141 template <> constexpr GT_Storage GTstorage<fpreal64>() { return GT_STORE_REAL64; }
142 template <> constexpr GT_Storage GTstorage<GT_String>() { return GT_STORE_STRING; }
143 template <> constexpr GT_Storage GTstorage<GT_Dict>() { return GT_STORE_DICT; }
144 
145 /// @{
146 /// Perform mapping between enum and string name
147 GT_API extern int GTsizeof(GT_Storage storage);
148 GT_API extern const char *GTstorage(GT_Storage storage);
149 GT_API extern GT_Storage GTstorage(const char *storage);
150 GT_API extern const char *GTtype(GT_Type type);
151 GT_API extern GT_Type GTtype(const char *type);
152 GT_API extern const char *GTbasis(GT_Basis basis);
153 GT_API extern GT_Basis GTbasis(const char *basis);
154 GT_API extern const char *GTscheme(GT_Scheme scheme);
155 GT_API extern GT_Scheme GTscheme(const char *scheme,
157 GT_API extern const char *GTowner(GT_Owner owner);
158 GT_API extern GT_Owner GTowner(const char *owner);
159 /// @}
160 
161 /// Compute the number of spans for a given basis and cv count. For basis
162 /// types other than linear, the order is assumed to be 4.
163 GT_API extern GT_Size GTbasisSpans(GT_Basis basis,
164  GT_Size count, bool wrapped,
165  int order = 4);
166 GT_API extern GT_Size GTbasisStep(GT_Basis basis, int order = 4);
167 
168 static inline constexpr bool GTisInteger(GT_Storage s)
169  {
170  return s == GT_STORE_INT32 ||
171  s == GT_STORE_INT64 ||
172  s == GT_STORE_INT16 ||
173  s == GT_STORE_INT8 ||
174  s == GT_STORE_UINT8;
175  }
176 static inline constexpr bool GTisFloat(GT_Storage s)
177  {
178  return s == GT_STORE_REAL16 ||
179  s == GT_STORE_REAL32 ||
180  s == GT_STORE_REAL64;
181  }
182 static inline constexpr bool GTisString(GT_Storage s)
183  { return s == GT_STORE_STRING; }
184 
185 static inline constexpr bool GTisDictionary(GT_Storage s)
186  { return s == GT_STORE_DICT; }
187 
188 template <typename T> static inline int64
189 GThandleMemoryUsage(const T &handle)
190 {
191  return handle ? handle->getMemoryUsage() : 0;
192 }
193 
194 #endif
GT_Storage
Definition: GT_Types.h:19
GT_API const char * GTscheme(GT_Scheme scheme)
constexpr GT_Storage GTstorage< GT_Dict >()
Definition: GT_Types.h:143
GT_API const char * GTbasis(GT_Basis basis)
GT_API const char * GTtype(GT_Type type)
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
constexpr GT_Storage GTstorage< uint8 >()
Definition: GT_Types.h:134
constexpr GT_Storage GTstorage< fpreal64 >()
Definition: GT_Types.h:141
GT_IndexingMode
Definition: GT_Types.h:106
constexpr GT_Storage GTstorage< fpreal32 >()
Definition: GT_Types.h:140
#define GT_API
Definition: GT_API.h:13
GT_Type
Definition: GT_Types.h:36
GLdouble s
Definition: glad.h:3009
constexpr GT_Storage GTstorage< int8 >()
Definition: GT_Types.h:135
GT_CacheEventType
Definition: GT_Types.h:114
GT_API GT_Size GTbasisStep(GT_Basis basis, int order=4)
constexpr GT_Storage GTstorage< GT_String >()
Definition: GT_Types.h:142
GT_Scheme
Subdivision schemes.
Definition: GT_Types.h:81
constexpr GT_Storage GTstorage< fpreal16 >()
Definition: GT_Types.h:139
int64 GT_Offset
Definition: GT_Types.h:129
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
long long int64
Definition: SYS_Types.h:116
GT_Parameterization
Definition: GT_Types.h:71
GT_Owner
Definition: GT_Types.h:90
int64 GT_Size
Definition: GT_Types.h:128
constexpr GT_Storage GTstorage< int32 >()
Definition: GT_Types.h:137
constexpr GT_Storage GTstorage< int64 >()
Definition: GT_Types.h:138
GT_API GT_Size GTbasisSpans(GT_Basis basis, GT_Size count, bool wrapped, int order=4)
GT_Basis
Definition: GT_Types.h:55
type
Definition: core.h:1059
GT_API int GTsizeof(GT_Storage storage)
constexpr GT_Storage GTstorage< int16 >()
Definition: GT_Types.h:136
GT_API const char * GTowner(GT_Owner owner)
GLint GLsizei count
Definition: glcorearb.h:405
constexpr GT_Storage GTstorage()
Definition: GT_Types.h:132