* Add roof surface placement support for items
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.
- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fixed conflict
* Fix spiral stair openings and fence handle arrows
* Implement roof trim planes and ridge vent clipping
* Fix mansard roof and ridge vent placement
* Fix mansard merged roof cutouts
* Fix Dutch roof gable overhang
* Refactor roof segment, ridge vent, and surface geometry
Remove Dutch ridge axis abstraction and rework roof edit system,
ridge vent clipping geometry, and roof surface placement.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Simplify Dutch roof shape
* Add Dutch roof gable top geometry controls
* Fix Dutch roof slope material slots
* Render dutch roof tops as double-sided faces
* Add auto ridge vent toggle to roof segments
Track ridge vent auto-generation via an `autoRidgeVent` metadata flag so
geometry changes only regenerate default vents when enabled, treating
legacy segments with generated vents as auto-enabled for back-compat.
Expose a panel toggle to opt in/out per segment.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Snap new walls to the floor below
Feed the walls of the level directly beneath the active one into the
draft snap pipeline as extra references, so a new wall can align with
the floor below. They share the same local XZ origin, and the list is
kept separate from the current-level walls so the measurement HUD and
wall splitting only act on the active level.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Set Dutch roof shape defaults on type switch
Seed the Dutch shape parameters (waist width/height/length, top rake
thickness/length) with sensible defaults whenever a segment is created
as or switched to Dutch, so the gablet is well-formed regardless of
leftover values from the previous roof type.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Use green accent for corner and endpoint snap markers
Color the corner/endpoint snap markers and the vertical cursor pillar
green across the 2D floorplan beacon, the 3D alignment guide dots, and
the wall snap beacon so snap targets read as a consistent accent.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Add magnetic wall snapping to the roof tool
Snap roof draft corners onto wall corners, midpoints, crossings, and
bodies on the active level and the floor below, reusing the wall tool's
snap pipeline so the beacon and coloring match. The cursor's ground
dot/ring is hidden while a wall snap is active to avoid overlapping the
beacon glyph.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Update auto-generated Next.js route types path
Regenerated next-env.d.ts now references ./.next/dev/types/routes.d.ts.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Show cutaway outline while dragging roof trim
Slice an untrimmed segment volume generated from the live node instead of
the registry mesh, whose CSG rebuild lags a few frames behind the drag and
may still hold placeholder geometry — so the section outline now renders
deterministically. Use LineBasicNodeMaterial so the outline draws under the
WebGPU pipeline, and export generateRoofSegmentGeometry for the slice source.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Fill and clip roof trim cutaway, gate it to active drag
Add a violet silhouette fill behind the cutaway outline, extend the
section slicing to angled diagonal/corner trims via a generic vertical
cut plane, and clip each slice to its footprint span so the infinite
plane no longer sprouts stray lines across the rest of the roof. The
cutaway now renders only while a trim handle is being dragged.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Separate and extend Dutch roof end slopes
Pull the Dutch hip end slopes out of the watertight shingle shell into
their own slab wedge so they can be reshaped independently, and extend
each end slope inward up its own hip plane until the top edge meets the
gablet's inner triangle. Refactor roof-segment shape geometry into a
shared roof-segment-shape module.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Render roof trim cutaway as a material-only section cut
Replace the triangle-mesh slicer with a CSG intersection of a thin slab
against the untrimmed roof shell, so the cutaway shows red only on real
material (wall + deck bands) and leaves the hollow attic empty. Add an
analytic surface-edge outline, style both solid red like a SketchUp
section, and make the cutaway persist whenever a segment is trimmed.
Keep the merged roof shell visible during trim editing (re-trimmed live
from each segment's drag override) instead of swapping in the per-segment
meshes, whose abutting end-cap faces showed as stray white planes the
commit never had. Extend each slab past free cut-line ends only — trimmed
ends clamp to the cut line — so the red section stays inside the trim box.
Re-export INTERSECTION from the viewer CSG surface for the editor.
* Outline roof cutaway by fill silhouette, restyle to destructive red
Derive the section-cut outline from the fill geometry's edges
(EdgesGeometry) so it traces the real cut shape — wall/deck band
boundaries and the hollow-attic edge — instead of just the top surface
line. Drop the fill to 85% opacity and recolor both fill and outline to
the app's destructive red, matching the delete/destructive UI.
* Include roof accessories in trim clipping and red cutaway
Roof accessories (chimney, vents, skylight, dormer, gutter, downspout,
solar-panel, cupola) now slice at the trim plane like the roof shell and
appear in the red section-cut while dragging a trim handle:
- Export clipGeometryBySegmentTrim from the viewer as a reusable
segment-local trim-clip primitive.
- Add a shared useSegmentTrimClippedGeometry hook + TrimClippedMesh
wrapper (nodes) that slice accessory geometry by the host segment's
live trim override, so the cut tracks the drag.
- Wire the clip into all 11 accessory renderers, including skylight
glass panes and dormer window glass/frame/sill.
- Feed every hosted accessory mesh into the editor's red cutaway, welding
triangle-soup geometry (e.g. ridge vent) so CSG INTERSECTION yields a
cross-section.
- Register skylight in the scene-graph tree-node map so it shows in the
outliner when placed on a roof.
Co-Authored-By: Claude <noreply@anthropic.com>
* Add smooth spline fences with editable curve handles
Fences can now be drawn as one continuous Catmull-Rom/Bezier curve via an
optional `path` (+ per-point `tangents`), selectable in a Straight/Curved
mode toggle. Selected spline fences expose draggable control-point dots
(hexagon) and symmetric tangent handles (circle) joined by a violet line,
editable in both 2D plan and 3D. Side-move arrows are dropped for splines.
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix dutch roof ridge vent handling
* Fix Dutch ridge vent placement and support
* Fix Dutch roof trim artifacts
* Fix Dutch roof trim preview geometry
* Tag roof trim overlay meshes with EDITOR_LAYER
Child meshes relied on a parent group's layer, which three.js does not
propagate, so the trim section/rail/plane overlays rendered on the scene
layer — getting inked/SSGI-darkened and leaking into thumbnail exports.
Co-Authored-By: Claude <noreply@anthropic.com>
* Apply Biome cleanup
* fix(core): address Dutch roof review feedback
* chore: apply biome check cleanup
* fix(core): relax Dutch roof surface helper input
* fix
* Fix biome checks and dev verification
* fixes
* Remove unsupported Biome noShadow override
* Improve roof interactions and fence editing
* Fix fence drag and ridge vent default handling
* editor: drop wall-snap debug log, gate curved-fence finish hint on draft start
Remove the leftover TEMP DIAGNOSTIC console.log in the wall tool's onMove
hot path.
Curved fences commit on a closing gesture (double-click / Enter) rather than
per-click, so surface a 'Finish curve' hint in the fence HUD — but only once a
point has been placed and a curve is actually in flight. The draft point count
is published from SplineFenceDraft into a small ephemeral editor store
(useFenceCurveDraft) that the contextual helper reads, mirroring the existing
useSegmentDraftChain pattern.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Wassim SAMAD <wass08@gmail.com>
Implements plans/editor-placement-interaction-overhaul.md: an authoritative
interaction-scope state machine plus the catalogued placement/interaction
fixes, and split-view floor-plan performance.
- Interaction-scope spine (lib/interaction/* + store/use-interaction-scope),
driven from central useEditor setters; overlay scoping (zone labels,
context badges, floating action menu) reads resolveOverlayPolicy.
- Bug tracks A/B/D/E/F/G/H: handle/cutout raycast, footprint validity,
auto-slab loop, ceiling hosting, B-key tool desync, 2D drop offset,
per-frame jank.
- Snapping modes (grid/lines/angles/off) + contextual HUD chips; modifier
model (Shift=cycle, Alt=free place, Ctrl=grid step).
- Item move now tracks the cursor 1:1 (was a laggy per-frame lerp); handle
rig hides during a whole-node move; rotate gizmo advertises Shift=free
rotation in the HUD and hides the move cross while rotating.
- Floor-plan perf: pause live reactivity while in 3D-only view; per-node
geometry cache so only changed nodes rebuild on a drag; hoist wall miters
to a once-per-pass ctx.levelData (O(N^2) -> O(N) on wall/opening drags).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Add roof surface placement support for items
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.
- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fixed conflict
* feat(duct): ceiling-snap drawing + connected-joint endpoint move
Duct draw tool's ceiling mode now hangs each path point just below the
ceiling actually covering it (per-room heights tracked), with a
translucent surface highlight and a plumb line to the floor so the
in-flight point reads clearly from any angle.
Dragging a duct corner that sits on a fitting now carries the fitting's
other ducts along (port-connectivity second hop), so the joint moves
together instead of tearing apart.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): detach + vertical modifiers for duct/pipe joint editing
Alt detaches a dragged duct/pipe endpoint or fitting from its connected
joint (no elbow re-aim, no connectivity follow); Ctrl/Cmd drives vertical
riser movement on the fitting move. Behavioral parity across 2D and 3D.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): full DWV pipe parity for joint editing
Bring pipe-segment endpoint drags and pipe-fitting moves to parity with
duct: free-drag endpoints, Alt-detach, Ctrl/Cmd-vertical riser, elbow
re-aim, and connectivity follow. Generalizes the shared elbow-reaim and
auto-fitting helpers to dispatch by run kind so 2D and 3D share one path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): wall-style arrow handles for duct fittings + segments
Add violet directional arrow affordances to duct-fitting selection (height,
move cross, rotate arc) mirroring the duct-segment rig: portaled into the
parent frame to stay out of the selection outline, rendered via the shared
HandleArrow, and carrying mated-run connectivity through the single-undo
dance. The move cross engages press-drag-release (placementDragMode) the same
way the floating drag does, so the markup hit-areas go inert and the fitting
move tool commits on pointer-up.
Also re-export the HandleArrow primitives from @pascal-app/editor and extend
the duct-segment side-move/floorplan affordances.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): click-to-latch cube handles for duct + fitting editing
Replace the hover-reveal / multi-handle selection rigs with a single
click-to-latch cube that opens a directional cluster, shared between
duct segments and fittings via a new selection-handles module
(HandleCube / MoveChevron / RotateArc, all sized to the roof pitch cube).
- Duct segment: per-vertex + run-center cubes reveal axis-locked move
chevrons (down arrow always shown), plus a roll arc at the run center.
- Duct fitting: center cube reveals six ±XYZ move arrows and three
per-axis rotation arcs (oriented in place), replacing the old
height/move/rotate trio with axis-cycling.
- Rotation (fitting arcs + duct roll) snaps to 45° steps; Shift = smooth.
- thin chevron profile + press-drag-release commit retained.
* fix(mep): orient duct roll arc consistently + drop Ctrl-vertical drag
Build a fully-determined basis for the duct roll gizmo so the curved
arrow always seats at the top-outer 45° corner regardless of run
direction, instead of an arbitrary apex from a single setFromUnitVectors.
The selection-rig ±Y arrows now own vertical movement, so the redundant
Ctrl-modifier riser drag is removed from the fitting move tool.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): run-aligned duct handles, swing snapping, elbow flatten
Align the duct run-center cube + horizontal arrows to the run axis
(matching the per-vertex handles) while keeping whole-run translate.
Endpoint side / up-down swing arrows now follow grid snap points and
port-snap onto nearby collars (Shift sweeps smoothly). Relax elbow
realign + fitting schemas to flatten to a straight 0° coupling. Surface
HVAC-specific hints in the select-mode helper panel for duct / fitting.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): per-segment linesets/liquid-lines with joint-follow editing
Linesets and liquid lines now commit one independent two-point node per
drawn segment instead of folding into a single mitered polyline, so each
line selects and deletes on its own. Endpoint caps fill shared-coordinate
joints so connected segments still read as continuous pipe.
Dragging a shared endpoint carries mated segments along via port
connectivity (Alt detaches), so a run still edits as one welded piece.
Liquid-line follow mode traces the whole connected lineset run, laying a
per-segment parallel line down its full assembled length.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(mep): vertical-offset auto-routing on duct center-cube ±Y drag
Lifting/lowering a connected run with the run-center cube now keeps each
connected end welded to its stationary partner instead of dragging the
whole network. Run-to-run ends get the classic S/Z offset (two elbows +
plumb riser, partner trimmed back one leg); elbow-connected ends form a
clean L — the existing elbow stays put and re-aims its collar vertical,
with one new top elbow + riser reconnecting to the lifted endpoint. The
offset is ghosted live and minted as a single undo step on release.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Add roof accessory placement guides
Measure roof accessory placement against the active roof face using visible surface bounds and preview geometry footprints. Add dormer-local guides and special linear handling for ridge vents and gutters.
* Improve duct and placement routing
* Fix duct vertical movement routing
* Fix duct vertical offsets and roof accessory movement
* Add DWV movement parity and line endpoint controls
* Fix MEP handle review issues
* Fix chimney placement and duct offset cleanup
* Use snapped targets for roof accessory commits
* fix(nodes): repair MEP movement review issues
- auto-fitting: tee branch now follows the drawn lateral angle; update the
stale square-tee test + doc comment that contradicted the rewrite
- duct-segment: re-enable the vertical auto-offset rewind (the disabled stub
left mintedIds empty, so re-dragging a tagged duct stranded old elbows/risers
and stacked duplicates); remove the dead stub
- duct-segment: strip the stale auto-offset tag on manual corner/roll commits
so the horizontal-move path no longer trusts an out-of-date base
- chimney: resume history before mutating segment children arrays so a
cross-segment move reparents in one tracked transaction (undo stays consistent)
- dormer: align schema test with the new windowSill=false default
* fix: address mep movement review issues
* fix: address follow-up mep review comments
* fix: address additional mep review comments
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: pascal-open-bot <open@pascal.app>
The editor's /icons assets were ~10MB of oversized PNGs (a single
toolbar icon up to 1.4MB). Convert every non-PWA icon to WebP (quality
92) and repoint all /icons/*.png references to .webp across
packages/editor, packages/nodes, and apps/editor. PWA/platform icons
(apple-touch-icon, icon-192, icon-512) stay PNG.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- core: fix layer violation in level-height.ts — extract sceneRegistry
import, replace with optional WallBaseYResolver callback so core stays
pure (no Three.js mesh state); viewer callers pass resolver, headless
callers (MCP/tests) get deterministic node-data-only result
- core: generalise port-connectivity service from duct-only to all
distribution families — match partners by distributionRole ('run' →
endpoint stretch, 'fitting' → rigid follow) instead of hard-coded
duct-segment/duct-fitting type names; add system-compat guard so
cross-system ports (e.g. supply duct vs waste pipe) don't fuse
- editor: fix port-snap rotation bug in move tool — pass preview node
at live rotation into resolvePortSnap so own-port positions reflect
any mid-drag R/T rotation before computing the snap delta
- editor: wire pipe-trap into UI — add to StructureTool union,
MepToolKind, MEP_ITEMS Build-tab tile, and structure-tools action menu
- test: add port-connectivity-pipe.test.ts — 2 tests covering
pipe-fitting → pipe-segment endpoint drag and cross-system isolation
- test: fix stale pipe-auto-fitting.test.ts wye expectation — author
deliberately chose square sanitary-tee for DWV side-taps (documented
in PR description and PipeFittingNode schema); update the one test
that still expected wye to match the implemented behaviour
- nit: fix optional-chain biome warning in validate-dwv.ts
Dual review pass (Claude multi-angle + Codex release-quality). One
correctness fix and the agreed do-now cleanups:
- fix: clone-scene-graph remaps roofSegmentId like wallId in both
clone paths — duplicated scenes/levels kept pointing roof-hosted
children at the original segments.
- extract the settled, stateless roof target/cursor math shared by the
four door/window tools into shared/roof-wall-opening-placement.ts
(resolveRoofWallOpeningTarget + getRoofWallOpeningCursorPose +
worldToSelectedBuildingLocal); tools keep the stateful lifecycle
(drafts, undo/temporal, commit field lists). −199 net lines.
- rename host-generic state: currentWallId→currentHostId,
markWallDirty→markHostDirty (they hold segment ids too); capability
cascadesViaHostSegment→dirtyHandledByOwnSystem (behavior-facing,
before the public API hardens).
- drop getRoofAccessoryKinds from core's public API — its only caller
was the standalone Build tab, which now enumerates the registry
inline with its app-specific filter.
- window move-tool uses the shared stripPlacementMetadataFlags; stale
"segment-local" comment fixed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Openings now host on the walls a roof segment generates — the base
walls under the roof and the coplanar gable/shed/gambrel end faces, so
a window can sit in a gable pediment.
- core: roof-segment-walls.ts models the four vertical faces as 2D
frames (u along face, v height) with convex profile polygons that
mirror the wall volume getRoofSegmentBrushes builds; rect-in-profile
clamping and anchored resize limits via half-plane algebra.
- schemas: optional roofSegmentId on door/window; position is the
segment-local wall mid-plane center, rotation[1] the face yaw.
- cut: reuses capabilities.roofAccessory.buildCut; new cutScope: 'wall'
subtracts from the wall brush only. cascadesViaHostSegment keeps the
roof-merge loop from consuming door/window dirty marks (their own
systems cascade via parentId).
- tools: roof:* handlers in door/window tool + move-tool (the Build-tab
preset path), with roofSegmentId cleared/restored across every
roof<->wall re-anchor and revert; shared hit resolver normalizes
normals through world space (merged mesh vs painted segment frames).
- fix: RoofSystem no longer rebuilds per-segment CSG in accessory-reveal
mode — the uncut rebuild used to draw over the merged shell's fresh
opening until deselect.
- fix: the walkthrough collider world now prunes by renderer-effective
visibility; stale uncut segment CSG inside the hidden segments-wrapper
blocked the player at openings the merged shell had cut through.
Known gap: painted segments render per-segment CSG without accessory
cuts (pre-existing, also affects skylight/dormer). Twice Codex-reviewed;
details in private-editor plans/editor-roof-wall-openings.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- registry: getRoofAccessoryKinds() enumerates kinds declaring the
roofAccessory capability, in deterministic builtin-list order (mirrors
getSelectableKinds); exported from the registry barrel.
- apps/editor build-tab: a "Features" group under the Roof tile, discovered
from the registry (no DB) and activating each kind's roof-attach tool —
parity with the community editor's roof features.
- site-boundary-editor: hide the flag handle group around thumbnail captures
(they render on SCENE_LAYER so the thumbnail camera can't layer-filter them),
matching handle-arrow.tsx — keeps flags out of preset/snapshot thumbnails.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Add roof surface placement support for items
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.
- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fixed conflict
* editor: per-door-type floor-plan symbols
Render a distinct, static plan symbol for each door type in the
registry floor-plan builder (`packages/nodes/src/door/floorplan.ts`),
independent of the door's live open/close animation:
- single / hinged: fixed 90° swing with a dashed quarter-circle arc
- double / french: two mirrored half-width leaves + dashed arcs
- folding / bifold: static zigzag accordion (~80% span) on the wall face
- sliding: bypass — two overlapping panels on parallel tracks + arrow
- pocket: thin white leaf, ~60% closed, sliding into the solid wall
- barn: surface-mounted panel parked over the wall, dashed closed-ghost
+ slide arrow
The swing arc is dashed in screen-pixel units (the renderer uses
non-scaling-stroke). Symbols are oriented by hingesSide / swingDirection
/ slideDirection as appropriate.
Also includes pre-existing working-tree changes unrelated to the door
symbols: group move/rotate transform and box-select tweaks, and a
regenerated ifc-converter next-env.d.ts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Fix recessed ceiling fixtures and draw safety
* feat(editor): magnetic wall-snap with per-kind beacon (2D + 3D)
Snap the wall draft / endpoint-move point onto existing wall geometry —
corners, midpoints, wall–wall intersections, and along-wall edges — and
show a beacon at the snap point whose glyph encodes what it caught
(square = corner, triangle = midpoint, ✕ = intersection, circle = edge).
- Pure snap geometry extracted to wall-snap-geometry.ts (unit-tested).
- Ephemeral useWallSnapIndicator store drives a 3D pillar+glyph beacon
and a 2D SVG glyph beacon, both indigo to match the alignment guides.
- Gated by a new persisted "Magnetic snap" toggle in the Display menu
(useEditor); honored by draw + commit + endpoint-move in both views.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* editor: garage and open-doorway floor-plan symbols
Extend the per-door-type plan symbols in the registry floor-plan
builder (packages/nodes/src/door/floorplan.ts):
- open doorway (openingKind === 'opening'): bare gap, no leaf/arc/panel
(mirrors the 3D system, which renders only the cutout for openings)
- garage sectional: closed leaf + side tracks into the garage + dashed
parked ghost at the inner end
- garage roll-up: closed leaf + coil barrel (capsule) with a coil hint
- garage tilt-up: closed leaf + dashed parked panel + dashed curved
up-and-over swing path
- gate the swing arc to actual swing doors (hinged/double/french) so
other types fall back to the plain footprint
Garage mechanisms sit on the interior (door-local -z) side to match the
3D garage builders, independent of swingDirection.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* arch: enforce layer boundaries — registry dispatch, store relocation, shared helper
Three architectural fixes to bring the branch into full compliance:
1. **ceiling-system kind check → CeilingCutCapability**
Replace `child.type === 'item'` branch in `ceiling-system` with registry
dispatch. Add `CeilingCutCapability` type to `packages/core` registry types,
implement `buildCeilingHole` on `itemDefinition`, and rewrite
`collectRecessedItemHoles` → `collectCeilingHoles` to dispatch through
`nodeRegistry` — viewer never again inspects a node's kind directly.
2. **useAlignmentGuides + useWallSnapIndicator → packages/editor**
These stores are editor-only UI (snap beacons, alignment guides). Move them
from `packages/core/src/store/` to `packages/editor/src/store/`, re-export
from `packages/editor`, and update all 34 consumer files across
`packages/editor` and `packages/nodes` to import from `@pascal-app/editor`.
3. **findLevelAncestorId extracted to core**
`item-light-system` had a private `resolveNodeLevelId` that duplicated
level-ancestor traversal logic. Extract it as `findLevelAncestorId` in
`packages/core` (spatial-grid-sync), export it, and replace the local copy.
All four packages typecheck cleanly (zero errors).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: fix lint, untrack .claude/launch.json
Run bun check --write to clear 8 Biome errors (formatting + import order
+ one unused import). Untrack .claude/launch.json and add it plus
.claude/settings.local.json to .gitignore so local IDE/agent configs
stop landing in commits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* wip sfx
* wip audios
* feat(editor): structure build-start/end cues + menu hover/click SFX
Sound design pass for the build/items experience:
- Split structure-build into a start cue (draft begins) and end cue
(commit). Wall/fence fire start on the first click; slab/ceiling/zone
tick start on every non-closing vertex; roof on the first corner.
- Doors and windows now use the structure-end cue on place + move;
shelves use item-place instead.
- New menu_hover (round-robin retired in favour of a single sample) and
menu_click cues wired to the Build/Items main categories, item-catalog
tiles, the icon rail / tab bar, and the bottom action menu (via the
shared ActionButton).
- Refresh item_pick / item_place / item_rotate samples; drop the
now-unused numbered menu_hover variations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(editor): silence forEach return lint in updateSFXVolumes
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(editor): convert SFX wavs to mp3 to shrink assets
Re-encode all SFX samples as 128kbps mp3 (~94% smaller, transparent for
short UI cues) and point the player at the .mp3 sources. Drops the .wav
originals; the freshly converted item_pick/place/rotate.mp3 override the
older committed mp3s.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* Add roof surface placement support for items
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.
- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fixed conflict
* feat(editor): 3D alignment guides for item/wall/fence move + placement
Bring Figma-style alignment guides into the 3D editor, reusing the shared
pure resolver (`resolveAlignment`) and ephemeral guide store
(`useAlignmentGuides`) that previously only drove the 2D floor plan.
Core:
- `alignment-anchors.ts`: node→anchor adapters (footprint AABBs, corner
anchors, wall/fence segment anchors) + `refineGuidesToGap` so a guide's
line and distance read to the candidate's nearest edge, not the far side.
- `bboxCornerAnchors` + corner-only footprint anchors so alignment locks to
item edges, never centrelines.
- `resolvePointSnap` (point-coincidence variant; kept for future use).
Editor:
- `Alignment3DGuideLayer`: dashed ribbon + flat floor dots + distance pill,
in the project's indigo accent, mounted inside ToolManager's building-local
group so guides render in the cursor's frame.
- Producers wired in the item move tool, item placement coordinator, and the
wall + fence endpoint tools; walls and fences cross-align.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): align guides snap to nearest real anchor, drop bbox re-span
The 3D alignment guide could place its end dot in empty space: a diagonal
wall (or any rotated / non-rectangular object) has bounding-box corners that
don't lie on the object, and `refineGuidesToGap` re-spanned the guide to
exactly those AABB edges — so the dot floated "along the coordinate" rather
than on the item.
- `resolveAlignment` now tie-breaks to the candidate anchor NEAREST on the
perpendicular axis (after the tightest axis match). Anchors are real points
(corners / endpoints / midpoints), so the guide always connects to the
closest actual point — which also yields the facing-edge gap distance.
- All four producers (item move, item placement, wall + fence endpoints) now
publish the raw resolver guides; the AABB nearest-edge re-span is gone.
- Removed the now-dead `refineGuidesToGap` and `resolvePointSnap` helpers
(and their tests / exports).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): group move handle + shared group-transform core, move-tool polish
Add a group-move gizmo alongside the existing group-rotate handle, both
driven by a new shared `group-transform-shared` module (participant
classification, group-box + corner math, connected wall/fence component
expansion so attached structure transforms rigidly as one piece).
- core: refactor alignment-anchors collection + tests, extend handle registry
- editor: group-move-handle, group-transform-shared; rotate handle reuses them;
node-arrow-handles gains click-swallow guard; box-select + placement tweaks
- nodes: move-tool updates across ceiling/column/slab/roof/registry; door math
and panel adjustments; item definition cleanup
- nodes(fence): play `sfx:grid-snap` ticker on endpoint move, matching the
wall endpoint tool (fixes missing audio feedback on fence side drag)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): keep autosave alive across page unload
The autosave debounces writes by 1s and relies on a `beforeunload` flush
for anything still pending. That flush fired a plain `fetch` PUT, which
the browser cancels the instant the page unloads — so refreshing right
after an edit (e.g. painting a roof material) silently dropped the change
and the reload showed the last persisted scene.
Thread a `{ keepalive }` option through the save callback and set it on
the unload flush so the request survives the unload. Also listen for
`pagehide` (fires where `beforeunload` does not, e.g. mobile Safari /
bfcache) and clear the dirty flag up front so the two listeners don't
double-send. Normal debounced saves omit `keepalive` (its 64KB body cap
only constrains the best-effort unload flush, not regular saves).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): paint eraser + reset-all, drop roof cross-role bleed
Material paint gains an eraser (clear a surface back to its default) and a
"Reset all" action that defaults every painted surface on a node — for a
roof that includes each child segment — via a generic
`buildResetSurfaceMaterialUpdates` that nulls catch-all and role-specific
material fields without per-kind knowledge.
Also stop a single painted roof surface from bleeding onto the others:
`getEffectiveRoofSurfaceMaterial`, `getRoofMaterialArray`, and the segment
renderer no longer cross-fall-back between top/edge/wall. An unset role
resolves only to the legacy catch-all (back-compat) or the theme default,
so painting just the shingle, trim, or soffit stays on that surface.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): alignment guides + drag bounding box across tools
Extend the Figma-style 3D alignment guides to the placement and move
tools for columns, elevators, roofs, stairs, ceilings, slabs, fences,
walls, doors, and windows: each collects alignment anchors from the
scene, resolves a snap within the shared threshold, and drives the
`useAlignmentGuides` overlay. Wall openings (doors/windows) only snap
along their host wall via the new `wall-opening-alignment` helper.
Add a shared `DragBoundingBox` overlay (exported from the editor barrel)
that renders the dragged object's bounds during a move, wired into the
column move tool alongside the alignment snap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): axis-stable resize-arrow drag plane + slimmer gizmo handles
Build the linear resize-arrow's drag plane so it always contains the
handle's axis (view direction minus its along-axis component) instead of
a plane that merely faces the camera. The old camera-facing normal
collapsed when the axis pointed toward the viewer — screen motion barely
changed the axis component, so the resize crawled or stopped tracking the
cursor. Also slim the extruded arrow/handle geometry (shared by the node
arrows, wall side handles, and polygon editor) for a lighter gizmo.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): fill-block wall opening highlight + selected frameless openings
Draw the selected-wall opening highlight as a translucent block filling
the cutout volume (front-side culled) instead of a single vertical pane,
so it reads as an occupied slot from any angle — including a top-down
floorplan view where an edge-on pane was invisible. Also highlight a
directly-selected frameless opening (a `door` with openingKind
`'opening'`), which otherwise renders no geometry of its own, and reflect
live drag overrides via `useLiveNodeOverrides`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(viewer): double-side slab hole side-walls
Build the slab in 3D rather than via ExtrudeGeometry so each hole-wall
quad is emitted twice with opposite winding. The slab material is forced
to FrontSide (DoubleSide poisons the MRT scene pass), under which
ExtrudeGeometry's single-sided hole walls get back-face culled and you
see straight through the cut. The doubled quads keep the cut's inner
thickness visible from any angle without z-fighting.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): box-select building-scoped nodes like elevators
Building-scoped selectable nodes (e.g. elevators) are children of the
building, not the active level, so the level walk never reached them.
Also walk the level's building children and box-test any registry-
selectable kind by its rendered bounds, matching the column/stair/shelf
path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): shelf placement alignment + column placement ghost
Shelf placement now snaps to Figma-style alignment guides by its
footprint edges (layered on grid snap, Alt bypasses), matching the
existing 3D move tool. Guides refresh after each drop and clear on
teardown.
Column placement migrates to the registry `def.tool` path so it can
render a translucent column ghost at the cursor (like the shelf build
tool) instead of a bare cursor sphere — the editor package can't import
the column geometry, so the tool now lives in packages/nodes:
- extract `ColumnBody` from the renderer and add a `ColumnPreview`
(cloned translucent material, raycast disabled, origin-positioned)
- new `column/tool.tsx` registry placement tool with the same
footprint-edge alignment as shelf / column move
- wire `def.tool` + tool hints; drop the now-unreachable legacy
editor-side `ColumnTool` and its dead file
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): floor-plan alignment, pivot moves & placement ghosts
Bring the 3D editor's Figma-style alignment experience to the 2D floor
plan across every node kind, fix pivot semantics on move, and add 2D
placement ghosts.
Alignment
- Wall anchors now include ±thickness/2 face corners so columns/items/etc.
snap flush to wall faces (fixes pillar↔wall); shared by 2D and 3D.
- Shared apply-alignment helper (applyFloorplanAlignment /
alignFloorplanDraftPoint, with excludeIds) used by move sessions,
structural drafting (wall/fence/slab/zone/ceiling/roof), and wall/fence
endpoint drags.
- Door/window/wall-item moves get along-wall edge-to-edge snapping.
- Generic free-translate move path aligns by edges (corner anchors).
Pivot moves (2D)
- Polygon kinds (slab/ceiling/zone) move by centroid→cursor via a shared
polygon-centroid mover; stair moves by origin→cursor; matching 3D.
- Shelf/column move targets write position directly (single source of
truth) so the 3D group no longer sticks on commit.
Placement ghosts (2D)
- usePlacementPreview store + FloorplanPlacementPreviewLayer render a
kind's def.floorplan footprint following the cursor; wired for column
and elevator.
Fixes
- Elevator placement no longer deselects the active floor plan
(preserve levelId through setSelection's hierarchy guard).
- Guides clear on every commit/cancel/unmount path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(editor): address architecture review for floor-plan work
- Move usePlacementPreview store from core to editor: placement ghosts
are an editor/tool concern the read-only viewer never needs. Rewire the
column tool (via the @pascal-app/editor public surface) and the
editor-internal elevator tool + preview layer (relative imports).
- FloorplanPlacementPreviewLayer: read scene lazily in ctx.resolve instead
of bulk-reading the nodes map during render.
- wiki/architecture/tools.md: refresh the stale useLiveTransforms-per-kind
note to reflect item/shelf/column (world-plan) + slab/ceiling/zone (delta).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(nodes): recreate window draft on wall:move when null after placement
After a successful click-to-place, the click handler deletes the
transient draft and relies on the wall-rebuild → R3F pointer-enter
cascade to create a fresh draft for the next placement. If that cascade
doesn't fire synchronously (e.g. async geometry rebuild) the next
wall:move receives a null draftRef and bails — requiring leave/re-enter
to place again.
Fix: in onWallMove, when draftRef.current is null but we're hovering a
valid wall, recreate the draft immediately (same WindowNode.parse +
createNode path as onWallEnter). This is idempotent: if wall:enter does
fire first, destroyDraft() in onWallEnter cleans up cleanly.
Preserves parity with door multi-place behaviour, matching #367's intent.
* fix(nodes): recreate door draft on wall:move when null after placement
Mirror of the window fix one commit back: after click-to-place the
DoorTool deletes its transient draft and relies on the wall-rebuild \u2192
R3F pointer-enter cascade to spawn a fresh draft for the next placement.
When that cascade doesn't fire synchronously, the next wall:move sees a
null draftRef and bails \u2014 forcing a leave/re-enter to place again.
Recreate the draft in onWallMove when null and over a valid wall on the
current level. Idempotent with onWallEnter (destroyDraft cleans up if
both fire).
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Pascal <open@pascal.app>
Replace the seven separate display-control buttons in the canvas toolbar
(render, theme, edges, grid, shadows, units, camera) with a single
"Display" dropdown, matching the simplification already shipped in the
hosted editor. Grid, shadows, camera and units are direct toggles that
keep the menu open; render, edges and theme are submenus.
Portal DropdownMenuSubContent so the side-opening submenus escape the
parent content's overflow-x-hidden clip, and re-export the submenu
primitives (Sub/SubTrigger/SubContent/Separator) from @pascal-app/editor.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(nodes,viewer): window preset live wall preview + shaped-cutout move tracking
MoveWindowTool marked the moving window `isTransient` unconditionally, but
WindowSystem only rebuilds the host wall's cutout for non-transient windows —
so a window *preset* (isNew) showed no live hole on the wall and couldn't be
placed consecutively without leaving/re-entering. Guard the transient mark on
`!isNew`, matching MoveDoorTool.
Separately, shaped openings (arch / rounded / `opening`) rebuild their cutout
brush from `node.position`, which a same-wall move doesn't write (it mutates the
mesh directly and publishes to `useLiveTransforms`). The wall-system's
`getEffectiveNode` only merges `useLiveNodeOverrides` (resize arrows), so shaped
cutouts lagged the move while rectangular ones (rebuilt from the live mesh
matrixWorld) tracked. Fold `useLiveTransforms` into door/window children before
collecting cutouts so shaped holes follow the live move too.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(editor,viewer,nodes): smooth item placement on shelves
Three issues made hosting an item on a shelf janky (item-on-item was already
smooth because plain items have no `def.geometry` to rebuild):
- Jitter: the draft mesh intercepted the cursor ray, so the shelf-row hit was
re-derived from the moving item each frame. Disable raycasting on the draft
during placement (incl. async GLB children, reconciled per frame) so the ray
passes through to the surface beneath — mirrors MoveRegistryNodeTool.
- Reparent/vanish at the edges: `onShelfLeave` flipped state to floor without
reparenting the draft off the shelf, so the floor strategy's level-local
position rendered compounded with the shelf transform. The grid handler now
owns the shelf→floor transition.
- In/out oscillation: reparenting the draft onto the shelf dirtied the shelf,
and GeometrySystem disposed+rebuilt its boards, making r3f fire a spurious
shelf:leave→enter that thrashed placement between the row and the floor. Add
an opt-in `def.geometryKey` so GeometrySystem skips the rebuild when geometry
inputs are unchanged (shelf boards don't depend on hosted children). Keep the
item sticky by testing the cursor ray against the shelf's bounding box: a ray
that slips through a gap and lands on the floor behind the shelf still counts
as "on the shelf"; only a ray that misses the shelf detaches to the floor.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(editor-app): add Shelf to the standalone editor Build tab
The shelf kind is fully wired (def.tool, presentation icon, StructureTool id)
but was absent from the standalone editor's Build palette. Add it between
Column and Spawn Point. Community has its own build-tab and is left untouched.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(mcp): biome-format coordinate-conventions-demo.json
The committed example violated Biome formatting (expanded polygon arrays),
which broke the `mcp-ci` Biome check on main (#356) and every branch since.
Format it so CI is green. Pure formatting — no content change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Bring the open-source standalone editor closer to the community editor's
v2 sidebar without pulling in any preset/catalog infrastructure.
- Add a preset-less Build tab (apps/editor) that mirrors the community
Build sidebar: wall, fence, slab, ceiling, roof, stair, elevator,
door, window, column, spawn, plus the material-paint panel. Clicking a
type activates the raw structure tool drawn with the kind's defaults.
- Wire the Build tab into both editor mount points (local + saved scene)
and give the left rail proper image icons (Scene/Build/Items/Settings)
instead of letter fallbacks.
- Gate the ItemsPanel Library/Community/Mine source chips and tag filter
rows behind `showSourceFilter` / `showTagFilters` props (default true,
so community and external consumers are unchanged). The standalone
editor passes both off, leaving plain category tabs + full-width search.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* viewer: add Phase 1 render-modes foundation (shading/textures/colorPreset state, defaultRender prop, SSGI gating)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 2 render-modes material-class switch (Lambert in solid, Standard in rendered)
Shading-aware material factories (cached per class), reactive selection in
renderers via the useViewer(shading) pattern, and dirty-rebuild on toggle for
geometry/door systems. Rendered mode output unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 3a render-modes surface roles + clay palette foundation
Adds surfaceRole token to core NodeDefinition, per-kind default roles,
ColorPreset palettes + resolveSurfaceColor/createSurfaceRoleMaterial (glazing
stays translucent), and the textures-off recolor path for def.geometry kinds
(slab/fence/shelf via GeometrySystem.applyDefaultSurfaceRole) + wall. Renderer-
based kinds (roof/window/stair/item/column/door/ceiling/elevator) wired in 3b.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 3b render-modes textures-off recoloring for renderer/system kinds
Wires clay role coloring (textures=off) for roof/roof-segment, window, stair/
stair-segment, door, item, column, ceiling, elevator via createSurfaceRoleMaterial,
reactive on textures/colorPreset. Per-surface roles: roof top+edge=roof /
underside=ceiling; window frame=joinery / glass=glazing; stair+door+elevator=
joinery; ceiling=ceiling; column=wall; item=furnishing. textures=on unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 4a render-modes UI — Solid/Rendered toggle + per-context persistence
Per-context shading via renderContext discriminator + shadingByContext (persisted);
<Viewer> renderContext prop seeds per-context on mount. Solid/Rendered toggle in the
editor action bar + standalone toolbar + command palette. Editor mounts default to
renderContext=editor / shading=solid.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: fix window-system glassMaterial type to allow clay glazing reassignment
The let was inferred as MeshLambertNodeMaterial from the imported glass constant,
so reassigning createSurfaceRoleMaterial('glazing') (returns THREE.Material) failed
under tsc --build. Widen the annotation to THREE.Material. Surfaced by the build
(check-types had replayed a stale turbo cache).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 5 lighting — add theme-driven hemisphere light, trim fill directionals 3->2
Adds a sky/ground hemisphere fill (theme-lerped) and drops the second fill
directional; the hemisphere covers the shadow-side fill it provided, at one
fewer per-fragment directional term (shared by Solid + Rendered). Ambient lowered
since the hemisphere now carries soft fill. Intensities are a starting point —
tune visually on the gpu-perf overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: tune Solid lighting for more form — stronger hemisphere sky/ground contrast, lower ambient
Darker hemisphere ground (#d8d6cf -> #aaa49a) + higher hemisphere intensity and
lower ambient so directional shading reads as form and undersides ground without
AO. Keeps Solid free of any post-processing pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: biome format render-mode files (lefthook pre-commit)
Formatting-only — import wrapping, dep-array wrapping, single-line ternaries —
across Phase 2-4a files that weren't biome-clean. No logic changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: scene-theme system — named environment themes (studio/paper/sunset/night/...)
New SceneTheme registry (lib/scene-themes.ts) drives lights, background, and tone
mapping; lights.tsx refactored data-driven (N directionals + hemisphere + ambient).
sceneTheme state (persisted) + cycle-button picker in editor bar + standalone
toolbar, importing the registry from the viewer barrel (single source). Default
'studio' reproduces the prior look exactly; app light/dark 'theme' untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 7 — popover-dropdown pickers for render mode + scene theme (editor bar)
Replace the shading + scene-theme cycle buttons in viewer-overlay.tsx with
DropdownMenu pickers: render mode shows 2 rows (Solid/Rendered) with one-line
detail; scene theme lists all themes with a derived color-swatch strip + active
check. Imports the registry from the viewer barrel (single source).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 7 — dropdown pickers in standalone toolbar + export DropdownMenu from barrel
Replicate the render-mode + scene-theme dropdown pickers (with swatch strip +
active check) to apps/editor's compact toolbar, matching viewer-overlay.tsx.
Export DropdownMenu* from the @pascal-app/editor barrel for the standalone app.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer+editor: Phase 8 — crisp geometry edge overlay (off/soft/strong/sketchy)
EdgeOverlaySystem draws EdgesGeometry LineSegments over node-backed building
meshes (scoped via sceneRegistry, skips zone-layer/hitbox/overlay meshes),
rebuilt on geometry-uuid or mode change, line color follows scene-theme
background luminance; sketchy = static TSL vertex jitter. New 'edges' state
(persisted, default off) + Edges dropdown in editor bar + standalone toolbar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer+editor: edge overlay — thick lines via Line2, drop sketchy mode
Switch EdgeOverlaySystem from LineBasicNodeMaterial (1px hardware cap) to
LineSegments2 + Line2NodeMaterial so edges have real screen-space width
(soft 1.5px / strong 3px); resolution tracks viewport. EdgeMode is now
off/soft/strong (sketchy removed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: fix edge overlay crash — webgpu Line2NodeMaterial has no settable resolution
material.resolution is undefined under WebGPU (the node material reads the
viewport internally); optional-chain the .set() call so it no-ops there instead
of throwing. Thickness still applies via linewidth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: edge overlay — weld vertices to fix CSG spiderweb edges + lighter strong
Position-only mergeVertices before EdgesGeometry so coplanar triangles from
CSG-cut walls (doors/windows) share vertices and their interior edges are
suppressed — only opening outlines + silhouettes remain. Strong linewidth
3 -> 2px (was too heavy).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: edge overlay — crease-only extractor to fix CSG spiderweb
Replace EdgesGeometry (which always draws unpaired boundary/T-junction edges)
with buildCreaseEdges: weld positions, keep only edges shared by exactly two
faces whose dihedral exceeds the threshold, drop everything unpaired. CSG-cut
walls/slabs are watertight so real corners + opening outlines survive while the
interior triangulation fans (coplanar or T-junction) are removed. Open meshes
(bare ground plane, billboard leaves) shed their boundary clutter too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: crease edges — coarser weld (0.1mm->1mm) to recover CSG/extrude seam edges
The cap<->side-wall top edge of ExtrudeGeometry walls drifts past 0.1mm after
CSG, so it stayed unpaired and was dropped. Weld at ~1mm to pair it into a real
crease while staying far below feature size (wall thickness, openings).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: replace geometry edge overlay with screen-space ink (SketchUp look)
Port the prototype's screen-space ink into the post-processing pipeline: depth +
normal Sobel reading the scene-pass MRT. Crease term (normalized normals,
center-vs-neighbour) + distance-independent depth-step term (raw Laplacian /
(1-d)² with a noise gate so flat ground stays clean). Topology-agnostic, so it
finally handles CSG-cut walls/openings without the spiderweb or missing-edge
problems of EdgesGeometry. Driven by the existing edges off/soft/strong mode;
MRT now builds when SSGI OR ink is on; ink colour tracks scene-theme luminance.
Removes EdgeOverlaySystem + crease-edges (geometry approach).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: soft/strong ink modes + keep editor overlays out of the ink
Two adjustments to the screen-space ink pass:
1. Soft vs strong now visibly differ. The edge masks saturate, so the old
`intensity` gain did nothing once a line was detected. Replace it with a
sample radius (line thickness) + opacity: soft = 1px / 50%, strong = 2px /
100%. `inkedEdges` takes `radius` + `opacity` instead of `intensity`.
2. Editor overlays (gizmos, move handles, tool previews, grid) no longer get
inked. The scene pass that feeds the depth/normal MRT now renders only
SCENE_LAYER; overlays render in a dedicated pass on OVERLAY_LAYER and are
composited on top after the ink + outlines, so they read as crisp UI and
never get inked or AO'd.
New OVERLAY_LAYER constant in viewer; editor's EDITOR_LAYER re-exports it so
the two stay in lockstep. Also moves WallMoveSideHandles (the wall/fence move
arrows) onto EDITOR_LAYER — it was the one overlay still on SCENE_LAYER.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: render the grid in the scene pass so geometry occludes it
The depth-gate fix couldn't help the grid: its material is depthWrite:false,
so it never wrote overlay-pass depth and the "didn't write depth -> keep on
top" term forced it on top — hence the floor grid bleeding through walls and
objects.
A full-floor plane can only be occluded correctly by living in the same depth
context as the scene, so move the grid onto its own GRID_LAYER which the scene
pass renders (alongside SCENE_LAYER). It's flat and depth-non-writing, so the
screen-space ink still ignores it; gizmos/handles stay on OVERLAY_LAYER. The
grid camera layer is enabled in custom-camera-controls and disabled on the
thumbnail camera so thumbnails stay grid-free, matching EDITOR_LAYER.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: strong ink — match soft's 1px thickness, differ by darkness only
Strong at radius 2 read too thick. Soft's 1px line is the nice one, so use it
for both modes and let strong distinguish itself purely by being fully solid
(opacity 1) vs soft's lighter 50%.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: shadow frustum follows the view + a shadows on/off setting
The directional light's ortho shadow camera only covers ±50 around the light
target, which was pinned at the origin — so zones far from origin received no
shadows no matter where the camera moved. Recentre each shadow-casting light
(position + target together, preserving direction) on the view focus every
frame: the orbit-controls target when available, else the camera's ground
projection. The shadow area now tracks wherever the user looks.
Also add a persisted `shadows` toggle (default on) to the viewer store and a
"Shadows" switch in the editor settings panel — the dedicated shadows control
the render-modes plan deferred. Lights gate castShadow on it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: shadows toggle in the standalone toolbar + a touch more shadow strength
The shadows switch I added only lived in the cloud settings panel's Visibility
section, which is hidden in the local/standalone editor (no projectId). Add a
ShadowsToggle button next to the grid toggle in the standalone toolbar so it's
reachable there, matching how Show Grid is exposed in both places.
Also push shadow strength partway toward the aesthetic prototype (which runs
near-black, no blur): bump the bright-key shadow-intensity cap 0.4 -> 0.55 and
tighten shadow-radius 2 -> 1.5. Still softer than aesthetic by design.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* nodes: site ground receives shadows (lit material instead of unlit Basic)
The site ground fill used MeshBasicMaterial — unlit, so it could never show
the directional shadow, and shadows visibly truncated at the slab edge. Swap it
for a lit MeshLambertNodeMaterial with receiveShadow on the mesh; the geometry
is the site polygon (slab footprints punched out), so shadows now extend across
the whole site and stop at its boundary, which is the desired bound.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: per-theme clay palettes + 2x2 swatch in the theme pickers
Each scene theme now carries a clayTints map (wall/floor/ceiling/roof/glazing)
giving it a per-surface-role palette — e.g. Mediterranean's blue roof + warm
walls. The theme pickers (standalone toolbar + community overlay) now render the
aesthetic-style 2x2 swatch of those role tints over the theme background instead
of the old 3-colour strip.
Data + UI only; wiring the tints into the textures-off surface materials is a
separate change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: slimmer theme switcher + cloud-sun icon
Shrink the scene-theme toolbar button (w-[8.5rem] -> w-28) so it stops reserving
space for "Mediterranean"; the label truncates when it overflows. Swap the
palette icon for cloud-sun (atmosphere/lighting, distinct from the app light/dark
Sun-Moon toggle) in both the standalone toolbar and the community overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: theme switcher icon -> swatch-book
Swap the scene-theme icon from cloud-sun to swatch-book in both the standalone
toolbar and the community overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: colour untextured building surfaces by the active scene theme
Untextured walls/roof/slab/ceiling now take the active theme's per-role colour
(theme.clayTints[role], falling back to the colour preset) in BOTH textures
modes. The textures toggle only governs surfaces that actually have an explicit
material/preset — those still show their texture when textures are on. This is
what makes e.g. Mediterranean read as a blue roof + warm walls instead of the
old hardcoded white/grey defaults.
- materials.ts: resolveSurfaceColor / createSurfaceRoleMaterial take an optional
sceneThemeId (theme tint ?? preset palette); theme folded into the cache key.
- wall-materials, roof-materials, slab/geometry, ceiling/renderer: the untextured
fallback now resolves to the themed role colour instead of white/grey, in both
modes; theme threaded into each builder + material cache key.
- wall-cutout: now reads textures/colorPreset/sceneTheme and re-applies wall
materials when any change (previously it ignored textures/colorPreset entirely).
- geometry-system: threads sceneTheme into the generic surface-role path + rebuild
effect. Renderers/preview call sites thread sceneTheme through.
Doors/windows/stairs/columns/items still use their existing defaults — a
follow-up pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(slab): recessed (negative-elevation) slabs extrude downward again
The registry geometry builder created the slab mesh at Y=0 without applying the
negative-elevation offset, so recessed slabs rendered above the floor plane
(pool geometry is built locally with its floor cap at Y=0 and walls rising to
Y=|elevation|, so the mesh must be shifted down by `elevation` to recess). The
runtime slab-system already did this; the static builder path didn't. Mirror it:
shift mesh.position.y by elevation when negative. Positive elevation unchanged.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): legacy roofs render again — migration wrote invalid wallHeight 0
Legacy roof nodes (old format, no `children`) were migrated with a hardcoded
`wallHeight: 0`. With zero wall height the eave height (`wallHeight - autoDrop`)
went negative in getRoofSegmentBrushes, producing geometrically invalid brushes;
three-bvh-csg then spammed "TriangleClipper: Coplanar clip not handled" every
frame and emitted NaN positions, so the merged roof geometry failed
computeBoundingSphere and never rendered.
- core/use-scene migration: wallHeight 0 -> 0.5 (the RoofSegmentNode schema
default), so migrated segments have a valid wall height.
- roof-system: clamp eave height to >= 0.01 so an intentional wallHeight 0 can
never yield a negative eave, and guard updateMergedRoofGeometry so a CSG result
with NaN positions is discarded (keep the last good mesh, warn once per roof)
instead of poisoning the buffer + spamming the console.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(column): columns cast and receive shadows
Column meshes (box, beam, cylinder, sphere, torus) rendered without castShadow/
receiveShadow, so columns neither dropped a shadow nor caught one — unlike walls,
slabs and roofs. Set both on all column shape meshes.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: default edges to soft
Editor defaults are now solid shading / studio theme / soft edges / shadows on.
Shading (solid, via EDITOR_DEFAULT_RENDER), theme (studio) and shadows (on) were
already the defaults; edges was 'off' — make 'soft' the default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: fold light/dark into the scene theme (remove the separate toggle)
The viewer had two overlapping appearance controls: a light/dark `theme` toggle
AND scene themes (which already drive the 3D background + lights). They
conflicted — e.g. Night/Twilight are dark themes, but the light/dark toggle was
an independent axis still tinting the 2D scene chrome.
Unify on the scene theme: add an explicit `appearance: 'light' | 'dark'` to each
SceneTheme (twilight/night = dark, the rest = light) and drive everything the
old toggle drove off it — canvas backdrop, grid line colours, measurement-label/
cursor/site-edge contrast, the site ground fill, the ground occluder, and the
mobile viewer bg. The editor UI chrome is unaffected (always dark via a fixed
body class).
Removes the `theme`/`setTheme` store state (+ persistence) and every light/dark
toggle UI: the standalone toolbar Sun/Moon button, the community overlay theme
switch, the command-palette command, and the ifc-converter preview toolbar
button.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: per-theme ground colour + add the "Verdant" nature theme
- Add a `ground` colour to every SceneTheme and drive the site ground fill +
the infinite ground-occluder off it (instead of the binary
isDark ? #1f2433 : #fafafa). Dark themes now get a lit mid-tone ground
(twilight #4a4566, night #2b3247) so the ground reads as ground rather than
going near-black.
- Add a new green/nature scene theme "Verdant": soft green sky + lit, with a
green roof clay tint and mossy ground.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* wiki: document the surface-colour / theme system
The colour-per-node/renderer/system model from the render-modes work was
undocumented. Add wiki/architecture/materials-and-themes.md covering surface
roles, colour presets, the textures axis, scene themes (appearance / ground /
clay tints), and the "untextured surfaces are theme-coloured in both modes"
invariant + where each kind wires it.
Also fix two pages that the same work made stale:
- node-definitions: geometry builders receive (shading, textures, colorPreset,
sceneTheme); document the `surfaceRole` token + applyDefaultSurfaceRole.
- layers: OVERLAY_LAYER (1, viewer) with EDITOR_LAYER now its alias, the new
GRID_LAYER (3, rendered in the scene pass for depth occlusion), and the
overlay pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* nodes: wire #330 roof-accessory kinds into the surface-role/theme colours
PR #330's new kinds (chimney, dormer, skylight, solar-panel, ridge-vent,
box-vent) use custom renderers, so the generic textures-off recolour path never
reached them — they fell back to hardcoded colours. Wire each renderer into the
render-modes system: read shading/textures/colorPreset/sceneTheme and resolve
untextured surfaces via createSurfaceRoleMaterial (and force the role colour when
textures are off), matching column/ceiling.
Roles: chimney body→wall / cap→roof; dormer wall→wall, roof→roof, glass→glazing,
frame→joinery; skylight glass→glazing / frame→joinery; ridge-vent + box-vent→roof;
solar-panel frame→roof (the dark product-specific cell face is left as-is). Each
definition also gets its dominant `surfaceRole` token.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): legacy-roof migration must use a non-zero wallHeight
The render-modes/#330 merge left the legacy roof→roof-segment migration writing
`wallHeight: 0`. With #330's pitch model that builds a flat, zero-volume wall
CSG brush, which three-bvh-csg can't clip ("Coplanar clip not handled") and
yields NaN positions — so the migrated old roof never renders. Use the schema
default 0.5 (what new roofs use), giving a valid wall. The eave clamp + merged-
geometry NaN guard added earlier stay as defense-in-depth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): guard slope frame against missing/NaN pitch (no more NaN geometry)
getSegmentSlopeFrame used `pitch <= 0` to detect flat/zero-pitch, but an
undefined or NaN pitch (a segment from an older migration that set `roofHeight`
instead of `pitch`, or stale persisted data) slips past that check and computes
Math.tan(NaN) → NaN tanTheta/activeRh → NaN segment geometry → the merged-roof
CSG spews "Coplanar clip not handled" and NaN positions, so the roof never
renders. Use `!(pitch > 0)` so any non-positive/non-finite pitch resolves to the
flat frame. Self-heals bad data regardless of how the segment was produced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): migration guarantees a positive pitch for every roof-segment
Segments saved with neither a valid pitch nor a roofHeight (older/partial
saves, e.g. landing home-graph) fell through the legacy roofHeight->pitch
branch, leaving pitch undefined. The slope-frame guard then resolved them
to a flat frame, so the roof rendered as a slab instead of pitched. Branch
2b now normalises any segment lacking a valid pitch: derive from roofHeight
when present, else fall back to the schema default (40deg). The migration
result is cast (not zod-parsed), so this is the only place the default lands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The standalone editor app loaded `lib/bootstrap.ts` as a side-effect
import only from `components/scene-loader.tsx`. That worked for the
`/edit/[sceneId]` route but left every other page (homepage, settings,
viewer-only routes) hitting `<Viewer>` with an empty client-side
registry — node materials resolved to `null` and React surfaced a
`<html>`-level hydration mismatch on first paint.
Fix mirrors the community-app side that landed in pascalorg/private-
editor#27:
- New `app/client-bootstrap.tsx` — thin client wrapper that imports
`../lib/bootstrap` and renders children.
- `app/layout.tsx` mounts `<ClientBootstrap>` around `{children}` so
every page in the standalone editor gets the registry populated
before its first `<Viewer>` / `<Editor>` mounts.
- `lib/bootstrap.ts` switched to **synchronous** built-in registration
via `registerNode(def)` per kind instead of `await loadPlugin(...)`.
The previous async kick-off only resolved in a microtask, letting
the first SSR / hydration pass see an empty registry. External
plugin discovery (`discoverPlugins()`) stays async and runs via its
own `loadExternalPlugins()` path, gated by `externalsKickedOff` so
HMR doesn't re-fetch.
- `components/scene-loader.tsx` drops the per-page side-effect import
— the root provider handles it now.
`bun.lock` syncs `@pascal-app/editor` into `@pascal-app/nodes`'s
peerDependencies + devDependencies (already declared in
`packages/nodes/package.json`; only the lockfile lagged).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds apps/editor/lib/bootstrap.ts that calls loadPlugin(builtinPlugin)
as a module-side-effect on first import. Imported from scene-loader.tsx
so it runs on the client side where the editor mounts.
Idempotency guard handles HMR re-execution (would otherwise throw on
duplicate registerNode). For the empty plugin this commit, the entire
call is a no-op — included now so future commits that add real node
kinds only need to push them onto builtinPlugin.nodes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Preview button next to Radio Pascal that switches the editor
into a viewer-like experience without leaving the page. The preview
mode swaps in the viewer's selection manager (hierarchical drill-down),
zone system, camera controls (left-click pan, auto-navigate), and
interactive item system while hiding editor-only UI (tools, panels,
sidebar, grid). Back arrow in the viewer overlay returns to the editor.
Also widens the default sidebar from 288px to 432px for better
project title visibility.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: harden viewer/editor renderer init and error handling
* Bump @biomejs/biome and turbo versions
Update devDependencies: bump @biomejs/biome from ^2.4.4 to ^2.4.6 and turbo from ^2.8.12 to ^2.8.13. Regenerated bun.lock to reflect the updated resolved package versions.
* Restore inline zone label editing on canvas