mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
Sequence timing options.
This commit deals with the problem that the keyframe timestamps are not standardized. Seconds, milliseconds and ticks are used depending on the import format. There is no metadata or property that specifies the format used, so the option is exposed to the user as part of the import options gui.
This commit is contained in:
parent
a75116e6aa
commit
98c22d0f1b
6 changed files with 263 additions and 14 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include <assimp/types.h>
|
||||
|
||||
aiAnimation* AssimpAppNode::sActiveSequence = NULL;
|
||||
F32 AssimpAppNode::sTimeMultiplier = 1.0f;
|
||||
|
||||
AssimpAppNode::AssimpAppNode(const struct aiScene* scene, const struct aiNode* node, AssimpAppNode* parent)
|
||||
: mInvertMeshes(false),
|
||||
|
|
@ -132,7 +133,7 @@ void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animS
|
|||
F32 lastT = 0.0;
|
||||
for (U32 key = 0; key < nodeAnim->mNumPositionKeys; ++key)
|
||||
{
|
||||
F32 curT = (F32)nodeAnim->mPositionKeys[key].mTime;
|
||||
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 > t)
|
||||
{
|
||||
|
|
@ -161,7 +162,7 @@ void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animS
|
|||
F32 lastT = 0.0;
|
||||
for (U32 key = 0; key < nodeAnim->mNumRotationKeys; ++key)
|
||||
{
|
||||
F32 curT = (F32)nodeAnim->mRotationKeys[key].mTime;
|
||||
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 > t)
|
||||
|
|
@ -190,7 +191,7 @@ void AssimpAppNode::getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animS
|
|||
F32 lastT = 0.0;
|
||||
for (U32 key = 0; key < nodeAnim->mNumScalingKeys; ++key)
|
||||
{
|
||||
F32 curT = (F32)nodeAnim->mScalingKeys[key].mTime;
|
||||
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 > t)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue