mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 13:45:34 +00:00
Support ESM4::Light with no spotlight data
This commit is contained in:
parent
97522c22ae
commit
ec564b14df
2 changed files with 34 additions and 28 deletions
|
@ -48,7 +48,11 @@ void ESM4::Light::load(ESM4::Reader& reader)
|
||||||
break;
|
break;
|
||||||
case ESM::fourCC("DATA"):
|
case ESM::fourCC("DATA"):
|
||||||
{
|
{
|
||||||
if (subHdr.dataSize != 32 && subHdr.dataSize != 48 && subHdr.dataSize != 64)
|
// 24: older TES4 records (found in GOG release)
|
||||||
|
// 32: newer TES4 records, FO3/FNV
|
||||||
|
// 48: TES5
|
||||||
|
// 64: FO4/FO76
|
||||||
|
if (subHdr.dataSize != 24 && subHdr.dataSize != 32 && subHdr.dataSize != 48 && subHdr.dataSize != 64)
|
||||||
{
|
{
|
||||||
reader.skipSubRecordData();
|
reader.skipSubRecordData();
|
||||||
break;
|
break;
|
||||||
|
@ -57,21 +61,23 @@ void ESM4::Light::load(ESM4::Reader& reader)
|
||||||
reader.get(mData.radius);
|
reader.get(mData.radius);
|
||||||
reader.get(mData.colour);
|
reader.get(mData.colour);
|
||||||
reader.get(mData.flags);
|
reader.get(mData.flags);
|
||||||
reader.get(mData.falloff);
|
if (subHdr.dataSize >= 32)
|
||||||
reader.get(mData.FOV);
|
|
||||||
// TES5, FO4
|
|
||||||
if (subHdr.dataSize >= 48)
|
|
||||||
{
|
{
|
||||||
reader.get(mData.nearClip);
|
reader.get(mData.falloff);
|
||||||
reader.get(mData.frequency);
|
reader.get(mData.FOV);
|
||||||
reader.get(mData.intensityAmplitude);
|
if (subHdr.dataSize >= 48)
|
||||||
reader.get(mData.movementAmplitude);
|
|
||||||
if (subHdr.dataSize == 64)
|
|
||||||
{
|
{
|
||||||
reader.get(mData.constant);
|
reader.get(mData.nearClip);
|
||||||
reader.get(mData.scalar);
|
reader.get(mData.frequency);
|
||||||
reader.get(mData.exponent);
|
reader.get(mData.intensityAmplitude);
|
||||||
reader.get(mData.godRaysNearClip);
|
reader.get(mData.movementAmplitude);
|
||||||
|
if (subHdr.dataSize == 64)
|
||||||
|
{
|
||||||
|
reader.get(mData.constant);
|
||||||
|
reader.get(mData.scalar);
|
||||||
|
reader.get(mData.exponent);
|
||||||
|
reader.get(mData.godRaysNearClip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.get(mData.value);
|
reader.get(mData.value);
|
||||||
|
|
|
@ -56,9 +56,9 @@ namespace ESM4
|
||||||
|
|
||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
std::int32_t time;
|
std::int32_t time = 0;
|
||||||
std::uint32_t radius;
|
std::uint32_t radius = 0;
|
||||||
std::uint32_t colour; // RGBA
|
std::uint32_t colour = 0; // RGBA
|
||||||
// flags:
|
// flags:
|
||||||
// 0x00000001 = Dynamic
|
// 0x00000001 = Dynamic
|
||||||
// 0x00000002 = Can be Carried
|
// 0x00000002 = Can be Carried
|
||||||
|
@ -70,19 +70,19 @@ namespace ESM4
|
||||||
// 0x00000100 = Pulse Slow
|
// 0x00000100 = Pulse Slow
|
||||||
// 0x00000200 = Spot Light
|
// 0x00000200 = Spot Light
|
||||||
// 0x00000400 = Spot Shadow
|
// 0x00000400 = Spot Shadow
|
||||||
std::int32_t flags;
|
std::int32_t flags = 0;
|
||||||
float falloff = 1.f;
|
float falloff = 1.f;
|
||||||
float FOV = 90; // FIXME: FOV in degrees or radians?
|
float FOV = 90; // FIXME: FOV in degrees or radians?
|
||||||
float nearClip; // TES5+
|
float nearClip = 0.f; // TES5+
|
||||||
float frequency; // TES5+
|
float frequency = 0.f; // TES5+
|
||||||
float intensityAmplitude; // TES5+
|
float intensityAmplitude = 0.f; // TES5+
|
||||||
float movementAmplitude; // TES5+
|
float movementAmplitude = 0.f; // TES5+
|
||||||
float constant; // FO4
|
float constant = 0.f; // FO4
|
||||||
float scalar; // FO4
|
float scalar = 0.f; // FO4
|
||||||
float exponent; // FO4
|
float exponent = 0.f; // FO4
|
||||||
float godRaysNearClip; // FO4
|
float godRaysNearClip = 0.f; // FO4
|
||||||
std::uint32_t value; // gold
|
std::uint32_t value = 0; // gold
|
||||||
float weight;
|
float weight = 0.f;
|
||||||
};
|
};
|
||||||
|
|
||||||
ESM::FormId mId; // from the header
|
ESM::FormId mId; // from the header
|
||||||
|
|
Loading…
Reference in a new issue