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 
19 {
30 
32 };
33 
34 enum GT_Type
35 {
36  GT_TYPE_NONE = -1, // Implicit type based on data
37  GT_TYPE_POINT, // Position
38  GT_TYPE_HPOINT, // Homogeneous position
39  GT_TYPE_VECTOR, // Direction vector
40  GT_TYPE_NORMAL, // Normal
41  GT_TYPE_COLOR, // Color
42  GT_TYPE_QUATERNION, // Quaternion
43  GT_TYPE_MATRIX3, // 3x3 Matrix
44  GT_TYPE_MATRIX, // Matrix
45  GT_TYPE_ST, // Parametric interval
46  GT_TYPE_HIDDEN, // "Private" (hidden)
47  GT_TYPE_BOX2, // 2x2 Bounding box
48  GT_TYPE_BOX, // 3x3 Bounding box
49  GT_TYPE_TEXTURE, // Texture coordinate
50  GT_TYPE_INDEXPAIR, // Capture index/weight pair
51 };
52 
54 {
56 
64 
66 };
67 
68 /// Subdivision schemes
70 {
74 };
75 
77 {
79 
84 
88 
90 };
91 
93 {
94  GT_INDEXING_SMALL, // Use small data types for indexing (i.e. int32)
95  GT_INDEXING_LARGE, // Use large data types for indexing (i.e. int64)
96  GT_INDEXING_QUICK, // Perform a quick check to see which indexing to use
97  GT_INDEXING_CHECK, // Check, perhaps using a more expensive test
98 };
99 
101 {
102  GT_CACHE_DETAIL_DELETE, // Delete all references to detail
103  GT_CACHE_ATTRIBUTE_CHANGE, // Attribute value change
104  GT_CACHE_ATTRIBUTE_CREATE, // Attribute created
105  GT_CACHE_ATTRIBUTE_DELETE, // Attribute deleted
106  GT_CACHE_INDEXMAP_CHANGE, // Index map change (grow/shrink)
107  GT_CACHE_GROUP_CHANGE, // Group was changed
108  GT_CACHE_GROUP_CREATE, // New group added
109  GT_CACHE_GROUP_DELETE, // Group deleted
110 };
111 
113 using GT_Size = int64;
114 using GT_Offset = int64;
115 
116 template <typename T> constexpr GT_Storage
118 
119 template <> constexpr GT_Storage GTstorage<uint8>() { return GT_STORE_UINT8; }
120 template <> constexpr GT_Storage GTstorage<int8>() { return GT_STORE_INT8; }
121 template <> constexpr GT_Storage GTstorage<int16>() { return GT_STORE_INT16; }
122 template <> constexpr GT_Storage GTstorage<int32>() { return GT_STORE_INT32; }
123 template <> constexpr GT_Storage GTstorage<int64>() { return GT_STORE_INT64; }
124 template <> constexpr GT_Storage GTstorage<fpreal16>() { return GT_STORE_REAL16; }
125 template <> constexpr GT_Storage GTstorage<fpreal32>() { return GT_STORE_REAL32; }
126 template <> constexpr GT_Storage GTstorage<fpreal64>() { return GT_STORE_REAL64; }
127 template <> constexpr GT_Storage GTstorage<GT_String>() { return GT_STORE_STRING; }
128 
129 /// @{
130 /// Perform mapping between enum and string name
131 GT_API extern int GTsizeof(GT_Storage storage);
132 GT_API extern const char *GTstorage(GT_Storage storage);
133 GT_API extern GT_Storage GTstorage(const char *storage);
134 GT_API extern const char *GTtype(GT_Type type);
135 GT_API extern GT_Type GTtype(const char *type);
136 GT_API extern const char *GTbasis(GT_Basis basis);
137 GT_API extern GT_Basis GTbasis(const char *basis);
138 GT_API extern const char *GTscheme(GT_Scheme scheme);
139 GT_API extern GT_Scheme GTscheme(const char *scheme,
141 GT_API extern const char *GTowner(GT_Owner owner);
142 GT_API extern GT_Owner GTowner(const char *owner);
143 /// @}
144 
145 /// Compute the number of spans for a given basis and cv count. For basis
146 /// types other than linear, the order is assumed to be 4.
147 GT_API extern GT_Size GTbasisSpans(GT_Basis basis,
148  GT_Size count, bool wrapped,
149  int order = 4);
150 GT_API extern GT_Size GTbasisStep(GT_Basis basis, int order = 4);
151 
152 static inline constexpr bool GTisInteger(GT_Storage s)
153  {
154  return s == GT_STORE_INT32 ||
155  s == GT_STORE_INT64 ||
156  s == GT_STORE_INT16 ||
157  s == GT_STORE_INT8 ||
158  s == GT_STORE_UINT8;
159  }
160 static inline constexpr bool GTisFloat(GT_Storage s)
161  {
162  return s == GT_STORE_REAL16 ||
163  s == GT_STORE_REAL32 ||
164  s == GT_STORE_REAL64;
165  }
166 static inline constexpr bool GTisString(GT_Storage s)
167  { return s == GT_STORE_STRING; }
168 
169 template <typename T> static inline int64
170 GThandleMemoryUsage(const T &handle)
171 {
172  return handle ? handle->getMemoryUsage() : 0;
173 }
174 
175 #endif
GLdouble s
Definition: glew.h:1390
GT_Storage
Definition: GT_Types.h:18
GT_API const char * GTscheme(GT_Scheme scheme)
GT_API const char * GTbasis(GT_Basis basis)
GT_API const char * GTtype(GT_Type type)
constexpr GT_Storage GTstorage< uint8 >()
Definition: GT_Types.h:119
constexpr GT_Storage GTstorage< fpreal64 >()
Definition: GT_Types.h:126
GT_IndexingMode
Definition: GT_Types.h:92
constexpr GT_Storage GTstorage< fpreal32 >()
Definition: GT_Types.h:125
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:34
constexpr GT_Storage GTstorage< int8 >()
Definition: GT_Types.h:120
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:3446
GT_CacheEventType
Definition: GT_Types.h:100
GT_API GT_Size GTbasisStep(GT_Basis basis, int order=4)
long long int64
Definition: SYS_Types.h:111
constexpr GT_Storage GTstorage< GT_String >()
Definition: GT_Types.h:127
GT_Scheme
Subdivision schemes.
Definition: GT_Types.h:69
constexpr GT_Storage GTstorage< fpreal16 >()
Definition: GT_Types.h:124
int64 GT_Offset
Definition: GT_Types.h:114
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
GT_Owner
Definition: GT_Types.h:76
int64 GT_Size
Definition: GT_Types.h:113
constexpr GT_Storage GTstorage< int32 >()
Definition: GT_Types.h:122
GLuint GLuint GLsizei count
Definition: glew.h:1253
constexpr GT_Storage GTstorage< int64 >()
Definition: GT_Types.h:123
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
GT_API GT_Size GTbasisSpans(GT_Basis basis, GT_Size count, bool wrapped, int order=4)
GT_Basis
Definition: GT_Types.h:53
GT_API int GTsizeof(GT_Storage storage)
constexpr GT_Storage GTstorage< int16 >()
Definition: GT_Types.h:121
GT_API const char * GTowner(GT_Owner owner)
constexpr GT_Storage GTstorage()
Definition: GT_Types.h:117