Merge branch 'buyskyrem' into 'master'

Load a few more NIF records, fix BSEffectShader rendering

See merge request OpenMW/openmw!2763
update_gitlab_rules
psi29a 2 years ago
commit cc5f20d66a

@ -137,6 +137,7 @@ namespace Nif
{ "BSBound", &construct<BSBound, RC_BSBound> },
{ "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> },
{ "BSFadeNode", &construct<NiNode, RC_NiNode> },
{ "BSLeafAnimNode", &construct<NiNode, RC_NiNode> },
{ "bhkBlendController", &construct<bhkBlendController, RC_bhkBlendController> },
{ "NiFloatInterpolator", &construct<NiFloatInterpolator, RC_NiFloatInterpolator> },
{ "NiBoolInterpolator", &construct<NiBoolInterpolator, RC_NiBoolInterpolator> },
@ -152,6 +153,7 @@ namespace Nif
{ "BSShaderPPLightingProperty", &construct<BSShaderPPLightingProperty, RC_BSShaderPPLightingProperty> },
{ "BSShaderNoLightingProperty", &construct<BSShaderNoLightingProperty, RC_BSShaderNoLightingProperty> },
{ "BSFurnitureMarker", &construct<BSFurnitureMarker, RC_BSFurnitureMarker> },
{ "BSFurnitureMarkerNode", &construct<BSFurnitureMarker, RC_BSFurnitureMarker> },
{ "NiCollisionObject", &construct<NiCollisionObject, RC_NiCollisionObject> },
{ "bhkCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "BSDismemberSkinInstance", &construct<BSDismemberSkinInstance, RC_BSDismemberSkinInstance> },
@ -181,6 +183,8 @@ namespace Nif
{ "NiBlendPoint3Interpolator", &construct<NiBlendPoint3Interpolator, RC_NiBlendPoint3Interpolator> },
{ "NiBlendTransformInterpolator",
&construct<NiBlendTransformInterpolator, RC_NiBlendTransformInterpolator> },
{ "bhkCompressedMeshShape", &construct<bhkCompressedMeshShape, RC_bhkCompressedMeshShape> },
{ "bhkCompressedMeshShapeData", &construct<bhkCompressedMeshShapeData, RC_bhkCompressedMeshShapeData> },
};
}

