mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
raea-sys-stage's Staging and raea-sys-contact's Clipping take each frame's parts as it's drawn and keep only what their verdicts read: each frame's camera, each block of words' and each named part's place on screen, each frame's cover and subject, the words over parts, and the solids of the parts on screen (a part's let go once it's been gone 120 frames, an overlap's kept until it's said; only the last frame's pair tests are reused). raea-runtime-endchecks hands each frame in; a still's frames go in one at a time, their parts made and let go. Nothing keeps a render's parts now: raea-io-kept is gone. raea-core-scene's ids_of names a frame's parts as spans_of follows them. Contact's unused slice check and told are gone, its deepest hit shared with the lint. The film: the same 439 errors, 705 warns and 47 notes in the same order; end checks 0.6 s (22.7 s); a 4.06 GB resident peak (4.76). The control's end checks add nothing (1.32 GB after its last frame; they rose to 1.52 GB). Its frames still grow 25% after the first minute (docs/stage-guards.feature). LX7's plan row follows the clipping check's per-frame code into clip.rs. raea-cli's tests name raea scene's usage where it moved (raea-app-scene), and an unused alias goes.
60 lines
3.0 KiB
Rust
60 lines
3.0 KiB
Rust
//! A render's frames as their parts, and the checks a render runs on them at its end: raea-sys-contact's clipping and
|
|
//! raea-sys-stage's staging (docs/stage-guards.feature SG10-SG14). `raea scene` (raea-app-scene) steps them without
|
|
//! drawing.
|
|
|
|
use super::{Frame, flag};
|
|
|
|
/// A frame's 3D walked into its parts (raea-runtime-scene).
|
|
pub fn items(f: &Frame) -> Vec<raea_core_scene::Item> {
|
|
raea_runtime_scene::items_of(&f.scene)
|
|
}
|
|
|
|
/// Each frame's items, walked once (a frame's tree was walked again for each kind of part: 11 times a live frame)
|
|
pub fn all_items(frames: &[(i64, Frame)]) -> Vec<Vec<raea_core_scene::Item>> {
|
|
frames.iter().map(|(_, f)| items(f)).collect()
|
|
}
|
|
|
|
/// The end checks (raea-runtime-endchecks) on a render's frames, each said on stderr: the parts that clip where the
|
|
/// camera sees them and the staging. `page` is the manifest's frames (each one's words in the page, which the staging
|
|
/// holds off the parts: SG11), None where they aren't known.
|
|
pub(crate) fn told(frames: &[(i64, Frame)], page: Option<&[serde_json::Value]>, w: u32, h: u32, fps: f64) -> Vec<raea_core_facts::Finding> {
|
|
let nums = frames.iter().map(|f| f.0).collect();
|
|
checked(nums, frames.iter().map(|f| raea_runtime_scene::items_of(&f.1.scene)), page, w, h, fps)
|
|
}
|
|
|
|
/// told for frames nothing reads the 3D of after: each frame's scene let go as its parts are checked (SG4a)
|
|
pub(crate) fn told_taking(frames: &mut [(i64, Frame)], page: Option<&[serde_json::Value]>, w: u32, h: u32, fps: f64) -> Vec<raea_core_facts::Finding> {
|
|
let nums = frames.iter().map(|f| f.0).collect();
|
|
checked(nums, frames.iter_mut().map(|(_, f)| raea_runtime_scene::items_of(&std::mem::take(&mut f.scene))), page, w, h, fps)
|
|
}
|
|
|
|
fn checked(nums: Vec<i64>, items: impl Iterator<Item = Vec<raea_core_scene::Item>>, page: Option<&[serde_json::Value]>, w: u32, h: u32, fps: f64) -> Vec<raea_core_facts::Finding> {
|
|
let pages = page.map(|p| raea_sys_stage::pages(p, &nums, w, h));
|
|
let mut e = raea_runtime_endchecks::EndChecks::new(w, h, fps);
|
|
for (k, its) in items.enumerate() {
|
|
e.push(nums[k], &its, pages.as_ref().and_then(|p| p.get(k)));
|
|
}
|
|
ended(e)
|
|
}
|
|
|
|
/// The end checks' findings, a memory mark after each step; what they say of the parts, in SEEN.
|
|
pub(crate) fn ended(e: raea_runtime_endchecks::EndChecks) -> Vec<raea_core_facts::Finding> {
|
|
let (found, seen) = e.told(raea_render::engine::mem_mark);
|
|
if seen.is_some() {
|
|
*SEEN.lock().unwrap() = seen;
|
|
}
|
|
found
|
|
}
|
|
|
|
/// What the manifest says of a render's parts (raea_sys_stage::seen; write_manifest takes it): for stills each
|
|
/// frame's parts on screen, for a longer render where they remount.
|
|
pub(crate) static SEEN: std::sync::Mutex<Option<serde_json::Value>> = std::sync::Mutex::new(None);
|
|
|
|
/// `--frame N`, 0 when it isn't given (scene lint and render --review).
|
|
pub fn frame_of(args: &[String]) -> Result<i64, String> {
|
|
match flag(args, "--frame") {
|
|
Some(f) => f.parse().map_err(|_| "--frame takes a frame number".to_string()),
|
|
None => Ok(0),
|
|
}
|
|
}
|