3D engine that AI agents drive
Merge origin/main into feat/light-bake and reset size budgets
Nguyen Xuan An7dadaa4432a2
diff --cc CHANGELOG.mdindex 339eb88d,d757d5d6..ac2d3096--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -2,8 -2,7 +2,9 @@@## Unreleased+- Add `67js/addons/light-bake` (part of issue #55; recipes, MCP, GLB export and reflection probes are not done). `bakeLightmaps(parts, lights, options)` traces cosine-weighted paths on the CPU against a triangle BVH and returns new parts that carry the light that bounces between surfaces (point lights and the sun, shadowed) as a lightmap texture drawn through the emissive map, with lightmap UVs from the `uv_unwrap` unwrap. The renderer and its shaders are untouched, so a scene without a bake renders as before and core size is unchanged. Bounded and deterministic: `samples`, `bounces`, `texelsPerUnit`, `maxResolution` and `maxSeconds` are range checked, texel, triangle, light and ray-work totals are checked before any ray is traced, and the same input gives the same bytes. Parts with their own maps, pattern, emission, skin or transparency are skipped and listed in the report. `npm run reference -- --bake lit-interior` takes `lit-interior` from 0.5055 to 0.1444 against Cycles (6 s bake); no other scene moved by more than 0.002. The package archive grows by 3,525 bytes (717,978 to 721,503). See `docs/light-bake.md`.++ - Add recipe cloth (part of issue #62, no new tool). A `cloth` section records sheets with a position-based solver (`src/cloth.js`, loaded on demand with the new `cloth` module, no peer dependency): pinned edges, gravity, steady wind, ball and box colliders, thickness and friction, 60 frames a second, bounded by particle, frame and solver-operation limits. A seek blends two recorded frames, so the same time gives the same positions and a seek backwards repeats them (`npm run smoke:agent-cloth` repeats the PNG bytes through the MCP preview). New `grid` geometry (a flat sheet, 1 to 64 segments), `set-cloth` operation and a `cloth` report in `scene_inspect`. The tool schemas stay within the total budget: `set-physics` now takes the same record reference as `set-motion`, and the physics descriptions are shorter. A hanging sheet matches a Blender cloth bake (`scripts/blender-cloth.py`) to 0.08 percent of its height; a sheet dropped on a ball does not match, and no parity is claimed. No self collision and no soft bodies yet.- Edit the topology of imported GLB parts (part of issue #48, no new tool). `mesh_edit` and `mesh_inspect` take a part ID such as `mesh-10` of an imported asset: the part becomes a welded polygon mesh with axis tags and a `material-<n>` tag, the edit log is kept in the asset recipe as `meshEdits` (checkpoints, export and replay work), and every result passes `validateTopology`. New vertices take skin weights, morph deltas and vertex colours from the nearest original surface point and faces left without UVs read the nearest UV island; on a skinned or morphed part an edit more than a quarter of the part's bounds diagonal from the original surface is rejected with the next action. `mesh_inspect` reports `localToWorldScale` and `localAxesInWorld`. Measured on RobotExpressive through MCP (`npm run smoke:imported-topology`): a through hole in the closed left leg (98 to 210 triangles, still one closed part), a cut in the skinned right hand (124 to 109) and the morphed head (154 to 134), a 3 m extrude on the head rejected, GLB export and checkpoint restore intact. Suite task `robot-leg-hole`.- Make room in the npm package (part of issue #36). The MCP preview page, `build/mcp/preview.js`, is now an entry of the library build and imports the engine chunks that the package entries already ship, instead of bundling its own copy of the engine. The archive drops from 904,975 to 666,214 bytes. `build/mcp/manifest.json` lists those chunks under `previewChunks` with their hashes, the MCP runtime serves them next to `preview.js`, and `bench/size/budgets.json` gains `archiveBytes`, which `npm run smoke:package` checks.- Add six whole-mesh modifiers as edits and stack nodes (part of issue #42): `weld`, `triangulate`, `edge_split`, `smooth`, `simple_deform` (twist, bend, taper, stretch) and `cast` (sphere). Each has Blender cases in `tests/fixtures/blender/` that match with no listed difference, `triangulate` and `edge_split` check their output size before building it, and their fields are described in `scene_capabilities` `meshModifiers` so the tool schemas grow by one compact entry. Left for later slices: screw, skin, wireframe, lattice, curve, hook, wave, shrinkwrap, weighted normal, smooth by angle and the other cast shapes. `npm run parity` now prints the modifier coverage.diff --cc bench/size/baseline.jsonindex 10e95cb7,15d720e2..3878af7f--- a/bench/size/baseline.json+++ b/bench/size/baseline.json@@@ -14,9 -14,9 +14,9 @@@},"bundles": {"entry:core": {- "min": 283213,- "min": 283224,-- "gzip": 80927,- "brotli": 69079- "brotli": 68972++ "min": 283270,++ "gzip": 80938,++ "brotli": 69059},"entry:model": {"min": 40093,diff --cc bench/size/budgets.jsonindex e309daa3,2f3ac69a..7ec05ccb--- a/bench/size/budgets.json+++ b/bench/size/budgets.json@@@ -1,5 -1,5 +1,5 @@@{- "archiveBytes": 721503,- "archiveBytes": 721300,++ "archiveBytes": 741100,"goals": {"lit-box": 50000,"gltf-box": 80000,@@@ -28,18 -28,17 +28,18 @@@"entry:terrain": 3100,"entry:grass": 4400,"entry:clutter": 5300,+ "entry:light-bake": 25400,"entry:texture-set": 900,-- "entry:agent-scene": 61800,- "entry:agent-scene+lazy": 191900,- "entry:agent-scene+lazy": 194600,-- "entry:agent-asset": 92800,- "entry:agent-asset+lazy": 202500,- "entry:agent-asset+lazy": 205000,++ "entry:agent-scene": 12800,++ "entry:agent-scene+lazy": 198100,++ "entry:agent-asset": 12800,++ "entry:agent-asset+lazy": 208700,"entry:hdri": 3300,"entry:camera-effects": 8600,"entry:render-passes": 1700,"scene:lit-box": 60200,"scene:gltf-box": 79700,-- "scene:agent-scene": 91700,- "scene:agent-scene+lazy": 221700- "scene:agent-scene+lazy": 223850++ "scene:agent-scene": 12800,++ "scene:agent-scene+lazy": 228000}}