Read all the NiBlendInterpolator record types

This commit is contained in:
Alexei Kotov 2023-02-08 23:13:36 +03:00
parent 7ecf018743
commit 091fcd837e
5 changed files with 75 additions and 1 deletions

View file

@ -43,7 +43,7 @@ namespace Nif
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 110))
{
nif->skip(4); // NiBlendInterpolator link
mBlendInterpolator.read(nif);
mBlendIndex = nif->getUShort();
}
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 106) && nif->getBethVersion() > 0)
@ -73,6 +73,7 @@ namespace Nif
{
mInterpolator.post(nif);
mController.post(nif);
mBlendInterpolator.post(nif);
mStringPalette.post(nif);
// TODO: probably should fill the strings with string palette contents here
}
@ -595,4 +596,39 @@ namespace Nif
{
mInterpolator.post(nif);
}
void NiBlendBoolInterpolator::read(NIFStream* nif)
{
NiBlendInterpolator::read(nif);
mValue = nif->getChar() != 0;
}
void NiBlendFloatInterpolator::read(NIFStream* nif)
{
NiBlendInterpolator::read(nif);
mValue = nif->getFloat();
}
void NiBlendPoint3Interpolator::read(NIFStream* nif)
{
NiBlendInterpolator::read(nif);
mValue = nif->getVector3();
}
void NiBlendTransformInterpolator::read(NIFStream* nif)
{
NiBlendInterpolator::read(nif);
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
{
mPosValue = nif->getVector3();
mRotValue = nif->getQuaternion();
mScaleValue = nif->getFloat();
if (!nif->getBoolean())
mPosValue = osg::Vec3f();
if (!nif->getBoolean())
mRotValue = osg::Quat();
if (!nif->getBoolean())
mScaleValue = 1.f;
}
}
}