From b71eac2069a30349435c192d682e865718c86a15 Mon Sep 17 00:00:00 2001 From: Clement Sibille Date: Mon, 5 May 2025 08:32:33 +0200 Subject: Add a vulkan renderer that renders an OBJ --- src/image.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/image.c (limited to 'src/image.c') 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 + +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); } -- cgit v1.2.3