@ -71,6 +71,46 @@ namespace Nif
mNormal = nif->getVector3();
}
void bhkMeshMaterial::read(NIFStream* nif)
{
mHavokMaterial.read(nif);
mHavokFilter.read(nif);
}
void bhkQsTransform::read(NIFStream* nif)
{
mTranslation = nif->getVector4();
mRotation = nif->getQuaternion();
}
void bhkCMSBigTri::read(NIFStream* nif)
{
for (int i = 0; i < 3; i++)
mTriangle[i] = nif->getUShort();
mMaterial = nif->getUInt();
mWeldingInfo = nif->getUShort();
}
void bhkCMSChunk::read(NIFStream* nif)
{
mTranslation = nif->getVector4();
mMaterialIndex = nif->getUInt();
mReference = nif->getUShort();
mTransformIndex = nif->getUShort();
size_t numVertices = nif->getUInt();
if (numVertices)
nif->getUShorts(mVertices, numVertices);
size_t numIndices = nif->getUInt();
if (numIndices)
nif->getUShorts(mIndices, numIndices);
size_t numStrips = nif->getUInt();
if (numStrips)
nif->getUShorts(mStrips, numStrips);
size_t numInfos = nif->getUInt();
if (numInfos)
nif->getUShorts(mWeldingInfos, numInfos);
}
void bhkRigidBodyCInfo::read(NIFStream* nif)
{
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
@ -327,6 +367,68 @@ namespace Nif
filter.read(nif);
}
void bhkCompressedMeshShape::read(NIFStream* nif)
{
mTarget.read(nif);
mUserData = nif->getUInt();
mRadius = nif->getFloat();
nif->getFloat(); // Unknown
mScale = nif->getVector4();
nif->getFloat(); // Radius
nif->getVector4(); // Scale
mData.read(nif);
}
void bhkCompressedMeshShape::post(Reader& nif)
{
mTarget.post(nif);
mData.post(nif);
}
void bhkCompressedMeshShapeData::read(NIFStream* nif)
{
mBitsPerIndex = nif->getUInt();
mBitsPerWIndex = nif->getUInt();
mMaskWIndex = nif->getUInt();
mMaskIndex = nif->getUInt();
mError = nif->getFloat();
mAabbMin = nif->getVector4();
mAabbMax = nif->getVector4();
mWeldingType = nif->getChar();
mMaterialType = nif->getChar();
nif->skip(nif->getUInt() * 4); // Unused
nif->skip(nif->getUInt() * 4); // Unused
nif->skip(nif->getUInt() * 4); // Unused
size_t numMaterials = nif->getUInt();
mMaterials.resize(numMaterials);
for (bhkMeshMaterial& material : mMaterials)
material.read(nif);
nif->getUInt(); // Unused
size_t numTransforms = nif->getUInt();
mChunkTransforms.resize(numTransforms);
for (bhkQsTransform& transform : mChunkTransforms)
transform.read(nif);
size_t numBigVertices = nif->getUInt();
if (numBigVertices)
nif->getVector4s(mBigVerts, numBigVertices);
size_t numBigTriangles = nif->getUInt();
mBigTris.resize(numBigTriangles);
for (bhkCMSBigTri& tri : mBigTris)
tri.read(nif);
size_t numChunks = nif->getUInt();
mChunks.resize(numChunks);
for (bhkCMSChunk& chunk : mChunks)
chunk.read(nif);
nif->getUInt(); // Unused
}
void bhkRigidBody::read(NIFStream* nif)
{
bhkEntity::read(nif);

@ -96,6 +96,41 @@ namespace Nif
void read(NIFStream* nif);
};
struct bhkMeshMaterial
{
HavokMaterial mHavokMaterial;
HavokFilter mHavokFilter;
void read(NIFStream* nif);
};
struct bhkQsTransform
{
osg::Vec4f mTranslation;
osg::Quat mRotation;
void read(NIFStream* nif);
};
struct bhkCMSBigTri
{
unsigned short mTriangle[3];
unsigned int mMaterial;
unsigned short mWeldingInfo;
void read(NIFStream* nif);
};
struct bhkCMSChunk
{
osg::Vec4f mTranslation;
unsigned int mMaterialIndex;
unsigned short mReference;
unsigned short mTransformIndex;
std::vector<unsigned short> mVertices;
std::vector<unsigned short> mIndices;
std::vector<unsigned short> mStrips;
std::vector<unsigned short> mWeldingInfos;
void read(NIFStream* nif);
};
enum class hkMotionType : uint8_t
{
Motion_Invalid = 0,
@ -354,6 +389,34 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct bhkCompressedMeshShape : public bhkShape
{
NodePtr mTarget;
unsigned int mUserData;
float mRadius;
osg::Vec4f mScale;
bhkCompressedMeshShapeDataPtr mData;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct bhkCompressedMeshShapeData : public bhkRefObject
{
unsigned int mBitsPerIndex, mBitsPerWIndex;
unsigned int mMaskWIndex, mMaskIndex;
float mError;
osg::Vec4f mAabbMin, mAabbMax;
char mWeldingType;
char mMaterialType;
std::vector<bhkMeshMaterial> mMaterials;
std::vector<bhkQsTransform> mChunkTransforms;
std::vector<osg::Vec4f> mBigVerts;
std::vector<bhkCMSBigTri> mBigTris;
std::vector<bhkCMSChunk> mChunks;
void read(NIFStream* nif) override;
};
struct bhkRigidBody : public bhkEntity
{
bhkRigidBodyCInfo mInfo;

@ -157,6 +157,8 @@ namespace Nif
RC_NiBlendFloatInterpolator,
RC_NiBlendPoint3Interpolator,
RC_NiBlendTransformInterpolator,
RC_bhkCompressedMeshShape,
RC_bhkCompressedMeshShapeData,
};
/// Base class for all records

@ -145,6 +145,7 @@ namespace Nif
struct NiBlendInterpolator;
struct NiDefaultAVObjectPalette;
struct NiControllerSequence;
struct bhkCompressedMeshShapeData;
using NodePtr = RecordPtrT<Node>;
using ExtraPtr = RecordPtrT<Extra>;
@ -179,6 +180,7 @@ namespace Nif
using NiControllerManagerPtr = RecordPtrT<NiControllerManager>;
using NiBlendInterpolatorPtr = RecordPtrT<NiBlendInterpolator>;
using NiDefaultAVObjectPalettePtr = RecordPtrT<NiDefaultAVObjectPalette>;
using bhkCompressedMeshShapeDataPtr = RecordPtrT<bhkCompressedMeshShapeData>;
using NodeList = RecordListT<Node>;
using PropertyList = RecordListT<Property>;

@ -2247,7 +2247,7 @@ namespace NifOsg
stateset->setTextureAttributeAndModes(texUnit, texMat, osg::StateAttribute::ON);
}
}
stateset->addUniform(new osg::Uniform("useFalloff", true)); // Should use the shader flag
stateset->addUniform(new osg::Uniform("useFalloff", false)); // Should use the shader flag
stateset->addUniform(new osg::Uniform("falloffParams", texprop->mFalloffParams));
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
break;

Loading…
Cancel
Save