Refactor material catalog for roofing and flooring

This commit is contained in:
sudhir
2026-05-20 00:52:01 +00:00
committed by open-pascal
parent a3378a666d
commit a9d26239b7
45 changed files with 118 additions and 191 deletions
+9
View File
@@ -53,6 +53,14 @@ type TextureSlot =
const SRGB_TEXTURE_SLOTS: TextureSlot[] = ['map', 'emissiveMap']
function getTextureChannel(slot?: TextureSlot): number {
if (slot === 'aoMap' || slot === 'lightMap') {
return 2
}
return 0
}
function getCacheKey(props: MaterialProperties): string {
return `${props.color}-${props.roughness}-${props.metalness}-${props.opacity}-${props.transparent}-${props.side}`
}
@@ -102,6 +110,7 @@ function applyTextureProperties(
texture.repeat.set(props.repeatX, props.repeatY)
texture.rotation = props.rotation
texture.flipY = props.flipY
texture.channel = getTextureChannel(slot)
texture.colorSpace = SRGB_TEXTURE_SLOTS.includes(slot ?? 'map')
? THREE.SRGBColorSpace
: THREE.NoColorSpace