7#include <nlohmann/json.hpp>
10#include "io/scene/component_serializer.h"
11#include "resource/asset/material_asset.h"
12#include "resource/asset_type.h"
14namespace Vkm::Engine {
38 std::vector<std::pair<AssetType, std::string>> names;
70 const std::vector<EntityId>& entities,
128 const nlohmann::json& assetsJson,
Open type-erased resource registry with typed handles and generational lifetimes.
Definition resource_manager.h:46
Central registry managing entities and an open set of component types.
Definition scene.h:29
Serialize / deserialize the asset graph referenced by a Scene.
Definition asset_serializer.h:28
void collectAssetRefs(const Scene &scene, EntityId id, const ResourceManager &resources, EntityAssetRefs &refs)
Append every asset reference id holds to refs.
size_t dropAssetsNotIn(const nlohmann::json &assetsJson, ResourceManager &resources)
Drop every asset in resources that assetsJson does not name.
nlohmann::json saveAssetsForEntities(const Scene &scene, const std::vector< EntityId > &entities, const ResourceManager &resources)
The assets block for a chosen set of entities.
void applyInline(const nlohmann::json &source, MaterialAsset &target, const ResourceManager &resources)
Apply an "inline" material descriptor (kind=="inline") to a freshly constructed MaterialAsset.
nlohmann::json saveAssetsForScene(const Scene &scene, const ResourceManager &resources)
The assets block for every entity in scene.
nlohmann::json materialToInline(const MaterialAsset &material, const ResourceManager &resources)
Build a material's canonical "inline" source descriptor: PBR scalars plus texture refs by name.
nlohmann::json saveAllAssets(const ResourceManager &resources)
The assets block for everything resources holds, referenced or not.
bool loadAssets(const nlohmann::json &assetsJson, ResourceManager &resources, LoadMode mode=LoadMode::Create)
Recreate the assets a document names into resources.
LoadMode
What loadAssets does about a name resources already holds.
Definition asset_serializer.h:101
@ Reload
Rebuild a material's contents in place, keeping its handle and name; leave every other kind alone,...
Definition asset_serializer.h:116
@ Create
Leave it alone.
Definition asset_serializer.h:107
Every asset reference a set of entities holds, as an assets block would name it.
Definition asset_serializer.h:36
Every asset a set of components references, one list per kind.
Definition component_serializer.h:266
Names one entity of one Scene, for as long as that slot holds it.
Definition entity.h:23
A complete PBR material.
Definition material_asset.h:67