From 9ea6474ce41d9a16eca73184c5c93454a20e0b7a Mon Sep 17 00:00:00 2001 From: yvan Date: Sun, 15 Jun 2025 21:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E6=9D=BF=E4=B8=8D=E9=80=8F=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/engine/SceneHelp.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/core/engine/SceneHelp.ts b/src/core/engine/SceneHelp.ts index 07738c0..aaf100b 100644 --- a/src/core/engine/SceneHelp.ts +++ b/src/core/engine/SceneHelp.ts @@ -4,7 +4,6 @@ import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry' import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial' import { Line2 } from 'three/examples/jsm/lines/Line2' import type { Object3DLike } from '@/types/ModelTypes.ts' -import { LineWrap } from '@/core/manager/LineSegmentManager.ts' /** * 场景帮助类 @@ -33,12 +32,14 @@ export default class SceneHelp { this.scene = new THREE.Scene() this.scene.background = new THREE.Color(gridOption.backgroundColor) + // 中心十字坐标 if (gridOption.axesEnabled) { this.axesHelper = createAxes(gridOption.axesSize, gridOption.axesColor, gridOption.axesWidth) this.axesHelper.position.setY(0) // 确保网格在地面上方 this.scene.add(this.axesHelper) } + // 1 米级地板 const gridHelper = new THREE.GridHelper(gridOption.gridSize, gridOption.gridDivisions) gridHelper.material.color.setHex(gridOption.gridColor) gridHelper.material.opacity = gridOption.gridOpacity @@ -52,6 +53,7 @@ export default class SceneHelp { this.gridHelper = gridHelper this.scene.add(this.gridHelper) + // 10 米级地板 const gridHelper2 = new THREE.GridHelper(1000, 100) gridHelper2.material.color.setHex(gridOption.gridColor) gridHelper2.material.transparent = false @@ -78,6 +80,16 @@ export default class SceneHelp { const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 1) this.scene.add(hemisphereLight) + // 完全不透明的地板 + const geometry = new THREE.PlaneGeometry(gridOption.gridSize, gridOption.gridSize) + const material = new THREE.MeshBasicMaterial({ + color: '#ffffff', + side: THREE.BackSide + }) + const ground = new THREE.Mesh(geometry, material) + ground.rotation.x = -Math.PI / 2 + this.scene.add(ground) + // const directionalLight = new THREE.DirectionalLight(0xffffff, 1.5) // directionalLight.position.set(5, 5, 5).multiplyScalar(3) // directionalLight.castShadow = true