mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
animation update
updated how animations are handled from assimp gltf timing now correct
This commit is contained in:
parent
5f1c2a63e5
commit
28fcb8d68b
6 changed files with 161 additions and 160 deletions
|
|
@ -135,115 +135,104 @@ MatrixF AssimpAppNode::getTransform(F32 time)
|
||||||
|
|
||||||
void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq)
|
void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq)
|
||||||
{
|
{
|
||||||
// Find the channel for this node
|
// Convert time `t` (in seconds) to a frame index
|
||||||
|
const F32 frameTime = (t * animSeq->mTicksPerSecond + 0.5f) + 1.0f;
|
||||||
|
|
||||||
|
// Loop through animation channels to find the matching node
|
||||||
for (U32 k = 0; k < animSeq->mNumChannels; ++k)
|
for (U32 k = 0; k < animSeq->mNumChannels; ++k)
|
||||||
{
|
{
|
||||||
if (dStrcmp(mName, animSeq->mChannels[k]->mNodeName.C_Str()) == 0)
|
const aiNodeAnim* nodeAnim = animSeq->mChannels[k];
|
||||||
|
if (dStrcmp(mName, nodeAnim->mNodeName.C_Str()) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Point3F translation(Point3F::Zero);
|
||||||
|
QuatF rotation(QuatF::Identity);
|
||||||
|
Point3F scale(Point3F::One);
|
||||||
|
|
||||||
|
// Interpolate Translation Keys
|
||||||
|
if (nodeAnim->mNumPositionKeys > 0)
|
||||||
{
|
{
|
||||||
aiNodeAnim *nodeAnim = animSeq->mChannels[k];
|
translation = interpolateVectorKey(nodeAnim->mPositionKeys, nodeAnim->mNumPositionKeys, frameTime);
|
||||||
Point3F trans(Point3F::Zero);
|
}
|
||||||
Point3F scale(Point3F::One);
|
|
||||||
QuatF rot;
|
|
||||||
rot.identity();
|
|
||||||
// T is in seconds, convert to frames.
|
|
||||||
F32 frame = (t * animSeq->mTicksPerSecond + 0.5f) + 1.0f;
|
|
||||||
|
|
||||||
// Transform
|
// Interpolate Rotation Keys
|
||||||
if (nodeAnim->mNumPositionKeys == 1)
|
if (nodeAnim->mNumRotationKeys > 0)
|
||||||
trans.set(nodeAnim->mPositionKeys[0].mValue.x, nodeAnim->mPositionKeys[0].mValue.y, nodeAnim->mPositionKeys[0].mValue.z);
|
{
|
||||||
else
|
rotation = interpolateQuaternionKey(nodeAnim->mRotationKeys, nodeAnim->mNumRotationKeys, frameTime);
|
||||||
{
|
}
|
||||||
Point3F curPos, lastPos;
|
|
||||||
F32 lastT = 0.0;
|
|
||||||
for (U32 key = 0; key < nodeAnim->mNumPositionKeys; ++key)
|
|
||||||
{
|
|
||||||
F32 curT = sTimeMultiplier * (F32)nodeAnim->mPositionKeys[key].mTime;
|
|
||||||
curPos.set(nodeAnim->mPositionKeys[key].mValue.x, nodeAnim->mPositionKeys[key].mValue.y, nodeAnim->mPositionKeys[key].mValue.z);
|
|
||||||
if ((curT > frame) && (key > 0))
|
|
||||||
{
|
|
||||||
F32 factor = (frame - lastT) / (curT - lastT);
|
|
||||||
trans.interpolate(lastPos, curPos, factor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if ((curT >= frame) || (key == nodeAnim->mNumPositionKeys - 1))
|
|
||||||
{
|
|
||||||
trans = curPos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastT = curT;
|
// Interpolate Scaling Keys
|
||||||
lastPos = curPos;
|
if (nodeAnim->mNumScalingKeys > 0)
|
||||||
}
|
{
|
||||||
}
|
scale = interpolateVectorKey(nodeAnim->mScalingKeys, nodeAnim->mNumScalingKeys, frameTime);
|
||||||
|
}
|
||||||
|
|
||||||
// Rotation
|
// Apply the interpolated transform components to the matrix
|
||||||
if (nodeAnim->mNumRotationKeys == 1)
|
rotation.setMatrix(&mat);
|
||||||
rot.set(nodeAnim->mRotationKeys[0].mValue.x, nodeAnim->mRotationKeys[0].mValue.y,
|
mat.inverse();
|
||||||
nodeAnim->mRotationKeys[0].mValue.z, nodeAnim->mRotationKeys[0].mValue.w);
|
mat.setPosition(translation);
|
||||||
else
|
mat.scale(scale);
|
||||||
{
|
|
||||||
QuatF curRot, lastRot;
|
|
||||||
F32 lastT = 0.0;
|
|
||||||
for (U32 key = 0; key < nodeAnim->mNumRotationKeys; ++key)
|
|
||||||
{
|
|
||||||
F32 curT = sTimeMultiplier * (F32)nodeAnim->mRotationKeys[key].mTime;
|
|
||||||
curRot.set(nodeAnim->mRotationKeys[key].mValue.x, nodeAnim->mRotationKeys[key].mValue.y,
|
|
||||||
nodeAnim->mRotationKeys[key].mValue.z, nodeAnim->mRotationKeys[key].mValue.w);
|
|
||||||
if ((curT > frame) && (key > 0))
|
|
||||||
{
|
|
||||||
F32 factor = (frame - lastT) / (curT - lastT);
|
|
||||||
rot.interpolate(lastRot, curRot, factor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if ((curT >= frame) || (key == nodeAnim->mNumRotationKeys - 1))
|
|
||||||
{
|
|
||||||
rot = curRot;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastT = curT;
|
return; // Exit after processing the matching node
|
||||||
lastRot = curRot;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale
|
// Default to the static node transformation if no animation data is found
|
||||||
if (nodeAnim->mNumScalingKeys == 1)
|
mat = mNodeTransform;
|
||||||
scale.set(nodeAnim->mScalingKeys[0].mValue.x, nodeAnim->mScalingKeys[0].mValue.y, nodeAnim->mScalingKeys[0].mValue.z);
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Point3F curScale, lastScale;
|
|
||||||
F32 lastT = 0.0;
|
|
||||||
for (U32 key = 0; key < nodeAnim->mNumScalingKeys; ++key)
|
|
||||||
{
|
|
||||||
F32 curT = sTimeMultiplier * (F32)nodeAnim->mScalingKeys[key].mTime;
|
|
||||||
curScale.set(nodeAnim->mScalingKeys[key].mValue.x, nodeAnim->mScalingKeys[key].mValue.y, nodeAnim->mScalingKeys[key].mValue.z);
|
|
||||||
if ((curT > frame) && (key > 0))
|
|
||||||
{
|
|
||||||
F32 factor = (frame - lastT) / (curT - lastT);
|
|
||||||
scale.interpolate(lastScale, curScale, factor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if ((curT >= frame) || (key == nodeAnim->mNumScalingKeys - 1))
|
|
||||||
{
|
|
||||||
scale = curScale;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastT = curT;
|
Point3F AssimpAppNode::interpolateVectorKey(const aiVectorKey* keys, U32 numKeys, F32 frameTime)
|
||||||
lastScale = curScale;
|
{
|
||||||
}
|
if (numKeys == 1) // Single keyframe: use it directly
|
||||||
}
|
return Point3F(keys[0].mValue.x, keys[0].mValue.y, keys[0].mValue.z);
|
||||||
|
|
||||||
rot.setMatrix(&mat);
|
// Clamp frameTime to the bounds of the keyframes
|
||||||
mat.inverse();
|
if (frameTime <= keys[0].mTime) {
|
||||||
mat.setPosition(trans);
|
// Before the first keyframe, return the first key
|
||||||
mat.scale(scale);
|
return Point3F(keys[0].mValue.x, keys[0].mValue.y, keys[0].mValue.z);
|
||||||
return;
|
}
|
||||||
|
if (frameTime >= keys[numKeys - 1].mTime) {
|
||||||
|
// After the last keyframe, return the last key
|
||||||
|
return Point3F(keys[numKeys - 1].mValue.x, keys[numKeys - 1].mValue.y, keys[numKeys - 1].mValue.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interpolate between the two nearest keyframes
|
||||||
|
for (U32 i = 1; i < numKeys; ++i)
|
||||||
|
{
|
||||||
|
if (frameTime < keys[i].mTime)
|
||||||
|
{
|
||||||
|
const F32 factor = (frameTime - keys[i - 1].mTime) / (keys[i].mTime - keys[i - 1].mTime);
|
||||||
|
Point3F start(keys[i - 1].mValue.x, keys[i - 1].mValue.y, keys[i - 1].mValue.z);
|
||||||
|
Point3F end(keys[i].mValue.x, keys[i].mValue.y, keys[i].mValue.z);
|
||||||
|
Point3F result;
|
||||||
|
result.interpolate(start, end, factor);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Node not found in the animation channels
|
// Default to the last keyframe
|
||||||
mat = mNodeTransform;
|
return Point3F(keys[numKeys - 1].mValue.x, keys[numKeys - 1].mValue.y, keys[numKeys - 1].mValue.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
QuatF AssimpAppNode::interpolateQuaternionKey(const aiQuatKey* keys, U32 numKeys, F32 frameTime)
|
||||||
|
{
|
||||||
|
if (numKeys == 1) // Single keyframe: use it directly
|
||||||
|
return QuatF(keys[0].mValue.x, keys[0].mValue.y, keys[0].mValue.z, keys[0].mValue.w);
|
||||||
|
|
||||||
|
for (U32 i = 1; i < numKeys; ++i)
|
||||||
|
{
|
||||||
|
if (frameTime < keys[i].mTime)
|
||||||
|
{
|
||||||
|
const F32 factor = (frameTime - keys[i - 1].mTime) / (keys[i].mTime - keys[i - 1].mTime);
|
||||||
|
QuatF start(keys[i - 1].mValue.x, keys[i - 1].mValue.y, keys[i - 1].mValue.z, keys[i - 1].mValue.w);
|
||||||
|
QuatF end(keys[i].mValue.x, keys[i].mValue.y, keys[i].mValue.z, keys[i].mValue.w);
|
||||||
|
QuatF result;
|
||||||
|
result.interpolate(start, end, factor);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default to the last keyframe
|
||||||
|
return QuatF(keys[numKeys - 1].mValue.x, keys[numKeys - 1].mValue.y, keys[numKeys - 1].mValue.z, keys[numKeys - 1].mValue.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AssimpAppNode::animatesTransform(const AppSequence* appSeq)
|
bool AssimpAppNode::animatesTransform(const AppSequence* appSeq)
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ class AssimpAppNode : public AppNode
|
||||||
|
|
||||||
MatrixF getTransform(F32 time);
|
MatrixF getTransform(F32 time);
|
||||||
void getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq);
|
void getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq);
|
||||||
|
Point3F interpolateVectorKey(const aiVectorKey* keys, U32 numKeys, F32 frameTime);
|
||||||
|
QuatF interpolateQuaternionKey(const aiQuatKey* keys, U32 numKeys, F32 frameTime);
|
||||||
void buildMeshList() override;
|
void buildMeshList() override;
|
||||||
void buildChildList() override;
|
void buildChildList() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,94 +12,103 @@
|
||||||
#include "ts/assimp/assimpAppSequence.h"
|
#include "ts/assimp/assimpAppSequence.h"
|
||||||
#include "ts/assimp/assimpAppNode.h"
|
#include "ts/assimp/assimpAppNode.h"
|
||||||
|
|
||||||
AssimpAppSequence::AssimpAppSequence(aiAnimation *a) :
|
AssimpAppSequence::AssimpAppSequence(aiAnimation* a)
|
||||||
seqStart(0.0f),
|
: seqStart(0.0f), seqEnd(0.0f), mTimeMultiplier(1.0f)
|
||||||
seqEnd(0.0f)
|
|
||||||
{
|
{
|
||||||
|
fps = 30.0f;
|
||||||
|
// Deep copy animation structure
|
||||||
mAnim = new aiAnimation(*a);
|
mAnim = new aiAnimation(*a);
|
||||||
// Deep copy channels
|
|
||||||
mAnim->mChannels = new aiNodeAnim * [a->mNumChannels];
|
mAnim->mChannels = new aiNodeAnim * [a->mNumChannels];
|
||||||
for (U32 i = 0; i < a->mNumChannels; ++i) {
|
for (U32 i = 0; i < a->mNumChannels; ++i) {
|
||||||
mAnim->mChannels[i] = new aiNodeAnim(*a->mChannels[i]);
|
mAnim->mChannels[i] = new aiNodeAnim(*a->mChannels[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deep copy meshes
|
|
||||||
mAnim->mMeshChannels = new aiMeshAnim * [a->mNumMeshChannels];
|
mAnim->mMeshChannels = new aiMeshAnim * [a->mNumMeshChannels];
|
||||||
for (U32 i = 0; i < a->mNumMeshChannels; ++i) {
|
for (U32 i = 0; i < a->mNumMeshChannels; ++i) {
|
||||||
mAnim->mMeshChannels[i] = new aiMeshAnim(*a->mMeshChannels[i]);
|
mAnim->mMeshChannels[i] = new aiMeshAnim(*a->mMeshChannels[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deep copy name
|
|
||||||
mAnim->mName = a->mName;
|
mAnim->mName = a->mName;
|
||||||
|
|
||||||
mSequenceName = mAnim->mName.C_Str();
|
mSequenceName = mAnim->mName.C_Str();
|
||||||
if (mSequenceName.isEmpty())
|
if (mSequenceName.isEmpty())
|
||||||
mSequenceName = "ambient";
|
mSequenceName = "ambient";
|
||||||
Con::printf("\n[Assimp] Adding %s animation", mSequenceName.c_str());
|
|
||||||
|
|
||||||
fps = (a->mTicksPerSecond > 0) ? a->mTicksPerSecond : 30.0f;
|
Con::printf("\n[Assimp] Adding animation: %s", mSequenceName.c_str());
|
||||||
|
|
||||||
if (a->mDuration > 0)
|
// Determine the FPS and Time Multiplier
|
||||||
{
|
determineTimeMultiplier(a);
|
||||||
// torques seqEnd is in seconds, this then gets generated into frames in generateSequences()
|
|
||||||
seqEnd = (F32)a->mDuration / fps;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (U32 i = 0; i < a->mNumChannels; ++i)
|
|
||||||
{
|
|
||||||
aiNodeAnim* nodeAnim = a->mChannels[i];
|
|
||||||
// Determine the maximum keyframe time for this animation
|
|
||||||
F32 maxKeyTime = 0.0f;
|
|
||||||
for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
|
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
|
|
||||||
}
|
|
||||||
for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
|
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
|
|
||||||
}
|
|
||||||
for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
|
|
||||||
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
seqEnd = getMax(seqEnd, maxKeyTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mTimeMultiplier = 1.0f;
|
|
||||||
|
|
||||||
S32 timeFactor = ColladaUtils::getOptions().animTiming;
|
|
||||||
S32 fpsRequest = (S32)a->mTicksPerSecond;
|
|
||||||
if (timeFactor == 0)
|
|
||||||
{ // Timing specified in frames
|
|
||||||
fps = mClamp(fpsRequest, 5 /*TSShapeLoader::MinFrameRate*/, TSShapeLoader::MaxFrameRate);
|
|
||||||
mTimeMultiplier = 1.0f / fps;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Timing specified in seconds or ms depending on format
|
|
||||||
if (seqEnd > 1000.0f || a->mDuration > 1000.0f)
|
|
||||||
timeFactor = 1000.0f; // If it's more than 1000 seconds, assume it's ms.
|
|
||||||
|
|
||||||
timeFactor = mClamp(timeFactor, 1, 1000);
|
|
||||||
mTimeMultiplier = 1.0f / timeFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Calculate sequence end time based on keyframes and multiplier
|
||||||
|
calculateSequenceEnd(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssimpAppSequence::~AssimpAppSequence()
|
AssimpAppSequence::~AssimpAppSequence()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AssimpAppSequence::determineTimeMultiplier(aiAnimation* a)
|
||||||
|
{
|
||||||
|
// Set fps from the file or use default
|
||||||
|
fps = (a->mTicksPerSecond > 0) ? a->mTicksPerSecond : 30.0f;
|
||||||
|
|
||||||
|
if (fps >= 1000.0f) { // Indicates milliseconds (GLTF or similar formats)
|
||||||
|
mTimeMultiplier = 1.0f / 1000.0f; // Convert milliseconds to seconds
|
||||||
|
Con::printf("[Assimp] Detected milliseconds timing (FPS >= 1000). Time Multiplier: %f", mTimeMultiplier);
|
||||||
|
}
|
||||||
|
else if (fps > 0.0f) { // Standard FPS
|
||||||
|
fps = mClamp(fps, 5 /*TSShapeLoader::MinFrameRate*/, TSShapeLoader::MaxFrameRate);
|
||||||
|
mTimeMultiplier = 1.0f / fps;
|
||||||
|
Con::printf("[Assimp] Standard FPS detected. Time Multiplier: %f", mTimeMultiplier);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Fall back to 30 FPS as default
|
||||||
|
mTimeMultiplier = 1.0f / 30.0f;
|
||||||
|
Con::printf("[Assimp] FPS not specified. Using default 30 FPS. Time Multiplier: %f", mTimeMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssimpAppSequence::calculateSequenceEnd(aiAnimation* a)
|
||||||
|
{
|
||||||
|
for (U32 i = 0; i < a->mNumChannels; ++i) {
|
||||||
|
aiNodeAnim* nodeAnim = a->mChannels[i];
|
||||||
|
F32 maxKeyTime = 0.0f;
|
||||||
|
|
||||||
|
// Calculate the maximum time across all keyframes for this channel
|
||||||
|
for (U32 k = 0; k < nodeAnim->mNumPositionKeys; ++k) {
|
||||||
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
|
||||||
|
}
|
||||||
|
for (U32 k = 0; k < nodeAnim->mNumRotationKeys; ++k) {
|
||||||
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
|
||||||
|
}
|
||||||
|
for (U32 k = 0; k < nodeAnim->mNumScalingKeys; ++k) {
|
||||||
|
maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the multiplier to convert to real sequence time
|
||||||
|
seqEnd = mTimeMultiplier * getMax(seqEnd, maxKeyTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
Con::printf("[Assimp] Sequence End Time: %f seconds", seqEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AssimpAppSequence::setActive(bool active)
|
void AssimpAppSequence::setActive(bool active)
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
AssimpAppNode::sActiveSequence = mAnim;
|
AssimpAppNode::sActiveSequence = mAnim;
|
||||||
AssimpAppNode::sTimeMultiplier = mTimeMultiplier;
|
AssimpAppNode::sTimeMultiplier = mTimeMultiplier;
|
||||||
|
Con::printf("[Assimp] Activating sequence: %s with Time Multiplier: %f", mSequenceName.c_str(), mTimeMultiplier);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (AssimpAppNode::sActiveSequence == mAnim)
|
if (AssimpAppNode::sActiveSequence == mAnim)
|
||||||
|
{
|
||||||
AssimpAppNode::sActiveSequence = NULL;
|
AssimpAppNode::sActiveSequence = NULL;
|
||||||
|
Con::printf("[Assimp] Deactivating sequence: %s", mSequenceName.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ class AssimpAppSequence : public AppSequence
|
||||||
F32 seqEnd;
|
F32 seqEnd;
|
||||||
F32 mTimeMultiplier; // The factor needed to convert the sequence data timestamp to seconds
|
F32 mTimeMultiplier; // The factor needed to convert the sequence data timestamp to seconds
|
||||||
|
|
||||||
|
void determineTimeMultiplier(aiAnimation* a);
|
||||||
|
void calculateSequenceEnd(aiAnimation* a);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AssimpAppSequence(aiAnimation *a);
|
AssimpAppSequence(aiAnimation *a);
|
||||||
|
|
|
||||||
|
|
@ -349,12 +349,16 @@ void AssimpShapeLoader::processAnimations()
|
||||||
|
|
||||||
Vector<aiNodeAnim*> ambientChannels;
|
Vector<aiNodeAnim*> ambientChannels;
|
||||||
F32 duration = 0.0f;
|
F32 duration = 0.0f;
|
||||||
|
F32 ticks = 0.0f;
|
||||||
if (mScene->mNumAnimations > 0)
|
if (mScene->mNumAnimations > 0)
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < mScene->mNumAnimations; ++i)
|
for (U32 i = 0; i < mScene->mNumAnimations; ++i)
|
||||||
{
|
{
|
||||||
aiAnimation* anim = mScene->mAnimations[i];
|
aiAnimation* anim = mScene->mAnimations[i];
|
||||||
duration = anim->mDuration;
|
|
||||||
|
ticks = anim->mTicksPerSecond;
|
||||||
|
|
||||||
|
duration = 0.0f;
|
||||||
for (U32 j = 0; j < anim->mNumChannels; j++)
|
for (U32 j = 0; j < anim->mNumChannels; j++)
|
||||||
{
|
{
|
||||||
aiNodeAnim* nodeAnim = anim->mChannels[j];
|
aiNodeAnim* nodeAnim = anim->mChannels[j];
|
||||||
|
|
@ -379,7 +383,7 @@ void AssimpShapeLoader::processAnimations()
|
||||||
ambientSeq->mNumChannels = ambientChannels.size();
|
ambientSeq->mNumChannels = ambientChannels.size();
|
||||||
ambientSeq->mChannels = ambientChannels.address();
|
ambientSeq->mChannels = ambientChannels.address();
|
||||||
ambientSeq->mDuration = duration;
|
ambientSeq->mDuration = duration;
|
||||||
ambientSeq->mTicksPerSecond = 24.0;
|
ambientSeq->mTicksPerSecond = ticks;
|
||||||
|
|
||||||
AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
|
AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
|
||||||
appSequences.push_back(defaultAssimpSeq);
|
appSequences.push_back(defaultAssimpSeq);
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,7 @@ IMPLEMENT_CALLBACK(TSShapeConstructor, onUnload, void, (), (),
|
||||||
ImplementEnumType(TSShapeConstructorUpAxis,
|
ImplementEnumType(TSShapeConstructorUpAxis,
|
||||||
"Axis to use for upwards direction when importing from Collada.\n\n"
|
"Axis to use for upwards direction when importing from Collada.\n\n"
|
||||||
"@ingroup TSShapeConstructor")
|
"@ingroup TSShapeConstructor")
|
||||||
{
|
{ UPAXISTYPE_X_UP, "X_AXIS" },
|
||||||
UPAXISTYPE_X_UP, "X_AXIS"
|
|
||||||
},
|
|
||||||
{ UPAXISTYPE_Y_UP, "Y_AXIS" },
|
{ UPAXISTYPE_Y_UP, "Y_AXIS" },
|
||||||
{ UPAXISTYPE_Z_UP, "Z_AXIS" },
|
{ UPAXISTYPE_Z_UP, "Z_AXIS" },
|
||||||
{ UPAXISTYPE_COUNT, "DEFAULT" }
|
{ UPAXISTYPE_COUNT, "DEFAULT" }
|
||||||
|
|
@ -68,9 +66,7 @@ EndImplementEnumType;
|
||||||
ImplementEnumType(TSShapeConstructorLodType,
|
ImplementEnumType(TSShapeConstructorLodType,
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"@ingroup TSShapeConstructor")
|
"@ingroup TSShapeConstructor")
|
||||||
{
|
{ ColladaUtils::ImportOptions::DetectDTS, "DetectDTS" },
|
||||||
ColladaUtils::ImportOptions::DetectDTS, "DetectDTS"
|
|
||||||
},
|
|
||||||
{ ColladaUtils::ImportOptions::SingleSize, "SingleSize" },
|
{ ColladaUtils::ImportOptions::SingleSize, "SingleSize" },
|
||||||
{ ColladaUtils::ImportOptions::TrailingNumber, "TrailingNumber" },
|
{ ColladaUtils::ImportOptions::TrailingNumber, "TrailingNumber" },
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
@ -78,9 +74,7 @@ ImplementEnumType(TSShapeConstructorLodType,
|
||||||
ImplementEnumType(TSShapeConstructorAnimType,
|
ImplementEnumType(TSShapeConstructorAnimType,
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"@ingroup TSShapeConstructor")
|
"@ingroup TSShapeConstructor")
|
||||||
{
|
{ ColladaUtils::ImportOptions::FrameCount, "Frames" },
|
||||||
ColladaUtils::ImportOptions::FrameCount, "Frames"
|
|
||||||
},
|
|
||||||
{ ColladaUtils::ImportOptions::Seconds, "Seconds" },
|
{ ColladaUtils::ImportOptions::Seconds, "Seconds" },
|
||||||
{ ColladaUtils::ImportOptions::Milliseconds, "Milliseconds" },
|
{ ColladaUtils::ImportOptions::Milliseconds, "Milliseconds" },
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue