From 7ea2ea96b63dac0cced680bfb992c7870b9c9bf7 Mon Sep 17 00:00:00 2001 From: alekulyn Date: Mon, 10 Jul 2023 17:27:05 -0500 Subject: [PATCH] Read new nodes pt1 --- components/nif/niffile.cpp | 6 ++++++ components/nif/nifstream.hpp | 1 + components/nif/node.cpp | 14 ++++++++++++++ components/nif/node.hpp | 15 +++++++++++++++ components/nif/physics.cpp | 8 ++++++++ components/nif/physics.hpp | 5 +++++ components/nif/record.hpp | 1 + 7 files changed, 50 insertions(+) diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index ce5a42f5db..ef87d75db9 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -139,6 +140,8 @@ namespace Nif { "BSFadeNode", &construct }, { "BSLeafAnimNode", &construct }, { "BSTreeNode", &construct }, + { "BSValueNode", &construct }, + { "BSOrderedNode", &construct }, { "BSMultiBoundNode", &construct }, { "bhkBlendController", &construct }, { "NiFloatInterpolator", &construct }, @@ -158,6 +161,7 @@ namespace Nif { "BSFurnitureMarkerNode", &construct }, { "NiCollisionObject", &construct }, { "bhkCollisionObject", &construct }, + { "bhkSPCollisionObject", &construct }, { "BSDismemberSkinInstance", &construct }, { "NiControllerManager", &construct }, { "bhkMoppBvTreeShape", &construct }, @@ -166,6 +170,8 @@ namespace Nif { "hkPackedNiTriStripsData", &construct }, { "bhkConvexVerticesShape", &construct }, { "bhkConvexTransformShape", &construct }, + { "bhkTransformShape", &construct }, + { "bhkSimpleShapePhantom", &construct }, { "bhkBoxShape", &construct }, { "bhkCapsuleShape", &construct }, { "bhkSphereShape", &construct }, diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index e4ad8727c3..500bb532da 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -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 T get() diff --git a/components/nif/node.cpp b/components/nif/node.cpp index 09e1e1589d..91922c4e43 100644 --- a/components/nif/node.cpp +++ b/components/nif/node.cpp @@ -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); + } } diff --git a/components/nif/node.hpp b/components/nif/node.hpp index c3e0172896..801728c201 100644 --- a/components/nif/node.hpp +++ b/components/nif/node.hpp @@ -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 diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index d6d063e8a9..58e07fcf71 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -440,4 +440,12 @@ namespace Nif mBodyFlags = nif->getUShort(); } + void bhkSimpleShapePhantom::read(NIFStream* nif) + { + bhkWorldObject::read(nif); + nif->skip(8); // Unused + std::vector mat; + nif->readVector(mat, 16); + mTransform.set(mat.data()); + } } // Namespace diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index cdabcd8bd1..3124e05692 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -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 diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 88de60ed00..1185008ce2 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -138,6 +138,7 @@ namespace Nif RC_hkPackedNiTriStripsData, RC_bhkConvexVerticesShape, RC_bhkConvexTransformShape, + RC_bhkSimpleShapePhantom, RC_bhkBoxShape, RC_bhkCapsuleShape, RC_bhkSphereShape,