createSourceFromSpec
createSourceFromSpec(
spec,options?):AssetSource|undefined
Defined in: packages/declarative-hex-worlds/src/asset-source/spec-source.ts:89
Create a live AssetSource from a validated AssetSourceSpec. Composes a tileset
source (from tileset-role assets) and a gltf-pack source (from model + glb/gltf
tile assets) first-match. Sprite-role assets are carried for a future sprite
source; today they resolve through the gltf/tileset arms only if they match, else
fall through. Returns undefined only when the spec yields no resolvable source.
Parameters
Section titled “Parameters”assetRoot
Section titled “assetRoot”string = ...
Root directory the asset paths are relative to (e.g. “public/assets”).
assets
Section titled “assets”({ biome: string; edgeMask?: number; format: "png" | "glb" | "gltf"; id: string; path: string; role: "tile"; } | { biome?: string; format: "png"; grid: { cellHeight: number; cellWidth: number; cols: number; rows: number; }; id: string; path: string; role: "tileset"; transition?: { edgeCells: Record<string, number>; }; } | { category?: "unit" | "prop" | "structure" | "npc" | "enemy" | "pc" | "encounter"; format: "png"; id: string; path: string; role: "sprite"; } | { category?: "unit" | "prop" | "structure" | "npc" | "enemy" | "pc" | "encounter"; format: "glb" | "gltf"; id: string; path: string; role: "model"; })[] = ...
Ordered asset records.
string = ...
Human-readable source name (e.g. “kaykit-free”, “my-tileset-pack”).
specVersion
Section titled “specVersion”1 = ...
Spec format version (this schema is v1).
options?
Section titled “options?”CreateSourceFromSpecOptions = {}
Returns
Section titled “Returns”AssetSource | undefined