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.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
FC0a: camera_pass writes a Camera only when its row changes it
shinyobjectz695f54b9663d
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.mdindex 3f7af488..ae31b8b3 100644--- a/docs/bevy-parity.md+++ b/docs/bevy-parity.md@@ -168,8 +168,8 @@ doesn't pay.| ui/ui_material | 10 | 0.999993 | 0 | 0 / 0 | 446 / 502 | 5 / 7 | 1 / 1 | 46.877 / 3.374 = 3.374 + 0 | yes | || ui/text/system_fonts | 10 | 0.987943 | 18 | 0 / 0 | 1992 / 500 | 5 / 7 | 1 / 1 | 115.916 / 3.184 = 3.184 + 0 | yes | || ui/text/font_atlas_debug | 10 | 0.999660 | 6 | 0 / 0 | 445 / 500 | 5 / 7 | 1 / 1 | 45.934 / 3.204 = 3.204 + 0 | yes | |-| 3d/split_screen | 10 | 0.998973 | 5 | 2 / 2 | 546 / 537 | 7 / 9 | 3 / 3 | 55.196 / 5.096 = 5.096 + 0 | yes | |-| 3d/two_passes | 10 | 0.999025 | 0 | 2 / 2 | 444 / 505 | 7 / 9 | 3 / 3 | 46.426 / 4.256 = 4.256 + 0 | yes | |+| 3d/two_passes | 10 | 0.999025 | 0 | 2 / 2 | 444 / 505 | 7 / 9 | 3 / 3 | 58.492 / 4.378 = 4.378 + 0 | yes | |+| 3d/split_screen | 10 | 0.998973 | 5 | 2 / 2 | 546 / 537 | 7 / 9 | 3 / 3 | 55.168 / 6.114 = 6.114 + 0 | yes | |## Excludeddiff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonlindex 34f06b9e..4b241a73 100644--- a/docs/bevy-parity/results.jsonl+++ b/docs/bevy-parity/results.jsonl@@ -155,5 +155,5 @@{"example":"ui/ui_material","frame":10,"ssim":0.999993,"tile":0,"bevy":{"batch_keys":0,"entities":446,"extents":[],"frame":10,"frame_ms":46.877,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":502,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":3.374,"step_ms":null,"cost_ms":3.374},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}{"example":"ui/text/system_fonts","frame":10,"ssim":0.987943,"tile":18,"bevy":{"batch_keys":0,"entities":1992,"extents":[],"frame":10,"frame_ms":115.916,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":500,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":3.184,"step_ms":null,"cost_ms":3.184},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}{"example":"ui/text/font_atlas_debug","frame":10,"ssim":0.999660,"tile":6,"bevy":{"batch_keys":0,"entities":445,"extents":[],"frame":10,"frame_ms":45.934,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":500,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":3.204,"step_ms":null,"cost_ms":3.204},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}-{"example":"3d/split_screen","frame":10,"ssim":0.998973,"tile":5,"bevy":{"batch_keys":2,"entities":546,"extents":["12.5927 39.5145 77.3599","50.0000 0.0000 50.0000"],"frame":10,"frame_ms":55.196,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":20,"entities":537,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["12.5927 39.5145 77.3599","50.0000 0.0000 50.0000"],"frame_ms":5.096,"step_ms":null,"cost_ms":5.096},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}-{"example":"3d/two_passes","frame":10,"ssim":0.999025,"tile":0,"bevy":{"batch_keys":2,"entities":444,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":46.426,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":505,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":4.256,"step_ms":null,"cost_ms":4.256},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}+{"example":"3d/two_passes","frame":10,"ssim":0.999025,"tile":0,"bevy":{"batch_keys":2,"entities":444,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame":10,"frame_ms":58.492,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":17,"entities":505,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["0.5000 0.5000 0.5000","2.5000 0.0000 2.5000"],"frame_ms":4.378,"step_ms":null,"cost_ms":4.378},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}+{"example":"3d/split_screen","frame":10,"ssim":0.998973,"tile":5,"bevy":{"batch_keys":2,"entities":546,"extents":["12.5927 39.5145 77.3599","50.0000 0.0000 50.0000"],"frame":10,"frame_ms":55.168,"materials":3,"mesh_entities":2,"meshes":7,"other_material":0,"visible":2},"raea":{"frame":20,"entities":537,"mesh_entities":2,"visible":2,"meshes":9,"materials":3,"batch_keys":2,"other_material":0,"extents":["12.5927 39.5145 77.3599","50.0000 0.0000 50.0000"],"frame_ms":6.114,"step_ms":null,"cost_ms":6.114},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}diff --git a/systems/frame/src/camera.rs b/systems/frame/src/camera.rsindex 3b7c6ee3..29356f08 100644--- a/systems/frame/src/camera.rs+++ b/systems/frame/src/camera.rs@@ -6,14 +6,27 @@ use bevy::camera::Viewport;/// The camera row's `order` among the cameras on its target, `clear` "none" to draw over the ones before without/// clearing, and its viewport (`vp_x`, `vp_y`, `vp_w`, `vp_h`: physical px from the target's top left), on its Camera.+/// Written only when the row says something else than the Camera holds, so a camera the row doesn't move isn't+/// marked changed (the live route calls this every frame).pub fn camera_pass(world: &mut World, e: Entity, vals: &BTreeMap<String, V>) {- let Some(mut c) = world.get_mut::<Camera>(e) else { return };- c.order = vals.get("order").map_or(0, |v| v.num() as isize);- if matches!(vals.get("clear"), Some(V::S(s)) if s == "none") {- c.clear_color = ClearColorConfig::None;- }+ let Some(c) = world.get::<Camera>(e) else { return };+ let order = vals.get("order").map_or(c.order, |v| v.num() as isize);+ let clear = if matches!(vals.get("clear"), Some(V::S(s)) if s == "none") { ClearColorConfig::None } else { c.clear_color };let n = |k: &str| vals.get(k).map(|v| v.num().max(0.0) as u32);- if let (Some(x), Some(y), Some(w), Some(h)) = (n("vp_x"), n("vp_y"), n("vp_w"), n("vp_h")) {- c.viewport = Some(Viewport { physical_position: UVec2::new(x, y), physical_size: UVec2::new(w.max(1), h.max(1)), ..default() });+ let viewport = match (n("vp_x"), n("vp_y"), n("vp_w"), n("vp_h")) {+ (Some(x), Some(y), Some(w), Some(h)) => Some(Viewport { physical_position: UVec2::new(x, y), physical_size: UVec2::new(w.max(1), h.max(1)), ..default() }),+ _ => c.viewport.clone(),+ };+ let same_vp = match (&viewport, &c.viewport) {+ (Some(a), Some(b)) => a.physical_position == b.physical_position && a.physical_size == b.physical_size,+ (None, None) => true,+ _ => false,+ };+ if order == c.order && same_vp && std::mem::discriminant(&clear) == std::mem::discriminant(&c.clear_color) {+ return;}+ let Some(mut c) = world.get_mut::<Camera>(e) else { return };+ c.order = order;+ c.clear_color = clear;+ c.viewport = viewport;}