|
|
|
@ -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
|
|
|
|
|