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.

PV3c: raea's help names media lod; two copied closures folded (L1 dupes)

shinyobjectzf0e01210c23e
diff --git a/apps/media/src/command.rs b/apps/media/src/command.rs
index ca0009b9..826fa556 100644
--- a/apps/media/src/command.rs
+++ b/apps/media/src/command.rs
@@ -1,7 +1,7 @@
//! The media verbs' command line (`raea media|ffmpeg|ffprobe`, and raea's shell, in process): the agent's media
//! work on raea-media (lib.rs and its files), and an HTML composition's render (html.rs).
//!
-//! media probe|still|sheet|audio|loudness|motion|cuts|freezes|proxy|trim|concat FILE ... media work, native (media help)
+//! media probe|still|sheet|audio|loudness|motion|cuts|freezes|proxy|lod|trim|concat FILE ... media work, native (media help)
//! ffmpeg ARGS | ffprobe ARGS ffmpeg and ffprobe command lines read as the media verbs (no ffmpeg involved)
//! render PAGE.html -o OUT.mp4|OUT.png|DIR [--at F,F] [--alpha] [--codec apple|soft|av1|ffmpeg] [--kbps K | --quality Q]
//! shots [--size WxH] [--root DIR] plain HTML pages' first frames as PNGs, over white: stdin lines `PAGE\tOUT.png`,
diff --git a/apps/media/src/lib.rs b/apps/media/src/lib.rs
index 292b8ede..d26a053a 100644
--- a/apps/media/src/lib.rs
+++ b/apps/media/src/lib.rs
@@ -162,8 +162,8 @@ fn run(verb: &str, pos: &[String], fl: &BTreeMap<String, String>) -> R<Option<Va
cuts(&file()?, th, from, to).map(|(v, _)| Some(v))
}
"lod" => {
- let n = |k: &str, d: u32| fl.get(k).and_then(|v| v.parse().ok()).unwrap_or(d);
- lod::lod(&file()?, n("level", 1), n("texture", 1024), &out()?).map(Some)
+ let level = fl.get("level").and_then(|v| v.parse().ok()).unwrap_or(1);
+ lod::lod(&file()?, level, fl.get("texture").and_then(|v| v.parse().ok()).unwrap_or(1024), &out()?).map(Some)
}
"proxy" => {
let h = fl.get("height").and_then(|h| h.parse().ok()).unwrap_or(720);
diff --git a/engine/cli/src/cli.rs b/engine/cli/src/cli.rs
index 5aceb7cc..6f4d056d 100644
--- a/engine/cli/src/cli.rs
+++ b/engine/cli/src/cli.rs
@@ -347,7 +347,7 @@ pub fn run(args: &[String]) -> R<String> {
if args.first().map(String::as_str) != Some("render") || args.len() < 2 {
return Err(format!(
"raea render EDIT.tsx -o OUT.mp4|OUT.png|DIR [--frame N | --at A,B] [--composition ID] [--w W] [--h H] [--fps FPS] [--frames N] [--words W.json] [--perception P.json] [--input I.json|inputs.rrl] [--manifest render.json] [--layers] [--stage WxH] [--10bit] [--aov] [--alpha] [--kbps N | --quality draft|high|master|0..1] [--clay] (also: --lite --comps)\n raea render EDIT.tsx --review DIR [--frame N] (fixed cameras hero, front, right, top, iso, low in colour and clay: DIR/colour.png, clay.png, review.json)\n raea render PAGE.html -o OUT.mp4|OUT.png|DIR [--at A,B] [--alpha] (an HTML composition)\n raea render --bundle NAME.comp.js -o OUT.png|DIR [--dir DIR] [--frame N] (a bundle from raea bundle, as render_bundle draws it)
- raea media probe|still|sheet|audio|loudness|motion|cuts|freezes|proxy|trim|concat FILE ... | ffmpeg ARGS | ffprobe ARGS (media work, native: media help)
+ raea media probe|still|sheet|audio|loudness|motion|cuts|freezes|proxy|lod|trim|concat FILE ... | ffmpeg ARGS | ffprobe ARGS (media work, native: media help)
raea bundle EDIT.tsx --composition-bundle -o OUT.js [--portable DIR] (a composition for render_bundle, on the Mac or the iPhone)\n raea add PKG[@RANGE]... [--dev] | remove NAME... | install [--offline] [--in DIR] (npm packages for the project: raea.lock, node_modules)\n {} (foley, local)\n {} (an instrument's notes, local)\n raea setup-audio [--check] [sao|tokensynth] (install or check the local audio models)\n {} (the song's energy map: beats, sections, builds, drops, stops, hits, cuts per bar; also: --backend NAME)\n raea sounds [WORDS] | sounds get PACK/INSTRUMENT [--notes ..|--all] [-o DIR] (open sample libraries for a Sampler)\n {} (the clip's camera solved, for <Matchmove>)",
tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE
));
diff --git a/engine/page/stage/src/calls.rs b/engine/page/stage/src/calls.rs
index 04c4c6a7..30983e8e 100644
--- a/engine/page/stage/src/calls.rs
+++ b/engine/page/stage/src/calls.rs
@@ -48,7 +48,7 @@ pub(super) fn calls(mut calls: ResMut<HostCalls>) {
}
})
.on("stage.view", move |w, a, answer| {
- let f = |k: &str| a.get(k).and_then(Value::as_f64).map(|v| v as f32);
+ let f = |k: &str| num(&a, k).map(|v| v as f32);
let target = a.get("target").and_then(Value::as_array).map(|t| t.iter().filter_map(Value::as_f64).map(|v| v as f32).collect::<Vec<_>>()).filter(|t| t.len() == 3);
let set = match (a.get("free").and_then(Value::as_bool), f("yaw"), f("pitch"), f("distance")) {
(Some(false), ..) => Some(None),