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?
Fixes #1273
Previously,
finishWallFacesranrepairWallTJunctionson every wall geometry build, including every live rebuild during drawing and editing. The repair exists to prevent dotted light leaks once quantized by GLB/export bakes, while the live renderer draws full-precision float geometry.I updated
@pascal-app/viewerand@pascal-app/editorso live wall rebuilds defer T-junction repair and export preparation runs it on demand on cloned meshes:packages/viewer/src/systems/wall/wall-system.tsx,packages/viewer/src/index.ts): Addedexport type WallTJunctionMode = 'repaired' | 'deferred'and an optional trailingtJunctions: WallTJunctionMode = 'repaired'parameter ongenerateExtrudedWall(threaded throughfinishWallFacesandmergeWallTerrainFill). Because the default stays'repaired', every existing caller, golden hash, and T-junction test keeps its existing behavior.updateWallGeometry): Both the live render wall mesh and itscollision-meshpass'deferred', skippingrepairWallTJunctionsduring interactive editing and markinggeometry.userData.wallTJunctions = 'deferred'.repairDeferredWallTJunctions,packages/editor/src/lib/glb-export.ts): ExportedrepairDeferredWallTJunctions(mesh), which runsrepairWallTJunctionson marked meshes, preserves material groups and non-markeruserData, recomputes normals and level-relative planar UVs (applyWorldPlanarWallUVs), refreshes bounds, and clearsuserData.wallTJunctions.finishSceneExportPreparation(shared across GLB, USDZ, STL, 3MF, and viewer bakes) invokes it on cloned deferred wall meshes (cloning first if a geometry is shared) so exports remain crack-free without mutating live viewer meshes.packages/viewer/src/systems/wall/wall-t-junctions.test.tsto verify deferred marking andrepairDeferredWallTJunctions, and addedpackages/editor/src/lib/glb-export-wall-t-junctions.test.tsbuilding a T-junction of walls with a window throughrunWallBuildFrame, exporting viaprepareSceneForExport+GLTFExporter, and parsing back withGLTFLoaderto verify live meshes stay deferred while exported GLB meshes have 0 T-junctions and preserved area, normals, and UVs.How to test
bunx biome check packages/viewer/src/systems/wall/wall-system.tsx packages/viewer/src/systems/wall/wall-t-junctions.test.ts packages/viewer/src/index.ts packages/editor/src/lib/glb-export.ts packages/editor/src/lib/glb-export-wall-t-junctions.test.ts.bunx turbo run build check-types --filter=@pascal-app/viewer --filter=@pascal-app/editor.bun test packages/viewer/src/systems/wall/wall-t-junctions.test.ts packages/viewer/src/systems/wall/wall-finish-geometry.test.ts packages/viewer/src/systems/wall/wall-opening-cutout.test.ts packages/editor/src/lib/glb-export-wall-t-junctions.test.ts packages/editor/src/lib/glb-export.test.ts(90 pass, 0 fail).Screenshots / screen recording
N/A (geometry build and export-preparation optimization; live wall rendering and committed golden hashes are unchanged).
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Changes wall geometry timing and export preparation for all baked formats, but defaults remain
'repaired'for non-live callers and export still enforces zero T-junctions.Overview
Live wall rebuilds now skip
repairWallTJunctionsduring interactive editing by threading a newWallTJunctionMode('repaired' | 'deferred') throughgenerateExtrudedWall,finishWallFaces, andmergeWallTerrainFill.updateWallGeometrypasses'deferred'for render and collision meshes, stampinggeometry.userData.wallTJunctions = 'deferred'instead of splitting triangles every drag.Export runs repair only on cloned meshes:
repairDeferredWallTJunctions(re-exported from viewer) fixes T-junctions, restores normals/UVs, and clears the marker;finishSceneExportPreparationwalks the export scene, cloning shared geometries before repair so live viewer meshes stay untouched.Tests cover deferred build + on-demand repair in the viewer and a T-junction GLB round-trip via
prepareSceneForExport.Reviewed by Cursor Bugbot for commit b063e9c. Bugbot is set up for automated code reviews on this repo. Configure here.