Skip to content

fix(editor): render slab side walls solid regardless of polygon winding#377

Merged
Aymericr merged 1 commit into
mainfrom
fix/slab-side-wall-winding
Jun 5, 2026
Merged

fix(editor): render slab side walls solid regardless of polygon winding#377
Aymericr merged 1 commit into
mainfrom
fix/slab-side-wall-winding

Conversation

@Aymericr

@Aymericr Aymericr commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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 / generatePoolGeometry build side walls assuming 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, so a CW-drawn slab gets inward-facing side-wall normals → FrontSide culling 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.js ExtrudeGeometry normalizes winding via ShapeUtils.isClockWise.

Verified

  • Caps unaffected (Earcut normalizes the outer ring internally — that's why the top always rendered).
  • Holes already double-emitted + winding-normalized (unionPolygons); ceilings use flat ShapeGeometry (no extruded walls); 2D floorplan is a separate path; autoFromWalls slabs are already CCW (no-op).
  • Reviewed adversarially (Codex) + against the three.js winding convention.

🤖 Generated with Claude Code

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>
@mintlify

mintlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed Jun 5, 2026, 9:36 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@Aymericr Aymericr merged commit f01c443 into main Jun 5, 2026
1 check failed
@Aymericr Aymericr deleted the fix/slab-side-wall-winding branch June 5, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant