Repository navigation
Conversation
…rge for baked scenes (pascalorg#1224) * perf(viewer): cache the daylight sun shadow; light the outside from lit sources only - The sun's 4096 shadow map re-rendered every frame, a full extra pass over every caster. It now renders only when its placement, frustum or settings change or a caster moves, appears, vanishes or swaps geometry (a cheap per-frame signature over a caster list refreshed with the bounds). Orbiting and walking reuse it. - The outside spill and lantern loops ran over every window and exterior lamp for every pixel, day and night. They now loop over compact lists of the windows whose room has a lamp on and the exterior lamps that are on (rewritten on lamp and door changes), and indoor pixels skip them. Pixel-identical. Baked GLB walkthrough, M5 Max: 22 → 50 fps (capped) on a 4.3k-draw house, 18 → 32 fps on a 72-window condo at night; daytime GPU on the condo 85 → 40 ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(viewer): merge a baked artifact's static meshes (the enhanced viewer's batching) A big baked house is ~4,000 meshes, each drawn once per pass; on WebGPU every draw costs CPU to encode, so the overview spent ~60 ms a frame just submitting. Static meshes now merge per level, ~24 m cell, material and surface role into one mesh under their level (level visibility, explode and solo still apply); a moving part's meshes (a sash, a door leaf, a shutter) merge under that part and swing with it, glass included. The originals stay on the batched layer: never drawn or shadowed, still hit by pointer, reticle and room rays and the walkthrough collider, still outlined. Interactive items, loose glass, ceilings and roofs, the site, zones and plugin kinds stay individual; batches follow monochrome by role, and the merge rebuilds if a merged mesh is shown or hidden on its own. ?merge=0 turns it off. M5 Max, baked GLBs: 72-window condo overview 14 → 42 fps (8.6k → 1.8k draws); 4.3k-mesh house overview 14 → 32 fps. Renders match the unmerged scene (mean pixel difference ~1/255); the walkthrough collider is identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Cover registry-aware create, render install gate, durable scene JSON, and the get_scene MCP wire listing under explicit uninstallation and missing-plugin reload. Keep upstream pascalorg#1225 intact. PE39-1225-SCENE-INSTALL-SEMANTICS
…ssion branch Restore the six unrelated viewer files to fork main and remove the two GLB batching files added by ancestor 0602f9e. Preserve all MCP bridge production changes and exported-package regression tests unchanged. PE44-1225-ANCESTRY-DIFF-HYGIENE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream pascalorg/editor#1225 makes MCP patch creation and scene validation accept registered plugin schemas. PE37 found the missing package-export regression; PE38 covered built-in, registered and unregistered kinds. PE39 characterizes the registered vs installed-in-this-scene contract: hidden plugin nodes retain their data and MCP listing, even when registration later becomes unavailable. PE40 checks two detached scene runtimes and real MCP clients against this contract, including disposal of one runtime. PE42 pins nested plugin nodes when their parent subtree is unrooted, moved to another building, or cascade-deleted, with a saved-scene reload lacking plugin registration.
Design
wiki/architecture/scene-runtime.md:17. No viewer dependency added to MCP.get_sceneremains a truthful view of saved nodes, including hidden ones.@pascal-app/core,@pascal-app/core/schema,@pascal-app/mcp/bridge, and@pascal-app/mcp/tools/get-sceneexports. PE40 importsSceneBridgeandcreatePascalMcpServerfrom the published@pascal-app/mcpentrypoint and exercises two real in-memory MCP clients. No new sleeps, source-grep or test stubs.Change
packages/mcp/src/bridge/scene-bridge.ts:37-51and its create/validation callers.3a58e69:packages/mcp/src/bridge/scene-bridge.test.ts:1-18,209-301uses exported bridge; tests built-in and unregistered kinds.0d25bbe37c34b51d5fb308f363e53f745976042e, parent3a58e69:packages/mcp/src/tools/get-scene.test.ts:4-40adds typed fixture; lines 97-191 add two lifecycle cases with registry restoration. No production file changed.a8c841b0ebcbc80908cb7df229d6f2e98dc057b6, parent PE390d25bbe37c34b51d5fb308f363e53f745976042e:packages/mcp/src/bridge/detached-bridge.test.ts:7-16brings in the public node registry/install gate; lines 36-37 use the published MCP package export; lines 133-240 add one detached client/scene/disposal regression. No production code changed.4333e588, parenta8c841b0:packages/mcp/src/bridge/detached-bridge.test.ts:242-399adds three exported-API ancestry cases, saved snapshot reload and real MCPget_scenereceipt. No production change.3d679d5c(parent4333e588) restores six viewer files to exact fork-main blobs and removes two inherited GLB merge files, all introduced by0602f9e4. No MCP file changed in this commit. Main-to-PR comparison is now 8 commits / 4 MCP files, with zero viewer paths.PE44 exact-main ancestry diff audit
Base: fork main
352ec93c; parent:4333e588; child/head:3d679d5c. Original comparison: 12 files, with the last eight inherited from the unrelated viewer perf/batching ancestor. Final comparison: 4 MCP paths, all preserved. The eight viewer restorations were atomic in one child commit, without rebase or force-push.packages/mcp/src/bridge/scene-bridge.ts3e771908,983766a8packages/mcp/src/bridge/scene-bridge.test.ts3e771908,983766a8,3a58e690packages/mcp/src/tools/get-scene.test.ts0d25bbe3packages/mcp/src/bridge/detached-bridge.test.tsa8c841b0,4333e588packages/viewer/src/components/viewer/glb-scene.tsx0602f9e4packages/viewer/src/components/viewer/glb-walkthrough-controller.tsx0602f9e4packages/viewer/src/components/viewer/lights.tsx0602f9e4packages/viewer/src/lib/daylight/room-context.ts0602f9e4packages/viewer/src/lib/daylight/rooms.ts0602f9e4packages/viewer/src/lib/glb-merge.test.ts0602f9e4packages/viewer/src/lib/glb-merge.ts0602f9e4packages/viewer/src/lib/merged-outline-node.ts0602f9e4PE44's eight restored paths were read back: six blob IDs exactly match main; the two added files are absent. The final main comparison changes only the four MCP paths. This respects E-001, E-002, E-003, E-010, E-016, E-018, and T-001 by leaving all MCP behavior and tests unchanged.
Tests
ALL UNRUN by the workers, including after PE44; no Bun, Biome, typecheck or browser execution receipt. PE44 adds 0 tests and does not edit any existing test. PE42 adds three Bun cases to the existing detached-bridge suite and uses the registry's test-only
_snapshot()/_reset()with restoration. Notest.todo: source inspection found no confirmed contract failure, but no case has been executed. Exact commands from the monorepo root afterbun install --frozen-lockfile:bun --cwd packages/core run build bun --cwd packages/mcp run build bun test packages/mcp/src/bridge/scene-bridge.test.ts packages/mcp/src/tools/get-scene.test.ts packages/mcp/src/bridge/detached-bridge.test.ts bun x biome check packages/mcp/src/bridge/scene-bridge.test.ts packages/mcp/src/tools/get-scene.test.ts packages/mcp/src/bridge/detached-bridge.test.ts bun run check bun run ciExact PE42 focused command (UNRUN):
bun test packages/mcp/src/bridge/detached-bridge.test.ts. Biome/typecheck/full CI are also UNRUN.Worked expected outcomes, not executed:
352ec933d679d5cvaluepathfixture:get-scene-nodewith value 7isNodeKindEnabled=false, both JSON andget_scenepreserve node and explicitinstalledPlugins=[]get_sceneandlistToolsidentical before/after first create and disposal; live editor unchanged; first bridge reads fail after disposalPE42 hand-worked before/after matrix (expected, UNRUN): Baseline has 2 buildings, 2 levels, 1 registered plugin child = 5 nodes; the plugin is installed, nested under
building_b/level_g, and validates.nodeRegistry._reset())building_bfrom scene rootsbuilding_other,level_other); plugin and its ancestors pruned; scene valid; installed ID persistslevel_gfrombuilding_btobuilding_otherlevel_g→building_other; installed ID persists; missing plugin schema makes validation invalid for the retained childbuilding_bAfter each change, core export and in-memory MCP
get_scenemust agree on node membership and installed IDs. Missing registration is a test-only later-session simulation; it is not production hot-unregister. The values above are inferred from the source, not test results.Rendering in PE39 is checked at the public core install-gate level, not by a newly mounted viewer. Existing viewer plugin-dispatch Bun tests exercise actual renderer suppression/activation and late registration; they have not been re-run here. The test-only
nodeRegistry._reset()models a later session where code was not loaded; hot-unregister is not a supported production operation.PE40 test:
plugin scene state stays isolated across detached MCP clients and disposaladded at the exact parent-to-head diff, UNRUN. PE42 tests (3): detach/unroot, reparent and cascade-delete an ancestor, then reload without plugin registration; each checks node ancestry/count, project installs,get_scene, and node-specific validation. UNRUN. It checks the public install gate (truefor first,falsefor second), saved data, two real MCP clients, unchanged second tool listing, unchanged live editor snapshot, and second registry version after disposal. The plugin definition is intentionally shared globally under E-018; this test does not claim separate per-runtime registration tables or an authorization refusal for a registered-but-uninstalled node (PE39 explicitly preserves that behavior).CI: no Actions runs or commit statuses reported at exact PE42 head
4333e588c90a08cae17a92a214463e7cbcfcabd6when inspected: not run.Upstream readiness
HOLD pending native checks. No fork CI success or local test execution. The unrelated viewer ancestry is now removed from the final PR diff (4 MCP files only), but historical ancestry still contains
0602f9e4and a future merge would preserve existing main's viewer content because PE44 restores it exactly. Per-runtime definition registry isolation is not an existing E-018 contract: the globalnodeRegistryis deliberately shared; only scene data, installed-plugin state and client observations are independent. The generic MCPapplyPatchaccepting a registered-but-uninstalled kind remains characterized but not a confirmed authorization bug. PE42 is test-only and cannot establish a passing native result without Bun/CI. Plugin-specific tool offering is host policy; do not add an install restriction without a documented requirement. No upstream comments, PRs, reviews or merges were made.Follow-ups
What does this PR do?
Tests registry-aware MCP create/validation, per-scene installation and durable JSON/MCP scene discovery, plus independent detached scene/MCP client state and safe disposal under a deliberately shared definition registry.
How to test
Build core and MCP, run the three focused Bun files and Biome commands above. Verify the PE39 lifecycle cases against the previous bridge, and the PE40 two-runtime/client regression against the exact parent. All are UNRUN here. Run the complete native quality suite before promotion.
Screenshots / screen recording
N/A — headless MCP regression.
Checklist
kvnloo/editor:mainImplemented by ChatGPT (mobile app, GitHub connector) for Kevin's OSS factory.