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-10-31 19:32:00 +00:00
|
|
|
|
/** @file Defines the data structures in which the imported animations
|
|
|
|
|
are returned. */
|
2008-05-05 12:36:31 +00:00
|
|
|
|
#ifndef AI_ANIM_H_INC
|
|
|
|
|
#define AI_ANIM_H_INC
|
|
|
|
|
|
|
|
|
|
#include "aiTypes.h"
|
|
|
|
|
#include "aiQuaternion.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/** A time-value pair specifying a certain 3D vector for the given time. */
|
|
|
|
|
struct aiVectorKey
|
|
|
|
|
{
|
|
|
|
|
double mTime; ///< The time of this key
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiVector3D mValue; ///< The value of this key
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
|
|
// time is not compared
|
|
|
|
|
bool operator == (const aiVectorKey& o) const
|
|
|
|
|
{return o.mValue == this->mValue;}
|
|
|
|
|
|
|
|
|
|
bool operator != (const aiVectorKey& o) const
|
|
|
|
|
{return o.mValue != this->mValue;}
|
|
|
|
|
|
|
|
|
|
#endif
|
2008-05-05 12:36:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** A time-value pair specifying a rotation for the given time. For joint
|
|
|
|
|
* animations the rotation is usually expressed using a quaternion.
|
2008-05-05 12:36:31 +00:00
|
|
|
|
*/
|
|
|
|
|
struct aiQuatKey
|
|
|
|
|
{
|
|
|
|
|
double mTime; ///< The time of this key
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiQuaternion mValue; ///< The value of this key
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
|
|
// time is not compared
|
|
|
|
|
bool operator == (const aiQuatKey& o) const
|
|
|
|
|
{return o.mValue == this->mValue;}
|
|
|
|
|
|
|
|
|
|
bool operator != (const aiQuatKey& o) const
|
|
|
|
|
{return o.mValue != this->mValue;}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum aiAnimBehaviour
|
|
|
|
|
{
|
|
|
|
|
// --- Wert aus Node-Transformation wird <20>bernommen
|
|
|
|
|
aiAnimBehaviour_DEFAULT = 0x0,
|
|
|
|
|
|
|
|
|
|
// -- N<>chster Key wird verwendet
|
|
|
|
|
aiAnimBehaviour_CONSTANT = 0x1,
|
|
|
|
|
|
|
|
|
|
// -- N<>chste beiden Keys werden linear extrapoliert
|
|
|
|
|
aiAnimBehaviour_LINEAR = 0x2,
|
|
|
|
|
|
|
|
|
|
// -- Animation wird wiederholt
|
|
|
|
|
// Und das solange bis die Animationszeit (aiAnimation::mDuration)
|
|
|
|
|
// abgelaufen ist. Ist diese 0 l<>uft das ganze ewig.
|
|
|
|
|
aiAnimBehaviour_REPEAT = 0x3
|
2008-05-05 12:36:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** Describes the animation of a single node. The name specifies the
|
|
|
|
|
* bone/node which is affected by this animation channel. The keyframes
|
|
|
|
|
* are given in three separate series of values, one each for position,
|
|
|
|
|
* rotation and scaling. The transformation matrix computed from these
|
|
|
|
|
* values replaces the node's original transformation matrix at a
|
|
|
|
|
* spefific time.
|
2008-05-05 12:36:31 +00:00
|
|
|
|
*/
|
2008-09-30 13:05:48 +00:00
|
|
|
|
struct aiNodeAnim
|
2008-05-05 12:36:31 +00:00
|
|
|
|
{
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** The name of the node affected by this animation. The node
|
|
|
|
|
* must exist anf it must be unique.
|
|
|
|
|
*/
|
2008-09-30 13:05:48 +00:00
|
|
|
|
C_STRUCT aiString mNodeName;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
/** The number of position keys */
|
|
|
|
|
unsigned int mNumPositionKeys;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
/** The position keys of this animation channel. Positions are
|
|
|
|
|
* specified as 3D vector. The array is mNumPositionKeys in size.
|
|
|
|
|
*
|
|
|
|
|
* If there are rotation or scaling keys, but no position keys,
|
|
|
|
|
* a constant position of 0|0|0 should be assumed.
|
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiVectorKey* mPositionKeys;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
/** The number of rotation keys */
|
|
|
|
|
unsigned int mNumRotationKeys;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
/** The rotation keys of this animation channel. Rotations are
|
|
|
|
|
* given as quaternions, which are 4D vectors. The array is
|
|
|
|
|
* mNumRotationKeys in size.
|
|
|
|
|
*
|
|
|
|
|
* If there are position or scaling keys, but no rotation keys,
|
|
|
|
|
* a constant rotation of 0|0|0 should be assumed.
|
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiQuatKey* mRotationKeys;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
|
/** The number of scaling keys */
|
|
|
|
|
unsigned int mNumScalingKeys;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
/** The scaling keys of this animation channel. Scalings are
|
|
|
|
|
* specified as 3D vector. The array is mNumScalingKeys in size.
|
|
|
|
|
*
|
|
|
|
|
* If there are position or rotation keys, but no scaling keys,
|
|
|
|
|
* a constant scaling of 1|1|1 should be assumed.
|
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiVectorKey* mScalingKeys;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
aiAnimBehaviour mPrePostState;
|
|
|
|
|
|
2008-05-05 12:36:31 +00:00
|
|
|
|
#ifdef __cplusplus
|
2008-09-30 13:05:48 +00:00
|
|
|
|
aiNodeAnim()
|
2008-05-05 12:36:31 +00:00
|
|
|
|
{
|
|
|
|
|
mNumPositionKeys = 0; mPositionKeys = NULL;
|
|
|
|
|
mNumRotationKeys= 0; mRotationKeys = NULL;
|
|
|
|
|
mNumScalingKeys = 0; mScalingKeys = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-30 13:05:48 +00:00
|
|
|
|
~aiNodeAnim()
|
2008-05-05 12:36:31 +00:00
|
|
|
|
{
|
2008-07-10 16:49:01 +00:00
|
|
|
|
if (mNumPositionKeys)
|
|
|
|
|
delete [] mPositionKeys;
|
|
|
|
|
if (mNumRotationKeys)
|
|
|
|
|
delete [] mRotationKeys;
|
|
|
|
|
if (mNumScalingKeys)
|
|
|
|
|
delete [] mScalingKeys;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
}
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
};
|
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** An animation consists of keyframe data for a number of nodes. For
|
|
|
|
|
* each node affected by the animation a separate series of data is given.
|
2008-05-05 12:36:31 +00:00
|
|
|
|
*/
|
|
|
|
|
struct aiAnimation
|
|
|
|
|
{
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** The name of the animation. If the modelling package this data was
|
|
|
|
|
* exported from does support only a single animation channel, this
|
|
|
|
|
* name is usually empty (length is zero).
|
|
|
|
|
*/
|
2008-05-09 17:24:28 +00:00
|
|
|
|
C_STRUCT aiString mName;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** Duration of the animation in ticks.
|
|
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
|
double mDuration;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
/** Ticks per second. 0 if not specified in the imported file
|
|
|
|
|
*/
|
2008-05-05 12:36:31 +00:00
|
|
|
|
double mTicksPerSecond;
|
|
|
|
|
|
2008-10-31 19:32:00 +00:00
|
|
|
|
/** The number of bone animation channels. Each channel affects
|
|
|
|
|
* a single node.
|
|
|
|
|
*/
|
2008-09-30 13:05:48 +00:00
|
|
|
|
unsigned int mNumChannels;
|
2008-10-31 19:32:00 +00:00
|
|
|
|
|
|
|
|
|
/** The node animation channels. Each channel affects a single node.
|
|
|
|
|
* The array is mNumChannels in size.
|
|
|
|
|
*/
|
2008-09-30 13:05:48 +00:00
|
|
|
|
C_STRUCT aiNodeAnim** mChannels;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
aiAnimation()
|
|
|
|
|
{
|
|
|
|
|
mDuration = 0;
|
|
|
|
|
mTicksPerSecond = 0;
|
2008-09-30 13:05:48 +00:00
|
|
|
|
mNumChannels = 0; mChannels = NULL;
|
2008-05-05 12:36:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~aiAnimation()
|
|
|
|
|
{
|
2008-09-30 13:05:48 +00:00
|
|
|
|
if (mNumChannels)
|
2008-07-10 16:49:01 +00:00
|
|
|
|
{
|
2008-09-30 13:05:48 +00:00
|
|
|
|
for( unsigned int a = 0; a < mNumChannels; a++)
|
|
|
|
|
delete mChannels[a];
|
|
|
|
|
delete [] mChannels;
|
2008-07-10 16:49:01 +00:00
|
|
|
|
}
|
2008-05-05 12:36:31 +00:00
|
|
|
|
}
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // AI_ANIM_H_INC
|