2015-02-23 20:06:10 +00:00
|
|
|
#include "effect.hpp"
|
|
|
|
|
|
|
|
#include "node.hpp"
|
2023-08-31 15:59:33 +00:00
|
|
|
#include "texture.hpp"
|
2015-02-23 20:06:10 +00:00
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
2022-07-21 11:51:34 +00:00
|
|
|
void NiDynamicEffect::read(NIFStream* nif)
|
|
|
|
{
|
2023-09-10 02:23:25 +00:00
|
|
|
NiAVObject::read(nif);
|
2023-08-31 19:05:55 +00:00
|
|
|
|
|
|
|
if (nif->getVersion() > NIFFile::VER_MW && nif->getVersion() < nif->generateVersion(10, 1, 0, 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_FO4)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (nif->getVersion() >= nif->generateVersion(10, 1, 0, 106))
|
|
|
|
nif->read(mSwitchState);
|
|
|
|
size_t numAffectedNodes = nif->get<uint32_t>();
|
|
|
|
nif->skip(numAffectedNodes * 4);
|
2022-07-21 11:51:34 +00:00
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2015-11-12 22:27:34 +00:00
|
|
|
void NiLight::read(NIFStream* nif)
|
2015-02-23 20:06:10 +00:00
|
|
|
{
|
2015-11-12 22:27:34 +00:00
|
|
|
NiDynamicEffect::read(nif);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-09-17 19:43:02 +00:00
|
|
|
nif->read(mDimmer);
|
|
|
|
nif->read(mAmbient);
|
|
|
|
nif->read(mDiffuse);
|
|
|
|
nif->read(mSpecular);
|
2015-02-23 20:06:10 +00:00
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-08-31 19:05:55 +00:00
|
|
|
void NiPointLight::read(NIFStream* nif)
|
2015-02-23 20:06:10 +00:00
|
|
|
{
|
2023-08-31 19:05:55 +00:00
|
|
|
NiLight::read(nif);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-09-17 19:43:02 +00:00
|
|
|
nif->read(mConstantAttenuation);
|
|
|
|
nif->read(mLinearAttenuation);
|
|
|
|
nif->read(mQuadraticAttenuation);
|
2023-08-31 19:05:55 +00:00
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-08-31 19:05:55 +00:00
|
|
|
void NiSpotLight::read(NIFStream* nif)
|
|
|
|
{
|
|
|
|
NiPointLight::read(nif);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-11-08 09:27:12 +00:00
|
|
|
nif->read(mOuterSpotAngle);
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 5))
|
|
|
|
nif->read(mInnerSpotAngle);
|
2023-09-17 19:43:02 +00:00
|
|
|
nif->read(mExponent);
|
2023-08-31 19:05:55 +00:00
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-08-31 19:05:55 +00:00
|
|
|
void NiTextureEffect::read(NIFStream* nif)
|
|
|
|
{
|
|
|
|
NiDynamicEffect::read(nif);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-08-31 19:05:55 +00:00
|
|
|
nif->read(mProjectionRotation);
|
|
|
|
nif->read(mProjectionPosition);
|
|
|
|
nif->read(mFilterMode);
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(20, 5, 0, 4))
|
|
|
|
nif->read(mMaxAnisotropy);
|
|
|
|
nif->read(mClampMode);
|
|
|
|
mTextureType = static_cast<TextureType>(nif->get<uint32_t>());
|
|
|
|
mCoordGenType = static_cast<CoordGenType>(nif->get<uint32_t>());
|
|
|
|
mTexture.read(nif);
|
|
|
|
nif->read(mEnableClipPlane);
|
|
|
|
mClipPlane = osg::Plane(nif->get<osg::Vec4f>());
|
2020-10-03 22:27:49 +00:00
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 2, 0, 0))
|
|
|
|
nif->skip(4); // PS2-specific shorts
|
|
|
|
if (nif->getVersion() <= NIFStream::generateVersion(4, 1, 0, 12))
|
|
|
|
nif->skip(2); // Unknown short
|
2015-02-23 20:06:10 +00:00
|
|
|
}
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2022-09-17 17:24:42 +00:00
|
|
|
void NiTextureEffect::post(Reader& nif)
|
2015-02-23 20:06:10 +00:00
|
|
|
{
|
2015-11-12 22:27:34 +00:00
|
|
|
NiDynamicEffect::post(nif);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2023-08-31 19:05:55 +00:00
|
|
|
mTexture.post(nif);
|
2015-11-12 22:45:12 +00:00
|
|
|
}
|
|
|
|
|
2015-02-23 20:06:10 +00:00
|
|
|
}
|