Skip to main content

concinnity_engine/
lib.rs

1//! The runtime crate. Holds the world loop, the ECS, the GraphicsSystem renderer
2//! driver, audio, and physics. The GPU-free render-prep lives in
3//! concinnity-render and the hardware backends (Metal/DirectX/Vulkan/Win32) in
4//! concinnity-device; this crate drives them through a `Box<dyn RenderBackend>`
5//! from `concinnity_device::init_backend` and never names a concrete backend.
6//! Depends on concinnity-core/render/device (no concinnity-cook, no image
7//! decoders). The editor crate (concinnity-editor) drives this crate's App /
8//! renderer through the public API widened here; the modules the editor reaches
9//! into are `pub` so it can name their paths, but individual internals stay
10//! `pub(crate)` unless the editor specifically needs them.
11pub mod blob;
12pub mod components;
13pub mod ecs;
14mod heap;
15
16#[cfg(test)]
17mod bench;
18
19// Renderer-free foundation shared with the build/validate pipeline: the result
20// vocabulary, the payload decoders, and the runtime geometry generators, all
21// from concinnity-core. Re-exported under the historical crate::* paths so the
22// rest of the client keeps resolving. world.jsonl I/O lives in concinnity-cook
23// (authoring), which the runtime does not link.
24pub(crate) use concinnity_core::{build, geometry, result};
25
26// The access-declaration mask builders, reached crate-wide as
27// `crate::component_mask!` / `crate::resource_mask!`.
28pub(crate) use ecs::access_ids::{component_mask, resource_mask};
29
30pub mod app;
31// Flat entry point for a shipped player: run a compiled world from a state dir.
32// The runtime bin calls `concinnity_engine::run_from` rather than reaching
33// through the `app::run` module path.
34pub use app::run::{BlobSource, run_from};
35// The application surface a host embeds: construct an App, populate its world,
36// and drive it with `App::run` / `App::run_with`. Exported flat so the
37// `concinnity` facade crate re-exports these under its own root.
38pub use app::run::{PipelineMode, RunOptions, init_logging};
39pub use app::state::App;
40// Redirect runtime-writable state (`saves/` + `settings`) before `run_from`
41// when the content dir is read-only. Exported beside `run_from` so the runtime
42// bin's entire entry API lives on this crate.
43pub use concinnity_host::store::paths;
44pub use concinnity_host::store::paths::set_writable_state_dir;
45
46// Export-time compilation of the built-in shaders into a bundle's
47// shader-cache/, for backends that compile them at renderer init. Re-exported
48// so `cn export` reaches it without a direct device dependency.
49#[cfg(any(backend_dx, backend_vk))]
50pub use concinnity_device::precompile::{
51    Report as ShaderPrecompileReport, precompile_builtin_shaders,
52};
53pub(crate) mod cbor_file;
54pub(crate) mod config;
55/// Crash reporting: panic hook, native fault capture, local report files.
56/// `pub` so the binaries install the hooks and the editor composes the
57/// recent-log ring layer into its tracing subscriber.
58pub mod crash;
59pub mod shutdown;
60// 3D positional sound and screen-triggered cues, and the one module that names
61// kira.
62pub(crate) mod audio;
63// The standalone startup-error window, shown when a fatal startup failure
64// happens before any world exists.
65pub(crate) mod error_screen;
66pub mod gfx;
67pub(crate) mod hud;
68pub(crate) mod input;
69// The rigid-body simulation driver: builds a `concinnity_physics::Simulation`
70// from the world's physics content and steps it on the fixed tick.
71pub(crate) mod physics;
72// Declarative logic (Behavior components + the shared world variables
73// store), scheduled before SpawnSystem so its requests apply the same tick.
74pub(crate) mod behavior;
75// The rayon job pool, re-exported under the historical crate::jobs path. `pub`
76// so the editor's hot-reload decoder keeps reaching it through
77// `concinnity_engine::jobs`.
78pub use concinnity_host::thread::jobs;
79/// Runtime resource tables (per-kind, handle-indexed views of the blob's resource
80/// stream). `pub` so the editor's in-memory build path can construct the tables it
81/// inserts into the world, mirroring the shipped-runtime loader.
82pub mod resource;
83// Runtime entity churn (Lifetime/Spawner ticks + spawn/despawn/reparent
84// drains), scheduled immediately before GraphicsSystem.
85pub(crate) mod spawn;
86pub(crate) mod story;
87pub(crate) mod text_input_system;
88pub(crate) mod ui;
89
90// Asset API
91pub use components::*;