mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 10:15:38 +00:00
Merge branch 'allofthetime' into 'master'
Read all official Oblivion, Fallout 3 and New Vegas NIF files See merge request OpenMW/openmw!3453
This commit is contained in:
commit
0e4a599656
6 changed files with 168 additions and 3 deletions
|
@ -272,6 +272,7 @@ namespace Nif
|
|||
{ "BSDynamicTriShape", &construct<BSDynamicTriShape, RC_BSDynamicTriShape> },
|
||||
{ "BSLODTriShape", &construct<BSLODTriShape, RC_BSLODTriShape> },
|
||||
{ "BSMeshLODTriShape", &construct<BSMeshLODTriShape, RC_BSMeshLODTriShape> },
|
||||
{ "BSSegmentedTriShape", &construct<BSSegmentedTriShape, RC_BSSegmentedTriShape> },
|
||||
|
||||
// PARTICLES
|
||||
|
||||
|
@ -423,19 +424,27 @@ namespace Nif
|
|||
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
|
||||
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
|
||||
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
|
||||
{ "bhkMeshShape", &construct<bhkMeshShape, RC_bhkMeshShape> },
|
||||
{ "bhkMultiSphereShape", &construct<bhkMultiSphereShape, RC_bhkMultiSphereShape> },
|
||||
{ "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> },
|
||||
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },
|
||||
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
|
||||
{ "bhkPlaneShape", &construct<bhkPlaneShape, RC_bhkPlaneShape> },
|
||||
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
|
||||
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
|
||||
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
|
||||
|
||||
// Phantom records, Bethesda
|
||||
{ "bhkAabbPhantom", &construct<bhkAabbPhantom, RC_bhkAabbPhantom> },
|
||||
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
|
||||
|
||||
// Physics system records, Bethesda
|
||||
{ "bhkPhysicsSystem", &construct<bhkPhysicsSystem, RC_bhkPhysicsSystem> },
|
||||
{ "bhkRagdollSystem", &construct<bhkRagdollSystem, RC_bhkRagdollSystem> },
|
||||
|
||||
// Action records
|
||||
{ "bhkLiquidAction", &construct<bhkLiquidAction, RC_bhkLiquidAction> },
|
||||
{ "bhkOrientHingedBodyAction", &construct<bhkOrientHingedBodyAction, RC_bhkOrientHingedBodyAction> },
|
||||
|
||||
// PROPERTIES
|
||||
|
||||
// 4.0.0.2
|
||||
|
|
|
@ -196,6 +196,7 @@ namespace Nif
|
|||
{
|
||||
case RC_NiTriShape:
|
||||
case RC_BSLODTriShape:
|
||||
case RC_BSSegmentedTriShape:
|
||||
if (mData->recType != RC_NiTriShapeData)
|
||||
mData = NiGeometryDataPtr(nullptr);
|
||||
break;
|
||||
|
@ -217,6 +218,19 @@ namespace Nif
|
|||
}
|
||||
}
|
||||
|
||||
void BSSegmentedTriShape::read(NIFStream* nif)
|
||||
{
|
||||
NiTriShape::read(nif);
|
||||
|
||||
mSegments.resize(nif->get<uint32_t>());
|
||||
for (SegmentData& segment : mSegments)
|
||||
{
|
||||
nif->read(segment.mFlags);
|
||||
nif->read(segment.mStartIndex);
|
||||
nif->read(segment.mNumTriangles);
|
||||
}
|
||||
}
|
||||
|
||||
void BSLODTriShape::read(NIFStream* nif)
|
||||
{
|
||||
NiTriBasedGeom::read(nif);
|
||||
|
|
|
@ -161,6 +161,20 @@ namespace Nif
|
|||
{
|
||||
};
|
||||
|
||||
struct BSSegmentedTriShape : NiTriShape
|
||||
{
|
||||
struct SegmentData
|
||||
{
|
||||
uint8_t mFlags;
|
||||
uint32_t mStartIndex;
|
||||
uint32_t mNumTriangles;
|
||||
};
|
||||
|
||||
std::vector<SegmentData> mSegments;
|
||||
|
||||
void read(NIFStream* nif);
|
||||
};
|
||||
|
||||
struct NiTriStrips : NiTriBasedGeom
|
||||
{
|
||||
};
|
||||
|
|
|
@ -731,6 +731,24 @@ namespace Nif
|
|||
nif->read(mCenter);
|
||||
}
|
||||
|
||||
void bhkMeshShape::read(NIFStream* nif)
|
||||
{
|
||||
nif->skip(8); // Unknown
|
||||
nif->read(mRadius);
|
||||
nif->skip(8); // Unknown
|
||||
nif->read(mScale);
|
||||
mShapeProperties.resize(nif->get<uint32_t>());
|
||||
for (bhkWorldObjCInfoProperty& property : mShapeProperties)
|
||||
property.read(nif);
|
||||
nif->skip(12); // Unknown
|
||||
readRecordList(nif, mDataList);
|
||||
}
|
||||
|
||||
void bhkMeshShape::post(Reader& nif)
|
||||
{
|
||||
postRecordList(nif, mDataList);
|
||||
}
|
||||
|
||||
void bhkMultiSphereShape::read(NIFStream* nif)
|
||||
{
|
||||
bhkSphereRepShape::read(nif);
|
||||
|
@ -828,9 +846,18 @@ namespace Nif
|
|||
mBodyFlags = nif->get<uint16_t>();
|
||||
}
|
||||
|
||||
void bhkAabbPhantom::read(NIFStream* nif)
|
||||
{
|
||||
bhkPhantom::read(nif);
|
||||
|
||||
nif->skip(8); // Unused
|
||||
nif->read(mAabbMin);
|
||||
nif->read(mAabbMax);
|
||||
}
|
||||
|
||||
void bhkSimpleShapePhantom::read(NIFStream* nif)
|
||||
{
|
||||
bhkWorldObject::read(nif);
|
||||
bhkShapePhantom::read(nif);
|
||||
|
||||
nif->skip(8); // Unused
|
||||
std::array<float, 16> mat;
|
||||
|
@ -927,4 +954,36 @@ namespace Nif
|
|||
nif->read(mRemoveWhenBroken);
|
||||
}
|
||||
|
||||
void bhkUnaryAction::read(NIFStream* nif)
|
||||
{
|
||||
mEntity.read(nif);
|
||||
nif->skip(8); // Unused
|
||||
}
|
||||
|
||||
void bhkUnaryAction::post(Reader& nif)
|
||||
{
|
||||
mEntity.post(nif);
|
||||
}
|
||||
|
||||
void bhkLiquidAction::read(NIFStream* nif)
|
||||
{
|
||||
nif->skip(12); // Unused
|
||||
nif->read(mInitialStickForce);
|
||||
nif->read(mStickStrength);
|
||||
nif->read(mNeighborDistance);
|
||||
nif->read(mNeighborStrength);
|
||||
}
|
||||
|
||||
void bhkOrientHingedBodyAction::read(NIFStream* nif)
|
||||
{
|
||||
bhkUnaryAction::read(nif);
|
||||
|
||||
nif->skip(8); // Unused
|
||||
nif->read(mHingeAxisLS);
|
||||
nif->read(mForwardLS);
|
||||
nif->read(mStrength);
|
||||
nif->read(mDamping);
|
||||
nif->skip(8); // Unused
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
|
|
@ -695,6 +695,18 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
/// A shape based on triangle strips
|
||||
struct bhkMeshShape : bhkShape
|
||||
{
|
||||
float mRadius;
|
||||
osg::Vec4f mScale;
|
||||
std::vector<bhkWorldObjCInfoProperty> mShapeProperties;
|
||||
NiTriStripsDataList mDataList;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
// A sphere
|
||||
using bhkSphereShape = bhkConvexShape;
|
||||
|
||||
|
@ -757,7 +769,26 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct bhkSimpleShapePhantom : public bhkWorldObject
|
||||
// Abstract non-physical object that receives collision events
|
||||
struct bhkPhantom : bhkWorldObject
|
||||
{
|
||||
};
|
||||
|
||||
// A Phantom with an AABB
|
||||
struct bhkAabbPhantom : bhkPhantom
|
||||
{
|
||||
osg::Vec4f mAabbMin, mAabbMax;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// Abstract Phantom with a collision shape
|
||||
struct bhkShapePhantom : bhkPhantom
|
||||
{
|
||||
};
|
||||
|
||||
// A ShapePhantom with a transformation
|
||||
struct bhkSimpleShapePhantom : bhkShapePhantom
|
||||
{
|
||||
osg::Matrixf mTransform;
|
||||
|
||||
|
@ -844,5 +875,38 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// Abstract action applied during the simulation
|
||||
struct bhkAction : bhkSerializable
|
||||
{
|
||||
};
|
||||
|
||||
struct bhkUnaryAction : bhkAction
|
||||
{
|
||||
bhkRigidBodyPtr mEntity;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct bhkLiquidAction : bhkAction
|
||||
{
|
||||
float mInitialStickForce;
|
||||
float mStickStrength;
|
||||
float mNeighborDistance;
|
||||
float mNeighborStrength;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct bhkOrientHingedBodyAction : bhkUnaryAction
|
||||
{
|
||||
osg::Vec4f mHingeAxisLS;
|
||||
osg::Vec4f mForwardLS;
|
||||
float mStrength;
|
||||
float mDamping;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
} // Namespace
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace Nif
|
|||
{
|
||||
RC_MISSING = 0,
|
||||
RC_AvoidNode,
|
||||
RC_bhkAabbPhantom,
|
||||
RC_bhkBallAndSocketConstraint,
|
||||
RC_bhkBallSocketConstraintChain,
|
||||
RC_bhkBlendCollisionObject,
|
||||
|
@ -53,11 +54,14 @@ namespace Nif
|
|||
RC_bhkConvexVerticesShape,
|
||||
RC_bhkHingeConstraint,
|
||||
RC_bhkLimitedHingeConstraint,
|
||||
RC_bhkLiquidAction,
|
||||
RC_bhkListShape,
|
||||
RC_bhkMalleableConstraint,
|
||||
RC_bhkMeshShape,
|
||||
RC_bhkMoppBvTreeShape,
|
||||
RC_bhkMultiSphereShape,
|
||||
RC_bhkNiTriStripsShape,
|
||||
RC_bhkOrientHingedBodyAction,
|
||||
RC_bhkPackedNiTriStripsShape,
|
||||
RC_bhkPlaneShape,
|
||||
RC_bhkPhysicsSystem,
|
||||
|
@ -116,6 +120,7 @@ namespace Nif
|
|||
RC_BSStripPSysData,
|
||||
RC_BSRefractionFirePeriodController,
|
||||
RC_BSRefractionStrengthController,
|
||||
RC_BSSegmentedTriShape,
|
||||
RC_BSShaderNoLightingProperty,
|
||||
RC_BSShaderPPLightingProperty,
|
||||
RC_BSShaderProperty,
|
||||
|
|
Loading…
Reference in a new issue