Wall Phase 3 milestone B: runtime port behind feature flag

Brings the wall kind onto the registry path when
NEXT_PUBLIC_USE_REGISTRY_FOR_WALL=true; default-off keeps wall on its
legacy path unchanged.

Files added:

- nodes/src/wall/renderer.tsx — thin placeholder-mesh mount point.
  Identical pattern to the legacy WallRenderer: registers ref via
  useRegistry, marks dirty on mount, renders hosted children
  recursively via NodeRenderer. The legacy WallSystem fills geometry
  on the next frame regardless of which mount path is active.

- nodes/src/wall/system.tsx — a bundle component that renders
  <WallSystem /> + <WallCutout /> (both re-exported from viewer).
  Registered via def.system with priority 4 to mirror the legacy
  WallSystem's useFrame priority. Zero logic duplication — the
  ~970 lines of CSG/mitering/cutaway code stays in viewer.

Files changed:

- packages/viewer/src/index.ts — new exports for WallSystem, WallCutout,
  and NodeRenderer. The first two so the registry-driven system bundle
  can compose them; NodeRenderer so any parent kind (wall, slab,
  ceiling, building) can recursively render hosted children without
  reaching into viewer internals.

- nodes/src/wall/definition.ts — adds renderer + system fields. Tool
  field stays absent (wall placement / endpoint drag remain bespoke
  for now; the affordance port is a later milestone).

- nodes/src/index.ts — conditionally appends wallDefinition to
  builtinPlugin.nodes based on isWallRegistryEnabled(). With the flag
  off, the array is identical to before this commit; with it on,
  Phase 0 dispatch shims switch wall to the registry path:
    * <LegacySystem kind="wall"> around WallSystem returns null
    * <LegacySystem kind="wall"> around WallCutout returns null
    * <NodeRenderer> takes the registry-first branch and mounts the
      new renderer instead of the legacy switch case for 'wall'
    * RegisteredSystems mounts the new system bundle, which re-mounts
      the same WallSystem + WallCutout components from viewer

No behavior change with the flag off. With the flag on, behavior should
be byte-identical (same components, same priority, same geometry path).
Manual verification next: place walls, t-junctions, walls-with-doors
with the flag toggled both ways; confirm visual + interactive parity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-05-15 09:00:15 -04:00
co-authored by Claude Opus 4.7
parent 0a723fa1f2
commit 02aeca8439
5 changed files with 172 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
'use client'
import { WallCutout, WallSystem } from '@pascal-app/viewer'
/**
* Registry-driven wall system bundle.
*
* Wall has two per-frame concerns that need to mount when the kind is
* registry-driven:
*
* - **`WallSystem`** — reads `dirtyNodes`, batches by level, runs
* `calculateLevelMiters(levelWalls)`, rebuilds geometry via
* `generateExtrudedWall(node, children, miterData, slabElevation)`,
* and cascades to adjacent walls that share a junction. This is the
* bulk of the wall runtime (~820 lines in viewer).
* - **`WallCutout`** — cutaway-mode hide/show logic based on camera
* direction and `frontSide` / `backSide` interior/exterior tags.
*
* Both already live in `@pascal-app/viewer` and are wrapped in
* `<LegacySystem kind="wall">` at the legacy mount point. When the
* `wall` kind appears in `nodeRegistry`, those wrappers short-circuit and
* this bundle takes over the mount via `RegisteredSystems`. The
* components themselves are unchanged — no logic duplication during
* Phase 3.
*
* Phase 6 deletes the legacy `<LegacySystem kind="wall">` wrappers; until
* then this file is the single mount surface for wall's per-frame work.
*/
const WallSystems = () => {
return (
<>
<WallSystem />
<WallCutout />
</>
)
}
export default WallSystems