makepad/libs/model/tests/sculpted.rs
Admin b22eadbe58 render, model, scene, texcomp, platform: the sandbox round-3 engine work -- realtime shadows that never flash sunless, foliage with impostors and GPU grass, a city material with glass and clear coat, sky reflections on all PBR, BC5 normal maps and Basis/UASTC transcoding with zero dependencies, a whole-frame GPU timer, conforming decals and sculpted shells in the model kit, character locomotion and grip fixes, and joint-following parts
- render:
  - CSM re-renders every cascade on Apple GPUs (incremental reuse read sunless on Metal); the VFX pass follows the scene pass rect;
  - an opaque no-discard pipeline variant; clustered spot cone culling;
  - foliage wind, impostors, grass (grass.rs, impostor.rs); DrawSceneCity (glass, interiors, headlights); occluder dither near the lens;
  - viewmodel shading in linear space; per-game grade/exposure; tile image sharing and texture_pack; a 31-attribute guard test.
- model: sculpted-shell booleans (a tolerant surface mapping, larger inputs); text_material badges and decals; the elbow and knee hinge fixes; the grip poses for first-person arms; Kestrel/Halcyon presets; faster tinting.
- scene: parts that follow a skeleton joint; HUD layout from real text metrics; VFX presets.
- texcomp: Basis UASTC, BC7, BC5 (RGTC), ASTC and ETC encode and transcode, with tests.
- platform: a GPU frame timer (Metal command-buffer times, Vulkan timestamps); a BC5/compressed-texture format on Metal, Vulkan and D3D11; draw_shader_ready (draw a fallback while a pipeline compiles); a Linux render-texture readback; thumbnail PNG encoding off Metal's completion thread.

Checked: cargo check --release --workspace on node 165 (Linux; the only errors are makepad-motion's `Media` ambiguity from widgets/families/media, not these changes); the sandbox workspace --all-targets; Metal builds and runs on the Mac mini; per-lane test suites in apps/sandbox/local/agent_state/rebuild (render 506, platform 333, model and texcomp suites).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 15:03:39 +02:00

26 lines
1.1 KiB
Rust

//! Sculpted lofted bodies cut by booleans (a race car's shell with its wheel
//! arches) must build: the kernel may retriangulate a smooth loft's
//! near-coplanar faces across their authored diagonals.
use makepad_model::{build_program, json, Limits};
fn run(path: &str) -> Result<usize, String> {
let text = std::fs::read(path).map_err(|e| e.to_string())?;
let ops = match json::parse(&text).map_err(|e| format!("{e:?}"))? { json::Value::Arr(ops) => ops, _ => return Err("program".into()) };
let built = build_program(&ops, Limits::default(), &mut |_| Err("no assets".into()), None).map_err(|f| format!("op {} ({}): {}", f.index, f.op, f.message))?;
Ok(built.compiled.glb.len())
}
#[test]
fn a_sculpted_car_shell_takes_its_wheel_arches() {
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/sculpted_car_shell.json");
let bytes = run(path).expect("the shell builds");
assert!(bytes > 10_000);
}
/// `MODEL_REPLAY=program.json cargo test -p makepad-model --test sculpted -- --ignored`
#[test]
#[ignore]
fn replay() {
let path = std::env::var("MODEL_REPLAY").expect("MODEL_REPLAY");
println!("{:?}", run(&path));
}