From 4b040dba9fa2fac2d2f878bfdb5972e746a1ee3e Mon Sep 17 00:00:00 2001 From: lucas-watkins Date: Fri, 27 Feb 2026 09:47:25 -0500 Subject: [PATCH] Method overloads for `Texture::Load` to unload previous texture before loading new texture --- include/Texture.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/Texture.hpp b/include/Texture.hpp index 1de51892..ea77dfe1 100644 --- a/include/Texture.hpp +++ b/include/Texture.hpp @@ -62,6 +62,31 @@ class Texture : public TextureUnmanaged { return *this; } + + /** + * Unload previous texture, then load texture from image data + */ + void Load(const ::Image& image) { + Unload(); + TextureUnmanaged::Load(image); + } + + /** + * Unload previous texture, then load cubemap from image. + * Multiple image cubemap layouts supported + */ + void Load(const ::Image& image, int layoutType) { + Unload(); + TextureUnmanaged::Load(image, layoutType); + } + + /** + * Unload previous texture, then load texture from file into GPU memory (VRAM) + */ + void Load(const std::string& fileName) { + Unload(); + TextureUnmanaged::Load(fileName); + } }; // Create the Texture aliases.