44 lines
807 B
C++
44 lines
807 B
C++
//
|
|
// Created by Vicente Ferrari Smith on 14.02.26.
|
|
//
|
|
|
|
#ifndef V_TEXTURE_H
|
|
#define V_TEXTURE_H
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <volk/volk.h>
|
|
#include <vma/vk_mem_alloc.h>
|
|
|
|
struct Renderer;
|
|
|
|
typedef std::string texture_id;
|
|
|
|
struct Texture {
|
|
texture_id id;
|
|
std::string path;
|
|
|
|
// NOTE: (vfs) stb_image wants s32 values for the width and height.
|
|
int32_t width;
|
|
int32_t height;
|
|
int32_t channels;
|
|
|
|
bool srgb;
|
|
bool uploaded;
|
|
|
|
VkImage image;
|
|
VmaAllocation allocation;
|
|
VkImageView view;
|
|
uint32_t descriptor_index;
|
|
};
|
|
|
|
struct TextureManager {
|
|
std::unordered_map<texture_id, Texture> textures;
|
|
|
|
TextureManager();
|
|
Texture load(const std::string& path, Renderer &renderer);
|
|
};
|
|
|
|
inline TextureManager texture_manager;
|
|
|
|
#endif //V_TEXTURE_H
|