@@ -126,6 +126,10 @@ enum TextureFlags {
Allows the texture to be loaded asynchronously (requires initializating hxd.res.Image.ASYNC_LOADER)
**/
AsyncLoading;
+ /**
+ By default, the texture are loaded from images when created. If this flag is enabled, the texture will be loaded from disk when first used.
+ **/
+ LazyLoading;
}
typedef TextureFormat = hxd.PixelFormat;
@@ -625,7 +625,7 @@ class Image extends Resource {
tex.setName(entry.path);
setupTextureFlags(tex);
// DirectX12 texture array triggers an access violation.
- if ( tex.flags.has(IsArray) )
+ if ( tex.flags.has(IsArray) || !tex.flags.has(LazyLoading) )
loadTexture();
else
tex.realloc = () -> loadTexture();