Skip to content

ludus::geometry::content

Ludus Wiki · API overview · Browse API

Namespace

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

Enumerations

GeometrySourceMode

enum class GeometrySourceMode : uint8
Which source geometry a GeometrySource holds.

Related types: uint8

CubicPath

CubicPath
Line and cubic Bezier spans in asset coordinates.

HermitePath

HermitePath
Hermite waypoints converted to cubic spans.

CatmullRomPath

CatmullRomPath
Centripetal Catmull-Rom waypoints converted to cubic spans.

ScalarTrack

ScalarTrack
Scalar-track keys over TrackTime.

PatchSurface

PatchSurface
Untrimmed bicubic patches with explicit adjacency.

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

HandleMode

enum class HandleMode : uint8
Editing mode of a waypoint handle.
Moving an automatic handle either preserves its mode or visibly converts it to Manual (the editor adapter performs the visible conversion; the source records the resulting mode).

Related types: uint8

Automatic

Automatic
Handle is derived from neighbours (Catmull-Rom or auto-smooth).

Manual

Manual
Handle is authored directly.

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

Constants and variables

SOURCE_SCHEMA_VERSION

constexpr uint64 ludus::geometry::content::SOURCE_SCHEMA_VERSION = 1
Geometry source schema version this reader and writer support.

Related types: uint64

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

CATALOG_KIND

constexpr std::string_view ludus::geometry::content::CATALOG_KIND = "cooked-geometry"
The resource kind registered with the content catalog for cooked geometry.
Register with content::Catalog version 2 (see modules/content catalog). The string used in a catalog document is "cooked-geometry".

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

Functions

ParseGeometrySource

ludus::content::Status ludus::geometry::content::ParseGeometrySource(std::string_view json, GeometrySource &outSource, GeometryDiagnosticReport &outDiagnostic) noexcept
Parse a JSON geometry source into an owned, validated GeometrySource.
Validates the schema version, known mode and enum strings, finite numbers, strictly increasing key times, unique author IDs, and the count ceilings from Ludus::GeometryFormat limits. Unknown top-level fields, an unknown version, duplicate IDs and invalid constraints return a structured diagnostic; nothing asserts on bad content.
ParameterDescription
json
Source text, at most MAX_SOURCE_BYTES.
outSource
Replaced only on success.
outDiagnostic
Set on every failure; cleared to Ok on success.

Returns

content::Status::Ok on success, else Invalid, Limit or OutOfMemory.

Related types: GeometrySource · ludus::content::Status · GeometryDiagnosticReport

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

WriteGeometrySource

ludus::content::Status ludus::geometry::content::WriteGeometrySource(const GeometrySource &source, ludus::content::Bytes &outJson, GeometryDiagnosticReport &outDiagnostic) noexcept
Write a GeometrySource to deterministic canonical JSON.
Fixed field order and reproducible numeric spelling, so Parse∘Write∘Parse is stable.
ParameterDescription
source
Validated source.
outJson
Replaced on success.
outDiagnostic
Set on failure.

Returns

Ok, Invalid or OutOfMemory.

Related types: ludus::content::Bytes · GeometrySource · ludus::content::Status · GeometryDiagnosticReport

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

CookGeometry

ludus::content::Status ludus::geometry::content::CookGeometry(const GeometrySource &source, core::Array< uint8 > &outBlob, GeometryDiagnosticReport &outDiagnostic, const Cancellation *cancelOrNull=nullptr) noexcept
Cook a validated source into a LUGEO blob (Ludus::GeometryFormat layout).
Validates and dry-runs the FoundationGeometry preparation so a cook never emits a blob that cannot load, then serialises the blob field by field in little-endian order and computes the source, dependency and payload digests. The cook is cooperatively cancellable; cancellation yields Cancelled with no partial output. Identical source bytes produce identical blob bytes.
ParameterDescription
source
Validated source.
outBlob
Replaced only on success; preserved on failure or cancellation.
outDiagnostic
Set on failure.
cancelOrNull
Optional cancellation hook; nullptr disables it.

Returns

Ok, Invalid, Limit, OutOfMemory or Cancelled.

Related types: core::Array · GeometrySource · ludus::content::Status · uint8 · Cancellation · GeometryDiagnosticReport

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h

LoadGeometry

ludus::content::Status ludus::geometry::content::LoadGeometry(std::span< const uint8 > blob, const geom::WorkLimits &limits, GeometryLoad &outLoad, GeometryDiagnosticReport &outDiagnostic) noexcept
Validate a LUGEO blob and build the matching prepared owner.
Before exposing any view it validates, in order: the size and MAX_BLOB_BYTES ceiling; the magic and format version; the kind and precision enum tags; every count against its limit; each section's Count * ElementBytes byte product with checked arithmetic, its four-byte alignment, in-range offset and non-overlap, and that the required sections for the kind are present and no foreign section is; the tolerance profile; strictly increasing track-key times; finiteness of every origin, scale, control and tolerance; and the recomputed payload digest. It then builds the borrowed source views and calls the FoundationGeometry TryPrepare* owner, mapping any GeometryStatus into the diagnostic.
ParameterDescription
blob
Cooked bytes, borrowed for the call only.
limits
Preparation work limits (peak memory, leaves, depth, ...).
outLoad
Replaced only on success; unchanged on every failure.
outDiagnostic
Set on failure.

Returns

Ok, Invalid, Limit, OutOfMemory or Unsupported.

Related types: GeometryLoad · ludus::content::Status · uint8 · GeometryDiagnosticReport

Declared in modules/geometry/content/include/ludus/geometry/content/geometry_content.h