[WIP] Refactor project

There are many problems with the way the current version is provided
and maintained. This commit or series of commits will fix this.
This commit is contained in:
Piotr Krygier committed 2025-06-20 13:44:33 +02:00
1 parent f5ab5f3f27
commit 173a82b9d1
63 files changed
+2663 -2239

No files matched your search

+88
View File
@@ -0,0 +1,88 @@
/**
* @file vulkan_image.h
* @author Piotr Krygier (everyonecancode@gmail.com)
* @brief Library for loading and handling textures
* @version 0.1
* @date 2023-09-27
*
* @copyright Copyright (c) 2023
*
*/
#ifndef TEXTURE_H
#define TEXTURE_H
#include "utilities/file_utils.h"
#include "utilities/commons.h"
#include "graphics_context.h"
#include "vulkan/vulkan_core.h"
#include <stdint.h>
#define IMAGE_FORMAT VK_FORMAT_B8G8R8A8_SRGB;
/**
* @brief Initialize vulkan with image views and stuff
*
* @param context Graphics context
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
rse_err_t init_vulkan_images(struct graphics_context_t* context);
/**
* @brief Loads image from file, for later to be used as a texture
*
* @param context Graphics context handle
* @param file_path Path to texture file
* @param texture_id Texture ID will be set up here
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
rse_err_t load_texture_from_bitmat(struct graphics_context_t* context, const unsigned char* pixel_buffer, int width, int height, uint16_t* texture_id, VkFormat color_format);
/**
* @brief Loads image from file, for later to be used as a texture
*
* @param context Graphics context handle
* @param file_path Path to texture file
* @param texture_id Texture ID will be set up here
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
rse_err_t load_texture_from_file(struct graphics_context_t* context, const char* file_path, uint16_t* texture_id);
/**
* @brief Destroy all loaded textures. Usefull for closing application or just clearing.
*
* @param context Graphics context handle
*
*/
void destroy_textures(struct graphics_context_t* context);
/**
* @brief Checks if image exists for provided image ID.
*
* @param context Graphics context handle
* @param image_id Image ID
* @return uint8_t 1 on success, 0 on failure
*/
uint8_t image_exists(struct graphics_context_t* context, uint8_t image_id);
/**
* @brief Returns number of loaded texture
*
* @param context Graphics context handle
* @return size_t Texture count
*/
size_t get_textures_count(struct graphics_context_t* context);
rse_err_t find_depth_format(struct graphics_context_t* context, VkFormat* found_format);
rse_err_t create_color_resource(struct graphics_context_t* context);
void destroy_color_resource(struct graphics_context_t* context);
rse_err_t create_depth_resources(struct graphics_context_t* context);
void destroy_depth_resource(struct graphics_context_t* context);
#endif /* TEXTURE_H */