![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
A terrain as bytes: the .terrain file the editor writes into a project, and the body of its cooked file. More...
Classes | |
| struct | Names |
| What a body names, in the order resolve() reads it back. More... | |
Functions | |
| std::vector< uint8_t > | encode (const TerrainAsset &terrain, const ResourceManager &resources) |
terrain's body: its grid, maps and plants, its handles as their assets' names. | |
| bool | decode (const uint8_t *bytes, size_t size, TerrainAsset &out, Names &names, std::string &error) |
Read a body back into out, its handles left empty and their names in names. | |
| void | resolve (TerrainAsset &terrain, const Names &names, const ResourceManager &resources) |
Give terrain the handles names names, from resources; a name it does not hold stays empty, and is warned of. | |
| bool | write (const std::filesystem::path &path, const TerrainAsset &terrain, const ResourceManager &resources) |
Write terrain to path as a .terrain file, through a temporary file. | |
| bool | readBody (const std::filesystem::path &path, std::vector< uint8_t > &body, std::string &error) |
The body of the .terrain file at path, its magic and version checked. | |
Variables | |
| constexpr char | MAGIC [4] = {'V', 'K', 'M', 'T'} |
| The magic a .terrain file starts with, then VERSION. | |
| constexpr uint32_t | VERSION = 1 |
| The body's layout; readBody() refuses a file of another. | |
| constexpr uint32_t | MAX_NAME = 4096 |
| The longest name a body keeps. | |
A terrain as bytes: the .terrain file the editor writes into a project, and the body of its cooked file.
Kept by name where the asset holds handles - its layers' materials, its plants' meshes and materials - and resolved again against a graph that holds them (resolve()). The file is the terrain's source: its cook copies the body, so what a project carries is what is drawn.
| std::vector< uint8_t > Vkm::Engine::TerrainFile::encode | ( | const TerrainAsset & | terrain, |
| const ResourceManager & | resources ) |
terrain's body: its grid, maps and plants, its handles as their assets' names.
| terrain | The terrain. |
| resources | Names its handles; a hidden or unnamed asset is kept as no name, and warned of. |
| bool Vkm::Engine::TerrainFile::decode | ( | const uint8_t * | bytes, |
| size_t | size, | ||
| TerrainAsset & | out, | ||
| Names & | names, | ||
| std::string & | error ) |
Read a body back into out, its handles left empty and their names in names.
| bytes | What encode() wrote. |
| size | How many there are. |
| out | Filled when the body is sound. |
| names | The names it keeps. |
| error | Why it is not, when it is not. |
| void Vkm::Engine::TerrainFile::resolve | ( | TerrainAsset & | terrain, |
| const Names & | names, | ||
| const ResourceManager & | resources ) |
| bool Vkm::Engine::TerrainFile::write | ( | const std::filesystem::path & | path, |
| const TerrainAsset & | terrain, | ||
| const ResourceManager & | resources ) |
Write terrain to path as a .terrain file, through a temporary file.
| path | Where. |
| terrain | The terrain. |
| resources | Names its handles. |
| bool Vkm::Engine::TerrainFile::readBody | ( | const std::filesystem::path & | path, |
| std::vector< uint8_t > & | body, | ||
| std::string & | error ) |
The body of the .terrain file at path, its magic and version checked.
| path | The file. |
| body | Its body. |
| error | Why it could not be read. |