LightmapGI: Clean up and improve lightmap atlas storage
Excerpt from #85653
Godot's lightmap storage has gone through several iterations, with the current one working like this: Storage-wise, the lightmaps are an array of layered textures. This is due to how layered textures are imported into the engine (A single image is loaded, then split into several smaller ones based on the defined layer count. Since the size limit of an image is 16K, large lightmaps may exceed that limit and the image will fail to load. As a solution, the lightmap textures are split into several layered textures at the end of the baking process). When loaded, the engine recombines them into a single layered texture, which is then used for rendering.
The older methods are still kept for compatibility, though the 'old-style' texture references are still saved, which can result in the same image being loaded multiple times.
Additionally, the lightmap exposed in the editor inspector is still the old one, which only allowed a single layered texture.
This PR cleans up some parts of this process, namely by renaming the internal class members to be less confusing, adding comments, as well as ensuring the 'old-style' lightmaps are only loaded, but not saved. Additionally, a new function was added for the splitting process described above. This will make it easier to add features like shadowmasks or LDR-packed directional data in the future.
Should we merge this before https://github.com/godotengine/godot/pull/85653? For context, I'd really like to get https://github.com/godotengine/godot/pull/85653 merged in the 4.4 cycle
Should we merge this before #85653? For context, I'd really like to get #85653 merged in the 4.4 cycle
I think so, this is a part of that PR which I've split to reduce its complexity.
Thanks!