fix: ceiling transparent by default when no material is set

The ceiling renderer was falling back to DEFAULT_CEILING_MATERIAL (an
opaque MeshStandardMaterial) when no material was set on the node.
This made ceilings fully opaque instead of using the intended
transparent grid pattern for scenes created before v0.3.2.

Now uses resolveMaterial() to extract the color from whatever material
config exists (preset, custom, or default white), then always creates
the proper transparent ceiling materials for both faces.
This commit is contained in:
Pascal
2026-03-31 19:31:46 +00:00
parent e84e870248
commit b6636c179b
@@ -1,9 +1,8 @@
import { type CeilingNode, useRegistry } from '@pascal-app/core' import { type CeilingNode, resolveMaterial, useRegistry } from '@pascal-app/core'
import { useMemo, useRef } from 'react' import { useMemo, useRef } from 'react'
import { float, mix, positionWorld, smoothstep } from 'three/tsl' import { float, mix, positionWorld, smoothstep } from 'three/tsl'
import { BackSide, FrontSide, type Mesh, MeshBasicNodeMaterial } from 'three/webgpu' import { BackSide, FrontSide, type Mesh, MeshBasicNodeMaterial } from 'three/webgpu'
import { useNodeEvents } from '../../../hooks/use-node-events' import { useNodeEvents } from '../../../hooks/use-node-events'
import { DEFAULT_CEILING_MATERIAL } from '../../../lib/materials'
import { NodeRenderer } from '../node-renderer' import { NodeRenderer } from '../node-renderer'
const gridScale = 5 const gridScale = 5
@@ -40,16 +39,9 @@ export const CeilingRenderer = ({ node }: { node: CeilingNode }) => {
const handlers = useNodeEvents(node, 'ceiling') const handlers = useNodeEvents(node, 'ceiling')
const materials = useMemo(() => { const materials = useMemo(() => {
const mat = node.material const props = resolveMaterial(node.material)
if (mat) { const color = props.color || '#999999'
const props = mat.properties return createCeilingMaterials(color)
const color = props?.color || '#999999'
return createCeilingMaterials(color)
}
return {
topMaterial: createCeilingMaterials().topMaterial,
bottomMaterial: DEFAULT_CEILING_MATERIAL,
}
}, [node.material, node.material?.preset, node.material?.properties, node.material?.texture]) }, [node.material, node.material?.preset, node.material?.properties, node.material?.texture])
return ( return (