pub struct Runtime { /* private fields */ }Expand description
Headless, deterministic evaluator for one owned validated scene.
The runtime owns the document, generated meshes, local action state, and event buffer. It does not render, access clocks, perform I/O, or execute proposed external effects.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(scene: SceneDocument) -> Result<Self, Diagnostic>
pub fn new(scene: SceneDocument) -> Result<Self, Diagnostic>
Validates and takes ownership of a scene, then tessellates built-in geometry.
Built-in mesh buffers are allocated once and retained for the runtime’s
lifetime. Geometry::Mesh intentionally fails because asset resolution
belongs to a platform adapter.
§Errors
Returns validation or tessellation diagnostics, including unresolved mesh assets.
Sourcepub fn scene(&self) -> &SceneDocument
pub fn scene(&self) -> &SceneDocument
Borrows the immutable authored scene document owned by this runtime.
Sourcepub fn meshes(&self) -> &BTreeMap<EntityId, Mesh>
pub fn meshes(&self) -> &BTreeMap<EntityId, Mesh>
Borrows the deterministic built-in meshes keyed by source entity identifier.
Sourcepub fn sample(&self, time_seconds: f64) -> Result<Frame, Diagnostic>
pub fn sample(&self, time_seconds: f64) -> Result<Frame, Diagnostic>
Evaluates one frame at an explicit time without changing runtime state.
It allocates owned frame output and temporary transform state, composes parent transforms, and sorts draw records by entity ID. Repeated samples with the same state and time are deterministic.
§Errors
Returns a diagnostic for a non-finite or out-of-range time, or for a composed transform that cannot be represented safely by render adapters.
Sourcepub fn dispatch(&mut self, event: Event) -> Result<Receipt, Diagnostic>
pub fn dispatch(&mut self, event: Event) -> Result<Receipt, Diagnostic>
Dispatches a declared action and retains its resulting runtime event.
Applied actions toggle animation evaluation or replace a runtime colour. Proposed effects are recorded but never executed. When the bounded event buffer is full, the oldest event is discarded. Invalid events leave the runtime unchanged.
§Errors
Returns a diagnostic when the entity is unknown or does not declare the action.