//
// Created by Vicente Ferrari Smith on 14.02.26.
//

#ifndef V_TEXTURE_SHEET_H
#define V_TEXTURE_SHEET_H

#include <string>
#include <glm/glm.hpp>
#include "texture.h"

inline const std::string TEXTURE_SHEETS_PATH = "data/texture_sheets";

typedef std::string texture_cell_id;
typedef std::string texture_sheet_id;

struct sheet_cell_id {
    texture_sheet_id sheet_id;
    texture_cell_id cell_id;
};

struct TextureCell {
    texture_cell_id name;

    int64_t cell_x;
    int64_t cell_y;

    glm::vec2 st0 = {0.0, 0.0};
    glm::vec2 st1 = {1.0, 1.0};
};

struct TextureSheet {
    texture_sheet_id name;
    texture_id texture;

    int64_t cell_width;
    int64_t cell_height;

    int64_t columns;
    int64_t rows;

    std::vector<TextureCell> cells;
};

struct TextureSheetManager {
    std::unordered_map<texture_sheet_id, TextureSheet> sheets;
};

inline TextureSheetManager texture_sheet_manager;

#endif //V_TEXTURE_SHEET_H