Skip to content

Commit 4b040db

Browse files
committed
Method overloads for Texture::Load to unload previous texture before loading new texture
1 parent 21b0d0f commit 4b040db

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

include/Texture.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ class Texture : public TextureUnmanaged {
6262

6363
return *this;
6464
}
65+
66+
/**
67+
* Unload previous texture, then load texture from image data
68+
*/
69+
void Load(const ::Image& image) {
70+
Unload();
71+
TextureUnmanaged::Load(image);
72+
}
73+
74+
/**
75+
* Unload previous texture, then load cubemap from image.
76+
* Multiple image cubemap layouts supported
77+
*/
78+
void Load(const ::Image& image, int layoutType) {
79+
Unload();
80+
TextureUnmanaged::Load(image, layoutType);
81+
}
82+
83+
/**
84+
* Unload previous texture, then load texture from file into GPU memory (VRAM)
85+
*/
86+
void Load(const std::string& fileName) {
87+
Unload();
88+
TextureUnmanaged::Load(fileName);
89+
}
6590
};
6691

6792
// Create the Texture aliases.

0 commit comments

Comments
 (0)