diff options
| author | Clement Sibille <clements@lisible.xyz> | 2025-05-05 08:32:33 +0200 |
|---|---|---|
| committer | Clement Sibille <clements@lisible.xyz> | 2025-05-05 12:24:27 +0200 |
| commit | b71eac2069a30349435c192d682e865718c86a15 (patch) | |
| tree | 33754245a23533e31e6a83390bf190c11dfe2bb9 /src/image.c | |
| parent | 6017db0069977ae85e698a1234f4a2b7632ee495 (diff) | |
Add a vulkan renderer that renders an OBJ
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c new file mode 100644 index 0000000..a2d29c7 --- /dev/null +++ b/src/image.c @@ -0,0 +1,20 @@ +#include "image.h" + +#define STB_IMAGE_IMPLEMENTATION +#include <stb_image.h> + +bool vgltf_image_load_from_file(struct vgltf_image *image, + struct vgltf_string_view path) { + int width; + int height; + int tex_channels; + image->data = + stbi_load(path.data, &width, &height, &tex_channels, STBI_rgb_alpha); + image->width = width; + image->height = height; + image->format = VGLTF_IMAGE_FORMAT_R8G8B8A8; + + return image->data != nullptr; +} + +void vgltf_image_deinit(struct vgltf_image *image) { stbi_image_free(image->data); } |
