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.

FC0a: ui/scroll_and_overflow/overflow_debug passes (SSIM 0.9965, worst tile 10): the six clipping cells at the paused animation's t = 0, moved by (-50%, 0), scaled by (1.5, 1) and turned 45 radians, with the instructions' Overflow Debug span. Mutants (no clip, no rotation, no move, no scale, no span) each fail the bar.

shinyobjectzf84a89cd5209
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.list
index 606cac6b..b8ffd9d0 100644
--- a/bench/bevy-parity/examples.list
+++ b/bench/bevy-parity/examples.list
@@ -86,3 +86,4 @@ ui/ui_transform
ui/scroll_and_overflow/scroll
ui/scroll_and_overflow/drag_to_scroll
ui/scroll_and_overflow/scrollbars
+ui/scroll_and_overflow/overflow_debug
diff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsv
index 38cf34ba..91eb409e 100644
--- a/bench/bevy-parity/runs.tsv
+++ b/bench/bevy-parity/runs.tsv
@@ -85,3 +85,4 @@ ui/ui_transform - 10
ui/scroll_and_overflow/scroll - 10
ui/scroll_and_overflow/drag_to_scroll - 10
ui/scroll_and_overflow/scrollbars - 10
+ui/scroll_and_overflow/overflow_debug - 10
diff --git a/docs/bevy-parity.md b/docs/bevy-parity.md
index f3498aa0..c488d049 100644
--- a/docs/bevy-parity.md
+++ b/docs/bevy-parity.md
@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)
don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys and
frame time at most 1.25x the example's). Wall time is one machine's, measured in the same run.
-Examples: **438**, ported **86**, passing **82**, excluded **16** (docs/bevy-parity/excluded.tsv), left **340**.
+Examples: **438**, ported **87**, passing **83**, excluded **16** (docs/bevy-parity/excluded.tsv), left **339**.
raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the example
doesn't pay.
@@ -142,6 +142,7 @@ doesn't pay.
| ui/images/ui_texture_slice | 10 | 0.998941 | 8 | 0 / 0 | 447 / 492 | 5 / 7 | 1 / 1 | 33.914 / 0.905 = 0.905 + 0 | yes | |
| ui/images/ui_texture_atlas_slice | 10 | 0.990813 | 16 | 0 / 0 | 447 / 492 | 5 / 7 | 1 / 1 | 36.454 / 1.397 = 1.397 + 0 | yes | |
| ui/scroll_and_overflow/scrollbars | 10 | 0.994524 | 21 | 0 / 0 | 462 / 492 | 5 / 7 | 1 / 1 | 43.63 / 1.382 = 1.382 + 0 | yes | |
+| ui/scroll_and_overflow/overflow_debug | 10 | 0.996511 | 10 | 0 / 0 | 463 / 492 | 5 / 7 | 1 / 1 | 38.277 / 1.215 = 1.215 + 0 | yes | |
## Excluded
diff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonl
index 320127d3..9a1bcf81 100644
--- a/docs/bevy-parity/results.jsonl
+++ b/docs/bevy-parity/results.jsonl
@@ -129,3 +129,4 @@
{"example":"ui/images/ui_texture_slice","frame":10,"ssim":0.998941,"tile":8,"bevy":{"batch_keys":0,"entities":447,"extents":[],"frame":10,"frame_ms":33.914,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":0.905,"step_ms":null,"cost_ms":0.905},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"ui/images/ui_texture_atlas_slice","frame":10,"ssim":0.990813,"tile":16,"bevy":{"batch_keys":0,"entities":447,"extents":[],"frame":10,"frame_ms":36.454,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.397,"step_ms":null,"cost_ms":1.397},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
{"example":"ui/scroll_and_overflow/scrollbars","frame":10,"ssim":0.994524,"tile":21,"bevy":{"batch_keys":0,"entities":462,"extents":[],"frame":10,"frame_ms":43.63,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.382,"step_ms":null,"cost_ms":1.382},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
+{"example":"ui/scroll_and_overflow/overflow_debug","frame":10,"ssim":0.996511,"tile":10,"bevy":{"batch_keys":0,"entities":463,"extents":[],"frame":10,"frame_ms":38.277,"materials":1,"mesh_entities":0,"meshes":5,"other_material":0,"visible":0},"raea":{"frame":17,"entities":492,"mesh_entities":0,"visible":0,"meshes":7,"materials":1,"batch_keys":0,"other_material":0,"extents":[],"frame_ms":1.215,"step_ms":null,"cost_ms":1.215},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}
diff --git a/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_debug.tsx b/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_debug.tsx
new file mode 100644
index 00000000..3621912f
--- /dev/null
+++ b/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_debug.tsx
@@ -0,0 +1,51 @@
+// Bevy v0.20.0 examples/ui/scroll_and_overflow/overflow_debug.rs in raea's TSX: the instructions top left (12 px in,
+// Bevy's default font) ending in a span of Overflow::clip()'s Debug, and centred a grid of 3 x 2 cells of 150 px, 80
+// px apart, each a 0.25 grey node clipping its overflow around a centred node with a UiTransform: the bevy logo (100
+// px high, absolute at -200, -50) in the top row, "Bevy" in 100 px FiraSans-Bold in the bottom; moved, scaled and
+// turned per column. The animation starts paused (space plays it), so t stays 0: moved by (-50%, 0), scaled by (1.5,
+// 1) and turned 45 radians. Bevy's Camera2d over the default clear colour is the layered <Canvas3D>. In Bevy's default
+// 1280 x 720 window.
+import type { ReactNode } from "react";
+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";
+import { Canvas3D } from "raea/3d";
+import { ImageNode, Node, RepeatedGridTrack, Rot2, Text, TextSpan, Val2, percent, px, type UiTransform } from "raea/ui";
+import { Srgba } from "raea/color";
+
+const f = Math.fround;
+const T = 0;
+const TAU = f(Math.PI * 2);
+// each column's UpdateTransform at t (f32, as Bevy's ops)
+const MOVE: UiTransform = { translation: Val2.percent(f(Math.sin(f(f(T * TAU) - f(Math.PI / 2))) * 50), f(-Math.cos(f(f(T * TAU) - f(Math.PI / 2))) * 50)) };
+const SCALE: UiTransform = { scale: [f(1 + 0.5 * Math.max(f(Math.cos(f(T * TAU))), 0)), f(1 + 0.5 * Math.max(f(Math.cos(f(f(T * TAU) + f(Math.PI)))), 0))] };
+const ROTATE: UiTransform = { rotation: Rot2.radians(f(f(Math.cos(f(T * TAU))) * 45)) };
+
+function Container({ transform, children }: { transform: UiTransform; children: ReactNode }) {
+ return (
+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center" overflow={{ x: "Clip", y: "Clip" }} background_color={new Srgba(0.25, 0.25, 0.25)}>
+ <Node align_items="Center" justify_content="Center" ui_transform={transform}>{children}</Node>
+ </Node>
+ );
+}
+
+const logo = <ImageNode image={staticFile("branding/bevy_logo_dark_big.png")} height={px(100)} position_type="Absolute" top={px(-50)} left={px(-200)} />;
+const word = <Text font={staticFile("fonts/FiraSans-Bold.ttf")} font_size={{ Px: 100 }}>Bevy</Text>;
+
+function Shot() {
+ return (
+ <AbsoluteFill>
+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />
+ <Text position_type="Absolute" top={px(12)} left={px(12)}>
+ {"Next Overflow Setting (O)\nNext Container Size (S)\nToggle Animation (space)\n\n"}
+ <TextSpan>{"Overflow { x: Clip, y: Clip }"}</TextSpan>
+ </Text>
+ <Node width={percent(100)} height={percent(100)} justify_content="Center" align_items="Center">
+ <Node display="Grid" grid_template_columns={[RepeatedGridTrack.px(3, 150)]} grid_template_rows={[RepeatedGridTrack.px(2, 150)]} row_gap={px(80)} column_gap={px(80)}>
+ {[MOVE, SCALE, ROTATE].map((t, i) => <Container key={`i${i}`} transform={t}>{logo}</Container>)}
+ {[MOVE, SCALE, ROTATE].map((t, i) => <Container key={`t${i}`} transform={t}>{word}</Container>)}
+ </Node>
+ </Node>
+ </AbsoluteFill>
+ );
+}
+
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);