Skip to main content

concinnity_core/
lib.rs

1//! concinnity-core: the engine's RUNTIME vocabulary and the CPU compute over it.
2//! The types the renderer, the cook pipeline, the subsystem crates, and the
3//! editor all have to agree on and none of them owns: the backend-agnostic GPU
4//! data layouts the CPU and the shaders both name, the transform and skeleton
5//! math those layouts are expressed in, the ECS storage mechanism plus the
6//! component definitions and the registry built from them, the post-process /
7//! quality setting structs, the behavior virtual machine that evaluates
8//! declarative logic, and the `.cnb` blob container format the cooked world
9//! travels in.
10//!
11//! Above that vocabulary, the kernels that compute over it and belong to no
12//! single consumer: skinning and pose blending, IK, LOD decimation,
13//! rasterisation, IBL convolution, the procedural geometry generators, and the
14//! payload codecs (`build`, `decode`). The AUTHORED vocabulary (what a
15//! world.jsonl declares) is concinnity-asset, below. The asset COMPILE pipeline
16//! is concinnity-cook, which this crate has no edge into.
17
18#![no_std]
19// The blob container and the payload codecs parse bytes the process did not
20// produce, so a panic here is a crash on a corrupt file rather than a bug.
21// Invariants that genuinely cannot fail use `expect` with the invariant named;
22// tests unwrap freely.
23#![warn(clippy::unwrap_used)]
24#![cfg_attr(
25    test,
26    expect(
27        clippy::unwrap_used,
28        reason = "tests unwrap freely; the crate-wide warn covers non-test code"
29    )
30)]
31
32extern crate alloc;
33#[cfg(test)]
34extern crate std;
35
36/// The version of everything a cooked blob's bytes depend on: the
37/// postcard-visible component schema, the blob container's record shapes, and
38/// the payload formats in [`build`]. Stamped into every blob header and folded
39/// into the cook's payload cache key.
40///
41/// A blob whose stored version differs was written by a different engine and
42/// fails the load check instead of mis-decoding.
43///
44/// # Bumping
45///
46/// Bump this when a change makes previously cooked bytes unreadable or stale:
47///
48/// - reordering a serialized struct's fields, or an enum's variants
49/// - swapping a serialized field's type for one that encodes to the same width
50/// - changing what a `build` payload serialiser writes
51///
52/// Adding or removing a serialized field needs no bump: a blob frame is
53/// length-delimited and `blob::decode_exact` rejects one that does not decode
54/// exactly, so a stale record fails the load on its own.
55pub const SCHEMA_VERSION: u32 = 1;
56
57mod app;
58pub mod behavior;
59pub mod blob;
60pub mod build;
61pub mod components;
62pub mod decode;
63pub mod ecs;
64pub mod geometry;
65pub mod gfx;
66pub mod math;
67pub mod physics;
68pub mod platform;
69pub mod resource;
70pub mod result;
71pub mod spawn;
72#[cfg(test)]
73mod test_support;
74
75// The headless driver over a world, named at the crate root because it is the
76// counterpart to `ecs::World` rather than a corner of the module tree.
77pub use app::App;