1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 15:09:39 +00:00

Read BSShaderTextureSet and NiColorInterpolator

Accept boolean-based and 4D vector-based NiInterpolators in ValueInterpolator constructor
This commit is contained in:
Alexei Dobrohotov 2020-12-13 02:35:57 +03:00
parent 2373f07168
commit 1c83e4936d
8 changed files with 52 additions and 2 deletions

View file

@ -47,6 +47,11 @@ namespace Nif
data.post(nif); data.post(nif);
} }
void BSShaderTextureSet::read(NIFStream *nif)
{
nif->getSizedStrings(textures, nif->getUInt());
}
void NiParticleModifier::read(NIFStream *nif) void NiParticleModifier::read(NIFStream *nif)
{ {
next.read(nif); next.read(nif);

View file

@ -66,6 +66,24 @@ public:
void post(NIFFile *nif) override; void post(NIFFile *nif) override;
}; };
struct BSShaderTextureSet : public Record
{
enum TextureType
{
TextureType_Base = 0,
TextureType_Normal = 1,
TextureType_Glow = 2,
TextureType_Parallax = 3,
TextureType_Env = 4,
TextureType_EnvMask = 5,
TextureType_Subsurface = 6,
TextureType_BackLighting = 7
};
std::vector<std::string> textures;
void read(NIFStream *nif) override;
};
struct NiParticleModifier : public Record struct NiParticleModifier : public Record
{ {
NiParticleModifierPtr next; NiParticleModifierPtr next;

View file

@ -325,4 +325,15 @@ namespace Nif
data.post(nif); data.post(nif);
} }
void NiColorInterpolator::read(NIFStream *nif)
{
defaultVal = nif->getVector4();
data.read(nif);
}
void NiColorInterpolator::post(NIFFile *nif)
{
data.post(nif);
}
} }

View file

@ -230,5 +230,13 @@ struct NiTransformInterpolator : public Interpolator
void post(NIFFile *nif) override; void post(NIFFile *nif) override;
}; };
struct NiColorInterpolator : public Interpolator
{
osg::Vec4f defaultVal;
NiColorDataPtr data;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override;
};
} // Namespace } // Namespace
#endif #endif

View file

@ -129,6 +129,8 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
factory["NiPoint3Interpolator"] = {&construct <NiPoint3Interpolator> , RC_NiPoint3Interpolator }; factory["NiPoint3Interpolator"] = {&construct <NiPoint3Interpolator> , RC_NiPoint3Interpolator };
factory["NiTransformController"] = {&construct <NiKeyframeController> , RC_NiKeyframeController }; factory["NiTransformController"] = {&construct <NiKeyframeController> , RC_NiKeyframeController };
factory["NiTransformInterpolator"] = {&construct <NiTransformInterpolator> , RC_NiTransformInterpolator }; factory["NiTransformInterpolator"] = {&construct <NiTransformInterpolator> , RC_NiTransformInterpolator };
factory["NiColorInterpolator"] = {&construct <NiColorInterpolator> , RC_NiColorInterpolator };
factory["BSShaderTextureSet"] = {&construct <BSShaderTextureSet> , RC_BSShaderTextureSet };
return factory; return factory;
} }

View file

@ -118,7 +118,9 @@ enum RecordType
RC_NiFloatInterpolator, RC_NiFloatInterpolator,
RC_NiPoint3Interpolator, RC_NiPoint3Interpolator,
RC_NiBoolInterpolator, RC_NiBoolInterpolator,
RC_NiTransformInterpolator RC_NiTransformInterpolator,
RC_NiColorInterpolator,
RC_BSShaderTextureSet
}; };
/// Base class for all records /// Base class for all records

View file

@ -147,6 +147,7 @@ struct NiSkinPartition;
struct NiFloatInterpolator; struct NiFloatInterpolator;
struct NiPoint3Interpolator; struct NiPoint3Interpolator;
struct NiTransformInterpolator; struct NiTransformInterpolator;
struct BSShaderTextureSet;
using NodePtr = RecordPtrT<Node>; using NodePtr = RecordPtrT<Node>;
using ExtraPtr = RecordPtrT<Extra>; using ExtraPtr = RecordPtrT<Extra>;
@ -174,6 +175,7 @@ using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
using NiFloatInterpolatorPtr = RecordPtrT<NiFloatInterpolator>; using NiFloatInterpolatorPtr = RecordPtrT<NiFloatInterpolator>;
using NiPoint3InterpolatorPtr = RecordPtrT<NiPoint3Interpolator>; using NiPoint3InterpolatorPtr = RecordPtrT<NiPoint3Interpolator>;
using NiTransformInterpolatorPtr = RecordPtrT<NiTransformInterpolator>; using NiTransformInterpolatorPtr = RecordPtrT<NiTransformInterpolator>;
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
using NodeList = RecordListT<Node>; using NodeList = RecordListT<Node>;
using PropertyList = RecordListT<Property>; using PropertyList = RecordListT<Property>;

View file

@ -66,7 +66,9 @@ namespace NifOsg
std::conjunction_v< std::conjunction_v<
std::disjunction< std::disjunction<
std::is_same<ValueT, float>, std::is_same<ValueT, float>,
std::is_same<ValueT, osg::Vec3f> std::is_same<ValueT, osg::Vec3f>,
std::is_same<ValueT, bool>,
std::is_same<ValueT, osg::Vec4f>
>, >,
std::is_same<decltype(T::defaultVal), ValueT> std::is_same<decltype(T::defaultVal), ValueT>
>, >,