|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#include "controller.hpp"
|
|
|
|
|
|
|
|
|
|
#include "data.hpp"
|
|
|
|
|
#include "exception.hpp"
|
|
|
|
|
#include "node.hpp"
|
|
|
|
|
#include "particle.hpp"
|
|
|
|
|
#include "texture.hpp"
|
|
|
|
@ -8,25 +9,22 @@
|
|
|
|
|
namespace Nif
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
void Controller::read(NIFStream* nif)
|
|
|
|
|
void NiTimeController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
next.read(nif);
|
|
|
|
|
|
|
|
|
|
flags = nif->getUShort();
|
|
|
|
|
|
|
|
|
|
frequency = nif->getFloat();
|
|
|
|
|
phase = nif->getFloat();
|
|
|
|
|
timeStart = nif->getFloat();
|
|
|
|
|
timeStop = nif->getFloat();
|
|
|
|
|
|
|
|
|
|
target.read(nif);
|
|
|
|
|
mNext.read(nif);
|
|
|
|
|
nif->read(mFlags);
|
|
|
|
|
nif->read(mFrequency);
|
|
|
|
|
nif->read(mPhase);
|
|
|
|
|
nif->read(mTimeStart);
|
|
|
|
|
nif->read(mTimeStop);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 13))
|
|
|
|
|
mTarget.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Controller::post(Reader& nif)
|
|
|
|
|
void NiTimeController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Record::post(nif);
|
|
|
|
|
next.post(nif);
|
|
|
|
|
target.post(nif);
|
|
|
|
|
mNext.post(nif);
|
|
|
|
|
mTarget.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ControlledBlock::read(NIFStream* nif)
|
|
|
|
@ -44,28 +42,28 @@ namespace Nif
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 110))
|
|
|
|
|
{
|
|
|
|
|
mBlendInterpolator.read(nif);
|
|
|
|
|
mBlendIndex = nif->getUShort();
|
|
|
|
|
nif->read(mBlendIndex);
|
|
|
|
|
}
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 106) && nif->getBethVersion() > 0)
|
|
|
|
|
mPriority = nif->getChar();
|
|
|
|
|
nif->read(mPriority);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 2, 0, 0)
|
|
|
|
|
&& nif->getVersion() <= NIFStream::generateVersion(20, 1, 0, 0))
|
|
|
|
|
{
|
|
|
|
|
mStringPalette.read(nif);
|
|
|
|
|
mNodeNameOffset = nif->getUInt();
|
|
|
|
|
mPropertyTypeOffset = nif->getUInt();
|
|
|
|
|
mControllerTypeOffset = nif->getUInt();
|
|
|
|
|
mControllerIdOffset = nif->getUInt();
|
|
|
|
|
mInterpolatorIdOffset = nif->getUInt();
|
|
|
|
|
nif->read(mNodeNameOffset);
|
|
|
|
|
nif->read(mPropertyTypeOffset);
|
|
|
|
|
nif->read(mControllerTypeOffset);
|
|
|
|
|
nif->read(mControllerIdOffset);
|
|
|
|
|
nif->read(mInterpolatorIdOffset);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mNodeName = nif->getString();
|
|
|
|
|
mPropertyType = nif->getString();
|
|
|
|
|
mControllerType = nif->getString();
|
|
|
|
|
mControllerId = nif->getString();
|
|
|
|
|
mInterpolatorId = nif->getString();
|
|
|
|
|
nif->read(mNodeName);
|
|
|
|
|
nif->read(mPropertyType);
|
|
|
|
|
nif->read(mControllerType);
|
|
|
|
|
nif->read(mControllerId);
|
|
|
|
|
nif->read(mInterpolatorId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -80,16 +78,15 @@ namespace Nif
|
|
|
|
|
|
|
|
|
|
void NiSequence::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
mName = nif->getString();
|
|
|
|
|
nif->read(mName);
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
{
|
|
|
|
|
mAccumRootName = nif->getString();
|
|
|
|
|
nif->read(mAccumRootName);
|
|
|
|
|
mTextKeys.read(nif);
|
|
|
|
|
}
|
|
|
|
|
size_t numControlledBlocks = nif->getUInt();
|
|
|
|
|
mControlledBlocks.resize(nif->get<uint32_t>());
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 106))
|
|
|
|
|
mArrayGrowBy = nif->getUInt();
|
|
|
|
|
mControlledBlocks.resize(numControlledBlocks);
|
|
|
|
|
nif->read(mArrayGrowBy);
|
|
|
|
|
for (ControlledBlock& block : mControlledBlocks)
|
|
|
|
|
block.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -104,28 +101,30 @@ namespace Nif
|
|
|
|
|
void NiControllerSequence::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiSequence::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mWeight = nif->getFloat();
|
|
|
|
|
nif->read(mWeight);
|
|
|
|
|
mTextKeys.read(nif);
|
|
|
|
|
mExtrapolationMode = static_cast<Controller::ExtrapolationMode>(nif->getUInt());
|
|
|
|
|
mFrequency = nif->getFloat();
|
|
|
|
|
mExtrapolationMode = static_cast<NiTimeController::ExtrapolationMode>(nif->get<uint32_t>());
|
|
|
|
|
nif->read(mFrequency);
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 4, 0, 1))
|
|
|
|
|
mPhase = nif->getFloat();
|
|
|
|
|
mStartTime = nif->getFloat();
|
|
|
|
|
mStopTime = nif->getFloat();
|
|
|
|
|
mPlayBackwards = nif->getVersion() == NIFStream::generateVersion(10, 1, 0, 106) && nif->getBoolean();
|
|
|
|
|
nif->read(mPhase);
|
|
|
|
|
nif->read(mStartTime);
|
|
|
|
|
nif->read(mStopTime);
|
|
|
|
|
if (nif->getVersion() == NIFStream::generateVersion(10, 1, 0, 106))
|
|
|
|
|
nif->read(mPlayBackwards);
|
|
|
|
|
mManager.read(nif);
|
|
|
|
|
mAccumRootName = nif->getString();
|
|
|
|
|
nif->read(mAccumRootName);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 113)
|
|
|
|
|
&& nif->getVersion() <= NIFStream::generateVersion(20, 1, 0, 0))
|
|
|
|
|
mStringPalette.read(nif);
|
|
|
|
|
else if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() >= 24)
|
|
|
|
|
{
|
|
|
|
|
size_t numAnimNotes = 1;
|
|
|
|
|
uint16_t numAnimNotes = 1;
|
|
|
|
|
if (nif->getBethVersion() >= 29)
|
|
|
|
|
numAnimNotes = nif->getUShort();
|
|
|
|
|
nif->read(numAnimNotes);
|
|
|
|
|
|
|
|
|
|
nif->skip(4 * numAnimNotes); // BSAnimNotes links
|
|
|
|
|
}
|
|
|
|
@ -134,21 +133,24 @@ namespace Nif
|
|
|
|
|
void NiControllerSequence::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiSequence::post(nif);
|
|
|
|
|
|
|
|
|
|
mManager.post(nif);
|
|
|
|
|
mStringPalette.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiInterpController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 104)
|
|
|
|
|
&& nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 108))
|
|
|
|
|
mManagerControlled = nif->getBoolean();
|
|
|
|
|
nif->read(mManagerControlled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSingleInterpController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 104))
|
|
|
|
|
mInterpolator.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -156,83 +158,86 @@ namespace Nif
|
|
|
|
|
void NiSingleInterpController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mInterpolator.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiParticleInfo::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
nif->read(mVelocity);
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 4, 0, 1))
|
|
|
|
|
nif->read(mRotationAxis);
|
|
|
|
|
nif->read(mAge);
|
|
|
|
|
nif->read(mLifespan);
|
|
|
|
|
nif->read(mLastUpdate);
|
|
|
|
|
nif->read(mSpawnGeneration);
|
|
|
|
|
nif->read(mCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiParticleSystemController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
|
|
|
|
|
velocity = nif->getFloat();
|
|
|
|
|
velocityRandom = nif->getFloat();
|
|
|
|
|
verticalDir = nif->getFloat();
|
|
|
|
|
verticalAngle = nif->getFloat();
|
|
|
|
|
horizontalDir = nif->getFloat();
|
|
|
|
|
horizontalAngle = nif->getFloat();
|
|
|
|
|
/*normal?*/ nif->getVector3();
|
|
|
|
|
color = nif->getVector4();
|
|
|
|
|
size = nif->getFloat();
|
|
|
|
|
startTime = nif->getFloat();
|
|
|
|
|
stopTime = nif->getFloat();
|
|
|
|
|
nif->getChar();
|
|
|
|
|
emitRate = nif->getFloat();
|
|
|
|
|
lifetime = nif->getFloat();
|
|
|
|
|
lifetimeRandom = nif->getFloat();
|
|
|
|
|
|
|
|
|
|
emitFlags = nif->getUShort();
|
|
|
|
|
offsetRandom = nif->getVector3();
|
|
|
|
|
|
|
|
|
|
emitter.read(nif);
|
|
|
|
|
|
|
|
|
|
/* Unknown Short, 0?
|
|
|
|
|
* Unknown Float, 1.0?
|
|
|
|
|
* Unknown Int, 1?
|
|
|
|
|
* Unknown Int, 0?
|
|
|
|
|
* Unknown Short, 0?
|
|
|
|
|
*/
|
|
|
|
|
nif->skip(16);
|
|
|
|
|
|
|
|
|
|
numParticles = nif->getUShort();
|
|
|
|
|
activeCount = nif->getUShort();
|
|
|
|
|
|
|
|
|
|
particles.resize(numParticles);
|
|
|
|
|
for (size_t i = 0; i < particles.size(); i++)
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 13))
|
|
|
|
|
nif->read(mSpeed);
|
|
|
|
|
nif->read(mSpeedVariation);
|
|
|
|
|
nif->read(mDeclination);
|
|
|
|
|
nif->read(mDeclinationVariation);
|
|
|
|
|
nif->read(mPlanarAngle);
|
|
|
|
|
nif->read(mPlanarAngleVariation);
|
|
|
|
|
nif->read(mInitialNormal);
|
|
|
|
|
nif->read(mInitialColor);
|
|
|
|
|
nif->read(mInitialSize);
|
|
|
|
|
nif->read(mEmitStartTime);
|
|
|
|
|
nif->read(mEmitStopTime);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 13))
|
|
|
|
|
{
|
|
|
|
|
particles[i].velocity = nif->getVector3();
|
|
|
|
|
nif->getVector3(); /* unknown */
|
|
|
|
|
particles[i].lifetime = nif->getFloat();
|
|
|
|
|
particles[i].lifespan = nif->getFloat();
|
|
|
|
|
particles[i].timestamp = nif->getFloat();
|
|
|
|
|
nif->getUShort(); /* unknown */
|
|
|
|
|
particles[i].vertex = nif->getUShort();
|
|
|
|
|
mResetParticleSystem = nif->get<uint8_t>() != 0;
|
|
|
|
|
nif->read(mBirthRate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nif->getUInt(); /* -1? */
|
|
|
|
|
affectors.read(nif);
|
|
|
|
|
colliders.read(nif);
|
|
|
|
|
nif->getChar();
|
|
|
|
|
nif->read(mLifetime);
|
|
|
|
|
nif->read(mLifetimeVariation);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 13))
|
|
|
|
|
nif->read(mEmitFlags);
|
|
|
|
|
nif->read(mEmitterDimensions);
|
|
|
|
|
mEmitter.read(nif);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 13))
|
|
|
|
|
{
|
|
|
|
|
nif->read(mNumSpawnGenerations);
|
|
|
|
|
nif->read(mPercentageSpawned);
|
|
|
|
|
nif->read(mSpawnMultiplier);
|
|
|
|
|
nif->read(mSpawnSpeedChaos);
|
|
|
|
|
nif->read(mSpawnDirChaos);
|
|
|
|
|
mParticles.resize(nif->get<uint16_t>());
|
|
|
|
|
nif->read(mNumValid);
|
|
|
|
|
for (NiParticleInfo& particle : mParticles)
|
|
|
|
|
particle.read(nif);
|
|
|
|
|
nif->skip(4); // NiEmitterModifier link
|
|
|
|
|
}
|
|
|
|
|
mModifier.read(nif);
|
|
|
|
|
mCollider.read(nif);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(3, 3, 0, 15))
|
|
|
|
|
nif->read(mStaticTargetBound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiParticleSystemController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::post(nif);
|
|
|
|
|
emitter.post(nif);
|
|
|
|
|
affectors.post(nif);
|
|
|
|
|
colliders.post(nif);
|
|
|
|
|
NiTimeController::post(nif);
|
|
|
|
|
|
|
|
|
|
mEmitter.post(nif);
|
|
|
|
|
mModifier.post(nif);
|
|
|
|
|
mCollider.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiMaterialColorController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiPoint3InterpController::read(nif);
|
|
|
|
|
// Two bits that correspond to the controlled material color.
|
|
|
|
|
// 00: Ambient
|
|
|
|
|
// 01: Diffuse
|
|
|
|
|
// 10: Specular
|
|
|
|
|
// 11: Emissive
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
|
|
|
|
mTargetColor = nif->getUShort() & 3;
|
|
|
|
|
mTargetColor = static_cast<TargetColor>(nif->get<uint16_t>() & 3);
|
|
|
|
|
else
|
|
|
|
|
mTargetColor = (flags >> 4) & 3;
|
|
|
|
|
mTargetColor = static_cast<TargetColor>((mFlags >> 4) & 3);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -240,60 +245,70 @@ namespace Nif
|
|
|
|
|
void NiMaterialColorController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiPoint3InterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiLookAtController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
|
|
|
|
lookAtFlags = nif->getUShort();
|
|
|
|
|
target.read(nif);
|
|
|
|
|
nif->read(mLookAtFlags);
|
|
|
|
|
mLookAt.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiLookAtController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::post(nif);
|
|
|
|
|
target.post(nif);
|
|
|
|
|
NiTimeController::post(nif);
|
|
|
|
|
|
|
|
|
|
mLookAt.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiPathController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
|
|
|
|
nif->read(mPathFlags);
|
|
|
|
|
else
|
|
|
|
|
mPathFlags = (mFlags >> 4);
|
|
|
|
|
|
|
|
|
|
bankDir = nif->getInt();
|
|
|
|
|
maxBankAngle = nif->getFloat();
|
|
|
|
|
smoothing = nif->getFloat();
|
|
|
|
|
followAxis = nif->getShort();
|
|
|
|
|
posData.read(nif);
|
|
|
|
|
floatData.read(nif);
|
|
|
|
|
nif->read(mBankDirection);
|
|
|
|
|
nif->read(mMaxBankAngle);
|
|
|
|
|
nif->read(mSmoothing);
|
|
|
|
|
nif->read(mFollowAxis);
|
|
|
|
|
mPathData.read(nif);
|
|
|
|
|
mPercentData.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiPathController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::post(nif);
|
|
|
|
|
NiTimeController::post(nif);
|
|
|
|
|
|
|
|
|
|
posData.post(nif);
|
|
|
|
|
floatData.post(nif);
|
|
|
|
|
mPathData.post(nif);
|
|
|
|
|
mPercentData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiUVController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
uvSet = nif->getUShort();
|
|
|
|
|
data.read(nif);
|
|
|
|
|
nif->read(mUvSet);
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiUVController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::post(nif);
|
|
|
|
|
data.post(nif);
|
|
|
|
|
NiTimeController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiKeyframeController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiSingleInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -301,29 +316,30 @@ namespace Nif
|
|
|
|
|
void NiKeyframeController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiSingleInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiMultiTargetTransformController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::read(nif);
|
|
|
|
|
size_t numTargets = nif->getUShort();
|
|
|
|
|
std::vector<NiAVObjectPtr> targets;
|
|
|
|
|
targets.resize(numTargets);
|
|
|
|
|
for (size_t i = 0; i < targets.size(); i++)
|
|
|
|
|
targets[i].read(nif);
|
|
|
|
|
mExtraTargets = targets;
|
|
|
|
|
|
|
|
|
|
mExtraTargets.resize(nif->get<uint16_t>());
|
|
|
|
|
for (NiAVObjectPtr& extraTarget : mExtraTargets)
|
|
|
|
|
extraTarget.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiMultiTargetTransformController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
postRecordList(nif, mExtraTargets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiAlphaController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -331,12 +347,14 @@ namespace Nif
|
|
|
|
|
void NiAlphaController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiRollController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiSingleInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -344,49 +362,47 @@ namespace Nif
|
|
|
|
|
void NiRollController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiSingleInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiGeomMorpherController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() >= NIFFile::NIFVersion::VER_OB_OLD)
|
|
|
|
|
mUpdateNormals = nif->getUShort() & 1;
|
|
|
|
|
mUpdateNormals = nif->get<uint16_t>() & 1;
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
if (nif->getVersion() >= NIFFile::NIFVersion::VER_MW)
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() < NIFFile::NIFVersion::VER_MW)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mAlwaysActive = nif->get<uint8_t>() != 0;
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 105))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB)
|
|
|
|
|
{
|
|
|
|
|
mAlwaysActive = nif->getChar();
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 106))
|
|
|
|
|
{
|
|
|
|
|
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB)
|
|
|
|
|
{
|
|
|
|
|
readRecordList(nif, mInterpolators);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 2, 0, 0) && nif->getBethVersion() > 9)
|
|
|
|
|
{
|
|
|
|
|
unsigned int numUnknown = nif->getUInt();
|
|
|
|
|
nif->skip(4 * numUnknown);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::vector<NiInterpolatorPtr> interpolators;
|
|
|
|
|
size_t numInterps = nif->getUInt();
|
|
|
|
|
interpolators.resize(numInterps);
|
|
|
|
|
mWeights.resize(numInterps);
|
|
|
|
|
for (size_t i = 0; i < numInterps; i++)
|
|
|
|
|
{
|
|
|
|
|
interpolators[i].read(nif);
|
|
|
|
|
mWeights[i] = nif->getFloat();
|
|
|
|
|
}
|
|
|
|
|
mInterpolators = interpolators;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
readRecordList(nif, mInterpolators);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 2, 0, 0) && nif->getBethVersion() >= 10)
|
|
|
|
|
nif->skip(4 * nif->get<uint32_t>()); // Unknown
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mInterpolators.resize(nif->get<uint32_t>());
|
|
|
|
|
mWeights.resize(mInterpolators.size());
|
|
|
|
|
for (size_t i = 0; i < mInterpolators.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
mInterpolators[i].read(nif);
|
|
|
|
|
nif->read(mWeights[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiGeomMorpherController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
postRecordList(nif, mInterpolators);
|
|
|
|
|
}
|
|
|
|
@ -394,6 +410,7 @@ namespace Nif
|
|
|
|
|
void NiVisController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiBoolInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
|
}
|
|
|
|
@ -401,17 +418,19 @@ namespace Nif
|
|
|
|
|
void NiVisController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiBoolInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiFlipController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::read(nif);
|
|
|
|
|
mTexSlot = nif->getUInt();
|
|
|
|
|
|
|
|
|
|
mTexSlot = static_cast<NiTexturingProperty::TextureType>(nif->get<uint32_t>());
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
{
|
|
|
|
|
timeStart = nif->getFloat();
|
|
|
|
|
mDelta = nif->getFloat();
|
|
|
|
|
nif->read(mTimeStart);
|
|
|
|
|
nif->read(mDelta);
|
|
|
|
|
}
|
|
|
|
|
readRecordList(nif, mSources);
|
|
|
|
|
}
|
|
|
|
@ -419,14 +438,16 @@ namespace Nif
|
|
|
|
|
void NiFlipController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
postRecordList(nif, mSources);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiTextureTransformController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::read(nif);
|
|
|
|
|
mShaderMap = nif->getBoolean();
|
|
|
|
|
nif->read(mTexSlot);
|
|
|
|
|
|
|
|
|
|
nif->read(mShaderMap);
|
|
|
|
|
mTexSlot = static_cast<NiTexturingProperty::TextureType>(nif->get<uint32_t>());
|
|
|
|
|
nif->read(mTransformMember);
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
|
|
|
|
mData.read(nif);
|
|
|
|
@ -435,176 +456,113 @@ namespace Nif
|
|
|
|
|
void NiTextureTransformController::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::post(nif);
|
|
|
|
|
|
|
|
|
|
mData.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void bhkBlendController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
nif->getUInt(); // Zero
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
uint32_t numKeys;
|
|
|
|
|
nif->read(numKeys);
|
|
|
|
|
// Is this possible?
|
|
|
|
|
if (numKeys != 0)
|
|
|
|
|
throw Nif::Exception(
|
|
|
|
|
"Unsupported keys in bhkBlendController " + std::to_string(recIndex), nif->getFile().getFilename());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BSEffectShaderPropertyFloatController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiFloatInterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
nif->read(mControlledVariable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BSEffectShaderPropertyColorController::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
NiPoint3InterpController::read(nif);
|
|
|
|
|
|
|
|
|
|
nif->read(mControlledColor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiControllerManager::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::read(nif);
|
|
|
|
|
mCumulative = nif->getBoolean();
|
|
|
|
|
NiTimeController::read(nif);
|
|
|
|
|
|
|
|
|
|
nif->read(mCumulative);
|
|
|
|
|
readRecordList(nif, mSequences);
|
|
|
|
|
mObjectPalette.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiControllerManager::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
Controller::post(nif);
|
|
|
|
|
NiTimeController::post(nif);
|
|
|
|
|
|
|
|
|
|
postRecordList(nif, mSequences);
|
|
|
|
|
mObjectPalette.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiPoint3Interpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
defaultVal = nif->getVector3();
|
|
|
|
|
data.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiPoint3Interpolator::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiBoolInterpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
defaultVal = nif->getBoolean();
|
|
|
|
|
data.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiBoolInterpolator::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiFloatInterpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
defaultVal = nif->getFloat();
|
|
|
|
|
data.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiFloatInterpolator::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiTransformInterpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
defaultPos = nif->getVector3();
|
|
|
|
|
defaultRot = nif->getQuaternion();
|
|
|
|
|
defaultScale = nif->getFloat();
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
|
|
|
|
|
{
|
|
|
|
|
if (!nif->getBoolean())
|
|
|
|
|
defaultPos = osg::Vec3f();
|
|
|
|
|
if (!nif->getBoolean())
|
|
|
|
|
defaultRot = osg::Quat();
|
|
|
|
|
if (!nif->getBoolean())
|
|
|
|
|
defaultScale = 1.f;
|
|
|
|
|
}
|
|
|
|
|
data.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiTransformInterpolator::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiColorInterpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
defaultVal = nif->getVector4();
|
|
|
|
|
data.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiColorInterpolator::post(Reader& nif)
|
|
|
|
|
{
|
|
|
|
|
data.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiBlendInterpolator::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 112))
|
|
|
|
|
mManagerControlled = nif->getChar() & 1;
|
|
|
|
|
size_t numInterps = 0;
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
|
|
|
|
|
{
|
|
|
|
|
numInterps = nif->getUShort();
|
|
|
|
|
mArrayGrowBy = nif->getUShort();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
numInterps = nif->getChar();
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 112))
|
|
|
|
|
nif->read(mFlags);
|
|
|
|
|
mItems.resize(nif->get<uint8_t>());
|
|
|
|
|
nif->read(mWeightThreshold);
|
|
|
|
|
if (!(mFlags & Flag_ManagerControlled))
|
|
|
|
|
{
|
|
|
|
|
mWeightThreshold = nif->getFloat();
|
|
|
|
|
if (!mManagerControlled)
|
|
|
|
|
{
|
|
|
|
|
mInterpCount = nif->getChar();
|
|
|
|
|
mSingleIndex = nif->getChar();
|
|
|
|
|
mHighPriority = nif->getChar();
|
|
|
|
|
mNextHighPriority = nif->getChar();
|
|
|
|
|
mSingleTime = nif->getFloat();
|
|
|
|
|
mHighWeightsSum = nif->getFloat();
|
|
|
|
|
mNextHighWeightsSum = nif->getFloat();
|
|
|
|
|
mHighEaseSpinner = nif->getFloat();
|
|
|
|
|
}
|
|
|
|
|
mInterpCount = nif->get<uint8_t>();
|
|
|
|
|
mSingleIndex = nif->get<uint8_t>();
|
|
|
|
|
mHighPriority = nif->get<int8_t>();
|
|
|
|
|
mNextHighPriority = nif->get<int8_t>();
|
|
|
|
|
nif->read(mSingleTime);
|
|
|
|
|
nif->read(mHighWeightsSum);
|
|
|
|
|
nif->read(mNextHighWeightsSum);
|
|
|
|
|
nif->read(mHighEaseSpinner);
|
|
|
|
|
for (Item& item : mItems)
|
|
|
|
|
item.read(nif);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mManagerControlled)
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 110))
|
|
|
|
|
{
|
|
|
|
|
mItems.resize(numInterps);
|
|
|
|
|
mItems.resize(nif->get<uint8_t>());
|
|
|
|
|
for (Item& item : mItems)
|
|
|
|
|
item.read(nif);
|
|
|
|
|
if (nif->get<bool>())
|
|
|
|
|
mFlags |= Flag_ManagerControlled;
|
|
|
|
|
nif->read(mWeightThreshold);
|
|
|
|
|
if (nif->get<bool>())
|
|
|
|
|
mFlags |= Flag_OnlyUseHighestWeight;
|
|
|
|
|
mInterpCount = nif->get<uint8_t>();
|
|
|
|
|
mSingleIndex = nif->get<uint8_t>();
|
|
|
|
|
mSingleInterpolator.read(nif);
|
|
|
|
|
nif->read(mSingleTime);
|
|
|
|
|
mHighPriority = nif->get<int8_t>();
|
|
|
|
|
mNextHighPriority = nif->get<int8_t>();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 111))
|
|
|
|
|
mItems.resize(nif->get<uint16_t>());
|
|
|
|
|
nif->read(mArrayGrowBy);
|
|
|
|
|
for (Item& item : mItems)
|
|
|
|
|
item.read(nif);
|
|
|
|
|
if (nif->get<bool>())
|
|
|
|
|
mFlags |= Flag_ManagerControlled;
|
|
|
|
|
nif->read(mWeightThreshold);
|
|
|
|
|
if (nif->get<bool>())
|
|
|
|
|
mFlags |= Flag_OnlyUseHighestWeight;
|
|
|
|
|
nif->read(mInterpCount);
|
|
|
|
|
nif->read(mSingleIndex);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 108))
|
|
|
|
|
{
|
|
|
|
|
mManagerControlled = nif->getBoolean();
|
|
|
|
|
mWeightThreshold = nif->getFloat();
|
|
|
|
|
mOnlyUseHighestWeight = nif->getBoolean();
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
|
|
|
|
|
{
|
|
|
|
|
mInterpCount = nif->getUShort();
|
|
|
|
|
mSingleIndex = nif->getUShort();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mInterpCount = nif->getChar();
|
|
|
|
|
mSingleIndex = nif->getChar();
|
|
|
|
|
}
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 108))
|
|
|
|
|
{
|
|
|
|
|
mSingleInterpolator.read(nif);
|
|
|
|
|
mSingleTime = nif->getFloat();
|
|
|
|
|
}
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
|
|
|
|
|
{
|
|
|
|
|
mHighPriority = nif->getInt();
|
|
|
|
|
mNextHighPriority = nif->getInt();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mHighPriority = nif->getChar();
|
|
|
|
|
mNextHighPriority = nif->getChar();
|
|
|
|
|
}
|
|
|
|
|
mSingleInterpolator.read(nif);
|
|
|
|
|
nif->read(mSingleTime);
|
|
|
|
|
}
|
|
|
|
|
nif->read(mHighPriority);
|
|
|
|
|
nif->read(mNextHighPriority);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiBlendInterpolator::post(Reader& nif)
|
|
|
|
@ -617,13 +575,13 @@ namespace Nif
|
|
|
|
|
void NiBlendInterpolator::Item::read(NIFStream* nif)
|
|
|
|
|
{
|
|
|
|
|
mInterpolator.read(nif);
|
|
|
|
|
mWeight = nif->getFloat();
|
|
|
|
|
mNormalizedWeight = nif->getFloat();
|
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 109))
|
|
|
|
|
mPriority = nif->getInt();
|
|
|
|
|
nif->read(mWeight);
|
|
|
|
|
nif->read(mNormalizedWeight);
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 110))
|
|
|
|
|
mPriority = nif->get<int8_t>();
|
|
|
|
|
else
|
|
|
|
|
mPriority = nif->getChar();
|
|
|
|
|
mEaseSpinner = nif->getFloat();
|
|
|
|
|
nif->read(mPriority);
|
|
|
|
|
nif->read(mEaseSpinner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiBlendInterpolator::Item::post(Reader& nif)
|
|
|
|
@ -631,38 +589,4 @@ 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|