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 ++++++++-----------------------
public/textures/grass.jpg | 0
public/textures/floor_02.png | 0
public/textures/cross.png | 0
public/textures/wall_pic7.png | 0
public/textures/road2.jpg | 0
public/textures/surface.jpg | 0
src/pages/base.jsx | 2 +-
public/textures/wall_pic5.jpg | 0
public/textures/road.jpg | 0
10 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/public/textures/cross.png b/public/textures/cross.png
new file mode 100644
index 0000000..57c4098
--- /dev/null
+++ b/public/textures/cross.png
Binary files differ
diff --git a/public/textures/floor_02.png b/public/textures/floor_02.png
new file mode 100644
index 0000000..e76516c
--- /dev/null
+++ b/public/textures/floor_02.png
Binary files differ
diff --git a/public/textures/grass.jpg b/public/textures/grass.jpg
new file mode 100644
index 0000000..2abc7fa
--- /dev/null
+++ b/public/textures/grass.jpg
Binary files differ
diff --git a/public/textures/road.jpg b/public/textures/road.jpg
new file mode 100644
index 0000000..ded6db4
--- /dev/null
+++ b/public/textures/road.jpg
Binary files differ
diff --git a/public/textures/road2.jpg b/public/textures/road2.jpg
new file mode 100644
index 0000000..0119bc8
--- /dev/null
+++ b/public/textures/road2.jpg
Binary files differ
diff --git a/public/textures/surface.jpg b/public/textures/surface.jpg
new file mode 100644
index 0000000..059f4cb
--- /dev/null
+++ b/public/textures/surface.jpg
Binary files differ
diff --git a/public/textures/wall_pic5.jpg b/public/textures/wall_pic5.jpg
new file mode 100644
index 0000000..8256f81
--- /dev/null
+++ b/public/textures/wall_pic5.jpg
Binary files differ
diff --git a/public/textures/wall_pic7.png b/public/textures/wall_pic7.png
new file mode 100644
index 0000000..e04e9dd
--- /dev/null
+++ b/public/textures/wall_pic7.png
Binary files differ
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; // 鍨傜洿鏂瑰悜閲嶅
diff --git a/src/pages/base.jsx b/src/pages/base.jsx
index 6240fba..ea8269e 100644
--- a/src/pages/base.jsx
+++ b/src/pages/base.jsx
@@ -7,7 +7,6 @@
import Camera from '@/components/camera'
import Buildings from '@/components/buidings'
import TreeGroup from '../components/tree-group'
-import GridModule from '../components/grid'
import House from '../components/house'
const Base = (props) => {
@@ -24,6 +23,7 @@
<Sky distance={450000} sunPosition={[0, 1, 0]} inclination={0} azimuth={0.25} />
<Buildings />
<TreeGroup />
+ <House />
<Box position={[0, 0, 0]} />
<OrbitControls />
<Environment background preset="warehouse" />
--
Gitblit v1.9.1