vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
asset_cook.h
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5
6#include "resource/asset_type.h"
7
8namespace Vkm::Engine {
9
11struct AudioClipAsset;
12struct MeshAsset;
13struct SkeletonAsset;
14struct TextureAsset;
15
24namespace AssetCook {
25
34constexpr uint16_t COOKER_VERSION = 12;
35
47uint64_t cacheKey(uint64_t recipeHash, AssetType type);
48
54constexpr uint32_t MAX_SKELETON_BONES = 1024;
55
61constexpr uint32_t MAX_AUDIO_CHANNELS = 8;
62
69constexpr uint32_t MAX_AUDIO_SAMPLE_RATE = 384000;
70
79[[nodiscard]] bool writeMesh (const std::filesystem::path& path, const MeshAsset& mesh);
80[[nodiscard]] bool writeTexture (const std::filesystem::path& path, const TextureAsset& texture);
81[[nodiscard]] bool writeSkeleton (const std::filesystem::path& path, const SkeletonAsset& skeleton);
82[[nodiscard]] bool writeAnimationClip(const std::filesystem::path& path, const AnimationClipAsset& clip);
83[[nodiscard]] bool writeAudioClip (const std::filesystem::path& path, const AudioClipAsset& audio);
84
96[[nodiscard]] bool isCookedCurrent(AssetType type, const std::filesystem::path& path);
97
105[[nodiscard]] bool readMesh (const std::filesystem::path& path, MeshAsset& out);
106[[nodiscard]] bool readTexture (const std::filesystem::path& path, TextureAsset& out);
107[[nodiscard]] bool readSkeleton (const std::filesystem::path& path, SkeletonAsset& out);
108[[nodiscard]] bool readAnimationClip(const std::filesystem::path& path, AnimationClipAsset& out);
109[[nodiscard]] bool readAudioClip (const std::filesystem::path& path, AudioClipAsset& out);
110
111} // namespace AssetCook
112
113} // namespace Vkm::Engine
Cooked binary asset format (derived cache).
Definition asset_cook.h:24
bool readMesh(const std::filesystem::path &path, MeshAsset &out)
Read one cooked file of each kind.
constexpr uint32_t MAX_SKELETON_BONES
Bone count past which a rig is refused as corrupt rather than read.
Definition asset_cook.h:54
uint64_t cacheKey(uint64_t recipeHash, AssetType type)
The complete cache key for one cooked artifact.
constexpr uint32_t MAX_AUDIO_CHANNELS
Channel count past which a sound is refused as corrupt rather than read.
Definition asset_cook.h:61
bool writeMesh(const std::filesystem::path &path, const MeshAsset &mesh)
Write one cooked file of each kind.
constexpr uint32_t MAX_AUDIO_SAMPLE_RATE
Sample rate past which a clip is refused as corrupt rather than read.
Definition asset_cook.h:69
bool isCookedCurrent(AssetType type, const std::filesystem::path &path)
Whether the cooked file at path can still serve type.
constexpr uint16_t COOKER_VERSION
Bump when anything the cooker writes changes: a kind's byte layout, an importer flag,...
Definition asset_cook.h:34
A baked animation: every bone's keys, in six flat arrays.
Definition animation_clip_asset.h:50
A sound: fully decoded interleaved PCM, plus the rate and layout it was written at.
Definition audio_clip_asset.h:58
CPU-side geometry: indexed triangle mesh plus a cached local-space AABB.
Definition mesh_asset.h:51
A rig: a flat, parent-before-child bone array plus its bind pose.
Definition skeleton_asset.h:33
Texture asset combining Resource tracking with engine-level texture parameters.
Definition texture_asset.h:15