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
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Copyright (c) 2006-2008, ASSIMP Development Team
|
|
|
|
|
|
|
|
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.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifndef AI_TYPES_H_INC
|
|
|
|
#define AI_TYPES_H_INC
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <memory.h>
|
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
#include "aiDefines.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
2008-06-22 10:09:26 +00:00
|
|
|
// include math helper classes and their implementations
|
2008-05-05 12:36:31 +00:00
|
|
|
#include "aiVector3D.h"
|
|
|
|
#include "aiMatrix3x3.h"
|
|
|
|
#include "aiMatrix4x4.h"
|
|
|
|
#include "aiVector3D.inl"
|
|
|
|
#include "aiMatrix3x3.inl"
|
|
|
|
#include "aiMatrix4x4.inl"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2008-05-09 17:24:28 +00:00
|
|
|
# include <string>
|
2008-05-05 12:36:31 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** 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"
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Represents a two-dimensional vector.
|
|
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
2008-05-09 17:24:28 +00:00
|
|
|
struct aiVector2D
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
aiVector2D () : x(0.0f), y(0.0f) {}
|
|
|
|
aiVector2D (float _x, float _y) : x(_x), y(_y) {}
|
|
|
|
aiVector2D (const aiVector2D& o) : x(o.x), y(o.y) {}
|
|
|
|
|
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
|
|
|
//! X and y coordinates
|
2008-05-05 12:36:31 +00:00
|
|
|
float x, y;
|
2008-09-12 20:25:11 +00:00
|
|
|
} PACK_STRUCT;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
// aiVector3D type moved to separate header due to size of operators
|
|
|
|
// aiQuaternion type moved to separate header due to size of operators
|
|
|
|
// aiMatrix4x4 type moved to separate header due to size of operators
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** 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) {}
|
|
|
|
aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}
|
|
|
|
|
2008-09-07 16:51:05 +00:00
|
|
|
bool operator == (const aiColor3D& other) const
|
|
|
|
{return r == other.r && g == other.g && b == other.b;}
|
|
|
|
|
|
|
|
bool operator != (const aiColor3D& other) const
|
|
|
|
{return r != other.r || g != other.g || b != other.b;}
|
|
|
|
|
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;
|
2008-09-12 20:25:11 +00:00
|
|
|
} PACK_STRUCT;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Represents a color in Red-Green-Blue space including an
|
|
|
|
* alpha component.
|
|
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
2008-05-09 17:24:28 +00:00
|
|
|
struct aiColor4D
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
aiColor4D () : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {}
|
|
|
|
aiColor4D (float _r, float _g, float _b, float _a)
|
|
|
|
: r(_r), g(_g), b(_b), a(_a) {}
|
|
|
|
aiColor4D (const aiColor4D& o)
|
|
|
|
: r(o.r), g(o.g), b(o.b), a(o.a) {}
|
|
|
|
|
2008-09-07 16:51:05 +00:00
|
|
|
bool operator == (const aiColor4D& other) const
|
|
|
|
{return r == other.r && g == other.g && b == other.b && a == other.a;}
|
|
|
|
|
|
|
|
bool operator != (const aiColor4D& other) const
|
|
|
|
{return r != other.r || g != other.g || b != other.b || a != other.a;}
|
|
|
|
|
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, blue and alpha color values
|
2008-05-05 12:36:31 +00:00
|
|
|
float r, g, b, a;
|
2008-09-12 20:25:11 +00:00
|
|
|
} PACK_STRUCT;
|
|
|
|
|
|
|
|
#include "./Compiler/poppack1.h"
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Represents a string, zero byte terminated
|
|
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
2008-05-09 17:24:28 +00:00
|
|
|
struct aiString
|
2008-05-05 12:36:31 +00:00
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
inline aiString() :
|
|
|
|
length(0)
|
|
|
|
{
|
2008-06-22 10:09:26 +00:00
|
|
|
data[0] = '\0';
|
2008-05-05 12:36:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-02 13:20:41 +00:00
|
|
|
//! Copy constructor
|
2008-05-05 12:36:31 +00:00
|
|
|
inline aiString(const aiString& rOther) :
|
|
|
|
length(rOther.length)
|
|
|
|
{
|
2008-06-22 10:09:26 +00:00
|
|
|
::memcpy( data, rOther.data, rOther.length);
|
2008-05-05 12:36:31 +00:00
|
|
|
this->data[this->length] = '\0';
|
|
|
|
}
|
|
|
|
|
2008-08-02 13:20:41 +00:00
|
|
|
//! Constructor from std::string
|
|
|
|
inline aiString(const std::string& pString) :
|
|
|
|
length(pString.length())
|
|
|
|
{
|
|
|
|
memcpy( data, pString.c_str(), length);
|
|
|
|
data[length] = '\0';
|
|
|
|
}
|
|
|
|
|
2008-05-13 23:26:52 +00:00
|
|
|
//! copy a std::string to the aiString
|
2008-05-05 12:36:31 +00:00
|
|
|
void Set( const std::string& pString)
|
|
|
|
{
|
|
|
|
if( pString.length() > MAXLEN - 1)
|
|
|
|
return;
|
|
|
|
length = pString.length();
|
2008-06-22 10:09:26 +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
|
|
|
|
|
|
|
//! comparison operator
|
|
|
|
bool operator==(const aiString& other) const
|
|
|
|
{
|
|
|
|
return (this->length == other.length &&
|
|
|
|
0 == strcmp(this->data,other.data));
|
|
|
|
}
|
|
|
|
|
|
|
|
//! inverse comparison operator
|
|
|
|
bool operator!=(const aiString& other) const
|
|
|
|
{
|
|
|
|
return (this->length != other.length ||
|
2008-06-22 10:09:26 +00:00
|
|
|
0 != ::strcmp(this->data,other.data));
|
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
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Length of the string excluding the terminal 0
|
2008-05-05 12:36:31 +00:00
|
|
|
size_t length;
|
2008-05-09 17:24:28 +00:00
|
|
|
|
|
|
|
//! String buffer. Size limit is MAXLEN
|
2008-05-05 12:36:31 +00:00
|
|
|
char data[MAXLEN];
|
2008-05-09 17:24:28 +00:00
|
|
|
} ;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Standard return type for all library functions.
|
|
|
|
*
|
2008-06-22 10:09:26 +00:00
|
|
|
* To check whether or not a function failed check against
|
|
|
|
* AI_SUCCESS. The error codes are mainly used by the C-API.
|
2008-05-05 12:36:31 +00:00
|
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
enum aiReturn
|
|
|
|
{
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Indicates that a function was successful
|
2008-05-05 12:36:31 +00:00
|
|
|
AI_SUCCESS = 0x0,
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Indicates that a function failed
|
2008-05-05 12:36:31 +00:00
|
|
|
AI_FAILURE = -0x1,
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Indicates that a file was invalid
|
2008-05-05 12:36:31 +00:00
|
|
|
AI_INVALIDFILE = -0x2,
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Indicates that not enough memory was available
|
|
|
|
//! to perform the requested operation
|
2008-05-05 12:36:31 +00:00
|
|
|
AI_OUTOFMEMORY = -0x3,
|
2008-05-09 17:24:28 +00:00
|
|
|
//! Indicates that an illegal argument has been
|
|
|
|
//! passed to a function. This is rarely used,
|
|
|
|
//! most functions assert in this case.
|
2008-05-05 12:36:31 +00:00
|
|
|
AI_INVALIDARG = -0x4
|
|
|
|
};
|
|
|
|
|
2008-05-09 17:24:28 +00:00
|
|
|
|
2008-08-08 11:48:50 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Stores the memory requirements for different parts (e.g. meshes, materials,
|
|
|
|
* animations) of an import.
|
|
|
|
* @see Importer::GetMemoryRequirements()
|
|
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
struct aiMemoryInfo
|
|
|
|
{
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
//! Default constructor
|
|
|
|
inline aiMemoryInfo()
|
|
|
|
: textures (0)
|
|
|
|
, materials (0)
|
|
|
|
, meshes (0)
|
|
|
|
, nodes (0)
|
|
|
|
, animations (0)
|
|
|
|
, total (0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//! Storage allocated for texture data, in bytes
|
|
|
|
unsigned int textures;
|
|
|
|
//! Storage allocated for material data, in bytes
|
|
|
|
unsigned int materials;
|
|
|
|
//! Storage allocated for mesh data, in bytes
|
|
|
|
unsigned int meshes;
|
|
|
|
//! Storage allocated for node data, in bytes
|
|
|
|
unsigned int nodes;
|
|
|
|
//! Storage allocated for animation data, in bytes
|
|
|
|
unsigned int animations;
|
|
|
|
//! Storage allocated for the import, in bytes
|
|
|
|
unsigned int total;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2008-05-09 17:24:28 +00:00
|
|
|
#endif //! __cplusplus
|
|
|
|
#endif //!! include guard
|
2008-05-05 12:36:31 +00:00
|
|
|
|