Repository navigation
Conversation
This branch has not been deployed
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.
What does this PR do?
Adds deterministic ground slope and elevation controls to the existing terrain heightfield (
site.terrain) with zero schema changes, complementing the existingraise,lower,flatten, andsmoothsculpting verbs.@pascal-app/core): Addspackages/core/src/lib/terrain-slope.tswithclampTerrainSlopePitch(0..45°),normalizeTerrainSlopeDirection(0° = +X,90° = +Z),terrainSlopeGradePercent,compileTerrainSlopePlane(hoisting trig out of per-sample loops),resolveLotSlopePlane(centerdatum anchor matching USGS DEM imports orlow-edgeanchor),terrainSlopeBaseElevationForPlane,terrainSlopeElevationRange,deriveTerrainSlopeFromPoints, andbuildSlopedTerrainField.slopebrush verb (@pascal-app/core): ExtendsTerrainVerbinpackages/core/src/lib/terrain-brush.tswith'slope'using the same saturating snapshot-and-falloff kernel (re-crossing strokes never compound). ExportsBaseTerrainVerbsouseEditor.terrainVerbstays narrowed to the four original verbs for full type and runtime compatibility with@webxr/plugin, while editor consumers readselectActiveTerrainVerbandsetActiveTerrainVerb.@pascal-app/editor,i18n):slopeSite(grades the full padded heightfield in a single undo step and drops in-flight live strokes) andresolveSlopeStrokePlaneinpackages/editor/src/lib/terrain-sculpt.ts.#14b8a6) brush ring color, a draped uphill direction arrow inside the brush ring (hidden when pitch is0°), an amber A -> B guide line, and a live grade%readout in the cursor pill during two-point picking (TerrainBrushCursor).TerrainSculptPanel(Flat,2%,5%,1:12, and12%presets,Pitch, wrappingDirectionwithRotate 90°andFlip 180°,Elevation,Anchor: Center/Low edge, liveGrade %and lot elevation range readout, two-pointPick A -> Beyedropper with locked anchor indicator, andSlope lot), updatesuseTerrainPanelRows, and extracts/compiles Lingui catalogs across all 5 locales.How to test
5%or12%) or adjust Pitch, Direction (Rotate 90°/Flip 180°), Elevation, and Anchor (CentervsLow edge), then click Slope lot. Verify the terrain grades smoothly across the lot, the readout shows the exact grade%and min-to-max elevation range, andCtrl+Z/Cmd+Zundoes it in a single step.0°is selected). Drag across the lot to locally grade along the inclined plane.%pill), and click to lock the derived pitch, direction, lot base elevation, and plane anchor.bun run check(0 errors across 4,595 files)bun run check-types(14/14 packages pass, includingapps/editorand@webxr/plugin)bun run i18n:check(5/5 catalogs in sync, literal guard pass)bun run skills:validate(75/75 pass)bun test packages/core/src/lib/terrain*.test.ts packages/core/src/store/use-live-terrain.test.ts(147/147 pass)bun run --cwd packages/core test(7,688 pass, 3 skip, 0 fail)bun run --cwd packages/editor test(2,797 pass, 0 fail)bun test scripts/i18n.test.ts scripts/i18n-provider.test.ts scripts/i18n-literals.test.ts apps/editor/proxy.test.ts(81/81 pass)bun run --cwd apps/editor build && bun run --cwd apps/editor smoke(8/8 pass)bun run check:render-bundle(pass)Screenshots / screen recording
Verified live in Chrome against the Next.js 16 production build with 0 console or page errors:
1. Whole-lot planar grading (
Slope lot) on a 12% hillside lot: shows the Slope panel controls (Flat / 2% / 5% / 1:12 / 12%presets,Pitch,DirectionwithRotate 90°/Flip 180°,Elevation,Anchor: Center/Low edge, liveGrade 11.9%and0'0" -> 9'5"range readout, andSlope lot), 3D topographic contours, a hillside pavilion withfillToTerraindeck foundation, and the teal brush ring with draped uphill direction arrow and elevation pill.2. Two-point
A -> Bgrade picker on a terraced hillside ramp: clicking near the foot of the carved ramp and moving uphill drapes the amberA -> Bguide line and brush ring across the terrain, displays the live elevation and grade readout pill (H 3'7" · 8.6%), and shows the contextualPick end point to match slopeHUD prompt.3. Locked
A -> Banchor and rotatedSlopebrush: completing point B locks the derivedPitch(4.9°),Direction(302°),Elevation(3.87ft), andAnchored at 0'0" [x Clear]plane reference in the sidebar, rotating the teal brush ring's draped uphill arrow to match the picked slope for local touch-up strokes.Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Touches core terrain heightfield mutation and editor pointer/state flows; scope is additive with tests, but incorrect slope math or stroke plane resolution could visibly corrupt site terrain.
Overview
Adds a slope terrain sculpt verb on top of the existing heightfield brush pipeline, plus pure planar slope math in
@pascal-app/core.The core layer introduces
terrain-slope.ts(pitch/direction clamping, lot plane resolution with center vs low-edge anchors, two-pointderiveTerrainSlopeFromPoints, andbuildSlopedTerrainFieldfor whole-field grading).terrain-brushextends strokes with aslopeverb that lerps brushed samples toward a compiled inclined plane using the same non-compounding mask as flatten.The editor wires slope through sculpt state (
terrainSlope, A→B pick anchor,selectActiveTerrainVerb/setActiveTerrainVerbsoterrainVerbstays narrowed for WebXR),slopeSiteandresolveSlopeStrokePlane, panel controls (presets, pitch/direction/elevation, Slope lot), cursor feedback (uphill arrow, pick guide line, live grade %), HUD/i18n, and teal ring color for the new verb.Reviewed by Cursor Bugbot for commit 96f3115. Bugbot is set up for automated code reviews on this repo. Configure here.