2008-05-09 17:24:28 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
2008-05-22 10:20:31 +00:00
|
|
|
Open Asset Import Library (ASSIMP)
|
2008-05-09 17:24:28 +00:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
2010-04-10 15:30:22 +00:00
|
|
|
Copyright (c) 2006-2010, ASSIMP Development Team
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the following
|
|
|
|
conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
|
|
|
* Neither the name of the ASSIMP team, nor the names of its
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
|
|
|
written permission of the ASSIMP Development Team.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-01-13 18:58:07 +00:00
|
|
|
/** @file aiTypes.h
|
2009-05-28 11:32:54 +00:00
|
|
|
* Basic data types and primitives, such as vectors or colors.
|
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifndef AI_TYPES_H_INC
|
|
|
|
#define AI_TYPES_H_INC
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
// Some runtime headers
|
2008-05-05 12:36:31 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <memory.h>
|
2009-01-12 22:06:54 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <stddef.h>
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Our compile configuration
|
2008-06-22 10:09:26 +00:00
|
|
|
#include "aiDefines.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// Some types moved to separate header due to size of operators
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "aiVector3D.h"
|
2008-11-26 13:17:39 +00:00
|
|
|
#include "aiVector2D.h"
|
2010-01-28 21:17:25 +00:00
|
|
|
#include "aiColor4D.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "aiMatrix3x3.h"
|
|
|
|
#include "aiMatrix4x4.h"
|
2009-01-12 22:06:54 +00:00
|
|
|
#include "aiQuaternion.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2010-04-11 02:14:52 +00:00
|
|
|
#include <new> // for std::nothrow_t
|
|
|
|
#include <string> // for aiString::Set(const std::string&)
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
namespace Assimp {
|
2009-08-31 15:51:54 +00:00
|
|
|
//! @cond never
|
|
|
|
namespace Intern {
|
2009-05-28 11:32:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2009-01-23 21:06:43 +00:00
|
|
|
/** @brief Internal helper class to utilize our internal new/delete
|
|
|
|
* routines for allocating object of this and derived classes.
|
|
|
|
*
|
|
|
|
* By doing this you can safely share class objects between Assimp
|
|
|
|
* and the application - it works even over DLL boundaries. A good
|
2009-05-28 11:32:54 +00:00
|
|
|
* example is the #IOSystem where the application allocates its custom
|
|
|
|
* #IOSystem, then calls #Importer::SetIOSystem(). When the Importer
|
|
|
|
* destructs, Assimp calls operator delete on the stored #IOSystem.
|
2009-01-23 21:06:43 +00:00
|
|
|
* If it lies on a different heap than Assimp is working with,
|
|
|
|
* the application is determined to crash.
|
|
|
|
*/
|
2009-05-28 11:32:54 +00:00
|
|
|
// --------------------------------------------------------------------
|
2010-05-27 18:30:28 +00:00
|
|
|
#ifndef SWIG
|
2009-01-12 22:06:54 +00:00
|
|
|
struct ASSIMP_API AllocateFromAssimpHeap {
|
2010-04-11 02:14:52 +00:00
|
|
|
// http://www.gotw.ca/publications/mill15.htm
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
// new/delete overload
|
2010-04-11 02:14:52 +00:00
|
|
|
void *operator new ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
|
|
|
void *operator new ( size_t num_bytes, const std::nothrow_t& ) throw();
|
2009-01-12 22:06:54 +00:00
|
|
|
void operator delete ( void* data);
|
|
|
|
|
|
|
|
// array new/delete overload
|
2010-04-11 02:14:52 +00:00
|
|
|
void *operator new[] ( size_t num_bytes) /* throw( std::bad_alloc ) */;
|
|
|
|
void *operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw();
|
2009-01-12 22:06:54 +00:00
|
|
|
void operator delete[] ( void* data);
|
|
|
|
|
2009-08-31 15:51:54 +00:00
|
|
|
}; // struct AllocateFromAssimpHeap
|
2010-05-27 18:30:28 +00:00
|
|
|
#endif
|
2009-08-31 15:51:54 +00:00
|
|
|
} // namespace Intern
|
|
|
|
//! @endcond
|
|
|
|
} // namespace Assimp
|
2009-01-12 22:06:54 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
/** Maximum dimension for strings, ASSIMP strings are zero terminated. */
|
2008-05-09 17:24:28 +00:00
|
|
|
#ifdef __cplusplus
|
2008-05-05 12:36:31 +00:00
|
|
|
const size_t MAXLEN = 1024;
|
2008-05-09 17:24:28 +00:00
|
|
|
#else
|
|
|
|
# define MAXLEN 1024
|
|
|
|
#endif
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-09-12 20:25:11 +00:00
|
|
|
#include "./Compiler/pushpack1.h"
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2008-11-16 21:56:45 +00:00
|
|
|
/** Represents a plane in a three-dimensional, euclidean space
|
|
|
|
*/
|
|
|
|
struct aiPlane
|
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
aiPlane () : a(0.f), b(0.f), c(0.f), d(0.f) {}
|
|
|
|
aiPlane (float _a, float _b, float _c, float _d)
|
|
|
|
: a(_a), b(_b), c(_c), d(_d) {}
|
|
|
|
|
|
|
|
aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {}
|
2008-11-26 13:17:39 +00:00
|
|
|
|
2008-11-16 21:56:45 +00:00
|
|
|
#endif // !__cplusplus
|
|
|
|
|
|
|
|
//! Plane equation
|
|
|
|
float a,b,c,d;
|
2009-01-12 22:06:54 +00:00
|
|
|
} PACK_STRUCT; // !struct aiPlane
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2008-11-26 13:17:39 +00:00
|
|
|
/** Represents a ray
|
|
|
|
*/
|
|
|
|
struct aiRay
|
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
aiRay () {}
|
|
|
|
aiRay (const aiVector3D& _pos, const aiVector3D& _dir)
|
|
|
|
: pos(_pos), dir(_dir) {}
|
|
|
|
|
|
|
|
aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}
|
|
|
|
|
|
|
|
#endif // !__cplusplus
|
|
|
|
|
|
|
|
//! Position and direction of the ray
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiVector3D pos, dir;
|
|
|
|
} PACK_STRUCT; // !struct aiRay
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------
|
2008-05-05 12:36:31 +00:00
|
|
|
/** Represents a color in Red-Green-Blue space.
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
struct aiColor3D
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {}
|
|
|
|
aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}
|
2010-04-02 04:17:05 +00:00
|
|
|
aiColor3D (float _r) : r(_r), g(_r), b(_r) {}
|
2008-05-05 12:36:31 +00:00
|
|
|
aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Component-wise comparison */
|
2009-01-12 22:06:54 +00:00
|
|
|
// TODO: add epsilon?
|
2008-09-07 16:51:05 +00:00
|
|
|
bool operator == (const aiColor3D& other) const
|
|
|
|
{return r == other.r && g == other.g && b == other.b;}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Component-wise inverse comparison */
|
2009-01-12 22:06:54 +00:00
|
|
|
// TODO: add epsilon?
|
2008-09-07 16:51:05 +00:00
|
|
|
bool operator != (const aiColor3D& other) const
|
|
|
|
{return r != other.r || g != other.g || b != other.b;}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Component-wise addition */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiColor3D operator+(const aiColor3D& c) const {
|
|
|
|
return aiColor3D(r+c.r,g+c.g,b+c.b);
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Component-wise subtraction */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiColor3D operator-(const aiColor3D& c) const {
|
|
|
|
return aiColor3D(r+c.r,g+c.g,b+c.b);
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Component-wise multiplication */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiColor3D operator*(const aiColor3D& c) const {
|
|
|
|
return aiColor3D(r*c.r,g*c.g,b*c.b);
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Multiply with a scalar */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiColor3D operator*(float f) const {
|
|
|
|
return aiColor3D(r*f,g*f,b*f);
|
|
|
|
}
|
2008-09-20 15:55:51 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Access a specific color component */
|
|
|
|
float operator[](unsigned int i) const {
|
|
|
|
return *(&r + i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Access a specific color component */
|
|
|
|
float& operator[](unsigned int i) {
|
|
|
|
return *(&r + i);
|
|
|
|
}
|
2008-10-19 11:32:33 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Check whether a color is black */
|
|
|
|
bool IsBlack() const {
|
2009-02-05 16:16:04 +00:00
|
|
|
static const float epsilon = 10e-3f;
|
|
|
|
return fabs( r ) < epsilon && fabs( g ) < epsilon && fabs( b ) < epsilon;
|
2008-10-13 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif // !__cplusplus
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Red, green and blue color values
|
2008-05-05 12:36:31 +00:00
|
|
|
float r, g, b;
|
2009-01-12 22:06:54 +00:00
|
|
|
} PACK_STRUCT; // !struct aiColor3D
|
2008-09-12 20:25:11 +00:00
|
|
|
#include "./Compiler/poppack1.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2009-08-21 22:49:58 +00:00
|
|
|
/** Represents an UTF-8 string, zero byte terminated.
|
2009-01-12 22:06:54 +00:00
|
|
|
*
|
2009-08-21 22:49:58 +00:00
|
|
|
* The character set of an aiString is explicitly defined to be UTF-8. This Unicode
|
|
|
|
* transformation was chosen in the belief that most strings in 3d files are limited
|
2011-04-03 15:12:05 +00:00
|
|
|
* to ASCII, thus the character set needed to be strictly ASCII compatible.
|
2009-08-21 22:49:58 +00:00
|
|
|
*
|
|
|
|
* Most text file loaders provide proper Unicode input file handling, special unicode
|
|
|
|
* characters are correctly transcoded to UTF8 and are kept throughout the libraries'
|
|
|
|
* import pipeline.
|
|
|
|
*
|
|
|
|
* For most applications, it will be absolutely sufficient to interpret the
|
|
|
|
* aiString as ASCII data and work with it as one would work with a plain char*.
|
|
|
|
* Windows users in need of proper support for i.e asian characters can use the
|
|
|
|
* #MultiByteToWideChar(), #WideCharToMultiByte() WinAPI functionality to convert the
|
|
|
|
* UTF-8 strings to their working character set (i.e. MBCS, WideChar).
|
|
|
|
*
|
|
|
|
* We use this representation instead of std::string to be C-compatible. The
|
2010-04-14 21:45:00 +00:00
|
|
|
* (binary) length of such a string is limited to MAXLEN characters (including the
|
|
|
|
* the terminating zero).
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
struct aiString
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Default constructor, the string is set to have zero length */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiString() :
|
2008-05-05 12:36:31 +00:00
|
|
|
length(0)
|
|
|
|
{
|
2008-06-22 10:09:26 +00:00
|
|
|
data[0] = '\0';
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
// Debug build: overwrite the string on its full length with ESC (27)
|
2009-08-21 22:49:58 +00:00
|
|
|
memset(data+1,27,MAXLEN-1);
|
2009-01-12 22:06:54 +00:00
|
|
|
#endif
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Copy constructor */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiString(const aiString& rOther) :
|
2008-05-05 12:36:31 +00:00
|
|
|
length(rOther.length)
|
|
|
|
{
|
2010-02-05 22:32:19 +00:00
|
|
|
// Crop the string to the maximum length
|
|
|
|
length = length>=MAXLEN?MAXLEN-1:length;
|
|
|
|
memcpy( data, rOther.data, length);
|
2008-11-16 21:56:45 +00:00
|
|
|
data[length] = '\0';
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Constructor from std::string */
|
2010-11-22 18:14:51 +00:00
|
|
|
explicit aiString(const std::string& pString) :
|
2008-08-02 13:20:41 +00:00
|
|
|
length(pString.length())
|
|
|
|
{
|
2010-02-05 22:32:19 +00:00
|
|
|
length = length>=MAXLEN?MAXLEN-1:length;
|
2008-08-02 13:20:41 +00:00
|
|
|
memcpy( data, pString.c_str(), length);
|
|
|
|
data[length] = '\0';
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Copy a std::string to the aiString */
|
|
|
|
void Set( const std::string& pString) {
|
|
|
|
if( pString.length() > MAXLEN - 1) {
|
2008-05-05 12:36:31 +00:00
|
|
|
return;
|
2009-05-28 11:32:54 +00:00
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
length = pString.length();
|
2011-04-03 15:12:05 +00:00
|
|
|
memcpy( data, pString.c_str(), length);
|
2008-05-05 12:36:31 +00:00
|
|
|
data[length] = 0;
|
|
|
|
}
|
2008-05-13 23:26:52 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Copy a const char* to the aiString */
|
|
|
|
void Set( const char* sz) {
|
2009-01-12 22:06:54 +00:00
|
|
|
const size_t len = ::strlen(sz);
|
2009-05-28 11:32:54 +00:00
|
|
|
if( len > MAXLEN - 1) {
|
2009-01-12 22:06:54 +00:00
|
|
|
return;
|
2009-05-28 11:32:54 +00:00
|
|
|
}
|
2009-01-12 22:06:54 +00:00
|
|
|
length = len;
|
2011-04-03 15:12:05 +00:00
|
|
|
memcpy( data, sz, len);
|
2009-01-12 22:06:54 +00:00
|
|
|
data[len] = 0;
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Assign a const char* to the string */
|
|
|
|
aiString& operator = (const char* sz) {
|
2009-01-12 22:06:54 +00:00
|
|
|
Set(sz);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Assign a cstd::string to the string */
|
|
|
|
aiString& operator = ( const std::string& pString) {
|
2009-01-12 22:06:54 +00:00
|
|
|
Set(pString);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Comparison operator */
|
|
|
|
bool operator==(const aiString& other) const {
|
2011-04-03 15:12:05 +00:00
|
|
|
return (length == other.length && 0 == memcmp(data,other.data,length));
|
2008-05-13 23:26:52 +00:00
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Inverse comparison operator */
|
|
|
|
bool operator!=(const aiString& other) const {
|
2011-04-03 15:12:05 +00:00
|
|
|
return (length != other.length || 0 != memcmp(data,other.data,length));
|
2008-05-13 23:26:52 +00:00
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Append a string to the string */
|
|
|
|
void Append (const char* app) {
|
2011-04-03 15:12:05 +00:00
|
|
|
const size_t len = strlen(app);
|
2009-05-28 11:32:54 +00:00
|
|
|
if (!len) {
|
2008-11-16 21:56:45 +00:00
|
|
|
return;
|
2009-05-28 11:32:54 +00:00
|
|
|
}
|
|
|
|
if (length + len >= MAXLEN) {
|
|
|
|
return;
|
|
|
|
}
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-08-21 22:49:58 +00:00
|
|
|
memcpy(&data[length],app,len+1);
|
2008-11-16 21:56:45 +00:00
|
|
|
length += len;
|
|
|
|
}
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Clear the string - reset its length to zero */
|
|
|
|
void Clear () {
|
2008-11-16 21:56:45 +00:00
|
|
|
length = 0;
|
|
|
|
data[0] = '\0';
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
// Debug build: overwrite the string on its full length with ESC (27)
|
2009-08-21 22:49:58 +00:00
|
|
|
memset(data+1,27,MAXLEN-1);
|
2009-01-12 22:06:54 +00:00
|
|
|
#endif
|
2008-11-16 21:56:45 +00:00
|
|
|
}
|
2008-05-13 23:26:52 +00:00
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif // !__cplusplus
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-08-21 22:49:58 +00:00
|
|
|
/** Binary length of the string excluding the terminal 0. This is NOT the
|
|
|
|
* logical length of strings containing UTF-8 multibyte sequences! It's
|
|
|
|
* the number of bytes from the beginning of the string to its end.*/
|
2008-05-05 12:36:31 +00:00
|
|
|
size_t length;
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** String buffer. Size limit is MAXLEN */
|
2008-05-05 12:36:31 +00:00
|
|
|
char data[MAXLEN];
|
2009-01-12 22:06:54 +00:00
|
|
|
} ; // !struct aiString
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Standard return type for some library functions.
|
|
|
|
* Rarely used, and if, mostly in the C API.
|
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
enum aiReturn
|
|
|
|
{
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Indicates that a function was successful */
|
|
|
|
aiReturn_SUCCESS = 0x0,
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Indicates that a function failed */
|
|
|
|
aiReturn_FAILURE = -0x1,
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Indicates that not enough memory was available
|
|
|
|
* to perform the requested operation
|
|
|
|
*/
|
|
|
|
aiReturn_OUTOFMEMORY = -0x3,
|
2009-01-12 22:06:54 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** @cond never
|
|
|
|
* Force 32-bit size enum
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
_AI_ENFORCE_ENUM_SIZE = 0x7fffffff
|
|
|
|
}; // !enum aiReturn
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
// just for backwards compatibility, don't use these constants anymore
|
|
|
|
#define AI_SUCCESS aiReturn_SUCCESS
|
|
|
|
#define AI_FAILURE aiReturn_FAILURE
|
|
|
|
#define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY
|
2009-01-12 22:06:54 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Seek origins (for the virtual file system API).
|
|
|
|
* Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
enum aiOrigin
|
|
|
|
{
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Beginning of the file */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiOrigin_SET = 0x0,
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Current position of the file pointer */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiOrigin_CUR = 0x1,
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** End of the file, offsets must be negative */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiOrigin_END = 0x2,
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** @cond never
|
|
|
|
* Force 32-bit size enum
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
_AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff
|
|
|
|
}; // !enum aiOrigin
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
|
|
|
/** @brief Enumerates predefined log streaming destinations.
|
|
|
|
* Logging to these streams can be enabled with a single call to
|
|
|
|
* #LogStream::createDefaultStream or #aiAttachPredefinedLogStream(),
|
|
|
|
* respectively.
|
|
|
|
*/
|
|
|
|
enum aiDefaultLogStream
|
|
|
|
{
|
|
|
|
/** Stream the log to a file */
|
|
|
|
aiDefaultLogStream_FILE = 0x1,
|
|
|
|
|
|
|
|
/** Stream the log to std::cout */
|
|
|
|
aiDefaultLogStream_STDOUT = 0x2,
|
|
|
|
|
|
|
|
/** Stream the log to std::cerr */
|
|
|
|
aiDefaultLogStream_STDERR = 0x4,
|
|
|
|
|
|
|
|
/** MSVC only: Stream the log the the debugger
|
|
|
|
* (this relies on OutputDebugString from the Win32 SDK)
|
|
|
|
*/
|
|
|
|
aiDefaultLogStream_DEBUGGER = 0x8,
|
|
|
|
|
|
|
|
/** @cond never
|
|
|
|
* Force 32-bit size enum
|
|
|
|
*/
|
|
|
|
_AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff
|
|
|
|
}; // !enum aiDefaultLogStream
|
|
|
|
|
|
|
|
// just for backwards compatibility, don't use these constants anymore
|
|
|
|
#define DLS_FILE aiDefaultLogStream_FILE
|
|
|
|
#define DLS_STDOUT aiDefaultLogStream_STDOUT
|
|
|
|
#define DLS_STDERR aiDefaultLogStream_STDERR
|
|
|
|
#define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2009-01-12 22:06:54 +00:00
|
|
|
// ----------------------------------------------------------------------------------
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Stores the memory requirements for different components (e.g. meshes, materials,
|
|
|
|
* animations) of an import. All sizes are in bytes.
|
2008-08-08 11:48:50 +00:00
|
|
|
* @see Importer::GetMemoryRequirements()
|
|
|
|
*/
|
|
|
|
struct aiMemoryInfo
|
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Default constructor */
|
2009-01-12 22:06:54 +00:00
|
|
|
aiMemoryInfo()
|
2008-08-08 11:48:50 +00:00
|
|
|
: textures (0)
|
|
|
|
, materials (0)
|
|
|
|
, meshes (0)
|
|
|
|
, nodes (0)
|
|
|
|
, animations (0)
|
2008-11-16 21:56:45 +00:00
|
|
|
, cameras (0)
|
|
|
|
, lights (0)
|
2008-08-08 11:48:50 +00:00
|
|
|
, total (0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for texture data */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int textures;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for material data */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int materials;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for mesh data */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int meshes;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for node data */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int nodes;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for animation data */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int animations;
|
2008-11-16 21:56:45 +00:00
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for camera data */
|
2008-11-16 21:56:45 +00:00
|
|
|
unsigned int cameras;
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Storage allocated for light data */
|
2008-11-16 21:56:45 +00:00
|
|
|
unsigned int lights;
|
|
|
|
|
2009-05-28 11:32:54 +00:00
|
|
|
/** Total storage allocated for the full import. */
|
2008-08-08 11:48:50 +00:00
|
|
|
unsigned int total;
|
2009-01-12 22:06:54 +00:00
|
|
|
}; // !struct aiMemoryInfo
|
2008-08-08 11:48:50 +00:00
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif //! __cplusplus
|
2008-11-16 21:56:45 +00:00
|
|
|
|
|
|
|
// Include implementations
|
|
|
|
#include "aiVector3D.inl"
|
2010-01-28 21:17:25 +00:00
|
|
|
#include "aiColor4D.inl"
|
2008-11-16 21:56:45 +00:00
|
|
|
#include "aiMatrix3x3.inl"
|
|
|
|
#include "aiMatrix4x4.inl"
|
2010-01-28 21:17:25 +00:00
|
|
|
#endif
|