From 317b17ab02a1890f5762a68e569c83be7ed31c86 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sat, 4 Jan 2025 23:30:32 +0000 Subject: [PATCH] Only cast to lights in the cell light list --- KeepersCompound.Lightmapper/LightMapper.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/KeepersCompound.Lightmapper/LightMapper.cs b/KeepersCompound.Lightmapper/LightMapper.cs index ab6536e..881a068 100644 --- a/KeepersCompound.Lightmapper/LightMapper.cs +++ b/KeepersCompound.Lightmapper/LightMapper.cs @@ -641,9 +641,13 @@ public class LightMapper } } - foreach (var light in _lights) + foreach (var lightIdx in cell.LightIndices) { - var layer = 0; + if (lightIdx == 0) + { + continue; + } + var light = _lights[lightIdx - 1]; // Check if plane normal is facing towards the light // If it's not then we're never going to be (directly) lit by this @@ -693,6 +697,8 @@ public class LightMapper if (strength != 0f) { + var layer = 0; + // If we're an anim light there's a lot of stuff we need to update // Firstly we need to add the light to the cells anim light palette // Secondly we need to set the appropriate bit of the lightmap's