Use existing lighttable info to apply anim lights
This commit is contained in:
parent
69b29c15f6
commit
47d95307b5
|
@ -348,12 +348,28 @@ class Program
|
||||||
|
|
||||||
foreach (var light in lights)
|
foreach (var light in lights)
|
||||||
{
|
{
|
||||||
// For now we're not actually doing anything
|
var layer = 0;
|
||||||
if (light.anim)
|
if (light.anim)
|
||||||
|
{
|
||||||
|
var paletteIdx = -1;
|
||||||
|
for (var i = 0; i < cell.AnimLightCount; i++)
|
||||||
|
{
|
||||||
|
var id = cell.AnimLights[i];
|
||||||
|
if (id == light.animLightTableIndex)
|
||||||
|
{
|
||||||
|
paletteIdx = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paletteIdx == -1 || (info.AnimLightBitmask & (1 << paletteIdx)) == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mask = info.AnimLightBitmask & ((1 << (paletteIdx + 1)) - 1);
|
||||||
|
layer = BitOperations.PopCount((uint)mask);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if plane normal is facing towards the light
|
// Check if plane normal is facing towards the light
|
||||||
// If it's not then we're never going to be (directly) lit by this
|
// If it's not then we're never going to be (directly) lit by this
|
||||||
// light.
|
// light.
|
||||||
|
@ -422,7 +438,7 @@ class Program
|
||||||
if (hit)
|
if (hit)
|
||||||
{
|
{
|
||||||
var strength = CalculateLightStrengthAtPoint(light, pos, plane);
|
var strength = CalculateLightStrengthAtPoint(light, pos, plane);
|
||||||
lightmap.AddLight(0, x, y, light.color, strength, hdr);
|
lightmap.AddLight(layer, x, y, light.color, strength, hdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue