FBX C++ API Reference
fbxtypes.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
19 #ifndef _FBXSDK_CORE_ARCH_TYPES_H_
20 #define _FBXSDK_CORE_ARCH_TYPES_H_
21 
23 
24 //Note: On MacOSX and Linux 64-bit, long is defined as 64-bits while on Windows
25 //it is still a 32-bits for backward compatibility. We stick with Windows standard.
26 #if defined(FBXSDK_CPU_64) && !defined(FBXSDK_ENV_WIN)
27  #define FBXSDK_SYSTEM_IS_LP64 1
28 #endif
29 
30 #include <fbxsdk/fbxsdk_nsbegin.h>
31 
32 class FbxObject;
33 
34 typedef bool FbxBool;
35 typedef signed char FbxChar;
36 typedef unsigned char FbxUChar;
37 typedef signed short FbxShort;
38 typedef unsigned short FbxUShort;
39 typedef signed int FbxInt;
40 typedef unsigned int FbxUInt;
41 typedef float FbxFloat;
42 typedef double FbxDouble;
43 
49 typedef FbxInt* FbxIntPtr;
53 
54 typedef FbxInt FbxEnum;
56 
57 //-------------------------------------------------------------------------------------
58 //Architecture independent defines (guarantee size)
59 #if defined(FBXSDK_COMPILER_MSC)
60  #define FBXSDK_LONGLONG(x) (x##i64)
61  #define FBXSDK_ULONGLONG(x) (x##Ui64)
62 
63  typedef signed __int8 FbxInt8;
64  typedef unsigned __int8 FbxUInt8;
65  typedef signed __int16 FbxInt16;
66  typedef unsigned __int16 FbxUInt16;
67  typedef signed __int32 FbxInt32;
68  typedef unsigned __int32 FbxUInt32;
69  typedef signed __int64 FbxInt64;
70  typedef unsigned __int64 FbxUInt64;
71 #else
72  #define FBXSDK_LONGLONG(x) (x##LL)
73  #define FBXSDK_ULONGLONG(x) (x##ULL)
74 
75  typedef signed char FbxInt8;
76  typedef unsigned char FbxUInt8;
77  typedef signed short FbxInt16;
78  typedef unsigned short FbxUInt16;
79  typedef signed int FbxInt32;
80  typedef unsigned int FbxUInt32;
81  typedef signed long long FbxInt64;
82  typedef unsigned long long FbxUInt64;
83 #endif
84 
85 #ifdef FBXSDK_SYSTEM_IS_LP64
86  typedef signed int FbxLong;
87  typedef unsigned int FbxULong;
88 #else
89  typedef signed long FbxLong;
90  typedef unsigned long FbxULong;
91 #endif
94 
99 
100 
101 #if defined(FBXSDK_ENV_EMSCRIPTEN)
102  typedef FbxInt32 __int32_t;
103  typedef FbxUInt32 __uint32_t;
104  typedef FbxInt64 __int64_t;
105  typedef FbxUInt64 __uint64_t;
106 #endif
107 
108 //-------------------------------------------------------------------------------------
109 //Minimum and Maximum values for types
110 #define FBXSDK_CHAR_MIN -128
111 #define FBXSDK_CHAR_MAX 127
112 #define FBXSDK_UCHAR_MIN 0
113 #define FBXSDK_UCHAR_MAX 255
114 #define FBXSDK_SHORT_MIN -32768
115 #define FBXSDK_SHORT_MAX 32767
116 #define FBXSDK_USHORT_MIN 0
117 #define FBXSDK_USHORT_MAX 65535
118 #define FBXSDK_INT_MIN 0x80000000
119 #define FBXSDK_INT_MAX 0x7fffffff
120 #define FBXSDK_UINT_MIN 0
121 #define FBXSDK_UINT_MAX 0xffffffff
122 #define FBXSDK_LONG_MIN FBXSDK_INT_MIN
123 #define FBXSDK_LONG_MAX FBXSDK_INT_MAX
124 #define FBXSDK_ULONG_MIN FBXSDK_UINT_MIN
125 #define FBXSDK_ULONG_MAX FBXSDK_UINT_MAX
126 #define FBXSDK_LONGLONG_MIN FBXSDK_LONGLONG(0x8000000000000000)
127 #define FBXSDK_LONGLONG_MAX FBXSDK_LONGLONG(0x7fffffffffffffff)
128 #define FBXSDK_ULONGLONG_MIN FBXSDK_ULONGLONG(0)
129 #define FBXSDK_ULONGLONG_MAX FBXSDK_ULONGLONG(0xffffffffffffffff)
130 #define FBXSDK_FLOAT_MIN FLT_MIN
131 #define FBXSDK_FLOAT_MAX FLT_MAX
132 #define FBXSDK_FLOAT_EPSILON FLT_EPSILON
133 #define FBXSDK_DOUBLE_MIN DBL_MIN
134 #define FBXSDK_DOUBLE_MAX DBL_MAX
135 #define FBXSDK_DOUBLE_EPSILON DBL_EPSILON
136 #define FBXSDK_TOLERANCE (1.0e-6)
137 
138 //-------------------------------------------------------------------------------------
139 //Handle and atomic definition (size change depending of architecture)
140 #if defined(FBXSDK_CPU_32)
141  typedef FbxUInt32 FbxHandle;
142  #define FBXSDK_REF_MIN FBXSDK_UINT_MIN
143  #define FBXSDK_REF_MAX FBXSDK_UINT_MAX
144 
145  typedef FbxLong FbxAtomic;
146  #define FBXSDK_ATOMIC_MIN FBXSDK_LONG_MIN
147  #define FBXSDK_ATOMIC_MAX FBXSDK_LONG_MAX
148 #elif defined(FBXSDK_CPU_64)
149  typedef FbxUInt64 FbxHandle;
150  #define FBXSDK_REF_MIN FBXSDK_ULONGLONG_MIN
151  #define FBXSDK_REF_MAX FBXSDK_ULONGLONG_MAX
152 
153  typedef FbxInt64 FbxAtomic;
154  #define FBXSDK_ATOMIC_MIN FBXSDK_LONGLONG_MIN
155  #define FBXSDK_ATOMIC_MAX FBXSDK_LONGLONG_MAX
156 #else
157  #error Unsupported architecture!
158 #endif
159 
160 //-------------------------------------------------------------------------------------
161 //Various utility functions for fbxsdk basic types
162 inline const FbxChar FbxMin(const FbxChar){ return FBXSDK_CHAR_MIN; }
163 inline const FbxUChar FbxMin(const FbxUChar){ return FBXSDK_UCHAR_MIN; }
164 inline const FbxShort FbxMin(const FbxShort){ return FBXSDK_SHORT_MIN; }
165 inline const FbxUShort FbxMin(const FbxUShort){ return FBXSDK_USHORT_MIN; }
166 inline const FbxInt FbxMin(const FbxInt){ return FBXSDK_INT_MIN; }
167 inline const FbxUInt FbxMin(const FbxUInt){ return FBXSDK_UINT_MIN; }
168 inline const FbxLongLong FbxMin(const FbxLongLong){ return FBXSDK_LONGLONG_MIN; }
169 inline const FbxULongLong FbxMin(const FbxULongLong){ return FBXSDK_ULONGLONG_MIN; }
170 inline const FbxFloat FbxMin(const FbxFloat){ return FBXSDK_FLOAT_MIN; }
171 inline const FbxDouble FbxMin(const FbxDouble){ return FBXSDK_DOUBLE_MIN; }
172 
173 inline const FbxChar FbxMax(const FbxChar){ return FBXSDK_CHAR_MAX; }
174 inline const FbxUChar FbxMax(const FbxUChar){ return FBXSDK_UCHAR_MAX; }
175 inline const FbxShort FbxMax(const FbxShort){ return FBXSDK_SHORT_MAX; }
176 inline const FbxUShort FbxMax(const FbxUShort){ return FBXSDK_USHORT_MAX; }
177 inline const FbxInt FbxMax(const FbxInt){ return FBXSDK_INT_MAX; }
178 inline const FbxUInt FbxMax(const FbxUInt){ return FBXSDK_UINT_MAX; }
179 inline const FbxLongLong FbxMax(const FbxLongLong){ return FBXSDK_LONGLONG_MAX; }
180 inline const FbxULongLong FbxMax(const FbxULongLong){ return FBXSDK_ULONGLONG_MAX; }
181 inline const FbxFloat FbxMax(const FbxFloat){ return FBXSDK_FLOAT_MAX; }
182 inline const FbxDouble FbxMax(const FbxDouble){ return FBXSDK_DOUBLE_MAX; }
183 
184 #ifndef FBXSDK_SYSTEM_IS_LP64
185  inline const FbxLong FbxMin(const FbxLong){ return FBXSDK_LONG_MIN; }
186  inline const FbxULong FbxMin(const FbxULong){ return FBXSDK_ULONG_MIN; }
187  inline const FbxLong FbxMax(const FbxLong){ return FBXSDK_LONG_MAX; }
188  inline const FbxULong FbxMax(const FbxULong){ return FBXSDK_ULONG_MAX; }
189 #endif
190 
191 template<class T> inline const T FbxMin(const T){};
192 template<class T> inline const T FbxMax(const T){};
193 
194 template<class T> inline T FbxMin(const T x, const T y){ return (x < y) ? x : y; }
195 template<class T> inline T FbxMax(const T x, const T y){ return (x > y) ? x : y; }
196 
197 //-------------------------------------------------------------------------------------
198 //Vector Template Types
199 template<class T> class FBXSDK_DLL FbxVectorTemplate2
200 {
201 public:
202  inline FbxVectorTemplate2(){ *this = T(0); }
203  inline explicit FbxVectorTemplate2(T pValue){ *this = pValue; }
204  inline FbxVectorTemplate2(T pData0, T pData1){ mData[0] = pData0; mData[1] = pData1; }
206  inline T& operator[](int pIndex){ return mData[pIndex]; }
207  inline const T& operator[](int pIndex) const { return mData[pIndex]; }
208  inline FbxVectorTemplate2<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; return *this; }
209  inline FbxVectorTemplate2<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; }
210  inline bool operator==(const FbxVectorTemplate2<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1])); }
211  inline bool operator!=(const FbxVectorTemplate2<T>& pVector) const { return !operator==( pVector ); }
212  inline T* Buffer(){ return mData; }
213  inline const T* Buffer() const { return mData; }
214  T mData[2];
215 };
216 
217 template<class T> class FBXSDK_DLL FbxVectorTemplate3
218 {
219 public:
220  inline FbxVectorTemplate3(){ *this = T(0); }
221  inline explicit FbxVectorTemplate3(T pValue){ *this = pValue; }
222  inline FbxVectorTemplate3(T pData0, T pData1, T pData2){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; }
224  inline T& operator[](int pIndex) { return mData[pIndex]; }
225  inline const T& operator[](int pIndex) const { return mData[pIndex]; }
226  inline operator FbxVectorTemplate2<T>& () const { return *((FbxVectorTemplate2<T>*)this); }
227  inline FbxVectorTemplate3<T>& operator=(T const &pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; }
228  inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; }
229  inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate3<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; return *this; }
230  inline bool operator==(const FbxVectorTemplate3<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2])); }
231  inline bool operator!=(const FbxVectorTemplate3<T>& pVector) const { return !operator==(pVector); }
232  inline T* Buffer(){ return mData; }
233  inline const T* Buffer() const { return mData; }
234  T mData[3];
235 };
236 
237 template<class T> class FBXSDK_DLL FbxVectorTemplate4
238 {
239 public:
240  inline FbxVectorTemplate4(){ *this = T(0); }
241  inline explicit FbxVectorTemplate4(T pValue){ *this = pValue; }
242  inline FbxVectorTemplate4(T pData0, T pData1, T pData2, T pData3){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; mData[3] = pData3; }
244  inline T& operator[](int pIndex){ return mData[pIndex]; }
245  inline const T& operator[](int pIndex) const { return mData[pIndex]; }
246  inline operator FbxVectorTemplate3<T>& () const { return *((FbxVectorTemplate3<T>*)this); }
247  inline FbxVectorTemplate4<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; }
248  inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate3<T>& pValue){ mData[0] = pValue[0]; mData[1] = pValue[1]; mData[2] = pValue[2]; return *this; }
249  inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate4<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; mData[3] = pVector.mData[3]; return *this; }
250  inline bool operator==(const FbxVectorTemplate4<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2]) && (mData[3] == pVector.mData[3])); }
251  inline bool operator!=(const FbxVectorTemplate4<T>& pVector) const { return !operator==( pVector ); }
252  inline T* Buffer(){ return mData; }
253  inline const T* Buffer() const { return mData; }
254  T mData[4];
255 };
256 
261 
262 #include <fbxsdk/fbxsdk_nsend.h>
263 
264 #endif /* _FBXSDK_CORE_ARCH_TYPES_H_ */
FbxUInt64 FbxULongLong
Definition: fbxtypes.h:93
unsigned int FbxUInt
Definition: fbxtypes.h:40
bool operator!=(const FbxVectorTemplate3< T > &pVector) const
Definition: fbxtypes.h:231
#define FBXSDK_LONG_MIN
Definition: fbxtypes.h:122
FbxBool * FbxBoolPtr
Definition: fbxtypes.h:44
FbxVectorTemplate3< FbxDouble > FbxDouble3
Definition: fbxtypes.h:258
Architecture definition.
#define FBXSDK_ULONG_MIN
Definition: fbxtypes.h:124
const T * Buffer() const
Definition: fbxtypes.h:253
FbxVectorTemplate2(T pValue)
Definition: fbxtypes.h:203
#define FBXSDK_SHORT_MAX
Definition: fbxtypes.h:115
#define FBXSDK_USHORT_MIN
Definition: fbxtypes.h:116
FbxVectorTemplate3< T > & operator=(T const &pValue)
Definition: fbxtypes.h:227
#define FBXSDK_ULONGLONG_MAX
Definition: fbxtypes.h:129
unsigned short FbxUInt16
Definition: fbxtypes.h:78
unsigned long long FbxUInt64
Definition: fbxtypes.h:82
FbxObject * FbxReference
Definition: fbxtypes.h:55
signed int FbxInt32
Definition: fbxtypes.h:79
FbxVectorTemplate4< T > & operator=(const FbxVectorTemplate4< T > &pVector)
Definition: fbxtypes.h:249
FbxUInt * FbxUIntPtr
Definition: fbxtypes.h:50
const T & operator[](int pIndex) const
Definition: fbxtypes.h:225
#define FBXSDK_UINT_MIN
Definition: fbxtypes.h:120
#define FBXSDK_CHAR_MAX
Definition: fbxtypes.h:111
#define FBXSDK_UCHAR_MIN
Definition: fbxtypes.h:112
FbxVectorTemplate3(T pData0, T pData1, T pData2)
Definition: fbxtypes.h:222
#define FBXSDK_FLOAT_MIN
Definition: fbxtypes.h:130
unsigned short FbxUShort
Definition: fbxtypes.h:38
T & operator[](int pIndex)
Definition: fbxtypes.h:224
signed char FbxInt8
Definition: fbxtypes.h:75
unsigned char FbxUChar
Definition: fbxtypes.h:36
signed short FbxInt16
Definition: fbxtypes.h:77
FbxVectorTemplate2(T pData0, T pData1)
Definition: fbxtypes.h:204
T & operator[](int pIndex)
Definition: fbxtypes.h:244
#define FBXSDK_UINT_MAX
Definition: fbxtypes.h:121
const T & operator[](int pIndex) const
Definition: fbxtypes.h:245
const T * Buffer() const
Definition: fbxtypes.h:213
bool operator==(const FbxVectorTemplate2< T > &pVector) const
Definition: fbxtypes.h:210
unsigned char FbxUInt8
Definition: fbxtypes.h:76
double FbxDouble
Definition: fbxtypes.h:42
const T * Buffer() const
Definition: fbxtypes.h:233
FbxLongLong * FbxLongLongPtr
Definition: fbxtypes.h:97
#define FBXSDK_LONGLONG_MAX
Definition: fbxtypes.h:127
FbxULong * FbxULongPtr
Definition: fbxtypes.h:96
#define FBXSDK_ULONGLONG_MIN
Definition: fbxtypes.h:128
#define FBXSDK_USHORT_MAX
Definition: fbxtypes.h:117
#define FBXSDK_DOUBLE_MAX
Definition: fbxtypes.h:134
FbxVectorTemplate4(T pValue)
Definition: fbxtypes.h:241
The base class of most FBX objects.
Definition: fbxobject.h:157
signed short FbxShort
Definition: fbxtypes.h:37
FbxVectorTemplate2< T > & operator=(const T &pValue)
Definition: fbxtypes.h:208
FbxVectorTemplate2< T > & operator=(const FbxVectorTemplate2< T > &pVector)
Definition: fbxtypes.h:209
T & operator[](int pIndex)
Definition: fbxtypes.h:206
FbxVectorTemplate3(T pValue)
Definition: fbxtypes.h:221
bool FbxBool
Definition: fbxtypes.h:32
bool operator!=(const FbxVectorTemplate2< T > &pVector) const
Definition: fbxtypes.h:211
const FbxChar FbxMin(const FbxChar)
Definition: fbxtypes.h:162
FbxDouble * FbxDoublePtr
Definition: fbxtypes.h:52
FbxVectorTemplate3< T > & operator=(const FbxVectorTemplate2< T > &pVector)
Definition: fbxtypes.h:228
float FbxFloat
Definition: fbxtypes.h:41
FbxInt * FbxIntPtr
Definition: fbxtypes.h:49
#define FBXSDK_ULONG_MAX
Definition: fbxtypes.h:125
#define FBXSDK_UCHAR_MAX
Definition: fbxtypes.h:113
FbxULongLong * FbxULongLongPtr
Definition: fbxtypes.h:98
signed long long FbxInt64
Definition: fbxtypes.h:81
FbxInt FbxEnum
Definition: fbxtypes.h:54
#define FBXSDK_CHAR_MIN
Definition: fbxtypes.h:110
#define FBXSDK_INT_MIN
Definition: fbxtypes.h:118
signed char FbxChar
Definition: fbxtypes.h:35
FbxVectorTemplate3< T > & operator=(const FbxVectorTemplate3< T > &pVector)
Definition: fbxtypes.h:229
FbxUShort * FbxUShortPtr
Definition: fbxtypes.h:48
FbxLong * FbxLongPtr
Definition: fbxtypes.h:95
const FbxChar FbxMax(const FbxChar)
Definition: fbxtypes.h:173
FbxVectorTemplate4< FbxDouble4 > FbxDouble4x4
Definition: fbxtypes.h:260
#define FBXSDK_INT_MAX
Definition: fbxtypes.h:119
bool operator==(const FbxVectorTemplate4< T > &pVector) const
Definition: fbxtypes.h:250
FbxVectorTemplate4< FbxDouble > FbxDouble4
Definition: fbxtypes.h:259
#define FBXSDK_LONG_MAX
Definition: fbxtypes.h:123
#define FBXSDK_LONGLONG_MIN
Definition: fbxtypes.h:126
FbxChar * FbxCharPtr
Definition: fbxtypes.h:45
#define FBXSDK_DLL
Definition: fbxarch.h:173
signed int FbxInt
Definition: fbxtypes.h:39
unsigned int FbxUInt32
Definition: fbxtypes.h:80
bool operator==(const FbxVectorTemplate3< T > &pVector) const
Definition: fbxtypes.h:230
#define FBXSDK_DOUBLE_MIN
Definition: fbxtypes.h:133
FbxVectorTemplate4(T pData0, T pData1, T pData2, T pData3)
Definition: fbxtypes.h:242
FbxVectorTemplate4< T > & operator=(const T &pValue)
Definition: fbxtypes.h:247
signed long FbxLong
Definition: fbxtypes.h:89
bool operator!=(const FbxVectorTemplate4< T > &pVector) const
Definition: fbxtypes.h:251
FbxShort * FbxShortPtr
Definition: fbxtypes.h:47
FbxInt64 FbxLongLong
Definition: fbxtypes.h:92
#define FBXSDK_FLOAT_MAX
Definition: fbxtypes.h:131
FbxVectorTemplate4< T > & operator=(const FbxVectorTemplate3< T > &pValue)
Definition: fbxtypes.h:248
unsigned long FbxULong
Definition: fbxtypes.h:90
FbxFloat * FbxFloatPtr
Definition: fbxtypes.h:51
FbxVectorTemplate2< FbxDouble > FbxDouble2
Definition: fbxtypes.h:257
FbxUChar * FbxUCharPtr
Definition: fbxtypes.h:46
const T & operator[](int pIndex) const
Definition: fbxtypes.h:207
#define FBXSDK_SHORT_MIN
Definition: fbxtypes.h:114