refactor: 完善材质系统相关代码

- 修复 node-actions.ts 中 forEach 返回值 lint 警告
- 更新材质 schema 定义和渲染器
- wall-cutout.tsx 材质颜色保留修复
This commit is contained in:
Developer
2026-03-30 20:29:29 +08:00
parent d0cdeb2ac4
commit 0be6d84c98
12 changed files with 129 additions and 33 deletions
@@ -103,7 +103,12 @@ function getMaterialsForWall(wallNode: WallNode): WallMaterials {
return result
}
function getWallHideState(wallNode: WallNode, wallMesh: Mesh, wallMode: string, cameraDir: Vector3): boolean {
function getWallHideState(
wallNode: WallNode,
wallMesh: Mesh,
wallMode: string,
cameraDir: Vector3,
): boolean {
let hideWall = wallNode.frontSide === 'interior' && wallNode.backSide === 'interior'
if (wallMode === 'up') {
@@ -167,7 +172,10 @@ export const WallCutout = () => {
} else {
const currentMaterial = (wallMesh as Mesh).material
const materials = wallMaterialCache.get(wallId)
if (!materials || currentMaterial !== (hideWall ? materials.invisible : materials.visible)) {
if (
!materials ||
currentMaterial !== (hideWall ? materials.invisible : materials.visible)
) {
const newMaterials = getMaterialsForWall(wallNode)
;(wallMesh as Mesh).material = hideWall ? newMaterials.invisible : newMaterials.visible
}
@@ -202,4 +210,4 @@ export const WallCutout = () => {
}
})
return null
}
}