![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
Cooked binary asset format (derived cache). More...
Functions | |
| uint64_t | cacheKey (uint64_t recipeHash, AssetType type) |
| The complete cache key for one cooked artifact. | |
| bool | writeMesh (const std::filesystem::path &path, const MeshAsset &mesh) |
| Write one cooked file of each kind. | |
| bool | writeTerrain (const std::filesystem::path &path, const TerrainAsset &terrain) |
Cook terrain from its .terrain file (TerrainFile), the body copied once it reads soundly. | |
| bool | isCookedCurrent (AssetType type, const std::filesystem::path &path) |
Whether the cooked file at path can still serve type. | |
| bool | readMesh (const std::filesystem::path &path, MeshAsset &out) |
| Read one cooked file of each kind. | |
| bool | readTerrain (const std::filesystem::path &path, TerrainAsset &out, TerrainFile::Names &names) |
Read a cooked terrain: its handles empty, what they name in names (TerrainFile::resolve). | |
Variables | |
| constexpr uint16_t | COOKER_VERSION = 13 |
| Bump when anything the cooker writes changes: a kind's byte layout, an importer flag, a mip policy, a vertex welding rule. | |
| constexpr uint32_t | MAX_SKELETON_BONES = 1024 |
| Bone count past which a rig is refused as corrupt rather than read. | |
| constexpr uint32_t | MAX_AUDIO_CHANNELS = 8 |
| Channel count past which a sound is refused as corrupt rather than read. | |
| constexpr uint32_t | MAX_AUDIO_SAMPLE_RATE = 384000 |
| Sample rate past which a clip is refused as corrupt rather than read. | |
Cooked binary asset format (derived cache).
Host-endian; an endian sentinel rejects a file written on a differently-endianed machine. Cooked files are regenerable and keyed to their recipe by name (see cacheKey). Readers validate every count against the file length before allocating. Materials load straight from JSON and are not cooked; meshes, textures, skeletons, animation clips, sounds and terrains are.
| uint64_t Vkm::Engine::AssetCook::cacheKey | ( | uint64_t | recipeHash, |
| AssetType | type ) |
The complete cache key for one cooked artifact.
Covers what it was baked from, its kind and the cooker. It goes in the artifact's name, so a change to any of them makes the old file one nobody looks for rather than a stale one.
| recipeHash | Recorded hash of the recipe, its source art and dependencies (AssetRecord::recipeHash). |
| type | Asset kind, mixed in with COOKER_VERSION. |
|
nodiscard |
Write one cooked file of each kind.
Creates the parent directories and writes beside the target, renaming onto it once the write is whole.
| path | Where the file goes, already named for its key. |
|
nodiscard |
Cook terrain from its .terrain file (TerrainFile), the body copied once it reads soundly.
From the file, not the asset: the body keeps the names of what the asset holds by handle, which only a graph can give. The editor writes the file before it cooks.
| path | Where the file goes, already named for its key. |
| terrain | The terrain, whose recipe names its file. |
|
nodiscard |
Whether the cooked file at path can still serve type.
Reads the header and measures the file, nothing more. Not current: absent, not a cooked asset, another kind, or a length other than the header's. Recipe and cooker version are in the name, so not checked. A material is never current: it has no binary. Logs nothing; a stale cache is the caller's to report.
| type | Asset type the file is expected to hold. |
| path | Cooked file to probe, already named for its key. |
|
nodiscard |
Read one cooked file of each kind.
| path | The cooked file. |
| out | Filled on success. |
|
nodiscard |
Read a cooked terrain: its handles empty, what they name in names (TerrainFile::resolve).
| path | The cooked file. |
| out | Filled on success. |
| names | What its layers and plants name. |
|
constexpr |
Bump when anything the cooker writes changes: a kind's byte layout, an importer flag, a mip policy, a vertex welding rule.
Part of every cache key, so a bump re-bakes everything. Also written into each header, where a reader refuses a mismatch - the case of a file copied under a name not baked for it. Only testTheCookersOutputIsPinnedToItsVersion notices a forgotten bump that changes no layout.
|
constexpr |
Bone count past which a rig is refused as corrupt rather than read.
A rejection threshold, not a capability: a full character rig lands near three hundred bones.
|
constexpr |
Channel count past which a sound is refused as corrupt rather than read.
A rejection threshold, not a capability: 7.1 is the outer edge of authored source material.
|
constexpr |
Sample rate past which a clip is refused as corrupt rather than read.
Twice the highest consumer hardware rate. The rate gives the clip's duration, so a wild one makes the length wrong everywhere it is read.