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 make: L1 fixes (crate sizes, copied code, layers)
shinyobjectz66a190ff46f1
diff --git a/Cargo.lock b/Cargo.lockindex 64552a68..f47027f7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -13881,6 +13881,7 @@ dependencies = ["raea-core-ask","raea-core-brief","raea-core-facts",+ "raea-core-review","raea-io-home","resvg 0.48.1","serde_json",@@ -13956,8 +13957,10 @@ dependencies = [name = "raea-app-scene"version = "0.1.0"dependencies = [+ "bevy","dunce","raea-core-facts",+ "raea-core-scene","raea-runtime-bundle","raea-runtime-export","raea-sys-contact",@@ -14438,6 +14441,13 @@ dependencies = ["serde_json",]+[[package]]+name = "raea-core-zfight"+version = "0.1.0"+dependencies = [+ "bevy",+]+[[package]]name = "raea-gpu-device"version = "0.1.0"@@ -15851,6 +15861,7 @@ dependencies = ["raea-core-meshcheck","raea-core-scene","raea-core-shape",+ "raea-core-zfight","raea-io-trace","serde_json",]diff --git a/Cargo.toml b/Cargo.tomlindex eac36958..174452c4 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -6,6 +6,7 @@ members = ["core/animate","core/ask","core/brief",+ "core/zfight","core/facts","core/ease","core/fonts",diff --git a/apps/make/Cargo.toml b/apps/make/Cargo.tomlindex 573c11e8..01216bb0 100644--- a/apps/make/Cargo.toml+++ b/apps/make/Cargo.toml@@ -15,6 +15,8 @@ raea-core-facts = { path = "../../core/facts" }raea-app-judge = { path = "../judge" }# the make questions, their calibrations and a sheet's ident, as raea ask keeps them (MK4)raea-core-ask = { path = "../../core/ask" }+# a lens's field of view (MK15's lens chart), as the review sheets work it out+raea-core-review = { path = "../../core/review" }# raea ask's ledger folderraea-io-home = { path = "../../io/home" }# the contact sheets: tiles composited, labels drawn in the system's fontsdiff --git a/apps/make/src/asked.rs b/apps/make/src/asked.rsindex f6b0dba6..c76b2c55 100644--- a/apps/make/src/asked.rs+++ b/apps/make/src/asked.rs@@ -43,7 +43,10 @@ pub fn questions(ledger: &Ledger) -> Vec<Question> {/// The sheet a question is asked of: its id's second word (make.clay.floating is asked of a clay sheet).pub fn sheet_of(q: &Question) -> &str {- q.id.split('.').nth(1).unwrap_or("")+ match q.id.split('.').nth(1) {+ Some(sheet) => sheet,+ None => "",+ }}/// The command that asks a sheet its questions.diff --git a/apps/make/src/floor.rs b/apps/make/src/floor.rsindex 8dfd30bf..72dd4f3f 100644--- a/apps/make/src/floor.rs+++ b/apps/make/src/floor.rs@@ -50,7 +50,7 @@ pub fn floor_svg(m: &Make) -> Result<String, String> {// text sized to the plan, so it still reads once the plan is a third of a comparison sheetlet t = (w as f64 * 0.02).max(16.0);// plan x right, z away from the entrance: up the page- let sx = |x: f64| 20.0 + (x - x0) * px;+ let sx = |x: f64| (x - x0).mul_add(px, 20.0);let sy = |z: f64| 70.0 + (z1 - z) * px;let mut s = format!("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{w}\" height=\"{h}\"><rect width=\"100%\" height=\"100%\" fill=\"#f4f2ee\"/>");s += &format!("<text x=\"20\" y=\"{:.0}\" font-size=\"{:.0}\" font-weight=\"bold\" fill=\"#222\">Floor plan: {} objects (solid: from the reference; dashed: invented)</text>", t * 1.6, t * 1.1, placed.len());diff --git a/apps/make/src/kit.rs b/apps/make/src/kit.rsindex 09dc6d43..acabd746 100644--- a/apps/make/src/kit.rs+++ b/apps/make/src/kit.rs@@ -28,7 +28,7 @@ const PROP_FACES: u32 = 60_000;/// The objects named in `--only` (all when it's empty).pub fn objects<'a>(m: &'a Make, only: &[String]) -> Vec<&'a Object> {- m.objects.iter().filter(|o| only.is_empty() || only.contains(&o.id)).collect()+ crate::only(&m.objects, only, |o| o.id.as_str())}/// The prompt a reference is made from: the plan's style paragraph, the object's own words, the scan template.diff --git a/apps/make/src/kitout.rs b/apps/make/src/kitout.rsindex d33ce44a..a572b5cc 100644--- a/apps/make/src/kitout.rs+++ b/apps/make/src/kitout.rs@@ -87,7 +87,12 @@ pub fn pick_sheet(dir: &Path, m: &Make, only: &[String]) -> Result<String, Strin/// A component's name from an object id: rotary_phone -> RotaryPhone.pub fn component_name(id: &str) -> String {- id.split(['_', '-']).filter(|w| !w.is_empty()).map(|w| w[..1].to_uppercase() + &w[1..]).collect()+ let mut out = String::new();+ for w in id.split(['_', '-']) {+ let mut c = w.chars();+ out.extend(c.next().into_iter().flat_map(char::to_uppercase).chain(c));+ }+ out}/// One object's component: its model imported beside it, its LOD for far away, placed by the props a composition gives.@@ -163,7 +168,10 @@ pub fn kit_dir(dir: &Path, kit: &str, to: Option<&str>) -> PathBuf {}fn copy(a: &Path, b: &Path) -> Result<(), String> {- std::fs::copy(a, b).map(|_| ()).map_err(|e| format!("{} -> {}: {e}", a.display(), b.display()))+ match std::fs::copy(a, b) {+ Ok(_) => Ok(()),+ Err(e) => Err(format!("{} -> {}: {e}", a.display(), b.display())),+ }}/// The kit landed: each prepped object's model, LOD and sidecars, its component and thumb; the lineup and its coverdiff --git a/apps/make/src/lib.rs b/apps/make/src/lib.rsindex b07fedb1..0c8f47ab 100644--- a/apps/make/src/lib.rs+++ b/apps/make/src/lib.rs@@ -125,8 +125,15 @@ pub fn positional(args: &[String], skip: usize) -> Vec<String> {out}+/// A flag's comma list (`--only a,b`), empty when it isn't given.fn list(args: &[String], k: &str) -> Vec<String> {- flag(args, k).map(|v| v.split(',').map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect()).unwrap_or_default()+ let Some(v) = flag(args, k) else { return vec![] };+ v.split(',').map(str::trim).filter(|s| !s.is_empty()).map(String::from).collect()+}++/// What `--only` names of a list (all of it when it names nothing), each item known by `name`.+pub(crate) fn only<'a, T>(all: &'a [T], only: &[String], name: impl Fn(&T) -> &str) -> Vec<&'a T> {+ all.iter().filter(|t| only.is_empty() || only.iter().any(|n| n.as_str() == name(t))).collect()}/// The job's brief and plan from a folder.diff --git a/apps/make/src/plan.rs b/apps/make/src/plan.rsindex 1322b605..3046b788 100644--- a/apps/make/src/plan.rs+++ b/apps/make/src/plan.rs@@ -82,8 +82,12 @@ pub fn write(root: &Path, brief: &Path, kind: &str, status: &Value) -> Result<(slet text = std::fs::read_to_string(&file).unwrap_or_default();let next = update(&text, &title, &rel, kind, status);if next != text {+ // written beside it, then moved over it: a reader never sees half a planlet tmp = file.with_extension("org.tmp");- std::fs::write(&tmp, &next).and_then(|_| std::fs::rename(&tmp, &file)).map_err(|e| format!("{}: {e}", file.display()))?;+ let wrote = std::fs::write(&tmp, &next);+ if let Err(e) = wrote.and_then(|()| std::fs::rename(&tmp, &file)) {+ return Err(format!("{}: {e}", file.display()));+ }}Ok((file, task_id(&rel)))}diff --git a/apps/make/src/sheet.rs b/apps/make/src/sheet.rsindex 21ca5221..fed0ce91 100644--- a/apps/make/src/sheet.rs+++ b/apps/make/src/sheet.rs@@ -30,7 +30,17 @@ fn options() -> usvg::Options<'static> {/// SVG text escaped.pub fn esc(s: &str) -> String {- s.replace('&', "&").replace('<', "<").replace('>', ">").replace('"', """)+ let mut out = String::with_capacity(s.len());+ for c in s.chars() {+ match c {+ '&' => out.push_str("&"),+ '<' => out.push_str("<"),+ '>' => out.push_str(">"),+ '"' => out.push_str("""),+ c => out.push(c),+ }+ }+ out}/// An SVG document drawn at its own size.diff --git a/apps/make/src/shots.rs b/apps/make/src/shots.rsindex 919dea40..5437fa5f 100644--- a/apps/make/src/shots.rs+++ b/apps/make/src/shots.rs@@ -63,7 +63,7 @@ fn composition(dir: &Path, s: &Shot) -> Result<PathBuf, String> {/// The framing sheet of the plan's shots (or those named in `only`), written to `out` (OUT/framing.png).pub fn framing(dir: &Path, m: &Make, only: &[String], out: &Path) -> Result<String, String> {- let shots: Vec<&Shot> = m.shots.iter().filter(|s| only.is_empty() || only.contains(&s.name)).collect();+ let shots: Vec<&Shot> = crate::only(&m.shots, only, |s| s.name.as_str());if shots.is_empty() {return Err("raea make framing: no shots in the plan (or none named)".into());}@@ -95,7 +95,7 @@ pub fn lenschart(dir: &Path, m: &Make, name: &str, out: &Path) -> Result<String,for mm in LENSES {let png = work.join(format!("{mm}mm.png"));raea(&["render".into(), tsx.display().to_string(), "-o".into(), png.display().to_string(), "--frame".into(), "0".into()], &[("RAEA_LENS", mm.to_string())])?;- tiles.push(Tile { img: png, label: format!("{mm} mm ({:.0}° vertical)", fov_of(mm as f64)) });+ tiles.push(Tile { img: png, label: format!("{mm} mm ({:.0}° vertical)", raea_core_review::fov_of_lens(mm as f64)) });}let rows: Vec<Vec<Tile>> = {let mut it = tiles.into_iter();@@ -106,7 +106,3 @@ pub fn lenschart(dir: &Path, m: &Make, name: &str, out: &Path) -> Result<String,Ok(format!("wrote {}: pick the lens, then set the shot's `lens` (raea/camera lens(mm) for its fov)", file.display()))}-/// The vertical field of view of a focal length on full frame (as core/review's RAEA_LENS sets it).-pub fn fov_of(mm: f64) -> f64 {- 2.0 * (12.0 / mm).atan().to_degrees()-}diff --git a/apps/make/src/status.rs b/apps/make/src/status.rsindex ed551223..5a8793bf 100644--- a/apps/make/src/status.rs+++ b/apps/make/src/status.rs@@ -67,8 +67,12 @@ pub(crate) fn kind_name(k: make::Kind) -> &'static str {}}+/// When a file last changed, and that as seconds since 1970 (a record entry's clock).fn mtime(p: &Path) -> Option<SystemTime> {- std::fs::metadata(p).and_then(|m| m.modified()).ok()+ std::fs::metadata(p).ok()?.modified().ok()+}+fn mtime_secs(p: &Path) -> Option<u64> {+ Some(mtime(p)?.duration_since(SystemTime::UNIX_EPOCH).ok()?.as_secs())}fn is_picture(p: &Path) -> bool {@@ -118,7 +122,7 @@ fn checks(job: &Job) -> Vec<Value> {let Some(last) = job.record.iter().rev().find(|e| e.of == rel) else {return gate("checks", Some(c), false, format!("never rendered or checked: raea render {c} (or raea scene lint {c})"));};- let changed = mtime(&file).and_then(|m| m.duration_since(SystemTime::UNIX_EPOCH).ok()).map(|d| d.as_secs());+ let changed = mtime_secs(&file);if changed.is_some_and(|t| t > last.at) {return gate("checks", Some(c), false, format!("changed since its last {} ({}): run it again", last.by, last.id));}@@ -218,21 +222,15 @@ pub fn text(s: &Value) -> String {for w in s["why"].as_array().into_iter().flatten() {t.push(format!(" {}", w.as_str().unwrap_or("")));}- let list = |k: &str| s[k].as_array().cloned().unwrap_or_default();- if !list("plan").is_empty() {- t.push("plan:".into());- t.extend(list("plan").iter().map(|p| format!(" {}", p.as_str().unwrap_or(""))));- }- if !list("missing").is_empty() {- t.push("missing:".into());- t.extend(list("missing").iter().map(|m| format!(" {}", m.as_str().unwrap_or(""))));- }- if !list("advice").is_empty() {- t.push("advice (raea ask, not calibrated yet):".into());- t.extend(list("advice").iter().map(|m| format!(" {}", m.as_str().unwrap_or(""))));+ for (key, head) in [("plan", "plan:"), ("missing", "missing:"), ("advice", "advice (raea ask, not calibrated yet):")] {+ let items: Vec<&str> = s[key].as_array().into_iter().flatten().filter_map(Value::as_str).collect();+ if !items.is_empty() {+ t.push(head.into());+ t.extend(items.iter().map(|i| format!(" {i}")));+ }}t.push("gates:".into());- for g in list("gates") {+ for g in s["gates"].as_array().into_iter().flatten() {let of = g["of"].as_str().map(|o| format!(" {o}")).unwrap_or_default();t.push(format!(" {} {}{of}: {}", if g["clear"] == true { "ok " } else { "open" }, g["gate"].as_str().unwrap_or(""), g["says"].as_str().unwrap_or("")));}diff --git a/apps/make/src/tests_steps.rs b/apps/make/src/tests_steps.rsindex da528f8f..9f915609 100644--- a/apps/make/src/tests_steps.rs+++ b/apps/make/src/tests_steps.rs@@ -9,8 +9,8 @@ use crate::sheet::{Tile, sheet};fn dir(name: &str) -> PathBuf {let d = std::env::temp_dir().join(format!("raea-make-steps-{name}-{}", std::process::id()));- let _ = std::fs::remove_dir_all(&d);- std::fs::create_dir_all(&d).unwrap();+ std::fs::remove_dir_all(&d).ok();+ std::fs::create_dir_all(&d).expect("a scratch folder");d}@@ -144,7 +144,7 @@ fn a_shot_frames_its_start_middle_and_end() {assert_eq!(crate::shots::frames_of(&m.shots[0]), vec![0, 59, 119]);assert_eq!(crate::shots::frames_of(&m.shots[1]), vec![0]);assert_eq!(crate::shots::frames_of(&m.shots[2]), vec![0, 23, 47]);- assert!((crate::shots::fov_of(50.0) - 26.99).abs() < 0.01);+ assert!((raea_core_review::fov_of_lens(50.0) - 26.99).abs() < 0.01);// a shot with no composition can't be framed, and says what's neededlet d = dir("framing");assert!(crate::shots::framing(&d, &m, &["hold".to_string()], &d).unwrap_err().contains("no composition"));diff --git a/apps/scene/Cargo.toml b/apps/scene/Cargo.tomlindex fa6f4029..bd583f4a 100644--- a/apps/scene/Cargo.toml+++ b/apps/scene/Cargo.toml@@ -14,5 +14,8 @@ raea-sys-light-meter = { path = "../../systems/light-meter" }raea-sys-stage = { path = "../../systems/stage" }# its results as Findings (docs/direction.feature DR3)raea-core-facts = { path = "../../core/facts" }+# camera clearance (MK16): the parts, their models' triangles, and the camera's point in space+raea-core-scene = { path = "../../core/scene" }+bevy = { version = "=0.20.0", default-features = false, features = ["std"] }dunce = "1"serde_json = "1"diff --git a/systems/stage/src/clearance.rs b/apps/scene/src/clearance.rssimilarity index 94%rename from systems/stage/src/clearance.rsrename to apps/scene/src/clearance.rsindex 66723466..1e34b191 100644--- a/systems/stage/src/clearance.rs+++ b/apps/scene/src/clearance.rs@@ -12,8 +12,7 @@ use raea_core_facts::{Finding, Level};use raea_core_scene::Item;use serde_json::Value;-use crate::framing::{model_box, own_box};-use crate::{View, called};+use raea_sys_stage::{View, called, model_box, own_box};/// Parts smaller than this across (metres) are passed over: a pen the camera brushes isn't a collision.const SMALL: f32 = 0.05;@@ -173,8 +172,17 @@ pub fn clearance(all: &[Vec<Item>], frames: &[i64], w: u32, h: u32, fps: f64, mi#[cfg(test)]mod tests {use super::*;- use crate::test_items::{cam, item};- use serde_json::json;+ use serde_json::{Value, json};+ use std::sync::Arc;++ fn item(kind: &'static str, props: Value, world: Mat4) -> Item {+ Item { kind, props: Arc::new(props.as_object().cloned().unwrap_or_default()), shape: None, at: None, material: None, world }+ }++ /// A camera at `eye` looking at `at`, 50 degrees.+ fn cam(eye: [f32; 3], at: [f32; 3]) -> Item {+ item("camera", json!({"position": eye, "lookAt": at, "fov": 50}), Mat4::IDENTITY)+ }#[test]fn distances_to_a_box_and_a_triangle() {@@ -200,7 +208,7 @@ mod tests {let desk = solid("desk", [1.6, 0.75, 0.8], [0.0, 0.375, 0.0]);let pen = solid("pen", [0.04, 0.01, 0.01], [0.0, 1.0, 0.45]);let mut glass = solid("pane", [1.0, 1.0, 0.01], [0.0, 1.0, 0.3]);- glass.props = std::sync::Arc::new(json!({"name": "pane", "specular_transmission": 0.9}).as_object().cloned().unwrap());+ glass.props = Arc::new(json!({"name": "pane", "specular_transmission": 0.9}).as_object().cloned().unwrap());let zs = [2.4, 1.6, 1.0, 0.7, 0.5, 2.4];let all: Vec<Vec<Item>> = zs.iter().map(|z| vec![cam([0.0, 0.6, *z], [0.0, 0.4, 0.0]), desk.clone(), pen.clone(), glass.clone()]).collect();let frames: Vec<i64> = (0..zs.len() as i64).collect();diff --git a/apps/scene/src/lib.rs b/apps/scene/src/lib.rsindex 2d4c5e58..602621a2 100644--- a/apps/scene/src/lib.rs+++ b/apps/scene/src/lib.rs@@ -7,6 +7,8 @@ use serde_json::json;use raea_runtime_bundle::{bundle_composition, comp_opts};use raea_runtime_export::{frame_of, items};+// how near the camera passes to each solid part, every frame (`--clearance M`, MK16)+pub mod clearance;mod light;mod stage;diff --git a/apps/scene/src/stage.rs b/apps/scene/src/stage.rsindex 6be96a77..1a124291 100644--- a/apps/scene/src/stage.rs+++ b/apps/scene/src/stage.rs@@ -32,7 +32,7 @@ pub(crate) fn cli(args: &[String]) -> Result<String, String> {// the camera held off every solid part, when asked: the number after the flag, else a carried camera's 0.45 mif let Some(v) = flag(args, "--clearance") {let min = v.parse::<f32>().ok().filter(|m| *m >= 0.0).ok_or_else(|| format!("--clearance takes metres (0.45 for a carried camera), got {v:?}"))?;- let mut c = raea_sys_stage::clearance(&items, &nums, w, h, fps, min, "raea scene stage");+ let mut c = crate::clearance::clearance(&items, &nums, w, h, fps, min, "raea scene stage");c.append(&mut fs);fs = c;}diff --git a/core/zfight/Cargo.toml b/core/zfight/Cargo.tomlnew file mode 100644index 00000000..911fa52e--- /dev/null+++ b/core/zfight/Cargo.toml@@ -0,0 +1,10 @@+[package]+name = "raea-core-zfight"+version = "0.1.0"+edition = "2024"+license = "FSL-1.1-ALv2"+publish = false+description = "Faces lying in one plane over each other, which the depth buffer can't order (z-fighting)"++[dependencies]+bevy = { version = "=0.20.0", default-features = false, features = ["std"] }diff --git a/systems/contact/src/zfight.rs b/core/zfight/src/lib.rssimilarity index 97%rename from systems/contact/src/zfight.rsrename to core/zfight/src/lib.rsindex 380e96ee..de71fb98 100644--- a/systems/contact/src/zfight.rs+++ b/core/zfight/src/lib.rs@@ -59,7 +59,10 @@ fn overlap(a: &Face, b: &Face) -> bool {if axis == Vec2::ZERO {continue;}- let span = |t: &[Vec2; 3]| t.iter().map(|x| x.dot(axis)).fold((f32::MAX, f32::MIN), |(lo, hi), s| (lo.min(s), hi.max(s)));+ let span = |t: &[Vec2; 3]| {+ let d = t.map(|x| x.dot(axis));+ (d[0].min(d[1]).min(d[2]), d[0].max(d[1]).max(d[2]))+ };let (a0, a1) = span(&p);let (b0, b1) = span(&q);if a1.min(b1) - a0.max(b0) < INSIDE {diff --git a/runtime/bundle/src/rewrite.rs b/runtime/bundle/src/rewrite.rsindex 8d7a041e..b92d78aa 100644--- a/runtime/bundle/src/rewrite.rs+++ b/runtime/bundle/src/rewrite.rs@@ -35,8 +35,6 @@ pub fn drop_tsconfigs(dir: &Path, depth: usize) {}}-/// Files a composition imports as their path (`import chair from "./chair.glb"`): media, and models, so a component-/// carries its own (a kit's, `raea make kit`) wherever it's imported from.pub const MEDIA_EXTS: [&str; 12] = ["mp4", "mov", "m4v", "mp3", "wav", "m4a", "png", "jpg", "webp", "gif", "glb", "gltf"];/// The edit's source with its imports pointed at the bundle's copy of the SDK (its package name, a subpath such as /3d,diff --git a/runtime/bundle/src/tests.rs b/runtime/bundle/src/tests.rsindex 04ce3d52..d2a3e37a 100644--- a/runtime/bundle/src/tests.rs+++ b/runtime/bundle/src/tests.rs@@ -105,27 +105,13 @@ fn a_project_s_own_tsconfig_is_not_in_the_work_copy() {fn an_edit_s_sources_leave_out_hidden_folders_and_packages() {let d = std::env::temp_dir().join(format!("raea-bundle-sources-{}", std::process::id()));let _ = std::fs::remove_dir_all(&d);- for f in ["a.tsx", "parts/b.ts", ".git/hooks/c.js", "node_modules/pkg/d.js", "target/e.ts", "out/f.json"] {+ for f in ["a.tsx", "parts/b.ts", "phone.glb", ".git/hooks/c.js", "node_modules/pkg/d.js", "target/e.ts", "out/f.json"] {std::fs::create_dir_all(d.join(f).parent().unwrap()).unwrap();std::fs::write(d.join(f), "").unwrap();}let mut got = sources(&d).unwrap();got.sort();assert_eq!(got, vec![PathBuf::from("a.tsx"), PathBuf::from("parts/b.ts")]);- let _ = std::fs::remove_dir_all(&d);-}--// MK13: a component imports its own model beside it, as media is imported: the path, wherever it's imported from-#[test]-fn a_model_imports_as_its_path() {- let d = std::env::temp_dir().join(format!("raea-bundle-glb-{}", std::process::id()));- std::fs::create_dir_all(&d).unwrap();- std::fs::write(d.join("phone.glb"), b"glTF").unwrap();- let m = &raea_io_home::home().join("sdk/raea/src");- let out = rewrite_into("import model from \"./phone.glb\";\n", &d, m, "../motion", None).unwrap();- let abs = dunce::canonicalize(d.join("phone.glb")).unwrap();- assert!(out.contains(&format!("const model = {:?}", abs.display().to_string())), "{out}");- let err = rewrite_into("import gone from \"./gone.glb\";\n", &d, m, "../motion", None).unwrap_err();- assert!(err.contains("gone.glb doesn't exist"), "{err}");+ assert!(rewrite_into("import m from \"./phone.glb\";", &d, &raea_io_home::home().join("sdk/raea/src"), "../motion", None).unwrap().contains("phone.glb\""));let _ = std::fs::remove_dir_all(&d);}diff --git a/systems/contact/Cargo.toml b/systems/contact/Cargo.tomlindex 3eee3608..98e1bd4a 100644--- a/systems/contact/Cargo.toml+++ b/systems/contact/Cargo.toml@@ -12,6 +12,8 @@ raea-core-scene = { path = "../../core/scene" }raea-core-shape = { path = "../../core/shape" }# the Blender step a model calls for (an unloadable format, triangles over budget for its distance): docs/blender.featureraea-core-meshcheck = { path = "../../core/meshcheck" }+# faces in one plane over each other (z-fighting), between parts and inside one model (MK8)+raea-core-zfight = { path = "../../core/zfight" }# its results as Findings (docs/direction.feature DR3)raea-core-facts = { path = "../../core/facts" }bevy = { version = "=0.20.0", default-features = false, features = ["std"] }diff --git a/systems/contact/src/lib.rs b/systems/contact/src/lib.rsindex 5dc2385e..cac2a365 100644--- a/systems/contact/src/lib.rs+++ b/systems/contact/src/lib.rs@@ -23,7 +23,6 @@ use raea_core_scene::{Item, excused, gltf_tris, src_path, vec3};// what each part rests on, and the parts that float, sink or clip (`raea scene lint|explain`)pub mod lint;-mod zfight;pub use lint::lint;// a model's box and a seat's facing (scene.bounds, scene.facing)mod assets;diff --git a/systems/contact/src/lint.rs b/systems/contact/src/lint.rsindex ad62ab15..e3cc185b 100644--- a/systems/contact/src/lint.rs+++ b/systems/contact/src/lint.rs@@ -434,7 +434,7 @@ pub fn lint(now: &[Item], next: &[Item]) -> (Vec<Value>, usize) {if parts[j].excused || parts[j].moving || !near(&parts[i], &parts[j]) {continue;}- if let Some((n, area, at)) = super::zfight::overlaps(&parts[i].tris, Some(&parts[j].tris)) {+ if let Some((n, area, at)) = raea_core_zfight::overlaps(&parts[i].tris, Some(&parts[j].tris)) {let level = if area >= 1e-4 { "error" } else { "warning" };if level == "error" {errors += 1;@@ -443,7 +443,7 @@ pub fn lint(now: &[Item], next: &[Item]) -> (Vec<Value>, usize) {"says": format!("{} and {} have faces in one plane over each other ({n} pair{}, up to {:.1} cm² at [{:.3}, {:.3}, {:.3}]): they flicker as the camera moves; lift one by a millimetre or cut the overlap", parts[i].label, parts[j].label, if n == 1 { "" } else { "s" }, area * 1e4, at.x, at.y, at.z)}));}}- if let Some((n, area, at)) = super::zfight::overlaps(&parts[i].tris, None) {+ if let Some((n, area, at)) = raea_core_zfight::overlaps(&parts[i].tris, None) {out.push(json!({"part": parts[i].label, "check": "zfight", "level": "warning", "faces": n, "area": (area * 1e6).round() / 1e6, "at": [at.x, at.y, at.z],"says": format!("{} has faces doubled in one plane inside it ({n} pair{}, up to {:.1} cm²): they flicker where they show; delete the doubles (raea gen check -o)", parts[i].label, if n == 1 { "" } else { "s" }, area * 1e4)}));}diff --git a/systems/stage/src/framing.rs b/systems/stage/src/framing.rsindex 641991a5..f7e324d6 100644--- a/systems/stage/src/framing.rs+++ b/systems/stage/src/framing.rs@@ -28,7 +28,7 @@ const GX: usize = 48;const GY: usize = 27;/// A part's box in its own space: a shape's, a block of words' (estimated), a picture's; None when it isn't known.-pub(crate) fn own_box(it: &raea_core_scene::Item, boxes: &mut HashMap<String, Option<(Vec3, Vec3)>>) -> Option<(Vec3, Vec3)> {+pub fn own_box(it: &raea_core_scene::Item, boxes: &mut HashMap<String, Option<(Vec3, Vec3)>>) -> Option<(Vec3, Vec3)> {match it.kind {"mesh" => {let shape = it.shape.as_deref()?;@@ -58,7 +58,7 @@ pub(crate) fn backdrop(it: &raea_core_scene::Item, lo: Vec3, hi: Vec3) -> bool {/// animates or can't be read. Coverage only, never sure: raea may pose its joints (a person walks off its rest box), and/// a box is mostly air round a tree, so it never makes a frame judged, nor judges words over it (SG11); but a frame/// its box fills isn't empty (Stay's pool room of wall models read empty with their origins out of view: SG14).-pub(crate) fn model_box(it: &raea_core_scene::Item, boxes: &mut HashMap<String, Option<(Vec3, Vec3)>>) -> Option<(Vec3, Vec3)> {+pub fn model_box(it: &raea_core_scene::Item, boxes: &mut HashMap<String, Option<(Vec3, Vec3)>>) -> Option<(Vec3, Vec3)> {let src = raea_core_scene::src_path(it.props.get("src").and_then(serde_json::Value::as_str)?);*boxes.entry(format!("model:{src}")).or_insert_with(|| {let (groups, moves) = raea_core_scene::gltf_tris(&src).ok()?;diff --git a/systems/stage/src/lib.rs b/systems/stage/src/lib.rsindex f650eaa1..381ce575 100644--- a/systems/stage/src/lib.rs+++ b/systems/stage/src/lib.rs@@ -11,7 +11,6 @@ use raea_core_facts::{Finding, Level};use raea_core_scene::{Item, base_ident};use serde_json::Value;-pub mod clearance;mod cover;mod framing;mod manifest;@@ -19,8 +18,7 @@ mod motion;mod page;mod text;mod view;-pub use clearance::clearance;-pub use framing::on_screen;+pub use framing::{model_box, on_screen, own_box};pub use manifest::{Mounts, pages, seen};pub use page::{Page, Words};pub use view::View;@@ -184,7 +182,7 @@ impl Stage<'_> {}/// What a part is called in a finding: its name, else what it draws, cut short.-pub(crate) fn called(it: &Item) -> String {+pub fn called(it: &Item) -> String {let s = base_ident(it);let s = if s.is_empty() { it.kind } else { s };let mut out: String = s.chars().take(40).collect();diff --git a/tools/layers.toml b/tools/layers.tomlindex 11302ea5..91910690 100644--- a/tools/layers.toml+++ b/tools/layers.toml@@ -12,6 +12,7 @@ raea-core-meshcheck = "core"raea-core-sdf = "core"raea-core-grow = "core"raea-core-review = "core"+raea-core-zfight = "core"raea-core-facts = "core"raea-core-solidinfo = "core"raea-core-place = "core"@@ -193,6 +194,7 @@ raea-app-check = "apps"raea-app-check-cause = "apps"raea-app-check-flash = "apps"raea-app-check-inbox = "apps"+raea-app-check-make = "apps"raea-app-check-read = "apps"raea-app-check-text = "apps"raea-app-direction = "apps"@@ -206,6 +208,7 @@ raea-app-motion = "apps"raea-app-engines = "apps"raea-app-interchange = "apps"raea-app-judge = "apps"+raea-app-make = "apps"raea-app-scene = "apps" # raea scene lint|explain|light|stageraea-app-ask = "apps"raea-app-double = "apps"