From 8153f1b0588d03b7af956e746bde328590277aff Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 19 四月 2024 10:39:35 +0800 Subject: [PATCH] # --- src/components/house.jsx | 31 ++++++++----------------------- 1 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/components/house.jsx b/src/components/house.jsx index d41a378..1e04bb6 100644 --- a/src/components/house.jsx +++ b/src/components/house.jsx @@ -1,8 +1,7 @@ import React, { useEffect, useRef } from 'react'; import * as THREE from 'three'; -import { ThreeElements, useLoader, extend } from '@react-three/fiber'; +import { extend } from '@react-three/fiber'; import { Geometry, Base, Subtraction, Addition } from '@react-three/csg'; -import { FontLoader } from 'three/examples/jsm/loaders/FontLoader'; import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'; extend({ TextGeometry }); @@ -44,9 +43,7 @@ // const texture = new THREE.TextureLoader().load('/static/wall_pic5.jpg'); const texture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/wall_pic5.jpg' - : `/degital-twin-3d/static/wall_pic5.jpg` + `/textures/wall_pic5.jpg` ); console.log('env', process.env.NODE_ENV); @@ -54,9 +51,7 @@ texture.repeat.set(0.02, 0.02); const roofTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/wall_pic7.png' - : `/degital-twin-3d/static/wall_pic7.png` + `/textures/wall_pic7.png` ); roofTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 roofTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 @@ -64,45 +59,35 @@ roofTexture.repeat.set(0.005, 0.005); const floorTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/floor_02.png' - : `/degital-twin-3d/static/floor_02.png` + `/textures/floor_02.png` ); floorTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 floorTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 floorTexture.repeat.set(0.01, 0.01); const roadTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/road2.jpg' - : `/degital-twin-3d/static/road2.jpg` + `/textures/road2.jpg` ); roadTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 roadTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 roadTexture.repeat.set(5, 1); const grassTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/grass.jpg' - : `/degital-twin-3d/static/grass.jpg` + `/textures/grass.jpg` ); grassTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 grassTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 grassTexture.repeat.set(20, 1); const surfaceTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/surface.jpg' - : `/degital-twin-3d/static/surface.jpg` + `/textures/surface.jpg` ); surfaceTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 surfaceTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 surfaceTexture.repeat.set(0.01, 0.01); const crossTexture = new THREE.TextureLoader().load( - process.env.NODE_ENV == 'development' - ? '/static/cross.png' - : `/degital-twin-3d/static/cross.png` + `/textures/cross.png` ); crossTexture.wrapS = THREE.RepeatWrapping; // 姘村钩鏂瑰悜閲嶅 crossTexture.wrapT = THREE.RepeatWrapping; // 鍨傜洿鏂瑰悜閲嶅 -- Gitblit v1.9.1