Give NiLightColorController its own struct

master
Alexei Kotov 4 weeks ago
parent 2aa249e82a
commit a923e311f5

@ -231,12 +231,32 @@ namespace Nif
mCollider.post(nif);
}
void NiLightColorController::read(NIFStream* nif)
{
NiPoint3InterpController::read(nif);
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
mMode = static_cast<Mode>(nif->get<uint16_t>());
else
mMode = static_cast<Mode>((mFlags >> 4) & 1);
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
mData.read(nif);
}
void NiLightColorController::post(Reader& nif)
{
NiPoint3InterpController::post(nif);
mData.post(nif);
}
void NiMaterialColorController::read(NIFStream* nif)
{
NiPoint3InterpController::read(nif);
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
mTargetColor = static_cast<TargetColor>(nif->get<uint16_t>() & 3);
mTargetColor = static_cast<TargetColor>(nif->get<uint16_t>());
else
mTargetColor = static_cast<TargetColor>((mFlags >> 4) & 3);

@ -161,6 +161,21 @@ namespace Nif
};
using NiBSPArrayController = NiParticleSystemController;
struct NiLightColorController : public NiPoint3InterpController
{
enum class Mode
{
DiffuseSpecular = 0,
Ambient = 1,
};
NiPosDataPtr mData;
Mode mMode = Mode::DiffuseSpecular;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct NiMaterialColorController : public NiPoint3InterpController
{
enum class TargetColor

@ -112,8 +112,7 @@ namespace Nif
{ "NiGeomMorpherController", &construct<NiGeomMorpherController, RC_NiGeomMorpherController> },
{ "NiKeyframeController", &construct<NiKeyframeController, RC_NiKeyframeController> },
{ "NiLookAtController", &construct<NiLookAtController, RC_NiLookAtController> },
// FIXME: NiLightColorController should have its own struct
{ "NiLightColorController", &construct<NiMaterialColorController, RC_NiLightColorController> },
{ "NiLightColorController", &construct<NiLightColorController, RC_NiLightColorController> },
{ "NiMaterialColorController", &construct<NiMaterialColorController, RC_NiMaterialColorController> },
{ "NiPathController", &construct<NiPathController, RC_NiPathController> },
{ "NiRollController", &construct<NiRollController, RC_NiRollController> },

Loading…
Cancel
Save