Read all the NiBlendInterpolator record types

7220-lua-add-a-general-purpose-lexical-parser
Alexei Kotov 2 years ago
parent 7ecf018743
commit 091fcd837e

@ -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;
}
}
}

@ -34,6 +34,7 @@ namespace Nif
std::string mTargetName;
NiInterpolatorPtr mInterpolator;
ControllerPtr mController;
NiBlendInterpolatorPtr mBlendInterpolator;
unsigned short mBlendIndex;
unsigned char mPriority;
NiStringPalettePtr mStringPalette;
@ -376,5 +377,31 @@ namespace Nif
void post(Reader& nif) override;
};
struct NiBlendBoolInterpolator : public NiBlendInterpolator
{
char mValue;
void read(NIFStream* nif) override;
};
struct NiBlendFloatInterpolator : public NiBlendInterpolator
{
float mValue;
void read(NIFStream* nif) override;
};
struct NiBlendPoint3Interpolator : public NiBlendInterpolator
{
osg::Vec3f mValue;
void read(NIFStream* nif) override;
};
struct NiBlendTransformInterpolator : public NiBlendInterpolator
{
osg::Vec3f mPosValue;
osg::Quat mRotValue;
float mScaleValue;
void read(NIFStream* nif) override;
};
} // Namespace
#endif

@ -175,6 +175,11 @@ namespace Nif
{ "NiSequence", &construct<NiSequence, RC_NiSequence> },
{ "NiControllerSequence", &construct<NiControllerSequence, RC_NiControllerSequence> },
{ "NiDefaultAVObjectPalette", &construct<NiDefaultAVObjectPalette, RC_NiDefaultAVObjectPalette> },
{ "NiBlendBoolInterpolator", &construct<NiBlendBoolInterpolator, RC_NiBlendBoolInterpolator> },
{ "NiBlendFloatInterpolator", &construct<NiBlendFloatInterpolator, RC_NiBlendFloatInterpolator> },
{ "NiBlendPoint3Interpolator", &construct<NiBlendPoint3Interpolator, RC_NiBlendPoint3Interpolator> },
{ "NiBlendTransformInterpolator",
&construct<NiBlendTransformInterpolator, RC_NiBlendTransformInterpolator> },
};
}

@ -152,6 +152,10 @@ namespace Nif
RC_NiSequence,
RC_NiControllerSequence,
RC_NiDefaultAVObjectPalette,
RC_NiBlendBoolInterpolator,
RC_NiBlendFloatInterpolator,
RC_NiBlendPoint3Interpolator,
RC_NiBlendTransformInterpolator,
};
/// Base class for all records

@ -142,6 +142,7 @@ namespace Nif
struct NiInterpolator;
struct NiStringPalette;
struct NiControllerManager;
struct NiBlendInterpolator;
using NodePtr = RecordPtrT<Node>;
using ExtraPtr = RecordPtrT<Extra>;
@ -174,6 +175,7 @@ namespace Nif
using NiInterpolatorPtr = RecordPtrT<NiInterpolator>;
using NiStringPalettePtr = RecordPtrT<NiStringPalette>;
using NiControllerManagerPtr = RecordPtrT<NiControllerManager>;
using NiBlendInterpolatorPtr = RecordPtrT<NiBlendInterpolator>;
using NodeList = RecordListT<Node>;
using PropertyList = RecordListT<Property>;

Loading…
Cancel
Save