makepad/examples/material_lab
2026-10-24 23:38:45 +02:00
..
src work: realism step 1 (lit tree impostors, terrain ecology rules, aerial perspective, quality tiers, brake lights, Vulkan GPU prof), hub survives WM restarts + fast start + CUDA builds, Desk Link display fixes (exit restore, flip watchdog, nice-10 children, timeline), live-edit restart/layout fixes, harness fixes, Amp parallel song writing 2026-10-24 23:38:45 +02:00
tests material_lab: a row of spheres above the cubes, and the scene projected at the widget's aspect -- a cube shows a light only on the faces it turns toward it (the rect light reached only a cube's thin top face until e0956b4d3 moved it), while a sphere has every normal, so a light's falloff, the environment's reflection, a rim or a highlight always shows on it. Every scene now puts a sphere with its column's material above each cube (y 1.35..2.35; resident geometry for the world scenes, a GLB model for the hook row, one smooth mesh of shared vertices wound as each cube is), the rect scene gives the sphere its own light at the cube light's place (each out of the other row's reach), and the camera aims at y 1.15 to frame both rows. The 800x300 pass is drawn stretched over the widget, which on Windows is 800x271 under the in-window title bar, so shapes were 10% wide; the projection now takes the widget's aspect and spheres are round. The pixel tests split each column at the background gap between the rows (found in the Unlit column) and assert every check on the cube and on the sphere, and place columns by pixels per metre, the same across as down now. Checked: cargo test -p makepad-example-material-lab on D3D11 (3 passed; rect column 0 means 130.9 cube and 88.5 sphere, column 1 1.7 and 0.8; IBL metal spheres 53), cargo check --tests for x86_64-apple-darwin 2026-10-03 15:01:17 +02:00
Cargo.toml render: the world's generic items, lights and environment reach the renderer (KERNELS.md P6.1, step 1) -- Renderer::register_geometry(GeometryId, GeometryData) makes host geometry resident, and each frame the World's Mesh and packed Instances items (LAYOUT_TRANSFORM_TINT: a model matrix and a tint per record) ride the placed models on the same lanes, shadows and clustered lights as a game's props (renderer/items.rs): a (geometry, material) pair is one uploaded model built on first use, the base colour rides the instance tint, and Unlit, blended and IBL items draw through built-in Splash materials, while a Splash material draws through the program a host installed under splash_material_name(program). Lines, points, cards and models stay the host's (render-lines, the compositor; skipped_items counts them), and kernel-written buffers resolve through Renderer::resolve_buffer, left for makepad-render-kernels (RK2). A world's own Sun and Sky lights replace the rig's key and hemisphere fill (world_lights::apply_world_sun) and its environment's fog replaces the host's (world_fog; the lanes fog exponentially, so linear fog maps to a density). A game World has none of these, so Sandbox draws as before. examples/material_lab gains two World scenes drawn in the dark (--scene=rect, --scene=ibl) and their pixel tests: a rectangular area light lights its cube and not the next one, an IBL metal cube reflects the sunset environment's warm horizon, an Unlit item shows its colour, a packed Instances item draws its tinted copies. Checked: cargo test --release -p makepad-render (452 + integration; new: geometry packing and validation, material keys), cargo test --release -p makepad-example-material-lab --test pixels (3 pass on Metal), cargo build --release -p makepad-sandbox. 2026-09-30 12:24:20 +02:00