42 lines
736 B
C++
42 lines
736 B
C++
//
|
|
// Created by Vicente Ferrari Smith on 14.02.26.
|
|
//
|
|
|
|
#ifndef TEXTURE_H
|
|
#define TEXTURE_H
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <stb_image.h>
|
|
|
|
struct Renderer;
|
|
struct PlatformTexture;
|
|
|
|
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;
|
|
|
|
PlatformTexture *p_texture;
|
|
uint32_t descriptor_index;
|
|
};
|
|
|
|
struct TextureManager {
|
|
std::unordered_map<texture_id, Texture> textures;
|
|
|
|
TextureManager();
|
|
Texture load(const std::string& path);
|
|
};
|
|
|
|
inline TextureManager texture_manager;
|
|
|
|
#endif //TEXTURE_H
|