Destroy cubemaps with the scene.

This commit is contained in:
Alberto Torres 2024-09-13 18:43:01 +02:00
parent 7efd3bb160
commit c1291c0412

View file

@ -351,6 +351,11 @@ proc destroy*(self: Scene) =
self.shadow_maps.destroy() self.shadow_maps.destroy()
for ubo in self.lighting_UBOs: for ubo in self.lighting_UBOs:
ubo.destroy() ubo.destroy()
if self.background_cubemap != nil:
self.background_cubemap.destroy()
for cube in self.cubemaps:
cube.destroy()
self.cubemaps = @[]
self.engine.scenes.del(self.name) self.engine.scenes.del(self.name)
# bound textures can linger # bound textures can linger
unbindAllTextures() unbindAllTextures()