Merge remote-tracking branch 'github/master' into contrib
This commit is contained in:
@@ -296,8 +296,7 @@ protected:
|
||||
ExporterPimpl* pimpl;
|
||||
};
|
||||
|
||||
class ASSIMP_API ExportProperties
|
||||
{
|
||||
class ASSIMP_API ExportProperties {
|
||||
public:
|
||||
// Data type to store the key hash
|
||||
typedef unsigned int KeyType;
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Assimp {
|
||||
// =======================================================================
|
||||
// Public interface to Assimp
|
||||
class Importer;
|
||||
class Exporter; // export.hpp
|
||||
class IOStream;
|
||||
class IOSystem;
|
||||
class ProgressHandler;
|
||||
@@ -77,7 +76,6 @@ namespace Assimp {
|
||||
// =======================================================================
|
||||
// Holy stuff, only for members of the high council of the Jedi.
|
||||
class ImporterPimpl;
|
||||
class ExporterPimpl; // export.hpp
|
||||
} //! namespace Assimp
|
||||
|
||||
#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff
|
||||
|
||||
@@ -190,6 +190,39 @@ struct aiMeshKey
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Binds a morph anim mesh to a specific point in time. */
|
||||
struct aiMeshMorphKey
|
||||
{
|
||||
/** The time of this key */
|
||||
double mTime;
|
||||
|
||||
/** The values and weights at the time of this key */
|
||||
unsigned int *mValues;
|
||||
double *mWeights;
|
||||
|
||||
/** The number of values and weights */
|
||||
unsigned int mNumValuesAndWeights;
|
||||
#ifdef __cplusplus
|
||||
aiMeshMorphKey()
|
||||
: mTime(0.0)
|
||||
, mValues(NULL)
|
||||
, mWeights(NULL)
|
||||
, mNumValuesAndWeights(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
~aiMeshMorphKey()
|
||||
{
|
||||
if (mNumValuesAndWeights && mValues && mWeights) {
|
||||
delete [] mValues;
|
||||
delete [] mWeights;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Defines how an animation channel behaves outside the defined time
|
||||
* range. This corresponds to aiNodeAnim::mPreState and
|
||||
@@ -340,6 +373,37 @@ struct aiMeshAnim
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Describes a morphing animation of a given mesh. */
|
||||
struct aiMeshMorphAnim
|
||||
{
|
||||
/** Name of the mesh to be animated. An empty string is not allowed,
|
||||
* animated meshes need to be named (not necessarily uniquely,
|
||||
* the name can basically serve as wildcard to select a group
|
||||
* of meshes with similar animation setup)*/
|
||||
C_STRUCT aiString mName;
|
||||
|
||||
/** Size of the #mKeys array. Must be 1, at least. */
|
||||
unsigned int mNumKeys;
|
||||
|
||||
/** Key frames of the animation. May not be NULL. */
|
||||
C_STRUCT aiMeshMorphKey* mKeys;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiMeshMorphAnim()
|
||||
: mNumKeys()
|
||||
, mKeys()
|
||||
{}
|
||||
|
||||
~aiMeshMorphAnim()
|
||||
{
|
||||
delete[] mKeys;
|
||||
}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** An animation consists of key-frame data for a number of nodes. For
|
||||
* each node affected by the animation a separate series of data is given.*/
|
||||
@@ -372,6 +436,14 @@ struct aiAnimation {
|
||||
* The array is mNumMeshChannels in size. */
|
||||
C_STRUCT aiMeshAnim** mMeshChannels;
|
||||
|
||||
/** The number of mesh animation channels. Each channel affects
|
||||
* a single mesh and defines morphing animation. */
|
||||
unsigned int mNumMorphMeshChannels;
|
||||
|
||||
/** The morph mesh animation channels. Each channel affects a single mesh.
|
||||
* The array is mNumMorphMeshChannels in size. */
|
||||
C_STRUCT aiMeshMorphAnim **mMorphMeshChannels;
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiAnimation()
|
||||
: mDuration(-1.)
|
||||
@@ -379,7 +451,9 @@ struct aiAnimation {
|
||||
, mNumChannels(0)
|
||||
, mChannels(NULL)
|
||||
, mNumMeshChannels(0)
|
||||
, mMeshChannels(NULL) {
|
||||
, mMeshChannels(NULL)
|
||||
, mNumMorphMeshChannels(0)
|
||||
, mMorphMeshChannels(NULL) {
|
||||
// empty
|
||||
}
|
||||
|
||||
@@ -399,6 +473,13 @@ struct aiAnimation {
|
||||
|
||||
delete [] mMeshChannels;
|
||||
}
|
||||
if (mNumMorphMeshChannels && mMorphMeshChannels) {
|
||||
for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) {
|
||||
delete mMorphMeshChannels[a];
|
||||
}
|
||||
|
||||
delete [] mMorphMeshChannels;
|
||||
}
|
||||
}
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
@@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef AI_COLOR4D_H_INC
|
||||
#define AI_COLOR4D_H_INC
|
||||
|
||||
#include "./Compiler/pushpack1.h"
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -89,7 +88,7 @@ public:
|
||||
|
||||
// Red, green, blue and alpha color values
|
||||
TReal r, g, b, a;
|
||||
} PACK_STRUCT; // !struct aiColor4D
|
||||
}; // !struct aiColor4D
|
||||
|
||||
typedef aiColor4t<ai_real> aiColor4D;
|
||||
|
||||
@@ -97,10 +96,8 @@ typedef aiColor4t<ai_real> aiColor4D;
|
||||
|
||||
struct aiColor4D {
|
||||
ai_real r, g, b, a;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "./Compiler/poppack1.h"
|
||||
|
||||
#endif // AI_COLOR4D_H_INC
|
||||
|
||||
@@ -76,12 +76,34 @@ AI_FORCE_INLINE const aiColor4t<TReal>& aiColor4t<TReal>::operator /= (TReal f)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE TReal aiColor4t<TReal>::operator[](unsigned int i) const {
|
||||
return *(&r + i);
|
||||
//return *(&r + i);
|
||||
switch ( i ) {
|
||||
case 0:
|
||||
return r;
|
||||
case 1:
|
||||
return g;
|
||||
case 2:
|
||||
return b;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE TReal& aiColor4t<TReal>::operator[](unsigned int i) {
|
||||
return *(&r + i);
|
||||
// return *(&r + i);
|
||||
switch ( i ) {
|
||||
case 0:
|
||||
return r;
|
||||
case 1:
|
||||
return g;
|
||||
case 2:
|
||||
return b;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
|
||||
@@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef AI_MATRIX3X3_H_INC
|
||||
#define AI_MATRIX3X3_H_INC
|
||||
|
||||
#include "./Compiler/pushpack1.h"
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -153,7 +152,7 @@ public:
|
||||
/** @brief A function for creating a rotation matrix that rotates a
|
||||
* vector called "from" into another vector called "to".
|
||||
* Input : from[3], to[3] which both must be *normalized* non-zero vectors
|
||||
* Output: mtx[3][3] -- a 3x3 matrix in colum-major form
|
||||
* Output: mtx[3][3] -- a 3x3 matrix in column-major form
|
||||
* Authors: Tomas Möller, John Hughes
|
||||
* "Efficiently Building a Matrix to Rotate One Vector to Another"
|
||||
* Journal of Graphics Tools, 4(4):1-4, 1999
|
||||
@@ -165,7 +164,7 @@ public:
|
||||
TReal a1, a2, a3;
|
||||
TReal b1, b2, b3;
|
||||
TReal c1, c2, c3;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
typedef aiMatrix3x3t<ai_real> aiMatrix3x3;
|
||||
|
||||
@@ -175,10 +174,8 @@ struct aiMatrix3x3 {
|
||||
ai_real a1, a2, a3;
|
||||
ai_real b1, b2, b3;
|
||||
ai_real c1, c2, c3;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "./Compiler/poppack1.h"
|
||||
|
||||
#endif // AI_MATRIX3X3_H_INC
|
||||
|
||||
@@ -101,16 +101,34 @@ inline aiMatrix3x3t<TReal> aiMatrix3x3t<TReal>::operator* (const aiMatrix3x3t<TR
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex)
|
||||
{
|
||||
return &this->a1 + p_iIndex * 3;
|
||||
inline TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) {
|
||||
switch ( p_iIndex ) {
|
||||
case 0:
|
||||
return &a1;
|
||||
case 1:
|
||||
return &b1;
|
||||
case 2:
|
||||
return &c1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return &a1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const
|
||||
{
|
||||
return &this->a1 + p_iIndex * 3;
|
||||
inline const TReal* aiMatrix3x3t<TReal>::operator[] (unsigned int p_iIndex) const {
|
||||
switch ( p_iIndex ) {
|
||||
case 0:
|
||||
return &a1;
|
||||
case 1:
|
||||
return &b1;
|
||||
case 2:
|
||||
return &c1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return &a1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_MATRIX4X4_H_INC
|
||||
|
||||
#include "vector3.h"
|
||||
#include "./Compiler/pushpack1.h"
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -257,7 +256,7 @@ public:
|
||||
TReal b1, b2, b3, b4;
|
||||
TReal c1, c2, c3, c4;
|
||||
TReal d1, d2, d3, d4;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
typedef aiMatrix4x4t<ai_real> aiMatrix4x4;
|
||||
|
||||
@@ -268,11 +267,9 @@ struct aiMatrix4x4 {
|
||||
ai_real b1, b2, b3, b4;
|
||||
ai_real c1, c2, c3, c4;
|
||||
ai_real d1, d2, d3, d4;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "./Compiler/poppack1.h"
|
||||
|
||||
#endif // AI_MATRIX4X4_H_INC
|
||||
|
||||
@@ -243,9 +243,19 @@ inline TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) {
|
||||
if (p_iIndex > 3) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// XXX this is UB. Has been for years. The fact that it works now does not make it better.
|
||||
return &this->a1 + p_iIndex * 4;
|
||||
switch ( p_iIndex ) {
|
||||
case 0:
|
||||
return &a1;
|
||||
case 1:
|
||||
return &b1;
|
||||
case 2:
|
||||
return &c1;
|
||||
case 3:
|
||||
return &d1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return &a1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@@ -255,8 +265,19 @@ inline const TReal* aiMatrix4x4t<TReal>::operator[](unsigned int p_iIndex) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// XXX same
|
||||
return &this->a1 + p_iIndex * 4;
|
||||
switch ( p_iIndex ) {
|
||||
case 0:
|
||||
return &a1;
|
||||
case 1:
|
||||
return &b1;
|
||||
case 2:
|
||||
return &c1;
|
||||
case 3:
|
||||
return &d1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return &a1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -378,6 +378,9 @@ struct aiAnimMesh
|
||||
*/
|
||||
unsigned int mNumVertices;
|
||||
|
||||
/** Weight of the AnimMesh. */
|
||||
float mWeight;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
aiAnimMesh()
|
||||
@@ -446,6 +449,27 @@ struct aiAnimMesh
|
||||
#endif
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief Enumerates the methods of mesh morphing supported by Assimp.
|
||||
*/
|
||||
enum aiMorphingMethod
|
||||
{
|
||||
/** Interpolation between morph targets */
|
||||
aiMorphingMethod_VERTEX_BLEND = 0x1,
|
||||
|
||||
/** Normalized morphing between morph targets */
|
||||
aiMorphingMethod_MORPH_NORMALIZED = 0x2,
|
||||
|
||||
/** Relative morphing between morph targets */
|
||||
aiMorphingMethod_MORPH_RELATIVE = 0x3,
|
||||
|
||||
/** This value is not used. It is just here to force the
|
||||
* compiler to map this enum to a 32 Bit integer.
|
||||
*/
|
||||
#ifndef SWIG
|
||||
_aiMorphingMethod_Force32Bit = INT_MAX
|
||||
#endif
|
||||
}; //! enum aiMorphingMethod
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief A mesh represents a geometry or model with a single material.
|
||||
@@ -600,15 +624,18 @@ struct aiMesh
|
||||
C_STRUCT aiString mName;
|
||||
|
||||
|
||||
/** NOT CURRENTLY IN USE. The number of attachment meshes */
|
||||
/** The number of attachment meshes. Note! Currently only works with Collada loader. */
|
||||
unsigned int mNumAnimMeshes;
|
||||
|
||||
/** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.
|
||||
/** Attachment meshes for this mesh, for vertex-based animation.
|
||||
* Attachment meshes carry replacement data for some of the
|
||||
* mesh'es vertex components (usually positions, normals). */
|
||||
* mesh'es vertex components (usually positions, normals).
|
||||
* Note! Currently only works with Collada loader.*/
|
||||
C_STRUCT aiAnimMesh** mAnimMeshes;
|
||||
|
||||
|
||||
/** Method of morphing when animeshes are specified. */
|
||||
unsigned int mMethod;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor. Initializes all members to 0
|
||||
@@ -733,7 +760,6 @@ struct aiMesh
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //! extern "C"
|
||||
|
||||
@@ -69,7 +69,7 @@ extern "C" {
|
||||
* the imported scene does consist of only a single root node without children.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
struct aiNode
|
||||
struct ASSIMP_API aiNode
|
||||
{
|
||||
/** The name of the node.
|
||||
*
|
||||
@@ -124,47 +124,13 @@ struct aiNode
|
||||
|
||||
#ifdef __cplusplus
|
||||
/** Constructor */
|
||||
aiNode()
|
||||
// set all members to zero by default
|
||||
: mName("")
|
||||
, mParent(NULL)
|
||||
, mNumChildren(0)
|
||||
, mChildren(NULL)
|
||||
, mNumMeshes(0)
|
||||
, mMeshes(NULL)
|
||||
, mMetaData(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
aiNode();
|
||||
|
||||
/** Construction from a specific name */
|
||||
explicit aiNode(const std::string& name)
|
||||
// set all members to zero by default
|
||||
: mName(name)
|
||||
, mParent(NULL)
|
||||
, mNumChildren(0)
|
||||
, mChildren(NULL)
|
||||
, mNumMeshes(0)
|
||||
, mMeshes(NULL)
|
||||
, mMetaData(NULL)
|
||||
{
|
||||
}
|
||||
explicit aiNode(const std::string& name);
|
||||
|
||||
/** Destructor */
|
||||
~aiNode()
|
||||
{
|
||||
// delete all children recursively
|
||||
// to make sure we won't crash if the data is invalid ...
|
||||
if (mChildren && mNumChildren)
|
||||
{
|
||||
for( unsigned int a = 0; a < mNumChildren; a++)
|
||||
delete mChildren[a];
|
||||
}
|
||||
delete [] mChildren;
|
||||
delete [] mMeshes;
|
||||
delete mMetaData;
|
||||
}
|
||||
|
||||
~aiNode();
|
||||
|
||||
/** Searches for a node with a specific name, beginning at this
|
||||
* nodes. Normally you will call this method on the root node
|
||||
@@ -173,46 +139,26 @@ struct aiNode
|
||||
* @param name Name to search for
|
||||
* @return NULL or a valid Node if the search was successful.
|
||||
*/
|
||||
inline const aiNode* FindNode(const aiString& name) const
|
||||
{
|
||||
inline
|
||||
const aiNode* FindNode(const aiString& name) const {
|
||||
return FindNode(name.data);
|
||||
}
|
||||
|
||||
|
||||
inline aiNode* FindNode(const aiString& name)
|
||||
{
|
||||
inline
|
||||
aiNode* FindNode(const aiString& name) {
|
||||
return FindNode(name.data);
|
||||
}
|
||||
|
||||
const aiNode* FindNode(const char* name) const;
|
||||
|
||||
inline const aiNode* FindNode(const char* name) const
|
||||
{
|
||||
if (!::strcmp( mName.data,name))return this;
|
||||
for (unsigned int i = 0; i < mNumChildren;++i)
|
||||
{
|
||||
const aiNode* const p = mChildren[i]->FindNode(name);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
// there is definitely no sub-node with this name
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline aiNode* FindNode(const char* name)
|
||||
{
|
||||
if (!::strcmp( mName.data,name))return this;
|
||||
for (unsigned int i = 0; i < mNumChildren;++i)
|
||||
{
|
||||
aiNode* const p = mChildren[i]->FindNode(name);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
// there is definitely no sub-node with this name
|
||||
return NULL;
|
||||
}
|
||||
aiNode* FindNode(const char* name);
|
||||
|
||||
/**
|
||||
* @brief Will add new children.
|
||||
* @param numChildren Number of children to add.
|
||||
* @param children The array with pointers showing to the children.
|
||||
*/
|
||||
void addChildren(unsigned int numChildren, aiNode **children);
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#include "./Compiler/pushpack1.h"
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -126,7 +125,7 @@ public:
|
||||
const aiVector3t SymMul(const aiVector3t& o);
|
||||
|
||||
TReal x, y, z;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
|
||||
typedef aiVector3t<ai_real> aiVector3D;
|
||||
@@ -135,16 +134,12 @@ typedef aiVector3t<ai_real> aiVector3D;
|
||||
|
||||
struct aiVector3D {
|
||||
ai_real x, y, z;
|
||||
} PACK_STRUCT;
|
||||
};
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#include "./Compiler/poppack1.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // AI_VECTOR3D_H_INC
|
||||
|
||||
@@ -141,12 +141,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
|
||||
return *(&x + i);
|
||||
// return *(&x + i);
|
||||
switch (i) {
|
||||
case 0:
|
||||
return x;
|
||||
case 1:
|
||||
return y;
|
||||
case 2:
|
||||
return z;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
|
||||
return *(&x + i);
|
||||
// return *(&x + i);
|
||||
switch (i) {
|
||||
case 0:
|
||||
return x;
|
||||
case 1:
|
||||
return y;
|
||||
case 2:
|
||||
return z;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename TReal>
|
||||
|
||||
Reference in New Issue
Block a user