A disk asset (.tileset JSON) that owns an ordered list of TileAssets. At runtime, a CPU-side atlas is built by packing every tile texture into a single RGBA image, which is uploaded to Vulkan once. This gives the TilemapSystem a single draw call per tilemap.
More...
#include <TilesetAsset.hpp>
|
| void | buildAtlas (VulkanRenderer &renderer) |
| | Rebuilds the CPU-side atlas from tiles[].texturePath entries, uploads it as a Vulkan texture, and fills tiles[].atlasUV. If a tile's texture cannot be loaded, a solid magenta 1×1 tile is used.
|
| void | destroyAtlas (VulkanRenderer &renderer) |
| | Frees the GPU-side atlas resources if they exist.
|
|
| std::string | name |
| | Display name of the tileset.
|
| std::string | filePath |
| | Absolute (or project-relative) path to the .tileset file.
|
| int | tileWidth = 16 |
| | Width of each tile cell in the packed atlas (pixels).
|
| int | tileHeight = 16 |
| | Height of each tile cell in the packed atlas (pixels).
|
| std::vector< TileAsset > | tiles |
| | Ordered list of tile slots. tiles[i].id == i. Index is the value stored in TilemapComponent::tiles[].
|
| AtlasCache | atlas |
A disk asset (.tileset JSON) that owns an ordered list of TileAssets. At runtime, a CPU-side atlas is built by packing every tile texture into a single RGBA image, which is uploaded to Vulkan once. This gives the TilemapSystem a single draw call per tilemap.
◆ buildAtlas()
Rebuilds the CPU-side atlas from tiles[].texturePath entries, uploads it as a Vulkan texture, and fills tiles[].atlasUV. If a tile's texture cannot be loaded, a solid magenta 1×1 tile is used.
- Parameters
-
◆ destroyAtlas()
Frees the GPU-side atlas resources if they exist.
- Parameters
-
◆ loadFromFile()
| TilesetAsset Engine::TilesetAsset::loadFromFile |
( |
const std::string & | path | ) |
|
|
static |
Loads a TilesetAsset from a .tileset JSON file. Individual tile paths listed in the file are loaded as TileAssets.
- Parameters
-
| path | Path to the .tileset file. |
- Returns
- Loaded TilesetAsset (name and filePath set; tiles populated). Returns a default-constructed asset on error.
◆ loadTileFile()
| TileAsset Engine::TilesetAsset::loadTileFile |
( |
const std::string & | path | ) |
|
|
static |
Loads a single TileAsset from a .tile JSON file.
- Parameters
-
| path | Path to the .tile file. |
- Returns
- Loaded TileAsset.
◆ saveTileFile()
| void Engine::TilesetAsset::saveTileFile |
( |
const TileAsset & | tile, |
|
|
const std::string & | path ) |
|
static |
Saves a single TileAsset to a .tile JSON file.
- Parameters
-
| tile | The tile to persist. |
| path | Destination .tile file path. |
◆ saveToFile()
| void Engine::TilesetAsset::saveToFile |
( |
const TilesetAsset & | ts | ) |
|
|
static |
Saves the TilesetAsset to its filePath on disk (.tileset JSON). Does NOT write individual .tile files; use saveTileFile() for that.
- Parameters
-
| ts | The tileset to persist. |
◆ atlas
◆ filePath
| std::string Engine::TilesetAsset::filePath |
Absolute (or project-relative) path to the .tileset file.
◆ name
| std::string Engine::TilesetAsset::name |
Display name of the tileset.
◆ tileHeight
| int Engine::TilesetAsset::tileHeight = 16 |
Height of each tile cell in the packed atlas (pixels).
◆ tiles
| std::vector<TileAsset> Engine::TilesetAsset::tiles |
◆ tileWidth
| int Engine::TilesetAsset::tileWidth = 16 |
Width of each tile cell in the packed atlas (pixels).
The documentation for this struct was generated from the following files: