mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 13:15:34 +00:00
Merge branch 'nilightcolorcontroller' into 'master'
Give NiLightColorController its own struct See merge request OpenMW/openmw!4472
This commit is contained in:
commit
c454675cff
3 changed files with 37 additions and 3 deletions
|
@ -231,12 +231,32 @@ namespace Nif
|
||||||
mCollider.post(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)
|
void NiMaterialColorController::read(NIFStream* nif)
|
||||||
{
|
{
|
||||||
NiPoint3InterpController::read(nif);
|
NiPoint3InterpController::read(nif);
|
||||||
|
|
||||||
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
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
|
else
|
||||||
mTargetColor = static_cast<TargetColor>((mFlags >> 4) & 3);
|
mTargetColor = static_cast<TargetColor>((mFlags >> 4) & 3);
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,21 @@ namespace Nif
|
||||||
};
|
};
|
||||||
using NiBSPArrayController = NiParticleSystemController;
|
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
|
struct NiMaterialColorController : public NiPoint3InterpController
|
||||||
{
|
{
|
||||||
enum class TargetColor
|
enum class TargetColor
|
||||||
|
|
|
@ -112,8 +112,7 @@ namespace Nif
|
||||||
{ "NiGeomMorpherController", &construct<NiGeomMorpherController, RC_NiGeomMorpherController> },
|
{ "NiGeomMorpherController", &construct<NiGeomMorpherController, RC_NiGeomMorpherController> },
|
||||||
{ "NiKeyframeController", &construct<NiKeyframeController, RC_NiKeyframeController> },
|
{ "NiKeyframeController", &construct<NiKeyframeController, RC_NiKeyframeController> },
|
||||||
{ "NiLookAtController", &construct<NiLookAtController, RC_NiLookAtController> },
|
{ "NiLookAtController", &construct<NiLookAtController, RC_NiLookAtController> },
|
||||||
// FIXME: NiLightColorController should have its own struct
|
{ "NiLightColorController", &construct<NiLightColorController, RC_NiLightColorController> },
|
||||||
{ "NiLightColorController", &construct<NiMaterialColorController, RC_NiLightColorController> },
|
|
||||||
{ "NiMaterialColorController", &construct<NiMaterialColorController, RC_NiMaterialColorController> },
|
{ "NiMaterialColorController", &construct<NiMaterialColorController, RC_NiMaterialColorController> },
|
||||||
{ "NiPathController", &construct<NiPathController, RC_NiPathController> },
|
{ "NiPathController", &construct<NiPathController, RC_NiPathController> },
|
||||||
{ "NiRollController", &construct<NiRollController, RC_NiRollController> },
|
{ "NiRollController", &construct<NiRollController, RC_NiRollController> },
|
||||||
|
|
Loading…
Reference in a new issue