68 std::string animName(mNodeAnim->mNodeName.C_Str());
75 anim->
SetAttribute(
"rotationInterpolationMode",
"linear");
78 aiVectorKey* posKey = mNodeAnim->mPositionKeys;
79 aiQuatKey* rotKey = mNodeAnim->mRotationKeys;
80 aiVectorKey* scaleKey = mNodeAnim->mScalingKeys;
81 unsigned int nbKey[3] = {mNodeAnim->mNumPositionKeys, mNodeAnim->mNumRotationKeys, mNodeAnim->mNumScalingKeys};
82 unsigned int keySize = getBiggerValue(nbKey, 3);
84 std::set<float> times;
85 for(
unsigned int n=0; n<keySize; ++n)
87 if(mNodeAnim->mNumPositionKeys > n)
89 times.insert(
static_cast<float>(posKey[n].mTime));
92 if(mNodeAnim->mNumScalingKeys > n)
94 times.insert(
static_cast<float>(scaleKey[n].mTime));
97 if(mNodeAnim->mNumRotationKeys > n)
99 times.insert(
static_cast<float>(rotKey[n].mTime));
103 std::vector<ALKeyFrame> keyframes;
104 for(std::set<float>::iterator it=times.begin(); it!=times.end(); ++it)
107 for(
unsigned int n=0; n<keySize; ++n)
109 if(mNodeAnim->mNumPositionKeys > n)
111 if(posKey[n].mTime == *it)
117 if(mNodeAnim->mNumScalingKeys > n)
119 if(scaleKey[n].mTime == *it)
125 if(mNodeAnim->mNumRotationKeys > n)
127 if(rotKey[n].mTime == *it)
133 keyframes.push_back(key);
136 for(
unsigned int n=0; n<keyframes.size(); ++n)
138 keyframes[n].createInterpolation(keyframes, mNode);
140 aiVector3D keypos = keyframes[n].getPosition().mValue;
141 aiVector3D keyscale = keyframes[n].getScale().mValue;
142 aiQuaternion keyquat = keyframes[n].getRotation().mValue;
175 std::string animName(mNodeAnim->mNodeName.C_Str());
180 aiVectorKey* posKey = mNodeAnim->mPositionKeys;
181 aiQuatKey* rotKey = mNodeAnim->mRotationKeys;
182 aiVectorKey* scaleKey = mNodeAnim->mScalingKeys;
183 unsigned int nbKey[3] = {mNodeAnim->mNumPositionKeys, mNodeAnim->mNumRotationKeys, mNodeAnim->mNumScalingKeys};
184 unsigned int keySize = getBiggerValue(nbKey, 3);
186 std::set<float> times;
187 for(
unsigned int n=0; n<keySize; ++n)
189 if(mNodeAnim->mNumPositionKeys > n)
191 times.insert(
static_cast<float>(posKey[n].mTime));
194 if(mNodeAnim->mNumScalingKeys > n)
196 times.insert(
static_cast<float>(scaleKey[n].mTime));
199 if(mNodeAnim->mNumRotationKeys > n)
201 times.insert(
static_cast<float>(rotKey[n].mTime));
205 std::vector<ALKeyFrame> keyframes;
206 for(std::set<float>::iterator it=times.begin(); it!=times.end(); ++it)
209 for(
unsigned int n=0; n<keySize; ++n)
211 if(mNodeAnim->mNumPositionKeys > n)
213 if(posKey[n].mTime == *it)
219 if(mNodeAnim->mNumScalingKeys > n)
221 if(scaleKey[n].mTime == *it)
227 if(mNodeAnim->mNumRotationKeys > n)
229 if(rotKey[n].mTime == *it)
235 keyframes.push_back(key);
238 for(
unsigned int n=0; n<keyframes.size(); ++n)
240 keyframes[n].createInterpolation(keyframes, mNode);
242 aiVector3D keypos = keyframes[n].getPosition().mValue;
243 aiVector3D keyscale = keyframes[n].getScale().mValue;
244 aiQuaternion keyquat = keyframes[n].getRotation().mValue;
246 animationTrack->
CreateKey(
static_cast<float>(
ConversionTools::formatFloat(keyframes[n].getTime()/mTickPerSec)), Ogre::Vector3(keypos.x, keypos.y, keypos.z), Ogre::Quaternion(keyquat.w, keyquat.x, keyquat.y, keyquat.z), Ogre::Vector3(keyscale.x, keyscale.y, keyscale.z));