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
raea render holds a video's text to the check's rules as it ends, and keeps a 2D frame's fill out of the lighting advice
Zachary Guglin119f4580182b
diff --git a/Cargo.lock b/Cargo.lockindex be3d26e6..df473078 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -13724,6 +13724,7 @@ version = "0.1.0"dependencies = ["dunce","raea-app-check",+ "raea-app-check-text","raea-app-notes","raea-app-registry","raea-core-brief",diff --git a/apps/check/src/lib.rs b/apps/check/src/lib.rsindex 4e632b4f..3a799ad2 100644--- a/apps/check/src/lib.rs+++ b/apps/check/src/lib.rs@@ -203,13 +203,7 @@ fn things(p: &str, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {/// `fps`), with `more` (a render's own), worst first then by time.fn findings_of(mut issues: Vec<Issue>, more: Vec<Finding>, fps: f64) -> Vec<Finding> {issues.sort_by(|a, b| a.p.cmp(&b.p).then(a.at.unwrap_or(0.0).total_cmp(&b.at.unwrap_or(0.0))));- let mut found = Vec::new();- for i in &issues {- // an issue at a second is about the frame it falls on- let (f, fr) = (Finding::new(i.rule, Level::of_rank(i.p), &i.says, "raea check"), (i.at.unwrap_or(0.0) * fps).round() as i64);- found.push(if i.at.is_some() { f.frames(fr, fr + 1) } else { f });- }- finding::ranked(found.into_iter().chain(more).collect())+ finding::ranked(issues.iter().map(|i| i.finding("raea check", fps)).chain(more).collect())}/// The findings (`findings_of`), written to -o as JSON when asked, and the report's text with the count last. Truediff --git a/apps/check/text/src/lib.rs b/apps/check/text/src/lib.rsindex a653a68a..5ec319c7 100644--- a/apps/check/text/src/lib.rs+++ b/apps/check/text/src/lib.rs@@ -5,6 +5,8 @@ use serde_json::Value;pub type R<T> = Result<T, String>;+use raea_core_facts::{Finding, Level};+/// One thing a rule found: its rule, its rank (P0 breaks the piece to P3 polish), when (seconds) and what to do.#[derive(Clone, Debug)]pub struct Issue {@@ -14,6 +16,21 @@ pub struct Issue {pub says: String,}+impl Issue {+ /// As a Finding `by` a command (docs/direction.feature DR3: P0 and P1 errors, P2 a warn, P3 a note), about the+ /// frame its second falls on at `fps`+ pub fn finding(&self, by: &str, fps: f64) -> Finding {+ let f = Finding::new(self.rule, Level::of_rank(self.p), &self.says, by);+ match self.at {+ Some(t) => {+ let n = (t * fps).round() as i64;+ f.frames(n, n + 1)+ }+ None => f,+ }+ }+}+/// A text as it stays on screen: from the frame it comes on to the frame it leaves. Typing (a text growing into the/// next) and counting (only its digits changing) are one run, judged by its last text.#[derive(Clone)]diff --git a/apps/direction/Cargo.toml b/apps/direction/Cargo.tomlindex e038d3c1..0ce62144 100644--- a/apps/direction/Cargo.toml+++ b/apps/direction/Cargo.toml@@ -19,6 +19,8 @@ serde_json = "1"# project's compositionsraea-core-brief = { path = "../../core/brief" }raea-app-check = { path = "../check" }+# the check's text rules, held to a video render's manifest as it ends+raea-app-check-text = { path = "../check/text" }raea-app-registry = { path = "../workspace/registry" }# the project's notes, whose asks' checks raea check runs beside its rules (DR6)raea-app-notes = { path = "../notes" }diff --git a/apps/direction/src/rendered.rs b/apps/direction/src/rendered.rsindex e7622eed..14126a05 100644--- a/apps/direction/src/rendered.rs+++ b/apps/direction/src/rendered.rs@@ -38,7 +38,7 @@ pub fn rendered(args: &[String]) -> i32 {if args.first().map(String::as_str) != Some("render") {return 0;}- let found = finding::taken();+ let mut found = finding::taken();let through = despite(args, std::env::var("RAEA_DESPITE").ok());let excused: Vec<Despite> = through.iter().map(|(c, w)| Despite { check: c.clone(), why: w.clone() }).collect();let out = raea_runtime_bundle::flag(args, "-o").or_else(|| raea_runtime_bundle::flag(args, "--review")).map(PathBuf::from);@@ -46,6 +46,13 @@ pub fn rendered(args: &[String]) -> i32 {let manifest = raea_runtime_bundle::flag(args, "--manifest").map(PathBuf::from).or_else(|| Some(raea_runtime_world::manifest_for(out.as_deref()?, std::path::Path::new(args.get(1)?))));if let Some(m) = manifest {if let Some(mut v) = std::fs::read(&m).ok().and_then(|b| serde_json::from_slice::<Value>(&b).ok()) {+ // a video's text, held to the check's text rules as it finishes, a check's round sooner+ if out.as_deref().and_then(|o| o.extension()).is_some_and(|x| x == "mp4" || x == "mov") {+ for f in text_found(&v) {+ println!("{}", f.line());+ found.push(f);+ }+ }v["findings"] = json!(found);if !excused.is_empty() {v["despite"] = json!(excused);@@ -63,6 +70,26 @@ pub fn rendered(args: &[String]) -> i32 {code}+/// What a video render's text breaks, from its manifest (raea-app-check-text, the rules `raea check` holds it to): text+/// off the frame is an error, as the check has it; text in a UI zone a warn, by the default zones, since the platform's+/// are the check's to decide (`--platform`); reading time waits for the check, which has the transcript to tell a+/// caption the voice reads out from one that has to be read.+fn text_found(manifest: &Value) -> Vec<Finding> {+ let runs = raea_app_check_text::text_runs(manifest);+ let (w, h, fps) = (manifest["width"].as_f64().unwrap_or(1080.0), manifest["height"].as_f64().unwrap_or(1920.0), manifest["fps"].as_f64().unwrap_or(30.0));+ let (mut issues, mut passed) = (Vec::new(), Vec::new());+ raea_app_check_text::text_rules(&runs, None, w, h, None, None, &mut issues, &mut passed);+ let mut found = Vec::new();+ for mut i in issues.into_iter().filter(|i| i.rule != "reading") {+ if i.rule == "safe-area" {+ i.p = 2;+ i.says.push_str(" (by the default zones: `raea check --platform P` holds it to the platform's)");+ }+ found.push(i.finding("raea render", fps));+ }+ found+}+#[cfg(test)]mod tests {use super::*;@@ -71,6 +98,23 @@ mod tests {v.iter().map(|a| a.to_string()).collect()}+ /// A video's text off the frame fails its render, as the check fails it; text in a UI zone is a warn by the+ /// default zones; a word on screen too briefly is left to the check, which has the transcript+ #[test]+ fn a_video_render_holds_its_text_to_the_check_s_rules() {+ let text = |t: &str, b: [f64; 4]| json!({"text": t, "box": b, "opacity": 1.0, "size": 60.0, "color": "rgb(255, 255, 255)"});+ let frames: Vec<Value> = (0..48).map(|f| json!({"frame": f, "videos": [], "text": [+ text("OFF THE EDGE", [900.0, 800.0, 400.0, 80.0]),+ text("Per month", [700.0, 1233.0, 318.0, 44.0]),+ if f < 3 { text("Two words", [200.0, 900.0, 300.0, 80.0]) } else { json!({"text": "", "box": [0, 0, 0, 0]}) },+ ]})).collect();+ let found = text_found(&json!({"width": 1080, "height": 1920, "fps": 24, "frames": frames}));+ let got: Vec<(&str, Level)> = found.iter().map(|f| (f.check.as_str(), f.level)).collect();+ assert_eq!(got, vec![("clipped", Level::Error), ("safe-area", Level::Warn)], "{found:?}");+ assert!(found[1].says.contains("--platform"));+ assert_eq!(found[0].frames, Some([0, 1]));+ }+#[test]fn an_error_fails_the_render_unless_it_is_let_through_and_says_by_what() {let found = vec![Finding::new("clips", Level::Error, "rider in seat", "raea render"), Finding::new("tilted", Level::Warn, "vase leans", "raea render")];diff --git a/runtime/export/src/render.rs b/runtime/export/src/render.rsindex ed197604..06db6042 100644--- a/runtime/export/src/render.rs+++ b/runtime/export/src/render.rs@@ -150,15 +150,37 @@ fn with_exposure(said: String, out: &Path, manifest: Option<&Path>) -> String {return said;}match raea_sys_light_meter::exposure::of_pngs(&pngs) {- Ok((e, v)) => {- let fs = raea_sys_light_meter::exposure::said(&v); // counted with the render's other findings (DR3)- if let Some(m) = manifest {- if let Ok(mut doc) = std::fs::read_to_string(m).map_err(|e| e.to_string()).and_then(|t| serde_json::from_str::<serde_json::Value>(&t).map_err(|e| e.to_string())) {- if let Some(o) = doc.as_object_mut() {- o.insert("exposure".into(), v.clone());- let _ = std::fs::write(m, doc.to_string());+ Ok((e, mut v)) => {+ // a frame of the page's own fill (no 3D in the render, no footage on it: a brand card's dark ground) is dark+ // or bright by design, and the advice ("a fill, an ambient or the sky's light reaches them nowhere") is a 3D+ // scene's: it's measured, not said. A frame with footage keeps it (a clip that drew black). 11-19: the+ // walkaround's logo card warned on every stills render.+ let doc: Option<serde_json::Value> = manifest.and_then(|m| std::fs::read_to_string(m).ok()).and_then(|t| serde_json::from_str(&t).ok());+ if let Some(d) = doc.as_ref().filter(|d| d["has3d"] == false) {+ let frames = d["frames"].as_array().cloned().unwrap_or_default();+ fn fill(f: &serde_json::Value) -> bool {+ f["videos"].as_array().is_none_or(Vec::is_empty)+ }+ let mut names: Vec<String> = Vec::new();+ if pngs.len() == 1 && frames.len() == 1 && fill(&frames[0]) {+ names.push("the frame".into());+ } else if pngs.len() == frames.len() {+ for (p, f) in pngs.iter().zip(&frames) {+ if let (true, Some(n)) = (fill(f), p.file_name()) {+ names.push(n.to_string_lossy().into_owned());+ }}}+ if let Some(found) = v["found"].as_array_mut() {+ found.retain(|f| !names.iter().any(|n| f["says"].as_str().is_some_and(|s| s.starts_with(&format!("{n}:")))));+ }+ }+ let fs = raea_sys_light_meter::exposure::said(&v); // counted with the render's other findings (DR3)+ if let (Some(m), Some(mut doc)) = (manifest, doc) {+ if let Some(o) = doc.as_object_mut() {+ o.insert("exposure".into(), v.clone());+ let _ = std::fs::write(m, doc.to_string());+ }}let mut msg = format!("{said}\nEXPOSURE {}", e.line());for f in &fs {