geometry_format.h¶
Ludus Wiki · API overview · Browse API
File
LUGEO cooked geometry interchange format (Ludus::GeometryFormat).
This header is the single contract between the producer of cooked geometry (Ludus::GeometryContent's cooker and the Editor composer) and the consumer (Ludus::GeometryContent's loader, which rebuilds the Ludus::FoundationGeometry prepared owners). It is owned by neither side: tools and runtime both depend on it, and it depends on nothing but FoundationBase. See docs/architecture/curves-surfaces.md ("Content and failure contracts") and ADR 0024 for the frozen domains, statuses and format boundary. The layout mirrors the precedents in modules/content/scene_format (LUSCN) and modules/content/render_graph_format (the runtime package blob header).
A blob is little-endian and holds exactly one geometry kind (path, scalar track or bicubic surface). Layout, in order:
- Header (HEADER_BYTES): Magic[8]; FormatVersion; CookerVersion; KindTag; PrecisionTag; Flags; SpanCount; JointCount; KeyCount; PatchCount; AdjacencyCount; SourceIdentityCount; Revision (uint64); Origin[3] (float64); AssetScale (float64); PositionFloor (float64); EffectivePositionError (float64); the 12 ToleranceProfile fields (float64); SectionCount (uint32) then SectionCount SectionEntry records; and three SHA-256 digests (SourceDigest, DependencyDigest, PayloadDigest).
- Payload sections, each at its directory Offset with Count records of ElementBytes each, four-byte aligned and non-overlapping: path span and joint records, track key records, patch and adjacency records, and the source-identity table, as the KindTag selects (see GetKindSections).
The record structs document the exact wire layout and are checked with static_asserts; a codec serialises them field by field in little-endian order rather than copying the structs, so host endianness and padding never leak into files. Serialized widths (*_BYTES) are derived from the field schema, never from host sizeof padding. A reader validates the magic, both versions, the enum tags, every count against the limits, the count-times-width byte products, section offsets/alignment/overlap, monotone track domains, control finiteness and the payload digest before exposing any prepared owner. Bad content is a structured diagnostic, never an assertion.
Declared in modules/content/geometry_format/include/ludus/content/geometry_format/geometry_format.h
Related declarations¶
- ludus::content::geometry_format::SectionEntry
- ludus::content::geometry_format::PathSpanRecord
- ludus::content::geometry_format::JointRecord
- ludus::content::geometry_format::TrackKeyRecord
- ludus::content::geometry_format::PatchRecord
- ludus::content::geometry_format::AdjacencyRecord
- ludus::content::geometry_format::SourceIdentityRecord
- ludus
- ludus::content
- ludus::content::geometry_format