diff options
Diffstat (limited to 'src/3rdparty/assimp/include/assimp/anim.h')
-rw-r--r-- | src/3rdparty/assimp/include/assimp/anim.h | 187 |
1 files changed, 97 insertions, 90 deletions
diff --git a/src/3rdparty/assimp/include/assimp/anim.h b/src/3rdparty/assimp/include/assimp/anim.h index 393224e40..f8774b8fd 100644 --- a/src/3rdparty/assimp/include/assimp/anim.h +++ b/src/3rdparty/assimp/include/assimp/anim.h @@ -3,7 +3,8 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2016, assimp team +Copyright (c) 2006-2017, assimp team + All rights reserved. @@ -39,15 +40,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------- */ -/** @file anim.h - * @brief Defines the data structures in which the imported animations - * are returned. - */ +/** + * @file anim.h + * @brief Defines the data structures in which the imported animations + * are returned. + */ +#pragma once #ifndef AI_ANIM_H_INC #define AI_ANIM_H_INC -#include "types.h" -#include "quaternion.h" +#include <assimp/types.h> +#include <assimp/quaternion.h> #ifdef __cplusplus extern "C" { @@ -65,16 +68,20 @@ struct aiVectorKey #ifdef __cplusplus - //! Default constructor - aiVectorKey(){} + /// @brief The default constructor. + aiVectorKey() + : mTime( 0.0 ) + , mValue() { + // empty + } + + /// @brief Construction from a given time and key value. - //! Construction from a given time and key value aiVectorKey(double time, const aiVector3D& value) : mTime (time) , mValue (value) {} - typedef aiVector3D elem_type; // Comparison operators. For use with std::find(); @@ -92,7 +99,7 @@ struct aiVectorKey bool operator > (const aiVectorKey& o) const { return mTime > o.mTime; } -#endif +#endif // __cplusplus }; // --------------------------------------------------------------------------- @@ -107,7 +114,10 @@ struct aiQuatKey C_STRUCT aiQuaternion mValue; #ifdef __cplusplus - aiQuatKey(){ + aiQuatKey() + : mTime( 0.0 ) + , mValue() { + // empty } /** Construction from a given time and key value */ @@ -144,7 +154,7 @@ struct aiMeshKey double mTime; /** Index into the aiMesh::mAnimMeshes array of the - * mesh coresponding to the #aiMeshAnim hosting this + * mesh corresponding to the #aiMeshAnim hosting this * key frame. The referenced anim mesh is evaluated * according to the rules defined in the docs for #aiAnimMesh.*/ unsigned int mValue; @@ -181,7 +191,6 @@ struct aiMeshKey #endif }; - // --------------------------------------------------------------------------- /** Binds a morph anim mesh to a specific point in time. */ struct aiMeshMorphKey @@ -197,10 +206,10 @@ struct aiMeshMorphKey unsigned int mNumValuesAndWeights; #ifdef __cplusplus aiMeshMorphKey() - : mTime(0.0) - , mValues(NULL) - , mWeights(NULL) - , mNumValuesAndWeights(0) + : mTime(0.0) + , mValues(NULL) + , mWeights(NULL) + , mNumValuesAndWeights(0) { } @@ -237,8 +246,6 @@ enum aiAnimBehaviour * time is t, use the value at (t-n) % (|m-n|).*/ aiAnimBehaviour_REPEAT = 0x3, - - /** This value is not used, it is just here to force the * the compiler to map this enum to a 32 Bit integer */ #ifndef SWIG @@ -261,8 +268,7 @@ enum aiAnimBehaviour * Duplicate keys don't pass the validation step. Most likely there * will be no negative time values, but they are not forbidden also ( so * implementations need to cope with them! ) */ -struct aiNodeAnim -{ +struct aiNodeAnim { /** The name of the node affected by this animation. The node * must exist and it must be unique.*/ C_STRUCT aiString mNodeName; @@ -288,7 +294,6 @@ struct aiNodeAnim * scaling and one position key. */ C_STRUCT aiQuatKey* mRotationKeys; - /** The number of scaling keys */ unsigned int mNumScalingKeys; @@ -299,7 +304,6 @@ struct aiNodeAnim * position and one rotation key.*/ C_STRUCT aiVectorKey* mScalingKeys; - /** Defines how the animation behaves before the first * key is encountered. * @@ -315,17 +319,19 @@ struct aiNodeAnim C_ENUM aiAnimBehaviour mPostState; #ifdef __cplusplus - aiNodeAnim() - { - mNumPositionKeys = 0; mPositionKeys = NULL; - mNumRotationKeys = 0; mRotationKeys = NULL; - mNumScalingKeys = 0; mScalingKeys = NULL; - - mPreState = mPostState = aiAnimBehaviour_DEFAULT; + aiNodeAnim() + : mNumPositionKeys( 0 ) + , mPositionKeys( NULL ) + , mNumRotationKeys( 0 ) + , mRotationKeys( NULL ) + , mNumScalingKeys( 0 ) + , mScalingKeys( NULL ) + , mPreState( aiAnimBehaviour_DEFAULT ) + , mPostState( aiAnimBehaviour_DEFAULT ) { + // empty } - ~aiNodeAnim() - { + ~aiNodeAnim() { delete [] mPositionKeys; delete [] mRotationKeys; delete [] mScalingKeys; @@ -343,7 +349,7 @@ struct aiMeshAnim { /** 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 + * the name can basically serve as wild-card to select a group * of meshes with similar animation setup)*/ C_STRUCT aiString mName; @@ -400,10 +406,9 @@ struct aiMeshMorphAnim }; // --------------------------------------------------------------------------- -/** An animation consists of keyframe data for a number of nodes. For +/** 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.*/ -struct aiAnimation -{ +struct aiAnimation { /** The name of the animation. If the modeling package this data was * exported from does support only a single animation channel, this * name is usually empty (length is zero). */ @@ -432,7 +437,6 @@ 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; @@ -442,56 +446,59 @@ struct aiAnimation C_STRUCT aiMeshMorphAnim **mMorphMeshChannels; #ifdef __cplusplus - aiAnimation() - : mDuration(-1.) - , mTicksPerSecond() - , mNumChannels() - , mChannels() - , mNumMeshChannels() - , mMeshChannels() - , mNumMorphMeshChannels() - , mMorphMeshChannels() - { - } + aiAnimation() + : mDuration(-1.) + , mTicksPerSecond(0.) + , mNumChannels(0) + , mChannels(NULL) + , mNumMeshChannels(0) + , mMeshChannels(NULL) + , mNumMorphMeshChannels(0) + , mMorphMeshChannels(NULL) { + // empty + } - ~aiAnimation() - { - // DO NOT REMOVE THIS ADDITIONAL CHECK - if (mNumChannels && mChannels) { - for( unsigned int a = 0; a < mNumChannels; a++) { - delete mChannels[a]; - } - - delete [] mChannels; - } - if (mNumMeshChannels && mMeshChannels) { - for( unsigned int a = 0; a < mNumMeshChannels; a++) { - delete mMeshChannels[a]; - } - - delete [] mMeshChannels; - } - if (mNumMorphMeshChannels && mMorphMeshChannels) { - for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) { - delete mMorphMeshChannels[a]; - } - } - } + ~aiAnimation() { + // DO NOT REMOVE THIS ADDITIONAL CHECK + if ( mNumChannels && mChannels ) { + for( unsigned int a = 0; a < mNumChannels; a++) { + delete mChannels[ a ]; + } + + delete [] mChannels; + } + if (mNumMeshChannels && mMeshChannels) { + for( unsigned int a = 0; a < mNumMeshChannels; a++) { + delete mMeshChannels[a]; + } + + delete [] mMeshChannels; + } + if (mNumMorphMeshChannels && mMorphMeshChannels) { + for( unsigned int a = 0; a < mNumMorphMeshChannels; a++) { + delete mMorphMeshChannels[a]; + } + + delete [] mMorphMeshChannels; + } + } #endif // __cplusplus }; #ifdef __cplusplus -} +} -// some C++ utilities for inter- and extrapolation +/// @brief Some C++ utilities for inter- and extrapolation namespace Assimp { // --------------------------------------------------------------------------- -/** @brief CPP-API: Utility class to simplify interpolations of various data types. - * - * The type of interpolation is chosen automatically depending on the - * types of the arguments. */ +/** + * @brief CPP-API: Utility class to simplify interpolations of various data types. + * + * The type of interpolation is chosen automatically depending on the + * types of the arguments. + */ template <typename T> struct Interpolator { @@ -501,7 +508,7 @@ struct Interpolator * The interpolation algorithm depends on the type of the operands. * aiQuaternion's and aiQuatKey's SLERP, the rest does a simple * linear interpolation. */ - void operator () (T& out,const T& a, const T& b, float d) const { + void operator () (T& out,const T& a, const T& b, ai_real d) const { out = a + (b-a)*d; } }; // ! Interpolator <T> @@ -511,7 +518,7 @@ struct Interpolator template <> struct Interpolator <aiQuaternion> { void operator () (aiQuaternion& out,const aiQuaternion& a, - const aiQuaternion& b, float d) const + const aiQuaternion& b, ai_real d) const { aiQuaternion::Interpolate(out,a,b,d); } @@ -520,16 +527,16 @@ struct Interpolator <aiQuaternion> { template <> struct Interpolator <unsigned int> { void operator () (unsigned int& out,unsigned int a, - unsigned int b, float d) const + unsigned int b, ai_real d) const { out = d>0.5f ? b : a; } }; // ! Interpolator <aiQuaternion> template <> -struct Interpolator <aiVectorKey> { +struct Interpolator<aiVectorKey> { void operator () (aiVector3D& out,const aiVectorKey& a, - const aiVectorKey& b, float d) const + const aiVectorKey& b, ai_real d) const { Interpolator<aiVector3D> ipl; ipl(out,a.mValue,b.mValue,d); @@ -537,9 +544,9 @@ struct Interpolator <aiVectorKey> { }; // ! Interpolator <aiVectorKey> template <> -struct Interpolator <aiQuatKey> { +struct Interpolator<aiQuatKey> { void operator () (aiQuaternion& out, const aiQuatKey& a, - const aiQuatKey& b, float d) const + const aiQuatKey& b, ai_real d) const { Interpolator<aiQuaternion> ipl; ipl(out,a.mValue,b.mValue,d); @@ -547,9 +554,9 @@ struct Interpolator <aiQuatKey> { }; // ! Interpolator <aiQuatKey> template <> -struct Interpolator <aiMeshKey> { +struct Interpolator<aiMeshKey> { void operator () (unsigned int& out, const aiMeshKey& a, - const aiMeshKey& b, float d) const + const aiMeshKey& b, ai_real d) const { Interpolator<unsigned int> ipl; ipl(out,a.mValue,b.mValue,d); @@ -557,9 +564,9 @@ struct Interpolator <aiMeshKey> { }; // ! Interpolator <aiQuatKey> //! @endcond -} // ! end namespace Assimp - +} // ! end namespace Assimp #endif // __cplusplus + #endif // AI_ANIM_H_INC |