fix(editor): render slab side walls solid regardless of polygon winding#377
Merged
Conversation
Slab and pool side walls assumed a CCW contour (the unflipped quad's right-hand normal is outward only for CCW), but outsetPolygon and the slab tool preserve the drawn winding. A CW-drawn slab therefore got inward-facing side-wall normals that FrontSide culling dropped, so the slab read as see-through from the camera-facing side (~half the time, depending on draw direction). Normalize the contour to CCW (reverse when signed area < 0) before building both the positive-slab and pool geometry. Caps are unaffected (Earcut normalizes the outer ring); holes are already double-emitted + winding-normalized; ceilings use flat ShapeGeometry (no extruded walls); autoFromWalls slabs are already CCW so this is a no-op for them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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
When a floor slab is placed, ~half the time its vertical side walls don't render — the camera-facing walls vanish and you see through to the far walls (production bug).
Cause
generatePositiveSlabGeometry/generatePoolGeometrybuild side walls assuming a CCW contour (the unflipped quad's right-hand normal is outward only for CCW). ButoutsetPolygonand the slab tool preserve the drawn winding, so a CW-drawn slab gets inward-facing side-wall normals →FrontSideculling drops the front faces → see-through. Which half breaks depends on the click/draw direction.Fix
ensureCounterClockwisePolygon— reverse the contour when signed area < 0 — applied to both the positive-slab and pool contours before geometry generation. Matches how three.jsExtrudeGeometrynormalizes winding viaShapeUtils.isClockWise.Verified
unionPolygons); ceilings use flatShapeGeometry(no extruded walls); 2D floorplan is a separate path;autoFromWallsslabs are already CCW (no-op).🤖 Generated with Claude Code