rev |
line source |
nuclear@0
|
1 /*
|
nuclear@0
|
2 ---------------------------------------------------------------------------
|
nuclear@0
|
3 Open Asset Import Library (assimp)
|
nuclear@0
|
4 ---------------------------------------------------------------------------
|
nuclear@0
|
5
|
nuclear@0
|
6 Copyright (c) 2006-2018, assimp team
|
nuclear@0
|
7
|
nuclear@0
|
8
|
nuclear@0
|
9
|
nuclear@0
|
10 All rights reserved.
|
nuclear@0
|
11
|
nuclear@0
|
12 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
13 with or without modification, are permitted provided that the following
|
nuclear@0
|
14 conditions are met:
|
nuclear@0
|
15
|
nuclear@0
|
16 * Redistributions of source code must retain the above
|
nuclear@0
|
17 copyright notice, this list of conditions and the
|
nuclear@0
|
18 following disclaimer.
|
nuclear@0
|
19
|
nuclear@0
|
20 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
21 copyright notice, this list of conditions and the
|
nuclear@0
|
22 following disclaimer in the documentation and/or other
|
nuclear@0
|
23 materials provided with the distribution.
|
nuclear@0
|
24
|
nuclear@0
|
25 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
26 contributors may be used to endorse or promote products
|
nuclear@0
|
27 derived from this software without specific prior
|
nuclear@0
|
28 written permission of the assimp team.
|
nuclear@0
|
29
|
nuclear@0
|
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
31 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
32 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
33 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
34 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
35 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
36 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
37 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
38 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
39 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
40 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
41 ---------------------------------------------------------------------------
|
nuclear@0
|
42 */
|
nuclear@0
|
43
|
nuclear@0
|
44 /** @file types.h
|
nuclear@0
|
45 * Basic data types and primitives, such as vectors or colors.
|
nuclear@0
|
46 */
|
nuclear@0
|
47 #pragma once
|
nuclear@0
|
48 #ifndef AI_TYPES_H_INC
|
nuclear@0
|
49 #define AI_TYPES_H_INC
|
nuclear@0
|
50
|
nuclear@0
|
51 // Some runtime headers
|
nuclear@0
|
52 #include <sys/types.h>
|
nuclear@0
|
53 #include <stddef.h>
|
nuclear@0
|
54 #include <string.h>
|
nuclear@0
|
55 #include <limits.h>
|
nuclear@0
|
56
|
nuclear@0
|
57 // Our compile configuration
|
nuclear@0
|
58 #include "defs.h"
|
nuclear@0
|
59
|
nuclear@0
|
60 // Some types moved to separate header due to size of operators
|
nuclear@0
|
61 #include "vector3.h"
|
nuclear@0
|
62 #include "vector2.h"
|
nuclear@0
|
63 #include "color4.h"
|
nuclear@0
|
64 #include "matrix3x3.h"
|
nuclear@0
|
65 #include "matrix4x4.h"
|
nuclear@0
|
66 #include "quaternion.h"
|
nuclear@0
|
67
|
nuclear@0
|
68 #ifdef __cplusplus
|
nuclear@0
|
69 #include <cstring>
|
nuclear@0
|
70 #include <new> // for std::nothrow_t
|
nuclear@0
|
71 #include <string> // for aiString::Set(const std::string&)
|
nuclear@0
|
72
|
nuclear@0
|
73 namespace Assimp {
|
nuclear@0
|
74 //! @cond never
|
nuclear@0
|
75 namespace Intern {
|
nuclear@0
|
76 // --------------------------------------------------------------------
|
nuclear@0
|
77 /** @brief Internal helper class to utilize our internal new/delete
|
nuclear@0
|
78 * routines for allocating object of this and derived classes.
|
nuclear@0
|
79 *
|
nuclear@0
|
80 * By doing this you can safely share class objects between Assimp
|
nuclear@0
|
81 * and the application - it works even over DLL boundaries. A good
|
nuclear@0
|
82 * example is the #IOSystem where the application allocates its custom
|
nuclear@0
|
83 * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer
|
nuclear@0
|
84 * destructs, Assimp calls operator delete on the stored #IOSystem.
|
nuclear@0
|
85 * If it lies on a different heap than Assimp is working with,
|
nuclear@0
|
86 * the application is determined to crash.
|
nuclear@0
|
87 */
|
nuclear@0
|
88 // --------------------------------------------------------------------
|
nuclear@0
|
89 #ifndef SWIG
|
nuclear@0
|
90 struct ASSIMP_API AllocateFromAssimpHeap {
|
nuclear@0
|
91 // http://www.gotw.ca/publications/mill15.htm
|
nuclear@0
|
92
|
nuclear@0
|
93 // new/delete overload
|
nuclear@0
|
94 void *operator new ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
nuclear@0
|
95 void *operator new ( size_t num_bytes, const std::nothrow_t& ) throw();
|
nuclear@0
|
96 void operator delete ( void* data);
|
nuclear@0
|
97
|
nuclear@0
|
98 // array new/delete overload
|
nuclear@0
|
99 void *operator new[] ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
nuclear@0
|
100 void *operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw();
|
nuclear@0
|
101 void operator delete[] ( void* data);
|
nuclear@0
|
102
|
nuclear@0
|
103 }; // struct AllocateFromAssimpHeap
|
nuclear@0
|
104 #endif
|
nuclear@0
|
105 } // namespace Intern
|
nuclear@0
|
106 //! @endcond
|
nuclear@0
|
107 } // namespace Assimp
|
nuclear@0
|
108
|
nuclear@0
|
109 extern "C" {
|
nuclear@0
|
110 #endif
|
nuclear@0
|
111
|
nuclear@0
|
112 /** Maximum dimension for strings, ASSIMP strings are zero terminated. */
|
nuclear@0
|
113 #ifdef __cplusplus
|
nuclear@0
|
114 static const size_t MAXLEN = 1024;
|
nuclear@0
|
115 #else
|
nuclear@0
|
116 # define MAXLEN 1024
|
nuclear@0
|
117 #endif
|
nuclear@0
|
118
|
nuclear@0
|
119 // ----------------------------------------------------------------------------------
|
nuclear@0
|
120 /** Represents a plane in a three-dimensional, euclidean space
|
nuclear@0
|
121 */
|
nuclear@0
|
122 struct aiPlane {
|
nuclear@0
|
123 #ifdef __cplusplus
|
nuclear@0
|
124 aiPlane () AI_NO_EXCEPT : a(0.f), b(0.f), c(0.f), d(0.f) {}
|
nuclear@0
|
125 aiPlane (ai_real _a, ai_real _b, ai_real _c, ai_real _d)
|
nuclear@0
|
126 : a(_a), b(_b), c(_c), d(_d) {}
|
nuclear@0
|
127
|
nuclear@0
|
128 aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {}
|
nuclear@0
|
129
|
nuclear@0
|
130 #endif // !__cplusplus
|
nuclear@0
|
131
|
nuclear@0
|
132 //! Plane equation
|
nuclear@0
|
133 ai_real a,b,c,d;
|
nuclear@0
|
134 }; // !struct aiPlane
|
nuclear@0
|
135
|
nuclear@0
|
136 // ----------------------------------------------------------------------------------
|
nuclear@0
|
137 /** Represents a ray
|
nuclear@0
|
138 */
|
nuclear@0
|
139 struct aiRay {
|
nuclear@0
|
140 #ifdef __cplusplus
|
nuclear@0
|
141 aiRay () AI_NO_EXCEPT {}
|
nuclear@0
|
142 aiRay (const aiVector3D& _pos, const aiVector3D& _dir)
|
nuclear@0
|
143 : pos(_pos), dir(_dir) {}
|
nuclear@0
|
144
|
nuclear@0
|
145 aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}
|
nuclear@0
|
146
|
nuclear@0
|
147 #endif // !__cplusplus
|
nuclear@0
|
148
|
nuclear@0
|
149 //! Position and direction of the ray
|
nuclear@0
|
150 C_STRUCT aiVector3D pos, dir;
|
nuclear@0
|
151 }; // !struct aiRay
|
nuclear@0
|
152
|
nuclear@0
|
153 // ----------------------------------------------------------------------------------
|
nuclear@0
|
154 /** Represents a color in Red-Green-Blue space.
|
nuclear@0
|
155 */
|
nuclear@0
|
156 struct aiColor3D
|
nuclear@0
|
157 {
|
nuclear@0
|
158 #ifdef __cplusplus
|
nuclear@0
|
159 aiColor3D () AI_NO_EXCEPT : r(0.0f), g(0.0f), b(0.0f) {}
|
nuclear@0
|
160 aiColor3D (ai_real _r, ai_real _g, ai_real _b) : r(_r), g(_g), b(_b) {}
|
nuclear@0
|
161 explicit aiColor3D (ai_real _r) : r(_r), g(_r), b(_r) {}
|
nuclear@0
|
162 aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}
|
nuclear@0
|
163
|
nuclear@0
|
164 /** Component-wise comparison */
|
nuclear@0
|
165 // TODO: add epsilon?
|
nuclear@0
|
166 bool operator == (const aiColor3D& other) const
|
nuclear@0
|
167 {return r == other.r && g == other.g && b == other.b;}
|
nuclear@0
|
168
|
nuclear@0
|
169 /** Component-wise inverse comparison */
|
nuclear@0
|
170 // TODO: add epsilon?
|
nuclear@0
|
171 bool operator != (const aiColor3D& other) const
|
nuclear@0
|
172 {return r != other.r || g != other.g || b != other.b;}
|
nuclear@0
|
173
|
nuclear@0
|
174 /** Component-wise comparison */
|
nuclear@0
|
175 // TODO: add epsilon?
|
nuclear@0
|
176 bool operator < (const aiColor3D& other) const {
|
nuclear@0
|
177 return r < other.r || ( r == other.r && (g < other.g || (g == other.g && b < other.b ) ) );
|
nuclear@0
|
178 }
|
nuclear@0
|
179
|
nuclear@0
|
180 /** Component-wise addition */
|
nuclear@0
|
181 aiColor3D operator+(const aiColor3D& c) const {
|
nuclear@0
|
182 return aiColor3D(r+c.r,g+c.g,b+c.b);
|
nuclear@0
|
183 }
|
nuclear@0
|
184
|
nuclear@0
|
185 /** Component-wise subtraction */
|
nuclear@0
|
186 aiColor3D operator-(const aiColor3D& c) const {
|
nuclear@0
|
187 return aiColor3D(r-c.r,g-c.g,b-c.b);
|
nuclear@0
|
188 }
|
nuclear@0
|
189
|
nuclear@0
|
190 /** Component-wise multiplication */
|
nuclear@0
|
191 aiColor3D operator*(const aiColor3D& c) const {
|
nuclear@0
|
192 return aiColor3D(r*c.r,g*c.g,b*c.b);
|
nuclear@0
|
193 }
|
nuclear@0
|
194
|
nuclear@0
|
195 /** Multiply with a scalar */
|
nuclear@0
|
196 aiColor3D operator*(ai_real f) const {
|
nuclear@0
|
197 return aiColor3D(r*f,g*f,b*f);
|
nuclear@0
|
198 }
|
nuclear@0
|
199
|
nuclear@0
|
200 /** Access a specific color component */
|
nuclear@0
|
201 ai_real operator[](unsigned int i) const {
|
nuclear@0
|
202 return *(&r + i);
|
nuclear@0
|
203 }
|
nuclear@0
|
204
|
nuclear@0
|
205 /** Access a specific color component */
|
nuclear@0
|
206 ai_real& operator[](unsigned int i) {
|
nuclear@0
|
207 if ( 0 == i ) {
|
nuclear@0
|
208 return r;
|
nuclear@0
|
209 } else if ( 1 == i ) {
|
nuclear@0
|
210 return g;
|
nuclear@0
|
211 } else if ( 2 == i ) {
|
nuclear@0
|
212 return b;
|
nuclear@0
|
213 }
|
nuclear@0
|
214 return r;
|
nuclear@0
|
215 }
|
nuclear@0
|
216
|
nuclear@0
|
217 /** Check whether a color is black */
|
nuclear@0
|
218 bool IsBlack() const {
|
nuclear@0
|
219 static const ai_real epsilon = ai_real(10e-3);
|
nuclear@0
|
220 return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;
|
nuclear@0
|
221 }
|
nuclear@0
|
222
|
nuclear@0
|
223 #endif // !__cplusplus
|
nuclear@0
|
224
|
nuclear@0
|
225 //! Red, green and blue color values
|
nuclear@0
|
226 ai_real r, g, b;
|
nuclear@0
|
227 }; // !struct aiColor3D
|
nuclear@0
|
228
|
nuclear@0
|
229 // ----------------------------------------------------------------------------------
|
nuclear@0
|
230 /** Represents an UTF-8 string, zero byte terminated.
|
nuclear@0
|
231 *
|
nuclear@0
|
232 * The character set of an aiString is explicitly defined to be UTF-8. This Unicode
|
nuclear@0
|
233 * transformation was chosen in the belief that most strings in 3d files are limited
|
nuclear@0
|
234 * to ASCII, thus the character set needed to be strictly ASCII compatible.
|
nuclear@0
|
235 *
|
nuclear@0
|
236 * Most text file loaders provide proper Unicode input file handling, special unicode
|
nuclear@0
|
237 * characters are correctly transcoded to UTF8 and are kept throughout the libraries'
|
nuclear@0
|
238 * import pipeline.
|
nuclear@0
|
239 *
|
nuclear@0
|
240 * For most applications, it will be absolutely sufficient to interpret the
|
nuclear@0
|
241 * aiString as ASCII data and work with it as one would work with a plain char*.
|
nuclear@0
|
242 * Windows users in need of proper support for i.e asian characters can use the
|
nuclear@0
|
243 * MultiByteToWideChar(), WideCharToMultiByte() WinAPI functionality to convert the
|
nuclear@0
|
244 * UTF-8 strings to their working character set (i.e. MBCS, WideChar).
|
nuclear@0
|
245 *
|
nuclear@0
|
246 * We use this representation instead of std::string to be C-compatible. The
|
nuclear@0
|
247 * (binary) length of such a string is limited to MAXLEN characters (including the
|
nuclear@0
|
248 * the terminating zero).
|
nuclear@0
|
249 */
|
nuclear@0
|
250 struct aiString
|
nuclear@0
|
251 {
|
nuclear@0
|
252 #ifdef __cplusplus
|
nuclear@0
|
253 /** Default constructor, the string is set to have zero length */
|
nuclear@0
|
254 aiString() AI_NO_EXCEPT
|
nuclear@0
|
255 : length( 0 ) {
|
nuclear@0
|
256 data[0] = '\0';
|
nuclear@0
|
257
|
nuclear@0
|
258 #ifdef ASSIMP_BUILD_DEBUG
|
nuclear@0
|
259 // Debug build: overwrite the string on its full length with ESC (27)
|
nuclear@0
|
260 memset(data+1,27,MAXLEN-1);
|
nuclear@0
|
261 #endif
|
nuclear@0
|
262 }
|
nuclear@0
|
263
|
nuclear@0
|
264 /** Copy constructor */
|
nuclear@0
|
265 aiString(const aiString& rOther) :
|
nuclear@0
|
266 length(rOther.length)
|
nuclear@0
|
267 {
|
nuclear@0
|
268 // Crop the string to the maximum length
|
nuclear@0
|
269 length = length>=MAXLEN?MAXLEN-1:length;
|
nuclear@0
|
270 memcpy( data, rOther.data, length);
|
nuclear@0
|
271 data[length] = '\0';
|
nuclear@0
|
272 }
|
nuclear@0
|
273
|
nuclear@0
|
274 /** Constructor from std::string */
|
nuclear@0
|
275 explicit aiString(const std::string& pString) :
|
nuclear@0
|
276 length(pString.length())
|
nuclear@0
|
277 {
|
nuclear@0
|
278 length = length>=MAXLEN?MAXLEN-1:length;
|
nuclear@0
|
279 memcpy( data, pString.c_str(), length);
|
nuclear@0
|
280 data[length] = '\0';
|
nuclear@0
|
281 }
|
nuclear@0
|
282
|
nuclear@0
|
283 /** Copy a std::string to the aiString */
|
nuclear@0
|
284 void Set( const std::string& pString) {
|
nuclear@0
|
285 if( pString.length() > MAXLEN - 1) {
|
nuclear@0
|
286 return;
|
nuclear@0
|
287 }
|
nuclear@0
|
288 length = pString.length();
|
nuclear@0
|
289 memcpy( data, pString.c_str(), length);
|
nuclear@0
|
290 data[length] = 0;
|
nuclear@0
|
291 }
|
nuclear@0
|
292
|
nuclear@0
|
293 /** Copy a const char* to the aiString */
|
nuclear@0
|
294 void Set( const char* sz) {
|
nuclear@0
|
295 const size_t len = ::strlen(sz);
|
nuclear@0
|
296 if( len > MAXLEN - 1) {
|
nuclear@0
|
297 return;
|
nuclear@0
|
298 }
|
nuclear@0
|
299 length = len;
|
nuclear@0
|
300 memcpy( data, sz, len);
|
nuclear@0
|
301 data[len] = 0;
|
nuclear@0
|
302 }
|
nuclear@0
|
303
|
nuclear@0
|
304
|
nuclear@0
|
305 /** Assignment operator */
|
nuclear@0
|
306 aiString& operator = (const aiString &rOther) {
|
nuclear@0
|
307 if (this == &rOther) {
|
nuclear@0
|
308 return *this;
|
nuclear@0
|
309 }
|
nuclear@0
|
310
|
nuclear@0
|
311 length = rOther.length;;
|
nuclear@0
|
312 memcpy( data, rOther.data, length);
|
nuclear@0
|
313 data[length] = '\0';
|
nuclear@0
|
314 return *this;
|
nuclear@0
|
315 }
|
nuclear@0
|
316
|
nuclear@0
|
317
|
nuclear@0
|
318 /** Assign a const char* to the string */
|
nuclear@0
|
319 aiString& operator = (const char* sz) {
|
nuclear@0
|
320 Set(sz);
|
nuclear@0
|
321 return *this;
|
nuclear@0
|
322 }
|
nuclear@0
|
323
|
nuclear@0
|
324 /** Assign a cstd::string to the string */
|
nuclear@0
|
325 aiString& operator = ( const std::string& pString) {
|
nuclear@0
|
326 Set(pString);
|
nuclear@0
|
327 return *this;
|
nuclear@0
|
328 }
|
nuclear@0
|
329
|
nuclear@0
|
330 /** Comparison operator */
|
nuclear@0
|
331 bool operator==(const aiString& other) const {
|
nuclear@0
|
332 return (length == other.length && 0 == memcmp(data,other.data,length));
|
nuclear@0
|
333 }
|
nuclear@0
|
334
|
nuclear@0
|
335 /** Inverse comparison operator */
|
nuclear@0
|
336 bool operator!=(const aiString& other) const {
|
nuclear@0
|
337 return (length != other.length || 0 != memcmp(data,other.data,length));
|
nuclear@0
|
338 }
|
nuclear@0
|
339
|
nuclear@0
|
340 /** Append a string to the string */
|
nuclear@0
|
341 void Append (const char* app) {
|
nuclear@0
|
342 const size_t len = ::strlen(app);
|
nuclear@0
|
343 if (!len) {
|
nuclear@0
|
344 return;
|
nuclear@0
|
345 }
|
nuclear@0
|
346 if (length + len >= MAXLEN) {
|
nuclear@0
|
347 return;
|
nuclear@0
|
348 }
|
nuclear@0
|
349
|
nuclear@0
|
350 memcpy(&data[length],app,len+1);
|
nuclear@0
|
351 length += len;
|
nuclear@0
|
352 }
|
nuclear@0
|
353
|
nuclear@0
|
354 /** Clear the string - reset its length to zero */
|
nuclear@0
|
355 void Clear () {
|
nuclear@0
|
356 length = 0;
|
nuclear@0
|
357 data[0] = '\0';
|
nuclear@0
|
358
|
nuclear@0
|
359 #ifdef ASSIMP_BUILD_DEBUG
|
nuclear@0
|
360 // Debug build: overwrite the string on its full length with ESC (27)
|
nuclear@0
|
361 memset(data+1,27,MAXLEN-1);
|
nuclear@0
|
362 #endif
|
nuclear@0
|
363 }
|
nuclear@0
|
364
|
nuclear@0
|
365 /** Returns a pointer to the underlying zero-terminated array of characters */
|
nuclear@0
|
366 const char* C_Str() const {
|
nuclear@0
|
367 return data;
|
nuclear@0
|
368 }
|
nuclear@0
|
369
|
nuclear@0
|
370 #endif // !__cplusplus
|
nuclear@0
|
371
|
nuclear@0
|
372 /** Binary length of the string excluding the terminal 0. This is NOT the
|
nuclear@0
|
373 * logical length of strings containing UTF-8 multi-byte sequences! It's
|
nuclear@0
|
374 * the number of bytes from the beginning of the string to its end.*/
|
nuclear@0
|
375 size_t length;
|
nuclear@0
|
376
|
nuclear@0
|
377 /** String buffer. Size limit is MAXLEN */
|
nuclear@0
|
378 char data[MAXLEN];
|
nuclear@0
|
379 } ; // !struct aiString
|
nuclear@0
|
380
|
nuclear@0
|
381
|
nuclear@0
|
382 // ----------------------------------------------------------------------------------
|
nuclear@0
|
383 /** Standard return type for some library functions.
|
nuclear@0
|
384 * Rarely used, and if, mostly in the C API.
|
nuclear@0
|
385 */
|
nuclear@0
|
386 typedef enum aiReturn
|
nuclear@0
|
387 {
|
nuclear@0
|
388 /** Indicates that a function was successful */
|
nuclear@0
|
389 aiReturn_SUCCESS = 0x0,
|
nuclear@0
|
390
|
nuclear@0
|
391 /** Indicates that a function failed */
|
nuclear@0
|
392 aiReturn_FAILURE = -0x1,
|
nuclear@0
|
393
|
nuclear@0
|
394 /** Indicates that not enough memory was available
|
nuclear@0
|
395 * to perform the requested operation
|
nuclear@0
|
396 */
|
nuclear@0
|
397 aiReturn_OUTOFMEMORY = -0x3,
|
nuclear@0
|
398
|
nuclear@0
|
399 /** @cond never
|
nuclear@0
|
400 * Force 32-bit size enum
|
nuclear@0
|
401 */
|
nuclear@0
|
402 _AI_ENFORCE_ENUM_SIZE = 0x7fffffff
|
nuclear@0
|
403
|
nuclear@0
|
404 /// @endcond
|
nuclear@0
|
405 } aiReturn; // !enum aiReturn
|
nuclear@0
|
406
|
nuclear@0
|
407 // just for backwards compatibility, don't use these constants anymore
|
nuclear@0
|
408 #define AI_SUCCESS aiReturn_SUCCESS
|
nuclear@0
|
409 #define AI_FAILURE aiReturn_FAILURE
|
nuclear@0
|
410 #define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY
|
nuclear@0
|
411
|
nuclear@0
|
412 // ----------------------------------------------------------------------------------
|
nuclear@0
|
413 /** Seek origins (for the virtual file system API).
|
nuclear@0
|
414 * Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.
|
nuclear@0
|
415 */
|
nuclear@0
|
416 enum aiOrigin
|
nuclear@0
|
417 {
|
nuclear@0
|
418 /** Beginning of the file */
|
nuclear@0
|
419 aiOrigin_SET = 0x0,
|
nuclear@0
|
420
|
nuclear@0
|
421 /** Current position of the file pointer */
|
nuclear@0
|
422 aiOrigin_CUR = 0x1,
|
nuclear@0
|
423
|
nuclear@0
|
424 /** End of the file, offsets must be negative */
|
nuclear@0
|
425 aiOrigin_END = 0x2,
|
nuclear@0
|
426
|
nuclear@0
|
427 /** @cond never
|
nuclear@0
|
428 * Force 32-bit size enum
|
nuclear@0
|
429 */
|
nuclear@0
|
430 _AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff
|
nuclear@0
|
431
|
nuclear@0
|
432 /// @endcond
|
nuclear@0
|
433 }; // !enum aiOrigin
|
nuclear@0
|
434
|
nuclear@0
|
435 // ----------------------------------------------------------------------------------
|
nuclear@0
|
436 /** @brief Enumerates predefined log streaming destinations.
|
nuclear@0
|
437 * Logging to these streams can be enabled with a single call to
|
nuclear@0
|
438 * #LogStream::createDefaultStream.
|
nuclear@0
|
439 */
|
nuclear@0
|
440 enum aiDefaultLogStream
|
nuclear@0
|
441 {
|
nuclear@0
|
442 /** Stream the log to a file */
|
nuclear@0
|
443 aiDefaultLogStream_FILE = 0x1,
|
nuclear@0
|
444
|
nuclear@0
|
445 /** Stream the log to std::cout */
|
nuclear@0
|
446 aiDefaultLogStream_STDOUT = 0x2,
|
nuclear@0
|
447
|
nuclear@0
|
448 /** Stream the log to std::cerr */
|
nuclear@0
|
449 aiDefaultLogStream_STDERR = 0x4,
|
nuclear@0
|
450
|
nuclear@0
|
451 /** MSVC only: Stream the log the the debugger
|
nuclear@0
|
452 * (this relies on OutputDebugString from the Win32 SDK)
|
nuclear@0
|
453 */
|
nuclear@0
|
454 aiDefaultLogStream_DEBUGGER = 0x8,
|
nuclear@0
|
455
|
nuclear@0
|
456 /** @cond never
|
nuclear@0
|
457 * Force 32-bit size enum
|
nuclear@0
|
458 */
|
nuclear@0
|
459 _AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff
|
nuclear@0
|
460 /// @endcond
|
nuclear@0
|
461 }; // !enum aiDefaultLogStream
|
nuclear@0
|
462
|
nuclear@0
|
463 // just for backwards compatibility, don't use these constants anymore
|
nuclear@0
|
464 #define DLS_FILE aiDefaultLogStream_FILE
|
nuclear@0
|
465 #define DLS_STDOUT aiDefaultLogStream_STDOUT
|
nuclear@0
|
466 #define DLS_STDERR aiDefaultLogStream_STDERR
|
nuclear@0
|
467 #define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER
|
nuclear@0
|
468
|
nuclear@0
|
469 // ----------------------------------------------------------------------------------
|
nuclear@0
|
470 /** Stores the memory requirements for different components (e.g. meshes, materials,
|
nuclear@0
|
471 * animations) of an import. All sizes are in bytes.
|
nuclear@0
|
472 * @see Importer::GetMemoryRequirements()
|
nuclear@0
|
473 */
|
nuclear@0
|
474 struct aiMemoryInfo
|
nuclear@0
|
475 {
|
nuclear@0
|
476 #ifdef __cplusplus
|
nuclear@0
|
477
|
nuclear@0
|
478 /** Default constructor */
|
nuclear@0
|
479 aiMemoryInfo() AI_NO_EXCEPT
|
nuclear@0
|
480 : textures (0)
|
nuclear@0
|
481 , materials (0)
|
nuclear@0
|
482 , meshes (0)
|
nuclear@0
|
483 , nodes (0)
|
nuclear@0
|
484 , animations (0)
|
nuclear@0
|
485 , cameras (0)
|
nuclear@0
|
486 , lights (0)
|
nuclear@0
|
487 , total (0)
|
nuclear@0
|
488 {}
|
nuclear@0
|
489
|
nuclear@0
|
490 #endif
|
nuclear@0
|
491
|
nuclear@0
|
492 /** Storage allocated for texture data */
|
nuclear@0
|
493 unsigned int textures;
|
nuclear@0
|
494
|
nuclear@0
|
495 /** Storage allocated for material data */
|
nuclear@0
|
496 unsigned int materials;
|
nuclear@0
|
497
|
nuclear@0
|
498 /** Storage allocated for mesh data */
|
nuclear@0
|
499 unsigned int meshes;
|
nuclear@0
|
500
|
nuclear@0
|
501 /** Storage allocated for node data */
|
nuclear@0
|
502 unsigned int nodes;
|
nuclear@0
|
503
|
nuclear@0
|
504 /** Storage allocated for animation data */
|
nuclear@0
|
505 unsigned int animations;
|
nuclear@0
|
506
|
nuclear@0
|
507 /** Storage allocated for camera data */
|
nuclear@0
|
508 unsigned int cameras;
|
nuclear@0
|
509
|
nuclear@0
|
510 /** Storage allocated for light data */
|
nuclear@0
|
511 unsigned int lights;
|
nuclear@0
|
512
|
nuclear@0
|
513 /** Total storage allocated for the full import. */
|
nuclear@0
|
514 unsigned int total;
|
nuclear@0
|
515 }; // !struct aiMemoryInfo
|
nuclear@0
|
516
|
nuclear@0
|
517 #ifdef __cplusplus
|
nuclear@0
|
518 }
|
nuclear@0
|
519 #endif //! __cplusplus
|
nuclear@0
|
520
|
nuclear@0
|
521 // Include implementation files
|
nuclear@0
|
522 #include "vector2.inl"
|
nuclear@0
|
523 #include "vector3.inl"
|
nuclear@0
|
524 #include "color4.inl"
|
nuclear@0
|
525 #include "quaternion.inl"
|
nuclear@0
|
526 #include "matrix3x3.inl"
|
nuclear@0
|
527 #include "matrix4x4.inl"
|
nuclear@0
|
528
|
nuclear@0
|
529 #endif // AI_TYPES_H_INC
|