Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

LR1: a pass with no page answers through layout::nothing_drawn() (one closure, not one per caller), and the two new crates have their layer (runtime)

shinyobjectz272b94e7653d
diff --git a/runtime/bake/src/lib.rs b/runtime/bake/src/lib.rs
index 8b96a827..a3d66fe3 100644
--- a/runtime/bake/src/lib.rs
+++ b/runtime/bake/src/lib.rs
@@ -215,7 +215,7 @@ pub fn step_frames(app: &mut App, a: i64, b: i64, mut each: impl FnMut(&mut App,
app.world().resource::<ReactOutbox>().send(json!({"t": "event", "name": "raea-frames", "value": {"from": a, "to": b}}));
for g in a..b {
// a layout read gets no boxes: the frames stepped here draw no page (the 3D rows' pre-pass; docs/layout-reads.feature LR2)
- raea_runtime_react::scene::settle_with(app, Some(g), 20.0, &mut |_| Ok(raea_runtime_react::layout::NOTHING_DRAWN.into()))?;
+ raea_runtime_react::scene::settle_with(app, Some(g), 20.0, &mut raea_runtime_react::layout::nothing_drawn())?;
let te = std::time::Instant::now();
each(app, g)?;
t_each += te.elapsed();
diff --git a/runtime/export/src/sound.rs b/runtime/export/src/sound.rs
index 3d002536..069c2b7e 100644
--- a/runtime/export/src/sound.rs
+++ b/runtime/export/src/sound.rs
@@ -88,7 +88,7 @@ pub(crate) fn core_cues(js: &Path, dir: &Path, need_mix: bool) -> R<Option<(Vec<
for f in 0..total {
app.world().resource::<ReactOutbox>().send(json!({"t": "event", "name": "raea-frame", "value": f}));
// (a layout read here gets no boxes: the sound pass draws no page, docs/layout-reads.feature LR2)
- settle_with(&mut app, Some(f), 20.0, &mut |_| Ok(raea_runtime_react::layout::NOTHING_DRAWN.into()))?;
+ settle_with(&mut app, Some(f), 20.0, &mut raea_runtime_react::layout::nothing_drawn())?;
cx.now = f;
cx.sounds.clear();
cx.mix = None;
diff --git a/runtime/react/src/layout.rs b/runtime/react/src/layout.rs
index d5326da1..e006e0bb 100644
--- a/runtime/react/src/layout.rs
+++ b/runtime/react/src/layout.rs
@@ -95,6 +95,11 @@ pub(crate) fn register() {
/// has a box, so every read is 0, and the composition goes on as it would before it's laid out.
pub const NOTHING_DRAWN: &str = "{\"vw\":0,\"vh\":0,\"dpr\":1,\"n\":[],\"o\":[]}";
+/// [`NOTHING_DRAWN`] as a pass's answer.
+pub fn nothing_drawn() -> impl FnMut(&mut World) -> Result<String, String> {
+ |_| Ok(NOTHING_DRAWN.into())
+}
+
/// A host's answer when it has no page to lay out.
pub fn no_page(host: &'static str) -> impl FnMut(&mut World) -> Result<String, String> {
move |_| Err(format!("{host} lays no page out, so a composition can't read its layout here (getBoundingClientRect, offsetWidth and the rest)"))
diff --git a/tools/layers.toml b/tools/layers.toml
index 5b9023ba..d100a3c4 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -131,6 +131,7 @@ raea-runtime-bundle-lib = "runtime"
raea-runtime-calls = "runtime"
raea-runtime-shots = "runtime"
raea-runtime-export = "runtime"
+raea-runtime-pagestore = "runtime"
raea-runtime-page = "runtime"
raea-runtime-sound = "runtime"
raea-runtime-view = "runtime"
@@ -172,6 +173,7 @@ raea-rune-slots = "runtime"
raea-page-stage = "runtime"
raea-page-window = "runtime"
raea-runtime-react = "runtime"
+raea-runtime-track = "runtime"
raea-cli = "apps"
raea-neural = "runtime"
raea-app-registry = "apps"