The .drft container · interface
DrftAsset
A decoded asset. See docs/FORMAT.md for what each chunk carries.
Explained in The .drft container.
interface DrftAssetimport type { DrftAsset } from '@driftengine/drft';Properties
| Name | Type | Description |
|---|---|---|
headreadonly | DrftHead | |
meshesreadonly | readonly MeshData[] | |
lodsreadonly | readonly MeshData[] | Coarse whole-asset levels of detail, coarsest first, or empty for a file carrying none.MoreSeparate from |
levelsreadonly | readonly Uint8Array[] | Discrete levels of detail, finest first, each a complete .drft still in its bytes.MoreHanded over unparsed on purpose. A level is a whole model, and a consumer that picks one
by distance wants exactly one of them — parsing all four to hand back three that will not be
drawn is work nobody asked for. Pass the one you want to |
splatsreadonly | DrftSplatBlock | null | The whole capture, assembled from every SPLT block in ordinal order, or null for a file
carrying none.MoreAssembled rather than handed over as blocks, because a caller reading a whole file at
once has no use for the split: it exists so a stream can put a sparse capture on screen
early, and |
dtexreadonly | readonly DtexEntry[] | A decode program per material, or empty for a file that carries none.MoreEach says which |
navigationreadonly | NavPolyMesh | null | A way across the scene, or null for a file that carries none.More
|
entitiesreadonly | EntsScene | null | The things in the scene, or null for a file that is an asset rather than a scene. |
nodesreadonly | readonly DrftNode[] | The asset's own hierarchy, or empty for a file carrying no NODE.MoreEmpty means what it always meant — one mesh at the origin — so a caller written before 1.6 behaves identically against a file with a hierarchy it ignores. |
instancesreadonly | readonly DrftInstanceGroup[] | Meshes drawn many times, each group naming the mesh that holds one copy and a matrix a copy. Empty for a file that instances nothing, which is every file before 1.18. |
lightsreadonly | readonly DrftLight[] | The lights the scene was authored with, or empty. LITE, defined at 1.18. |
skinsreadonly | readonly DrftSkin[] | Skins, in the order their chunks appear. Empty for a file that deforms nothing. |
clipsreadonly | readonly AnimationClip[] | Clips, in the order their chunks appear. Empty for a file that animates nothing. |
materialsreadonly | readonly DrftMaterial[] | One per mesh by ordinal, or empty when the file names no materials. |
texturesreadonly | readonly DrftTexture[] | |
substancesreadonly | readonly { readonly material: number; readonly substance: string; }[] | Which substance each material is made of, or empty where the file labels none.MoreThe |
fieldsreadonly | readonly DrftSdfvEntry[] | The signed distance field of each mesh that carries one, or empty for a file with none.MoreThe |
networksreadonly | readonly DrftNetwork[] | The networks the file carries, each with the role a consumer asks for it by, or empty.MoreThe |
graphsreadonly | readonly DrftGraph[] | The graphs the file carries — networks built from operators — each with its role, or empty.MoreThe |
collidersreadonly | readonly Float32Array[] | The convex hulls this asset collides as, or empty for a file carrying no COLL.MoreViews over the fetched buffer, xyz-packed, in the asset's own space. Turning them into shapes is one line and belongs to whoever has a physics package: |
regionsreadonly | readonly DrftRegion[] | The regions of a streamed world, in the order they were written, or empty. REGN, defined at
1.21: each names the meshes it draws at every level, its props, occluders and collision. |
lightVolumereadonly | DrftLightVolume | null | A world's summed lights, or null for a file carrying no LVOL. Defined at 1.22. |
kitreadonly | readonly number[] | The meshes that are kit pieces, ascending, or empty. KITS, defined at 1.23. A piece is in
meshes like any other, and is drawn only as copies inside the assemblies. |
assembliesreadonly | ReadonlyMap<number, DrftAssembly> | Each MSHC mesh as the file carried it, by ordinal, or empty. Its slot in meshes holds it
expanded — which for a world built from a kit is most of a gigabyte, so a consumer of such a
file streams it (DrftStream.onAssembly) rather than reading it whole. |
skippedreadonly | readonly string[] | Optional chunks this reader did not understand, in file order. Diagnostics only. |
versionMajorreadonly | number | |
versionMinorreadonly | number |