diff --git a/src/views/FactoryView/threeMap.vue b/src/views/FactoryView/threeMap.vue index 2e042bc..9fa6542 100644 --- a/src/views/FactoryView/threeMap.vue +++ b/src/views/FactoryView/threeMap.vue @@ -1058,11 +1058,18 @@ function createTitleFloor(houseName: string, baseWidth: number, baseLength: numb } //创建地板,可以理解为地基 -function createFloor(houseName: string, baseWidth: number, baseLength: number, position: positionType, wood:any = requires.wood) { - const texture = new THREE.TextureLoader().load(wood); +function createFloor(houseName: string, baseWidth: number, baseLength: number, position: positionType, wood:any = "") { + let obj = {} + if (wood == "") { + const texture = new THREE.TextureLoader().load(wood); + obj = { map: texture, transparent: true } + } else { + obj = { color: wood } + } + //设置地板大小,由于后面将要生成墙体存在设置为1的厚度,因此这里对地板的x,z均-2 const floor = new THREE.BoxGeometry(baseWidth - 2, 1, baseLength); - const material = new THREE.MeshPhongMaterial({ map: texture, transparent: true }); + const material = new THREE.MeshPhongMaterial(obj); const mesh = new THREE.Mesh(floor, material); const { x, y, z } = position mesh.position.set(x, y + 1 / 2, z);