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`). Each asset's AUTHORED schema (what a
15//! world.jsonl declares) sits in `components` beside the runtime half it bakes
16//! into; the build-only assets, which never reach a running world, live with
17//! their registry group in concinnity-cook, the build-side crate that also owns
18//! the asset COMPILE pipeline and that this crate has no edge into.
19
20#![no_std]
21// The blob container and the payload codecs parse bytes the process did not
22// produce, so a panic here is a crash on a corrupt file rather than a bug.
23// Invariants that genuinely cannot fail use `expect` with the invariant named;
24// tests unwrap freely.
25#![warn(clippy::unwrap_used)]
26#![cfg_attr(
27 test,
28 expect(
29 clippy::unwrap_used,
30 reason = "tests unwrap freely; the crate-wide warn covers non-test code"
31 )
32)]
33
34extern crate alloc;
35#[cfg(test)]
36extern crate std;
37
38/// The version of everything a cooked blob's bytes depend on: the
39/// postcard-visible component schema, the blob container's record shapes, and
40/// the payload formats in [`bake`]. Stamped into every blob header and folded
41/// into the cook's payload cache key.
42///
43/// A blob whose stored version differs was written by a different engine and
44/// fails the load check instead of mis-decoding.
45///
46/// # Bumping
47///
48/// Bump this when a change makes previously cooked bytes unreadable or stale:
49///
50/// - reordering a serialized struct's fields, or an enum's variants
51/// - swapping a serialized field's type for one that encodes to the same width
52/// - changing what a `build` payload serialiser writes
53///
54/// Adding or removing a serialized field needs no bump: a blob frame is
55/// length-delimited and `blob::decode_exact` rejects one that does not decode
56/// exactly, so a stale record fails the load on its own.
57pub const SCHEMA_VERSION: u32 = 1;
58
59mod app;
60pub mod bake;
61pub mod behavior;
62pub mod blob;
63pub mod components;
64pub mod decode;
65pub mod defaults;
66pub mod ecs;
67pub mod geometry;
68pub mod gfx;
69pub mod math;
70pub mod memory;
71pub mod physics;
72pub mod platform;
73pub mod render;
74pub mod resource;
75pub mod result;
76pub mod spawn;
77#[cfg(test)]
78mod test_support;
79pub mod window_policy;
80
81// The headless driver over a world and the trait any loop that runs one
82// implements, named at the crate root because they are the counterpart to
83// `ecs::World` rather than a corner of the module tree.
84pub use app::{App, Driver};