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.

Renders draw each frame once: the Engine's reads skip the frame drawn last

shinyobjectz3796d708dba2
diff --git a/engine/render/src/engine.rs b/engine/render/src/engine.rs
index b796c66c..009e62c1 100644
--- a/engine/render/src/engine.rs
+++ b/engine/render/src/engine.rs
@@ -226,6 +226,9 @@ impl Engine {
Engine::build(prog, inserted, dir, None, true)
}
+ /// The frame `draw` drew last, if any.
+ pub fn drawn(&self) -> Option<i64> { self.drawn }
+
/// Frame `f` drawn into the target (one update: the pipeline is synchronous, so it's on the GPU's queue when this
/// returns, ahead of anything the paint device is given next).
pub fn draw(&mut self, f: i64) {
diff --git a/runtime/export/src/fed.rs b/runtime/export/src/fed.rs
index 5f3dd6bf..6e69cb23 100644
--- a/runtime/export/src/fed.rs
+++ b/runtime/export/src/fed.rs
@@ -194,7 +194,13 @@ pub(crate) fn engine_before(app: &App, cx: &mut Ctx, f: i64) {
return;
}
if let Some(e) = cx.scene3d.as_mut() {
- e.draw(f - 1);
+ // in order, frame f - 1 is the one drawn last and its World is f - 1's already. Drawn again, it was a whole update
+ // more: every frame of a render drew twice, and every temporal pass (Solari's, MetalFX's, the split emission's)
+ // took a second frame in which nothing moved, which live play never draws (a moving orb's rim, seen still,
+ // stayed as rings at every place it had been)
+ if e.drawn() != Some(f - 1) {
+ e.draw(f - 1);
+ }
}
raea_runtime_react::shared::engine_flush(app.world().resource::<ReactOutbox>());
}