Skip to content

luscn.h

Ludus Wiki · API overview · Browse API

File

LUSCN cooked scene interchange format (Ludus::SceneFormat).
This header is the single contract between producers of cooked scenes (Ludus::SceneCook, the Editor World composer) and consumers (Ludus::Resources SceneDefinition::Decode and the renderer that installs it). It is owned by neither side: tools and runtime both depend on it, and it depends on nothing but FoundationBase.
A bundle is little-endian and tightly packed, in this order: Header; Header::TextureCount x (TextureRecord + RGBA8 bytes); Header::MaterialCount x versioned MaterialRecord; Header::MeshCount x (MeshRecord + MeshRecord::VertexCount x VertexRecord + MeshRecord::IndexCount x uint32); Header::ObjectCount x versioned ObjectRecord. Version 3 uses VertexRecordV3 and ends with LightingRecord, analytic lights and its optional float32 RGB environment payload. Version 4 keeps every version 3 record except the vertices, which are VertexRecord again: bake chart coordinates are implicit (see TryGetBakeChartUv), so meshes stay indexed instead of storing one vertex per triangle corner. Version 5 keeps every version 4 record except the materials, which are MaterialRecordV5 with an alpha mode and cutoff, and admits the larger import profile (IMPORT_LIMITS) instead of the resident reference profile (see GetBundleLimits). Version 6 keeps the version 5 records except the materials (MaterialRecordV6 adds a linear surface map, an emission map and a normal-map strength) and the vertices (VertexRecordV6 adds a tangent frame), within the same import profile. Version 7 appends MaterialExtensionV7 after each MaterialRecordV6 to preserve source names, reflectance and typed optical parameters; other v6 records remain unchanged.
The record structs document the exact wire layout and are checked with static_asserts; serialise them field by field in little-endian order rather than copying the structs, so host endianness and padding never leak into files.

Declared in modules/content/scene_format/include/ludus/content/scene_format/luscn.h