Merge branch 'newNifNodeReads' into 'master'

Read a couple more Nif Nodes

See merge request OpenMW/openmw!3218
revert-6246b479
psi29a 2 years ago
commit 3961403b79

@ -637,4 +637,16 @@ namespace Nif
mScaleValue = 1.f;
}
}
void BSEffectShaderPropertyFloatController::read(NIFStream* nif)
{
NiFloatInterpController::read(nif);
nif->read(mControlledVariable);
}
void BSEffectShaderPropertyColorController::read(NIFStream* nif)
{
NiPoint3InterpController::read(nif);
nif->read(mControlledColor);
}
}

@ -406,5 +406,18 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct BSEffectShaderPropertyFloatController : public NiFloatInterpController
{
unsigned int mControlledVariable;
void read(NIFStream* nif) override;
};
struct BSEffectShaderPropertyColorController : public NiPoint3InterpController
{
unsigned int mControlledColor;
void read(NIFStream* nif) override;
};
} // Namespace
#endif

@ -16,6 +16,7 @@
#include "effect.hpp"
#include "exception.hpp"
#include "extra.hpp"
#include "node.hpp"
#include "physics.hpp"
#include "property.hpp"
@ -139,6 +140,8 @@ namespace Nif
{ "BSFadeNode", &construct<NiNode, RC_NiNode> },
{ "BSLeafAnimNode", &construct<NiNode, RC_NiNode> },
{ "BSTreeNode", &construct<BSTreeNode, RC_NiNode> },
{ "BSValueNode", &construct<BSValueNode, RC_NiNode> },
{ "BSOrderedNode", &construct<BSOrderedNode, RC_NiNode> },
{ "BSMultiBoundNode", &construct<BSMultiBoundNode, RC_NiNode> },
{ "bhkBlendController", &construct<bhkBlendController, RC_bhkBlendController> },
{ "NiFloatInterpolator", &construct<NiFloatInterpolator, RC_NiFloatInterpolator> },
@ -158,6 +161,8 @@ namespace Nif
{ "BSFurnitureMarkerNode", &construct<BSFurnitureMarker, RC_BSFurnitureMarker> },
{ "NiCollisionObject", &construct<NiCollisionObject, RC_NiCollisionObject> },
{ "bhkCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "bhkSPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "bhkPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "BSDismemberSkinInstance", &construct<BSDismemberSkinInstance, RC_BSDismemberSkinInstance> },
{ "NiControllerManager", &construct<NiControllerManager, RC_NiControllerManager> },
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
@ -166,6 +171,8 @@ namespace Nif
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
{ "bhkConvexTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
{ "bhkBoxShape", &construct<bhkBoxShape, RC_bhkBoxShape> },
{ "bhkCapsuleShape", &construct<bhkCapsuleShape, RC_bhkCapsuleShape> },
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
@ -192,6 +199,12 @@ namespace Nif
{ "BSMultiBoundSphere", &construct<BSMultiBoundSphere, RC_BSMultiBoundSphere> },
{ "BSInvMarker", &construct<BSInvMarker, RC_BSInvMarker> },
{ "BSTriShape", &construct<BSTriShape, RC_BSTriShape> },
{ "BSEffectShaderPropertyFloatController",
&construct<BSEffectShaderPropertyFloatController, RC_BSEffectShaderPropertyFloatController> },
{ "BSLightingShaderPropertyFloatController",
&construct<BSEffectShaderPropertyFloatController, RC_BSLightingShaderPropertyFloatController> },
{ "BSEffectShaderPropertyColorController",
&construct<BSEffectShaderPropertyColorController, RC_BSEffectShaderPropertyColorController> },
};
}

@ -89,6 +89,7 @@ namespace Nif
}
void read(osg::Vec3f& data) { readLittleEndianBufferOfType<3, float>(inp, data._v); }
void read(osg::Vec4f& data) { readLittleEndianBufferOfType<4, float>(inp, data._v); }
template <class T>
T get()

@ -483,4 +483,18 @@ namespace Nif
nif->read(mEyeData);
}
}
void BSValueNode::read(NIFStream* nif)
{
NiNode::read(nif);
nif->read(mValue);
nif->read(mValueFlags);
}
void BSOrderedNode::read(NIFStream* nif)
{
NiNode::read(nif);
nif->read(mAlphaSortBound);
nif->read(mStaticBound);
}
}

@ -377,5 +377,20 @@ namespace Nif
void post(Reader& nif) override;
};
struct BSValueNode : NiNode
{
unsigned int mValue;
char mValueFlags;
void read(NIFStream* nif) override;
};
struct BSOrderedNode : NiNode
{
osg::Vec4f mAlphaSortBound;
char mStaticBound;
void read(NIFStream* nif) override;
};
} // Namespace
#endif

@ -327,8 +327,8 @@ namespace Nif
mHavokMaterial.read(nif);
mRadius = nif->getFloat();
nif->skip(8); // Unused
std::vector<float> mat;
nif->getFloats(mat, 16);
std::array<float, 16> mat;
nif->readArray(mat);
mTransform.set(mat.data());
}
@ -440,4 +440,12 @@ namespace Nif
mBodyFlags = nif->getUShort();
}
void bhkSimpleShapePhantom::read(NIFStream* nif)
{
bhkWorldObject::read(nif);
nif->skip(8); // Unused
std::array<float, 16> mat;
nif->readArray(mat);
mTransform.set(mat.data());
}
} // Namespace

@ -426,5 +426,10 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct bhkSimpleShapePhantom : public bhkWorldObject
{
osg::Matrixf mTransform;
void read(NIFStream* nif) override;
};
} // Namespace
#endif

@ -138,6 +138,7 @@ namespace Nif
RC_hkPackedNiTriStripsData,
RC_bhkConvexVerticesShape,
RC_bhkConvexTransformShape,
RC_bhkSimpleShapePhantom,
RC_bhkBoxShape,
RC_bhkCapsuleShape,
RC_bhkSphereShape,
@ -164,6 +165,9 @@ namespace Nif
RC_BSMultiBoundSphere,
RC_BSInvMarker,
RC_BSTriShape,
RC_BSEffectShaderPropertyFloatController,
RC_BSEffectShaderPropertyColorController,
RC_BSLightingShaderPropertyFloatController,
};
/// Base class for all records

Loading…
Cancel
Save