feat(paint-slots): round-2 feedback — fence 2 slots + UVs, roof defaults, stair body

- fence: split into two paint slots — panel (posts/base/infill, default charcoal)
  and rail (cap, default wood-finewood27) — as separate meshes with userData.slotId.
  Fix applyFenceUVs to continuous world-space 1 UV unit = 1 m (drop the per-part
  min origin that broke tiling across parts). New generateFenceSlotGeometries.
- roof: real catalog defaults for the segment surfaces via getRoofMaterialArray
  (the actual default path): wall/trim concrete-plate (matches walls), deck +
  soffit soft-white, shingle terracotta; textures-off role escape hatch kept.
  Align nodes getRoofMaterials no-parent fallback to match.
- stair: body slot default -> preset-lightgrey.
- (biome formatting normalization of the round-1 merged renderer files rides along.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-17 17:21:58 -04:00
co-authored by Claude Opus 4.8
parent ad227a04a2
commit e92ee05702
15 changed files with 345 additions and 271 deletions
@@ -10,8 +10,20 @@ import {
createMaterialFromPresetRef,
createSurfaceRoleMaterial,
type RenderShading,
resolveSlotDefaultMaterial,
} from '../../lib/materials'
// Declared catalog defaults for an unpainted roof, per the 4-slot layout
// (0 wall/trim · 1 deck · 2 interior soffit · 3 shingle top). The wall/trim
// band mirrors the wall kind's default (WALL_SLOT_DEFAULT = concrete-plate) so
// a roof reads as continuous with the walls below it.
const ROOF_DEFAULT_REFS: [string, string, string, string] = [
'library:concrete-plate',
'library:preset-softwhite',
'library:preset-softwhite',
'library:roof-terracottatiles',
]
export type RoofMaterialArray = [THREE.Material, THREE.Material, THREE.Material, THREE.Material]
const roofMaterialArrayCache = new Map<string, RoofMaterialArray>()
@@ -77,30 +89,42 @@ export function getRoofMaterialArray(
roofMaterial,
]
// Textures-off (monochrome) is the guaranteed escape hatch: themed role
// colours, no catalog finishes.
if (!textures) {
roofMaterialArrayCache.set(cacheKey, roleArray)
return roleArray
}
// Textures-on default appearance: catalog finishes per slot (terracotta
// shingle, soft-white deck/soffit, wall-coloured trim). Used both when the
// roof is unpainted and to fill any individual unpainted slot below.
const defaultArray: RoofMaterialArray = [
resolveSlotDefaultMaterial(ROOF_DEFAULT_REFS[0], shading),
resolveSlotDefaultMaterial(ROOF_DEFAULT_REFS[1], shading),
resolveSlotDefaultMaterial(ROOF_DEFAULT_REFS[2], shading),
resolveSlotDefaultMaterial(ROOF_DEFAULT_REFS[3], shading),
]
const topMaterial = createResolvedMaterial(top.material, top.materialPreset, shading)
const edgeMaterial = createResolvedMaterial(edge.material, edge.materialPreset, shading)
const wallMaterial = createResolvedMaterial(wall.material, wall.materialPreset, shading)
if (!(topMaterial || edgeMaterial || wallMaterial)) {
roofMaterialArrayCache.set(cacheKey, roleArray)
return roleArray
roofMaterialArrayCache.set(cacheKey, defaultArray)
return defaultArray
}
// Each slot resolves to its own role only, then the themed default — never
// Each slot resolves to its own role only, then the declared default — never
// another role. Cross-role fallback here used to splatter a single painted
// surface (e.g. the edge) across the shingle and soffit slots. The legacy
// catch-all still fills every role because `getEffectiveRoofSurfaceMaterial`
// returns it for top/edge/wall alike.
const materialArray: RoofMaterialArray = [
edgeMaterial ?? roofMaterial,
wallMaterial ?? ceilingMaterial,
wallMaterial ?? ceilingMaterial,
topMaterial ?? roofMaterial,
edgeMaterial ?? defaultArray[0],
wallMaterial ?? defaultArray[1],
wallMaterial ?? defaultArray[2],
topMaterial ?? defaultArray[3],
]
roofMaterialArrayCache.set(cacheKey, materialArray)