ADDED: IsModelReady(), IsMaterialReady(), IsTextureReady(), IsRenderTextureReady() (#2895)

This commit is contained in:
Rob Loach 2023-01-28 06:13:09 -05:00 • committed by GitHub
commit 7fff1ba0b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -505,7 +505,7 @@ Image LoadImageFromScreen(void)
// Check if an image is ready
bool IsImageReady(Image image)
{
return image.data != NULL;
return image.data != NULL && image.width > 0 && image.height > 0 && image.format > 0;
}
// Unload image from CPU memory (RAM)
@ -3330,6 +3330,12 @@ RenderTexture2D LoadRenderTexture(int width, int height)
return target;
}
// Check if a texture is ready
bool IsTextureReady(Texture2D texture)
{
return texture.id > 0 && texture.width > 0 && texture.height > 0 && texture.format > 0;
}
// Unload texture from GPU memory (VRAM)
void UnloadTexture(Texture2D texture)
{
@ -3341,6 +3347,12 @@ void UnloadTexture(Texture2D texture)
}
}
// Check if a render texture is ready
bool IsRenderTextureReady(RenderTexture2D target)
{
return target.id > 0 && IsTextureReady(target.depth) && IsTextureReady(target.texture);
}
// Unload render texture from GPU memory (VRAM)
void UnloadRenderTexture(RenderTexture2D target)
{