#
luxiaotao1123
2024-04-24 5e39d5aaf44d377a91c135576a0c22b15790e7c7
src/components/house.jsx
@@ -3,14 +3,16 @@
import { extend } from '@react-three/fiber';
import { Geometry, Base, Subtraction, Addition } from '@react-three/csg';
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry';
import { DEBUG } from '../config/setting';
extend({ TextGeometry });
const House = (props) => {
  const {
    wallThickness = 2,
    width = 1400,
    length = 1200,
    height = 400,
    wallOpacity = .6,
    width = DEBUG ? 14000 : 1400,
    length = DEBUG ? 12000 : 1200,
    height = DEBUG ? 4000 : 400,
    aside_width = 130,
    aside_length = 130,
    position = new THREE.Vector3(200, 0, 0),
@@ -430,7 +432,7 @@
            { depth: wallThickness },
          ]}
        />
        <meshPhongMaterial map={texture} metalness={1.0} reflectivity={1.5}></meshPhongMaterial>
        <meshPhongMaterial map={texture} metalness={1.0} reflectivity={1.5} transparent={true} opacity={wallOpacity}></meshPhongMaterial>
      </mesh>
      {/* 后面的路 */}
      <mesh rotation={[Math.PI / 2, 0, 0]}>
@@ -451,7 +453,7 @@
            { depth: wallThickness },
          ]}
        />
        <meshPhongMaterial map={texture} metalness={1.0} reflectivity={1.5}></meshPhongMaterial>
        <meshPhongMaterial map={texture} metalness={1.0} reflectivity={1.5} transparent={true} opacity={wallOpacity}></meshPhongMaterial>
      </mesh>
      {/* 前面的墙壁下面的路 */}
      <mesh rotation={[Math.PI / 2, 0, 0]}>
@@ -481,7 +483,10 @@
        receiveShadow
      >
        <extrudeGeometry args={[getBackWallShape(), { depth: wallThickness }]} />
        <meshPhysicalMaterial map={texture} metalness={1.0} roughness={0.8}></meshPhysicalMaterial>
        <meshPhysicalMaterial map={texture} metalness={1.0} roughness={0.8}
          transparent={true}
          opacity={wallOpacity}
        ></meshPhysicalMaterial>
      </mesh>
      <mesh rotation={[Math.PI / 2, 0, 0]}>
        <LeftRoad></LeftRoad>
@@ -516,6 +521,8 @@
          color={'#0069c5'}
          metalness={1.0}
          roughness={0.8}
          transparent={true}
          opacity={wallOpacity}
        ></meshPhysicalMaterial>
      </mesh>
      {/* 顶部第二层 */}
@@ -529,6 +536,8 @@
          color={'#4895f6'}
          metalness={1.0}
          roughness={0.8}
          transparent={true}
          opacity={wallOpacity}
        ></meshPhysicalMaterial>
      </mesh>
      {/* 顶部第三层 */}
@@ -542,6 +551,8 @@
          map={roofTexture}
          metalness={1.0}
          roughness={0.8}
          transparent={true}
          opacity={wallOpacity}
        ></meshPhysicalMaterial>
      </mesh>
    </group>