57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
|
|
#pragma once
|
|
|
|
#if !defined(SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_UTIL_TEXTURE_ATLAS_HPP_INCLUDED)
|
|
#define SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_UTIL_TEXTURE_ATLAS_HPP_INCLUDED 1
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#include <mijin/virtual_filesystem/filesystem.hpp>
|
|
|
|
namespace sdl_gpu_test
|
|
{
|
|
struct TextureAtlasEntry
|
|
{
|
|
unsigned x = 0;
|
|
unsigned y = 0;
|
|
unsigned width = 0;
|
|
unsigned height = 0;
|
|
};
|
|
|
|
struct TextureAtlas
|
|
{
|
|
std::unordered_map<std::string, TextureAtlasEntry> entries;
|
|
};
|
|
|
|
struct UVTextureAtlasEntry
|
|
{
|
|
float uvX = 0.f;
|
|
float uvY = 0.f;
|
|
float uvWidth = 0.f;
|
|
float uvHeight = 0.f;
|
|
unsigned width = 0;
|
|
unsigned height = 0;
|
|
};
|
|
|
|
struct UVTextureAtlas
|
|
{
|
|
std::unordered_map<std::string, UVTextureAtlasEntry> entries;
|
|
};
|
|
|
|
struct MakeUVTextureAtlasArgs
|
|
{
|
|
const TextureAtlas* original;
|
|
unsigned textureWidth;
|
|
unsigned textureHeight;
|
|
};
|
|
|
|
[[nodiscard]]
|
|
TextureAtlas loadTextureAtlas(const mijin::PathReference& path);
|
|
|
|
[[nodiscard]]
|
|
UVTextureAtlas makeUVTextureAtlas(const MakeUVTextureAtlasArgs& args);
|
|
} // namespace sdl_gpu_test
|
|
|
|
#endif // !defined(SDL_GPU_TEST_PRIVATE_SDL_GPU_TEST_UTIL_TEXTURE_ATLAS_HPP_INCLUDED)
|