mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Read BSShaderProperty and handle NiGeometry properties
This commit is contained in:
parent
42226533d8
commit
c0b9823372
7 changed files with 48 additions and 2 deletions
|
@ -132,6 +132,7 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
|
||||||
factory["NiColorInterpolator"] = {&construct <NiColorInterpolator> , RC_NiColorInterpolator };
|
factory["NiColorInterpolator"] = {&construct <NiColorInterpolator> , RC_NiColorInterpolator };
|
||||||
factory["BSShaderTextureSet"] = {&construct <BSShaderTextureSet> , RC_BSShaderTextureSet };
|
factory["BSShaderTextureSet"] = {&construct <BSShaderTextureSet> , RC_BSShaderTextureSet };
|
||||||
factory["BSLODTriShape"] = {&construct <BSLODTriShape> , RC_BSLODTriShape };
|
factory["BSLODTriShape"] = {&construct <BSLODTriShape> , RC_BSLODTriShape };
|
||||||
|
factory["BSShaderProperty"] = {&construct <BSShaderProperty> , RC_BSShaderProperty };
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,8 @@ struct NiGeometry : Node
|
||||||
NiGeometryDataPtr data;
|
NiGeometryDataPtr data;
|
||||||
NiSkinInstancePtr skin;
|
NiSkinInstancePtr skin;
|
||||||
MaterialData material;
|
MaterialData material;
|
||||||
|
BSShaderPropertyPtr shaderprop;
|
||||||
|
NiAlphaPropertyPtr alphaprop;
|
||||||
|
|
||||||
void read(NIFStream *nif) override
|
void read(NIFStream *nif) override
|
||||||
{
|
{
|
||||||
|
@ -286,7 +288,10 @@ struct NiGeometry : Node
|
||||||
skin.read(nif);
|
skin.read(nif);
|
||||||
material.read(nif);
|
material.read(nif);
|
||||||
if (nif->getVersion() == NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
|
if (nif->getVersion() == NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
|
||||||
nif->skip(8);
|
{
|
||||||
|
shaderprop.read(nif);
|
||||||
|
alphaprop.read(nif);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void post(NIFFile *nif) override
|
void post(NIFFile *nif) override
|
||||||
|
@ -294,6 +299,8 @@ struct NiGeometry : Node
|
||||||
Node::post(nif);
|
Node::post(nif);
|
||||||
data.post(nif);
|
data.post(nif);
|
||||||
skin.post(nif);
|
skin.post(nif);
|
||||||
|
shaderprop.post(nif);
|
||||||
|
alphaprop.post(nif);
|
||||||
if (recType != RC_NiParticles && !skin.empty())
|
if (recType != RC_NiParticles && !skin.empty())
|
||||||
nif->setUseSkinning(true);
|
nif->setUseSkinning(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,18 @@ void NiTexturingProperty::post(NIFFile *nif)
|
||||||
shaderTextures[i].post(nif);
|
shaderTextures[i].post(nif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BSShaderProperty::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
NiShadeProperty::read(nif);
|
||||||
|
if (nif->getBethVersion() <= NIFFile::BethVersion::BETHVER_FO3)
|
||||||
|
{
|
||||||
|
type = nif->getUInt();
|
||||||
|
flags1 = nif->getUInt();
|
||||||
|
flags2 = nif->getUInt();
|
||||||
|
envMapIntensity = nif->getFloat();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NiFogProperty::read(NIFStream *nif)
|
void NiFogProperty::read(NIFStream *nif)
|
||||||
{
|
{
|
||||||
Property::read(nif);
|
Property::read(nif);
|
||||||
|
|
|
@ -118,6 +118,13 @@ struct NiShadeProperty : public Property
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BSShaderProperty : public NiShadeProperty
|
||||||
|
{
|
||||||
|
unsigned int type{0u}, flags1{0u}, flags2{0u};
|
||||||
|
float envMapIntensity{0.f};
|
||||||
|
void read(NIFStream *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
struct NiDitherProperty : public Property
|
struct NiDitherProperty : public Property
|
||||||
{
|
{
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
|
|
|
@ -121,7 +121,8 @@ enum RecordType
|
||||||
RC_NiTransformInterpolator,
|
RC_NiTransformInterpolator,
|
||||||
RC_NiColorInterpolator,
|
RC_NiColorInterpolator,
|
||||||
RC_BSShaderTextureSet,
|
RC_BSShaderTextureSet,
|
||||||
RC_BSLODTriShape
|
RC_BSLODTriShape,
|
||||||
|
RC_BSShaderProperty
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Base class for all records
|
/// Base class for all records
|
||||||
|
|
|
@ -146,6 +146,8 @@ struct NiPoint3Interpolator;
|
||||||
struct NiTransformInterpolator;
|
struct NiTransformInterpolator;
|
||||||
struct BSShaderTextureSet;
|
struct BSShaderTextureSet;
|
||||||
struct NiGeometryData;
|
struct NiGeometryData;
|
||||||
|
struct BSShaderProperty;
|
||||||
|
class NiAlphaProperty;
|
||||||
|
|
||||||
using NodePtr = RecordPtrT<Node>;
|
using NodePtr = RecordPtrT<Node>;
|
||||||
using ExtraPtr = RecordPtrT<Extra>;
|
using ExtraPtr = RecordPtrT<Extra>;
|
||||||
|
@ -171,6 +173,8 @@ using NiPoint3InterpolatorPtr = RecordPtrT<NiPoint3Interpolator>;
|
||||||
using NiTransformInterpolatorPtr = RecordPtrT<NiTransformInterpolator>;
|
using NiTransformInterpolatorPtr = RecordPtrT<NiTransformInterpolator>;
|
||||||
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
|
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
|
||||||
using NiGeometryDataPtr = RecordPtrT<NiGeometryData>;
|
using NiGeometryDataPtr = RecordPtrT<NiGeometryData>;
|
||||||
|
using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>;
|
||||||
|
using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>;
|
||||||
|
|
||||||
using NodeList = RecordListT<Node>;
|
using NodeList = RecordListT<Node>;
|
||||||
using PropertyList = RecordListT<Property>;
|
using PropertyList = RecordListT<Property>;
|
||||||
|
|
|
@ -96,6 +96,15 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto geometry = dynamic_cast<const Nif::NiGeometry*>(nifNode);
|
||||||
|
if (geometry)
|
||||||
|
{
|
||||||
|
if (!geometry->shaderprop.empty())
|
||||||
|
out.emplace_back(geometry->shaderprop.getPtr());
|
||||||
|
if (!geometry->alphaprop.empty())
|
||||||
|
out.emplace_back(geometry->alphaprop.getPtr());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeCallback used to have a node always oriented towards the camera. The node can have translation and scale
|
// NodeCallback used to have a node always oriented towards the camera. The node can have translation and scale
|
||||||
|
@ -366,6 +375,11 @@ namespace NifOsg
|
||||||
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
handleProperty(props[i].getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto geometry = dynamic_cast<const Nif::NiGeometry*>(nifNode);
|
||||||
|
// NiGeometry's NiAlphaProperty doesn't get handled here because it's a drawable property
|
||||||
|
if (geometry && !geometry->shaderprop.empty())
|
||||||
|
handleProperty(geometry->shaderprop.getPtr(), applyTo, composite, imageManager, boundTextures, animflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupController(const Nif::Controller* ctrl, SceneUtil::Controller* toSetup, int animflags)
|
void setupController(const Nif::Controller* ctrl, SceneUtil::Controller* toSetup, int animflags)
|
||||||
|
|
Loading…
Reference in a new issue