Working on morph targets
This commit is contained in:
@@ -165,76 +165,6 @@ struct Animation {
|
||||
kf->setRotation(Ogre::Quaternion::IDENTITY);
|
||||
}
|
||||
mRootTrack->setListener(mListener);
|
||||
#if 0
|
||||
OgreAssert(mHipsTrack, "no hips track");
|
||||
OgreAssert(mRootTrack, "no Root track");
|
||||
#endif
|
||||
#if 0
|
||||
if (mRootTrack) {
|
||||
Ogre::Vector3 delta = Ogre::Vector3::ZERO;
|
||||
Ogre::Vector3 motion = Ogre::Vector3::ZERO;
|
||||
for (j = 0; j < mRootTrack->getNumKeyFrames(); j++) {
|
||||
Ogre::Vector3 trans =
|
||||
mRootTrack->getNodeKeyFrame(j)
|
||||
->getTranslate();
|
||||
if (j == 0)
|
||||
delta = trans;
|
||||
else
|
||||
delta = trans - motion;
|
||||
mRootTrack->getNodeKeyFrame(j)->setTranslate(
|
||||
delta);
|
||||
motion = trans;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (!mMetaRootTrack) {
|
||||
Ogre::Bone *bone = nullptr;
|
||||
OgreAssert(skeleton->hasBone("MetaRoot"),
|
||||
"no bone MetaRoot");
|
||||
if (skeleton->hasBone("MetaRoot"))
|
||||
bone = skeleton->getBone("MetaRoot");
|
||||
#if 0
|
||||
else
|
||||
bone = skeleton->createBone("MetaRoot");
|
||||
#endif
|
||||
bone->setPosition(Ogre::Vector3::ZERO);
|
||||
bone->setOrientation(Ogre::Quaternion::IDENTITY);
|
||||
std::vector<
|
||||
std::pair<float, std::pair<Ogre::Vector3,
|
||||
Ogre::Quaternion> > >
|
||||
keyframes;
|
||||
for (j = 0; j < mRootTrack->getNumKeyFrames(); j++) {
|
||||
Ogre::TransformKeyFrame *kf =
|
||||
mRootTrack->getNodeKeyFrame(j);
|
||||
const Ogre::Vector3 &pt = kf->getTranslate();
|
||||
const Ogre::Quaternion &rt = kf->getRotation();
|
||||
float tp = kf->getTime();
|
||||
keyframes.push_back({ tp, { pt, rt } });
|
||||
#if 0
|
||||
new_kf->setTranslate(pt);
|
||||
new_kf->setTranslate(kf->getTranslate());
|
||||
new_kf->setRotation(kf->getRotation());
|
||||
#endif
|
||||
kf->setTranslate(Ogre::Vector3::ZERO);
|
||||
kf->setRotation(Ogre::Quaternion::IDENTITY);
|
||||
}
|
||||
mMetaRootTrack = mSkelAnimation->createNodeTrack(
|
||||
bone->getHandle());
|
||||
OgreAssert(mMetaRootTrack,
|
||||
"failed to create node track");
|
||||
for (j = 0; j < keyframes.size(); j++) {
|
||||
Ogre::TransformKeyFrame *new_kf =
|
||||
mMetaRootTrack->createNodeKeyFrame(
|
||||
keyframes[j].first);
|
||||
new_kf->setTranslate(keyframes[j].second.first);
|
||||
new_kf->setRotation(keyframes[j].second.second);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
mRootTrack = track;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
Ogre::String getName()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user