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.

#38: a glyph faded in on the live route is opaque once its fade is done (part of #38)

shinyobjectz485cb7b8aa85
diff --git a/bench/live-3d/check.sh b/bench/live-3d/check.sh
index 118af72f..e089cdd2 100755
--- a/bench/live-3d/check.sh
+++ b/bench/live-3d/check.sh
@@ -19,7 +19,7 @@ status=0
for f in bench/at-3d/scene.tsx sdk/raea/bench/bevy-parity/3d/spotlight.tsx sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx \
sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx examples/games/screenshake.tsx examples/games/shapes.tsx examples/games/lighting.tsx \
sdk/raea/bench/bevy/environment/edit.tsx sdk/raea/bench/bevy-ts/cases/material-field-0.tsx \
- sdk/raea/bench/bevy-ts/cases/kept-mount.tsx sdk/raea/bench/bevy-ts/cases/kept-unmount.tsx; do
+ sdk/raea/bench/bevy-ts/cases/kept-mount.tsx sdk/raea/bench/bevy-ts/cases/kept-unmount.tsx sdk/raea/bench/bevy/text3d/edit.tsx; do
n=$(basename "$f" .tsx)
RAEA_3D=program "$BIN" render "$f" -o "$OUT/$n.program.txt" > "$OUT/$n.program.log" 2>&1 || { echo "FAIL $f: the programmed render failed"; tail -3 "$OUT/$n.program.log"; status=1; continue; }
RAEA_3D=live RAEA_LIVE3D_CHECK=1 "$BIN" render "$f" -o "$OUT/$n.live.txt" > "$OUT/$n.live.log" 2>&1 || { echo "FAIL $f: the live render failed: $(grep -o 'RAEA_LIVE3D_CHECK.\{0,160\}' "$OUT/$n.live.log" | head -1)"; status=1; continue; }
diff --git a/runtime/scene/src/live.rs b/runtime/scene/src/live.rs
index 7262d71e..6aab88f6 100644
--- a/runtime/scene/src/live.rs
+++ b/runtime/scene/src/live.rs
@@ -290,9 +290,9 @@ impl LiveScene {
} else {
want.entry("emissive_k".into()).or_insert(V::N(1.0));
}
- if r.sent.contains_key("opacity") {
- want.entry("opacity".into()).or_insert(V::N(1.0));
- }
+ }
+ if matches!(kind.as_str(), "mesh" | "glyph") && r.sent.contains_key("opacity") {
+ want.entry("opacity".into()).or_insert(V::N(1.0));
}
if (r.sent.contains_key("visible") || kind != "light") && !matches!(kind.as_str(), "component" | "resource") {
want.entry("visible".into()).or_insert(V::N(1.0));
@@ -375,4 +375,14 @@ mod tests {
let body = set.iter().find(|t| t.vals.get("name") == Some(&V::S("b-body".into()))).unwrap();
assert_eq!(body.vals.get("bone_rows"), Some(&V::S(id_of("b-head"))));
}
+
+ /// A glyph faded in (`reveal`: 0, 0.5, 1) is opaque once done, not left at its last fade (#38: bevy/text3d's tag).
+ #[test]
+ fn a_faded_glyph_is_opaque_once_done() {
+ let text = |o: f64| vec![Node3 { kind: "RichText".into(), props: std::sync::Arc::new(json!({"spans": [{"t": "a"}], "glyphs": [{"at": 0, "span": 0, "ch": "a", "o": o}]}).as_object().unwrap().clone()), shape: None, kids: Vec::new().into() }];
+ let mut ls = LiveScene::default();
+ ls.open(Shot { scene: &text(0.5), clear: None }, 64, 64, 30.0);
+ let (set, _) = ls.frame(Shot { scene: &text(1.0), clear: None });
+ assert_eq!(set.iter().find(|t| t.kind == "glyph").and_then(|t| t.vals.get("opacity")), Some(&V::N(1.0)));
+ }
}