Skip light map updates that change nothing
- author
- Marijn Besseling <njirambem@gmail.com> · 2026-10-24 22:06 UTC
- commit
- aa47d4522e18f7fa7f83c11538cdc442496e2121
- parent
- 2ac698df8f
- tree
- browse at this commit
1 file changed +4 -1
| src/light.rs | +4 -1 |
src/light.rs +4 -1
| @@ -161,7 +161,10 @@ fn update_light_map( | ||
| 161 | 161 | if !sources_changed && step == light.ambient_step && light.size == map.size { |
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | - *light = LightMap::compute(&map, day, structures.iter().map(|(pos, s)| (pos.0, s.kind))); | |
| 164 | + let fresh = LightMap::compute(&map, day, structures.iter().map(|(pos, s)| (pos.0, s.kind))); | |
| 165 | + if fresh != *light { | |
| 166 | + *light = fresh; | |
| 167 | + } | |
| 165 | 168 | } |
| 166 | 169 | |
| 167 | 170 | #[cfg(test)] |