add no stbi build version

This commit is contained in:
Matthew 2025-12-16 18:02:10 +11:00
parent 617e03f917
commit 7f4c109106
2 changed files with 17 additions and 5 deletions

View File

@ -194,7 +194,14 @@ LoadImage(void* data, i32 size)
ImageData image;
i32 w, h, has_ch;
version(NO_STBI)
{
u8* image_bytes;
}
else
{
u8* image_bytes = stbi_load_from_memory(cast(const(u8)*)data, size, &w, &h, &has_ch, 4);
}
if(w <= 0 || h <= 0 || has_ch <= 0)
{
Logf("Failed to load image data");
@ -212,9 +219,13 @@ LoadImage(void* data, i32 size)
void
UnloadImage(ImageData* image)
{
version(NO_STBI) {}
else
{
stbi_image_free(image.data.ptr);
}
}
ImageData
LoadImage(cgltf_image* asset_image, string tex_path)

View File

@ -17,9 +17,10 @@
# include FT_GLYPH_H
#endif
#ifdef NO_STBI
# include "external/stb/stb_image.h"
# include "external/stb/stb_image_write.h"
#endif
#define CGLM_FORCE_DEPTH_ZERO_TO_ONE
#include "external/cglm/cglm.h"