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: bevy_ui's GhostNode (no box: its children its parent's, display: contents; at the top each a root); ui/layout/ghost_nodes ported, the parity host with Bevy's ghost_nodes feature
shinyobjectzbe661a5f0b38
diff --git a/bench/bevy-parity/Cargo.toml b/bench/bevy-parity/Cargo.tomlindex 8c5749f0..648d3b71 100644--- a/bench/bevy-parity/Cargo.toml+++ b/bench/bevy-parity/Cargo.toml@@ -10,7 +10,7 @@ description = "Bevy's own examples, built against raea's Bevy with the parity pr# the feature list engine/render's bevy has (its bevy-all: dfg_lut and bluenoise_texture too, which stock Bevy's defaults# leave out; without the DFG table rough surfaces at grazing angles take less ambient, many_cubes' box srgb 64 for 88), so the# examples build against the Bevy raea already compiled, and winit: the examples open a window (raea's renders don't), and bevy_scene: Bevy 0.20's examples write their scenes in BSN-bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "default_font", "system_font_discovery", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "jpeg", "tonemapping_luts", "ktx2", "zstd_rust", "smaa_luts", "experimental_pbr_pcss", "area_light_luts", "dfg_lut", "bluenoise_texture", "bevy_gilrs", "bevy_winit", "bevy_scene", "bevy_camera_controller", "free_camera", "pan_camera", "pan_orbit_camera", "bevy_gizmos", "bevy_gizmos_render", "bevy_state", "picking", "mesh_picking", "sprite_picking", "ui_picking", "hdr", "exr", "webp", "bevy_dev_tools", "bevy_ui_widgets", "bevy_feathers", "bevy_audio", "vorbis", "wav", "mp3", "morph_animation", "bevy_input_focus", "custom_cursor", "serialize", "reflect_functions", "pbr_multi_layer_material_textures"] }+bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "default_font", "system_font_discovery", "ghost_nodes", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "jpeg", "tonemapping_luts", "ktx2", "zstd_rust", "smaa_luts", "experimental_pbr_pcss", "area_light_luts", "dfg_lut", "bluenoise_texture", "bevy_gilrs", "bevy_winit", "bevy_scene", "bevy_camera_controller", "free_camera", "pan_camera", "pan_orbit_camera", "bevy_gizmos", "bevy_gizmos_render", "bevy_state", "picking", "mesh_picking", "sprite_picking", "ui_picking", "hdr", "exr", "webp", "bevy_dev_tools", "bevy_ui_widgets", "bevy_feathers", "bevy_audio", "vorbis", "wav", "mp3", "morph_animation", "bevy_input_focus", "custom_cursor", "serialize", "reflect_functions", "pbr_multi_layer_material_textures"] }raea-sys-parity = { path = "../../systems/parity" }# Bevy's examples' own dependencies (bevy v0.20.0's dev-dependencies)argh = "0.1.12"diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.listindex 8b8a9031..cea50083 100644--- a/bench/bevy-parity/examples.list+++ b/bench/bevy-parity/examples.list@@ -71,3 +71,4 @@ ui/layout/z_indexui/styling/stacked_gradientsui/styling/gradientsui/text/generic_font_families+ui/layout/ghost_nodesdiff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsvindex 403cd9ac..62d208f0 100644--- a/bench/bevy-parity/runs.tsv+++ b/bench/bevy-parity/runs.tsv@@ -70,3 +70,4 @@ ui/layout/z_index - 10ui/styling/stacked_gradients - 10ui/styling/gradients - 10ui/text/generic_font_families - 10+ui/layout/ghost_nodes - 10diff --git a/docs/bevy-parity.md b/docs/bevy-parity.mdindex ed9604fa..86bf4c20 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 andframe time at most 1.25x the example's). Wall time is one machine's, measured in the same run.-Examples: **438**, ported **71**, passing **67**, excluded **16** (docs/bevy-parity/excluded.tsv), left **355**.+Examples: **438**, ported **72**, passing **68**, excluded **16** (docs/bevy-parity/excluded.tsv), left **354**.raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the exampledoesn't pay.@@ -127,6 +127,7 @@ doesn't pay.| ui/styling/stacked_gradients | 10 | 0.994550 | 1 | 0 / 0 | 442 / 492 | 5 / 7 | 1 / 1 | 46.978 / 1.428 = 1.255 + 0.173 | yes | || ui/styling/gradients | 10 | 0.988141 | 14 | 0 / 0 | 553 / 492 | 5 / 7 | 1 / 1 | 40.253 / 4.425 = 2.089 + 2.336 | yes | || ui/text/generic_font_families | 10 | 0.990063 | 19 | 0 / 0 | 457 / 492 | 5 / 7 | 1 / 1 | 41.156 / 2.365 = 2.083 + 0.282 | yes | |+| ui/layout/ghost_nodes | 10 | 0.998544 | 9 | 0 / 0 | 455 / 492 | 5 / 7 | 1 / 1 | 35.333 / 1.312 = 1.13 + 0.182 | yes | |## Excludeddiff --git a/docs/bevy-parity/results.jsonl b/docs/bevy-parity/results.jsonlindex 743f4e27..bacadf13 100644--- a/docs/bevy-parity/results.jsonl+++ b/docs/bevy-parity/results.jsonl@@ -114,3 +114,4 @@{"example":"ui/styling/stacked_gradients","frame":10,"ssim":0.994550,"tile":1,"bevy":{"batch_keys":0,"entities":442,"extents":[],"frame":10,"frame_ms":46.978,"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.255,"step_ms":0.173,"cost_ms":1.428},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}{"example":"ui/styling/gradients","frame":10,"ssim":0.988141,"tile":14,"bevy":{"batch_keys":0,"entities":553,"extents":[],"frame":10,"frame_ms":40.253,"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":2.089,"step_ms":2.336,"cost_ms":4.425},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}{"example":"ui/text/generic_font_families","frame":10,"ssim":0.990063,"tile":19,"bevy":{"batch_keys":0,"entities":457,"extents":[],"frame":10,"frame_ms":41.156,"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":2.083,"step_ms":0.282,"cost_ms":2.365},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}+{"example":"ui/layout/ghost_nodes","frame":10,"ssim":0.998544,"tile":9,"bevy":{"batch_keys":0,"entities":455,"extents":[],"frame":10,"frame_ms":35.333,"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.13,"step_ms":0.182,"cost_ms":1.312},"pixels":true,"draws":true,"time":true,"pass":true,"why":""}diff --git a/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx b/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsxnew file mode 100644index 00000000..0cbdbf1b--- /dev/null+++ b/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx@@ -0,0 +1,43 @@+// Bevy v0.20.0 examples/ui/layout/ghost_nodes.rs in raea's TSX: a root under a GhostNode (so a root itself) holding+// "This text node is rendered under a ghost root", and a full-window root centring a row of three 150 x 65 buttons+// (5 px black borders, fully round, 0.15 grey, "0" in FiraSans-Bold 33 px, 0.9 grey), the first two under a GhostNode+// and so laid out in the row as its own children. Their counters see no pointer here. Bevy's Camera2d over the+// default clear colour is the layered <Canvas3D>. In Bevy's default 1280 x 720 window.+import { AbsoluteFill, Composition, registerRoot, staticFile } from "raea";+import { Canvas3D } from "raea/3d";+import { BorderRadius, GhostNode, Node, Text, UiRect, percent, px } from "raea/ui";+import { Srgba } from "raea/color";++const FONT = staticFile("fonts/FiraSans-Bold.ttf");++const Label = ({ text }: { text: string }) => <Text font={FONT} font_size={{ Px: 33 }} color={new Srgba(0.9, 0.9, 0.9)}>{text}</Text>;++function Button() {+ return (+ <Node width={px(150)} height={px(65)} border={UiRect.all(px(5))} justify_content="Center" align_items="Center" border_radius={BorderRadius.MAX} border_color={new Srgba(0, 0, 0)} background_color={new Srgba(0.15, 0.15, 0.15)}>+ <Label text="0" />+ </Node>+ );+}++function Shot() {+ return (+ <AbsoluteFill>+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />+ <GhostNode>+ <Node><Label text="This text node is rendered under a ghost root" /></Node>+ </GhostNode>+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center">+ <Node>+ <GhostNode>+ <Button />+ <Button />+ </GhostNode>+ <Button />+ </Node>+ </Node>+ </AbsoluteFill>+ );+}++registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);diff --git a/sdk/raea/conformance/ui.test.tsx b/sdk/raea/conformance/ui.test.tsxindex e7df74a6..9bc806c6 100644--- a/sdk/raea/conformance/ui.test.tsx+++ b/sdk/raea/conformance/ui.test.tsx@@ -1,7 +1,7 @@// docs/control.feature FC0a: bevy_ui's Node, Text and TextSpan on the page, with Bevy's defaults, values and blend// (ui/styling/transparency_ui, ui/layout/fixed_node).import { describe, expect, test } from "bun:test";-import { AngularColorStop, UiRect as GradRect, FontSource, GridPlacement, GridTrack, RepeatedGridTrack, ColorStop, ConicGradient, LinearGradient, RadialGradient, UiPosition, BorderRadius, CornerRadius, FontVariationTag, ImageNode, InlineImage, ImagePlugin, Node, TextureAtlasLayout, Overflow, OverflowClipMargin, Text, TextShadow, Text2d, UiScale, TextSpan, UiRect, auto, percent, px, vw } from "raea/ui";+import { AngularColorStop, GhostNode, UiRect as GradRect, FontSource, GridPlacement, GridTrack, RepeatedGridTrack, ColorStop, ConicGradient, LinearGradient, RadialGradient, UiPosition, BorderRadius, CornerRadius, FontVariationTag, ImageNode, InlineImage, ImagePlugin, Node, TextureAtlasLayout, Overflow, OverflowClipMargin, Text, TextShadow, Text2d, UiScale, TextSpan, UiRect, auto, percent, px, vw } from "raea/ui";import { LinearRgba, Srgba } from "raea/color";import { Canvas3D } from "raea/3d";import { renderFrame } from "../src/test";@@ -247,6 +247,13 @@ describe("A sliced ImageNode, a sampled picture and UiScale", () => {expect(html(<Text font={FontSource.ui_rounded()}>a</Text>)).toContain("font-family:"raea-bevy ui-rounded", ui-rounded");expect(() => html(<Text font={{ Generic: "Gothic" } as never}>a</Text>)).toThrow(/FontSource/);});+ test("a GhostNode has no box: inside a Node its children are the Node's (display: contents), at the top each is a root", () => {+ const inside = html(<Node><GhostNode><Node width={px(7)} /></GhostNode></Node>);+ expect(inside).toMatch(/<div style=\"display:contents\"><div style=\"display:flex[^\"]*width:7px/);+ const top = html(<GhostNode><Node width={px(7)} /><Node width={px(8)} /></GhostNode>);+ expect(top.match(/data-raea-blend=\"linear\"/g)?.length).toBe(2);+ expect(top).not.toContain("display:contents");+ });test("BorderColor takes a colour per side", () => {const out = html(<Node border={UiRect.all(px(2))} border_color={{ top: new Srgba(1, 0, 0), right: new Srgba(0, 0, 1), bottom: new Srgba(1, 1, 0), left: new Srgba(0, 1, 0) }} />);expect(out).toContain("border-color:rgba(255, 0, 0, 1) rgba(0, 0, 255, 1) rgba(255, 255, 0, 1) rgba(0, 255, 0, 1)");diff --git a/sdk/raea/src/ui.ts b/sdk/raea/src/ui.tsindex e356e547..6776081d 100644--- a/sdk/raea/src/ui.ts+++ b/sdk/raea/src/ui.ts@@ -6,6 +6,6 @@ export * from "@raea/video/region";// InputRegion (input-region.tsx) joins when it is committedexport * from "@raea/video/panel";// bevy_ui's Node and Text, and bevy_text's TextSpan, with their values (Val, UiRect, BorderRadius, Overflow)-export { Node, Text, TextSpan, TextShadow, Text2d, UiScale, ImageNode, InlineImage, type TextureSlicer, type SliceScaleMode, ImagePlugin, FontVariationTag, TextureAtlasLayout, type ImageNodeProps, px, percent, vw, vh, vmin, vmax, auto, UiRect, BorderRadius, CornerRadius, Overflow, OverflowClipMargin, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps, type Val } from "@raea/render/bevy3d";+export { Node, GhostNode, Text, TextSpan, TextShadow, Text2d, UiScale, ImageNode, InlineImage, type TextureSlicer, type SliceScaleMode, ImagePlugin, FontVariationTag, TextureAtlasLayout, type ImageNodeProps, px, percent, vw, vh, vmin, vmax, auto, UiRect, BorderRadius, CornerRadius, Overflow, OverflowClipMargin, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps, type Val } from "@raea/render/bevy3d";export { LinearGradient, RadialGradient, ConicGradient, ColorStop, AngularColorStop, UiPosition, type Gradient, type RadialGradientShape, type InterpolationColorSpace } from "@raea/render/bevy3d";export { GridTrack, RepeatedGridTrack, GridPlacement, type GridTrackRepetition, type GridAutoFlow, type MinTrackSizingFunction, type MaxTrackSizingFunction, FontSource, type GenericFontFamily } from "@raea/render/bevy3d";diff --git a/sdk/render/src/bevy3d.tsx b/sdk/render/src/bevy3d.tsxindex 31445a29..09e3ff71 100644--- a/sdk/render/src/bevy3d.tsx+++ b/sdk/render/src/bevy3d.tsx@@ -27,8 +27,8 @@ export { FogFalloff } from "./bevy3d/fog";export { Hdr } from "./bevy3d/core";// Lightmap (bevy_pbr::lightmap): a bake on a <Model>'s glTF meshes by name (docs/control.feature FC0a)export { Lightmap, type LightmapProps } from "./bevy3d/lightmap";-// bevy_ui's Node, Text and TextSpan, and their values, drawn by the page (docs/control.feature FC0a)-export { Node, Text, TextSpan, TextShadow, Text2d, UiScale, FontVariationTag, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps } from "./bevy3d/ui";+// bevy_ui's Node, Text and TextSpan, and their values, drawn by the page+export { Node, GhostNode, Text, TextSpan, TextShadow, Text2d, UiScale, FontVariationTag, type NodeProps, type TextProps, type TextStyleProps, type TextRunProps, type Text2dProps } from "./bevy3d/ui";export { ImageNode, InlineImage, ImagePlugin, TextureAtlasLayout, type TextureSlicer, type SliceScaleMode, type ImageNodeProps } from "./bevy3d/ui-image";export { px, percent, vw, vh, vmin, vmax, auto, UiRect, BorderRadius, CornerRadius, Overflow, OverflowClipMargin, type Val } from "./bevy3d/ui-val";export { LinearGradient, RadialGradient, ConicGradient, ColorStop, AngularColorStop, UiPosition, type Gradient, type RadialGradientShape, type InterpolationColorSpace } from "./bevy3d/ui-gradient";diff --git a/sdk/render/src/bevy3d/ui.tsx b/sdk/render/src/bevy3d/ui.tsxindex bfc292c2..874efb2b 100644--- a/sdk/render/src/bevy3d/ui.tsx+++ b/sdk/render/src/bevy3d/ui.tsx@@ -186,6 +186,12 @@ export function Node({ children, fixed, ...p }: NodeProps) {return boxOf(n.css, n.back, children, fixed ? "fixed" : ui === null, undefined, n.attrs);}+/** bevy_ui's GhostNode: no box of its own, its children laid out as its parent's (CSS display: contents), each one a+ * root when it is at the top. @bevy bevy_ui::experimental::GhostNode */+export function GhostNode({ children }: { children?: ReactNode }) {+ return useContext(InUi) === null ? <>{children}</> : <div style={{ display: "contents" }}>{children}</div>;+}+/** bevy_text's TextFont, TextColor, TextLayout and LineHeight, on a Text or a TextSpan. */export interface TextStyleProps {/** FontSource: a font file (staticFile("fonts/FiraSans-Bold.ttf")), FontSource.family(name) or a generic familydiff --git a/sdk/skills/raea/reference/sdk.md b/sdk/skills/raea/reference/sdk.mdindex 07223229..c72ad5f6 100644--- a/sdk/skills/raea/reference/sdk.md+++ b/sdk/skills/raea/reference/sdk.md@@ -99,7 +99,7 @@ with a capital, hooks with `use`. A component's props are in its file.## `raea/ui` (sdk/raea/src/ui.ts)-`AbsoluteFill`, `AngularColorStop`, `BorderRadius`, `ColorStop`, `ConicGradient`, `CornerRadius`, `FontSource`, `FontVariationTag`, `GridPlacement`, `GridTrack`, `ImageNode`, `ImagePlugin`, `InlineImage`, `LinearGradient`, `Node`, `Overflow`, `OverflowClipMargin`, `RadialGradient`, `RepeatedGridTrack`, `Text`, `Text2d`, `TextShadow`, `TextSpan`, `TextureAtlasLayout`, `UiPosition`, `UiRect`, `UiScale`, `auto`, `percent`, `px`, `vh`, `vmax`, `vmin`, `vw`+`AbsoluteFill`, `AngularColorStop`, `BorderRadius`, `ColorStop`, `ConicGradient`, `CornerRadius`, `FontSource`, `FontVariationTag`, `GhostNode`, `GridPlacement`, `GridTrack`, `ImageNode`, `ImagePlugin`, `InlineImage`, `LinearGradient`, `Node`, `Overflow`, `OverflowClipMargin`, `RadialGradient`, `RepeatedGridTrack`, `Text`, `Text2d`, `TextShadow`, `TextSpan`, `TextureAtlasLayout`, `UiPosition`, `UiRect`, `UiScale`, `auto`, `percent`, `px`, `vh`, `vmax`, `vmin`, `vw`## `raea/video` (sdk/raea/src/video.ts)