xy-map 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/package.json +3 -1
- package/public/draco/README.md +32 -0
- package/public/draco/draco_decoder.js +52 -0
- package/public/draco/draco_decoder.wasm +0 -0
- package/public/draco/draco_encoder.js +33 -0
- package/public/draco/draco_wasm_wrapper.js +104 -0
- package/public/draco/gltf/draco_decoder.js +48 -0
- package/public/draco/gltf/draco_decoder.wasm +0 -0
- package/public/draco/gltf/draco_encoder.js +33 -0
- package/public/draco/gltf/draco_wasm_wrapper.js +104 -0
- package/public/img/blue/nx.png +0 -0
- package/public/img/blue/ny.png +0 -0
- package/public/img/blue/nz.png +0 -0
- package/public/img/blue/px.png +0 -0
- package/public/img/blue/py.png +0 -0
- package/public/img/blue/pz.png +0 -0
- package/public/img/blue.jpg +0 -0
- package/public/img/hdr/hdr1.hdr +0 -0
- package/public/img/hdr/hdr2.hdr +0 -0
- package/public/img/hdr/venice_sunset_1k.hdr +0 -0
- package/public/img/loading.gif +0 -0
- package/public/img/taoshan2/baseColor_1.png +0 -0
- package/public/img/taoshan2/baseColor_10.jpg +0 -0
- package/public/img/taoshan2/baseColor_11.jpg +0 -0
- package/public/img/taoshan2/baseColor_12.jpg +0 -0
- package/public/img/taoshan2/baseColor_13.jpg +0 -0
- package/public/img/taoshan2/baseColor_14.jpg +0 -0
- package/public/img/taoshan2/baseColor_15.jpg +0 -0
- package/public/img/taoshan2/baseColor_16.jpg +0 -0
- package/public/img/taoshan2/baseColor_17.jpg +0 -0
- package/public/img/taoshan2/baseColor_18.jpg +0 -0
- package/public/img/taoshan2/baseColor_19.jpg +0 -0
- package/public/img/taoshan2/baseColor_2.png +0 -0
- package/public/img/taoshan2/baseColor_20.jpg +0 -0
- package/public/img/taoshan2/baseColor_3.png +0 -0
- package/public/img/taoshan2/baseColor_4.jpg +0 -0
- package/public/img/taoshan2/baseColor_5.jpg +0 -0
- package/public/img/taoshan2/baseColor_6.jpg +0 -0
- package/public/img/taoshan2/baseColor_7.jpg +0 -0
- package/public/img/taoshan2/baseColor_8.jpg +0 -0
- package/public/img/taoshan2/baseColor_9.jpg +0 -0
- package/public/img/taoshan2/taoshan4.bin +0 -0
- package/public/img/taoshan2/taoshan4.gltf +1 -0
- package/public/img/waternormals.jpg +0 -0
- package/src/index.js +133 -123
- package/src/layers/Text.js +25 -19
- package/src/layers/model copy.js +314 -0
- package/src/layers/model.js +251 -148
- package/src/layers/scene.js +314 -0
- package/src/layers/water.js +239 -0
- package/src/map.js +28 -5
- package/src/package/mapLoad.vue +120 -0
- package/src/package/mapModel.vue +69 -0
- package/src/package/mapRain.vue +110 -0
- package/vue.config.js +1 -1
- package/public/img/30.gltf +0 -58151
package/src/layers/model.js
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import mapSdk from '../map'
|
|
2
2
|
import * as THREE from 'three'
|
|
3
|
+
import * as dat from 'dat.gui'
|
|
3
4
|
import {
|
|
4
5
|
GLTFLoader
|
|
5
6
|
} from 'three/examples/jsm/loaders/GLTFLoader'
|
|
7
|
+
import {
|
|
8
|
+
EffectComposer
|
|
9
|
+
} from 'three/examples/jsm/postprocessing/EffectComposer'
|
|
10
|
+
import {
|
|
11
|
+
RenderPass
|
|
12
|
+
} from 'three/examples/jsm/postprocessing/RenderPass'
|
|
13
|
+
import {
|
|
14
|
+
DRACOLoader
|
|
15
|
+
} from 'three/examples/jsm/loaders/DRACOLoader'
|
|
16
|
+
import { // 环境贴图
|
|
17
|
+
RGBELoader
|
|
18
|
+
} from 'three/examples/jsm/loaders/RGBELoader'
|
|
19
|
+
import {
|
|
20
|
+
Water
|
|
21
|
+
} from 'three/examples/jsm/objects/Water'
|
|
22
|
+
|
|
6
23
|
import mapBoxGl from 'mapbox-gl'
|
|
7
24
|
|
|
8
25
|
import {
|
|
@@ -14,133 +31,216 @@ const defaultOptions = {
|
|
|
14
31
|
id: '3dModel',
|
|
15
32
|
path: '/img/30.gltf',
|
|
16
33
|
position: [103.353557, 23.362395], // 位置
|
|
17
|
-
|
|
18
|
-
scale: 1, // 缩放
|
|
19
|
-
rotateX: 0, // x旋转
|
|
20
|
-
rotateY: 0, // y旋转
|
|
21
|
-
rotateZ: 0, // z旋转
|
|
34
|
+
height: 0, // 海拔高度
|
|
22
35
|
directionalLight: [{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
color: 0xffffff,
|
|
29
|
-
opacity: 0.5,
|
|
30
|
-
position: [0, -200, 100]
|
|
31
|
-
}
|
|
32
|
-
],
|
|
36
|
+
color: 0xfffcce,
|
|
37
|
+
intensity: 1,
|
|
38
|
+
position: [-4100, 3000, -1800],
|
|
39
|
+
shadow: {},
|
|
40
|
+
}],
|
|
33
41
|
ambientLight: {
|
|
34
|
-
color:
|
|
35
|
-
|
|
36
|
-
}
|
|
42
|
+
color: 0xFFFFFF,
|
|
43
|
+
intensity: 0.2,
|
|
44
|
+
},
|
|
45
|
+
shadow: false,
|
|
46
|
+
edit: false,
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
/**
|
|
40
50
|
* 添加模型
|
|
41
51
|
*/
|
|
42
|
-
export const addLayerModel = (option, layerId) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
addModel(id)
|
|
60
|
-
map.addLayer(customLayer, layerId)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
function addModel() {
|
|
64
|
-
const modelOrigin = opt.position // 中心点
|
|
65
|
-
const modelAltitude = opt.hight // 高度
|
|
66
|
-
const modelRotate = [Math.PI / 2, 0, 0]
|
|
67
|
-
|
|
68
|
-
const modelAsMercatorCoordinate = mapBoxGl.MercatorCoordinate.fromLngLat(
|
|
69
|
-
modelOrigin,
|
|
70
|
-
modelAltitude
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
const modelTransform = {
|
|
74
|
-
translateX: modelAsMercatorCoordinate.x,
|
|
75
|
-
translateY: modelAsMercatorCoordinate.y,
|
|
76
|
-
translateZ: modelAsMercatorCoordinate.z,
|
|
77
|
-
rotateX: modelRotate[0],
|
|
78
|
-
rotateY: modelRotate[1],
|
|
79
|
-
rotateZ: modelRotate[2],
|
|
80
|
-
scale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits() * opt.scale
|
|
52
|
+
export const addLayerModel = (option, layerId = '') => {
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
let {
|
|
55
|
+
map
|
|
56
|
+
} = mapSdk
|
|
57
|
+
|
|
58
|
+
let opt = Object.assign({}, defaultOptions, option)
|
|
59
|
+
let id = opt.id
|
|
60
|
+
|
|
61
|
+
let camera = ''
|
|
62
|
+
let scene = ''
|
|
63
|
+
let renderer = ''
|
|
64
|
+
let customLayer = ''
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if (hasLayer(id)) {
|
|
68
|
+
removeLayer(id)
|
|
81
69
|
}
|
|
70
|
+
addModel(id)
|
|
71
|
+
map.addLayer(customLayer, layerId)
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
73
|
+
resolve(scene)
|
|
74
|
+
|
|
75
|
+
function addModel() {
|
|
76
|
+
const modelOrigin = opt.position // 中心点
|
|
77
|
+
const modelAltitude = opt.height // 高度
|
|
78
|
+
const modelRotate = [Math.PI / 2, 0, 0]
|
|
79
|
+
|
|
80
|
+
const modelAsMercatorCoordinate = mapBoxGl.MercatorCoordinate.fromLngLat(
|
|
81
|
+
modelOrigin,
|
|
82
|
+
modelAltitude
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const modelTransform = {
|
|
86
|
+
translateX: modelAsMercatorCoordinate.x,
|
|
87
|
+
translateY: modelAsMercatorCoordinate.y,
|
|
88
|
+
translateZ: modelAsMercatorCoordinate.z,
|
|
89
|
+
rotateX: modelRotate[0],
|
|
90
|
+
rotateY: modelRotate[1],
|
|
91
|
+
rotateZ: modelRotate[2],
|
|
92
|
+
scale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 根据CustomLayerInterface为三维模型配置自定义层
|
|
96
|
+
customLayer = {
|
|
97
|
+
id: opt.id,
|
|
98
|
+
type: 'custom',
|
|
99
|
+
renderingMode: '3d',
|
|
100
|
+
onAdd: (map, gl) => {
|
|
101
|
+
const gui = opt.edit ? new dat.GUI() : null
|
|
102
|
+
const container = map.getCanvas()
|
|
103
|
+
|
|
104
|
+
// 摄像机
|
|
105
|
+
camera = new THREE.PerspectiveCamera(50, container.clientWidth / container.clientHeight, 0.01, 50000000)
|
|
106
|
+
// camera = new THREE.Camera()
|
|
107
|
+
// 场景
|
|
108
|
+
scene = new THREE.Scene()
|
|
109
|
+
// scene.background = new THREE.Color('rgba(255,255,255, 0)')
|
|
110
|
+
|
|
111
|
+
// 辅助坐标轴
|
|
112
|
+
// if (gui) {
|
|
113
|
+
// let AxesHelper = new THREE.AxesHelper(100)
|
|
114
|
+
// AxesHelper.position.y = opt.translate[1]
|
|
115
|
+
// scene.add(AxesHelper)
|
|
116
|
+
// }
|
|
117
|
+
|
|
118
|
+
// 创建灯光
|
|
119
|
+
if (opt.directionalLight && opt.directionalLight.length > 0) {
|
|
120
|
+
opt.directionalLight.forEach((item, index) => {
|
|
121
|
+
let position = {
|
|
122
|
+
x: item.position[0],
|
|
123
|
+
y: item.position[1],
|
|
124
|
+
z: item.position[2],
|
|
125
|
+
}
|
|
126
|
+
const directionalLight = new THREE.DirectionalLight(item.color, item.intensity)
|
|
127
|
+
directionalLight.position.set(position.x, position.y, position.z)
|
|
128
|
+
directionalLight.width = 1
|
|
129
|
+
directionalLight.height = 1
|
|
130
|
+
// directionalLight.distance = 0
|
|
131
|
+
// directionalLight.decay = 0 // 衰减强度
|
|
132
|
+
// directionalLight.exponent = 0 // 衰减速度
|
|
133
|
+
// directionalLight.angle = 0 // 光源角度
|
|
134
|
+
directionalLight.castShadow = true
|
|
135
|
+
|
|
136
|
+
// 开启编辑模式
|
|
137
|
+
if (gui) {
|
|
138
|
+
const lightGui = gui.addFolder('灯光' + (index + 1))
|
|
139
|
+
lightGui.addColor(item, 'color').name('颜色').onChange(val => directionalLight.color = new THREE.Color(val))
|
|
140
|
+
lightGui.add(item, 'intensity').min(0).step(0.1).name('强度').onChange(val => directionalLight.intensity = val)
|
|
141
|
+
lightGui.add(position, 'x').step(100).name('x').onChange(val => directionalLight.position.x = val)
|
|
142
|
+
lightGui.add(position, 'y').step(100).name('y').onChange(val => directionalLight.position.y = val)
|
|
143
|
+
lightGui.add(position, 'z').step(100).name('z').onChange(val => directionalLight.position.z = val)
|
|
144
|
+
lightGui.open()
|
|
145
|
+
|
|
146
|
+
let pointLightHelper = new THREE.DirectionalLightHelper(directionalLight, 1000)
|
|
147
|
+
scene.add(pointLightHelper)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 开启阴影
|
|
151
|
+
let shadow = Object.assign({
|
|
152
|
+
size: 2000,
|
|
153
|
+
near: 1,
|
|
154
|
+
far: 8000,
|
|
155
|
+
clarity: 14, // 阴影清晰度 0-20
|
|
156
|
+
bias: -0.0005
|
|
157
|
+
}, item.shadow)
|
|
158
|
+
if (shadow) {
|
|
159
|
+
directionalLight.castShadow = true
|
|
160
|
+
const d = shadow.size || 1000 //阴影范围
|
|
161
|
+
directionalLight.shadow.camera.left = -d
|
|
162
|
+
directionalLight.shadow.camera.right = d
|
|
163
|
+
directionalLight.shadow.camera.top = d
|
|
164
|
+
directionalLight.shadow.camera.bottom = -d
|
|
165
|
+
directionalLight.shadow.camera.near = shadow.near || 1
|
|
166
|
+
directionalLight.shadow.camera.far = shadow.far || 8000
|
|
167
|
+
directionalLight.shadow.mapSize.width = 2 ** shadow.clarity // 定义阴影贴图的宽度和高度,必须为2的整数此幂
|
|
168
|
+
directionalLight.shadow.mapSize.height = 2 ** shadow.clarity // 较高的值会以计算时间为代价提供更好的阴影质量
|
|
169
|
+
directionalLight.shadow.bias = shadow.bias || -0.05 //解决条纹阴影的出现
|
|
170
|
+
}
|
|
171
|
+
scene.add(directionalLight)
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// 环境光
|
|
176
|
+
if (opt.ambientLight) {
|
|
177
|
+
let item = {
|
|
178
|
+
color: opt.ambientLight.color,
|
|
179
|
+
intensity: opt.ambientLight.intensity
|
|
180
|
+
}
|
|
181
|
+
let ambientLight = new THREE.AmbientLight(item.color, item.intensity)
|
|
182
|
+
if (gui) {
|
|
183
|
+
const lightGui = gui.addFolder('环境光')
|
|
184
|
+
lightGui.addColor(item, 'color').name('颜色').onChange(val => ambientLight.color = new THREE.Color(val))
|
|
185
|
+
lightGui.add(item, 'intensity').min(0).step(0.1).name('强度').onChange(val => ambientLight.intensity = val)
|
|
186
|
+
lightGui.open()
|
|
187
|
+
}
|
|
188
|
+
scene.add(ambientLight)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 渲染器
|
|
192
|
+
renderer = new THREE.WebGLRenderer({
|
|
193
|
+
canvas: map.getCanvas(),
|
|
194
|
+
context: gl,
|
|
195
|
+
antialias: true,
|
|
196
|
+
// logarithmicDepthBuffer: true
|
|
102
197
|
})
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (opt.ambientLight) {
|
|
106
|
-
const light = new THREE.AmbientLight(0xffffff, 0.8)
|
|
107
|
-
scene.add(light)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 加载模型
|
|
111
|
-
const loader = new GLTFLoader()
|
|
112
|
-
loader.load(opt.path, (gltf) => {
|
|
113
|
-
gltf.scene.rotateX(opt.rotateX)
|
|
114
|
-
gltf.scene.rotateY(opt.rotateY)
|
|
115
|
-
gltf.scene.rotateZ(opt.rotateZ)
|
|
116
|
-
scene.add(gltf.scene)
|
|
117
|
-
})
|
|
118
198
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
199
|
+
// 创建一个EffectComposer(效果组合器)对象,然后在该对象上添加后期处理通道。
|
|
200
|
+
// let composer = new EffectComposer(renderer)
|
|
201
|
+
// composer.setSize(container.clientWidth, container.clientHeight)
|
|
202
|
+
|
|
203
|
+
// let renderPass = new RenderPass(scene, camera)
|
|
204
|
+
// composer.addPass(renderPass)
|
|
205
|
+
|
|
206
|
+
// 处理阴影
|
|
207
|
+
if (opt.shadow) {
|
|
208
|
+
renderer.shadowMap.enabled = true
|
|
209
|
+
renderer.shadowMap.type = THREE.PCFSoftShadowMap
|
|
210
|
+
}
|
|
211
|
+
renderer.autoClear = false
|
|
212
|
+
renderer.outputEncoding = THREE.sRGBEncoding
|
|
213
|
+
renderer.setSize(container.clientWidth, container.clientHeight)
|
|
214
|
+
|
|
215
|
+
// 缩放比例调整
|
|
216
|
+
window.addEventListener('resize', () => {
|
|
217
|
+
renderer.setSize(container.clientWidth, container.clientHeight)
|
|
218
|
+
camera.aspect = container.clientWidth / container.clientHeight
|
|
219
|
+
camera.updateProjectionMatrix()
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
// loadHDR()
|
|
223
|
+
|
|
224
|
+
// getIntersects() // 点击事件
|
|
225
|
+
},
|
|
226
|
+
render: cameraUpdate
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return customLayer
|
|
230
|
+
|
|
231
|
+
function loadHDR() {
|
|
232
|
+
new RGBELoader().setPath('/img/hdr/').load('hdr2.hdr', (texture) => {
|
|
233
|
+
texture.mapping = THREE.EquirectangularReflectionMapping
|
|
234
|
+
scene.background = texture
|
|
235
|
+
scene.environment = texture
|
|
125
236
|
})
|
|
237
|
+
}
|
|
126
238
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const rotationX = new THREE.Matrix4().makeRotationAxis(
|
|
133
|
-
new THREE.Vector3(1, 0, 0),
|
|
134
|
-
modelTransform.rotateX
|
|
135
|
-
)
|
|
136
|
-
const rotationY = new THREE.Matrix4().makeRotationAxis(
|
|
137
|
-
new THREE.Vector3(0, 1, 0),
|
|
138
|
-
modelTransform.rotateY
|
|
139
|
-
)
|
|
140
|
-
const rotationZ = new THREE.Matrix4().makeRotationAxis(
|
|
141
|
-
new THREE.Vector3(0, 0, 1),
|
|
142
|
-
modelTransform.rotateZ
|
|
143
|
-
)
|
|
239
|
+
// 渲染摄像机
|
|
240
|
+
function cameraUpdate(gl, matrix) {
|
|
241
|
+
const rotationX = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(1, 0, 0), modelTransform.rotateX)
|
|
242
|
+
const rotationY = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0, 1, 0), modelTransform.rotateY)
|
|
243
|
+
const rotationZ = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0, 0, 1), modelTransform.rotateZ)
|
|
144
244
|
|
|
145
245
|
const m = new THREE.Matrix4().fromArray(matrix)
|
|
146
246
|
const l = new THREE.Matrix4().makeTranslation(
|
|
@@ -155,51 +255,54 @@ export const addLayerModel = (option, layerId) => {
|
|
|
155
255
|
.multiply(rotationY)
|
|
156
256
|
.multiply(rotationZ)
|
|
157
257
|
|
|
258
|
+
camera.projectionMatrix.elements = matrix
|
|
158
259
|
camera.projectionMatrix = m.multiply(l)
|
|
260
|
+
|
|
261
|
+
// renderer.toneMapping = THREE.ACESFilmicToneMapping
|
|
262
|
+
// renderer.toneMappingExposure = 1.5
|
|
263
|
+
|
|
159
264
|
renderer.resetState()
|
|
160
265
|
renderer.render(scene, camera)
|
|
161
266
|
map.triggerRepaint()
|
|
162
267
|
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return customLayer
|
|
166
268
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
269
|
+
// 点击事件
|
|
270
|
+
function getIntersects() {
|
|
271
|
+
const container = map.getCanvas()
|
|
170
272
|
|
|
171
|
-
|
|
172
|
-
|
|
273
|
+
container.addEventListener('click', (event) => {
|
|
274
|
+
event.preventDefault()
|
|
173
275
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
276
|
+
// 声明 raycaster 和 mouse 变量
|
|
277
|
+
let raycaster = new THREE.Raycaster()
|
|
278
|
+
let mouse = new THREE.Vector2()
|
|
177
279
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
280
|
+
// 通过鼠标点击位置,计算出 raycaster 所需点的位置,以屏幕为中心点,范围 -1 到 1
|
|
281
|
+
mouse.x = (event.layerX / container.clientWidth) * 2 - 1
|
|
282
|
+
mouse.y = -(event.layerY / container.clientHeight) * 2 + 1
|
|
181
283
|
|
|
182
|
-
|
|
183
|
-
|
|
284
|
+
//通过鼠标点击的位置(二维坐标)和当前相机的矩阵计算出射线位置
|
|
285
|
+
raycaster.setFromCamera(mouse, camera)
|
|
184
286
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
287
|
+
// 获取与射线相交的对象数组,其中的元素按照距离排序,越近的越靠前
|
|
288
|
+
let meshArr = []
|
|
289
|
+
findMesh(scene.children)
|
|
290
|
+
let intersects = raycaster.intersectObjects(meshArr, true)
|
|
189
291
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
292
|
+
// 获取所有mesh
|
|
293
|
+
function findMesh(list) {
|
|
294
|
+
list.forEach(item => {
|
|
295
|
+
if (item.children.length > 0) {
|
|
296
|
+
findMesh(item.children)
|
|
297
|
+
} else {
|
|
298
|
+
meshArr.push(item)
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
}
|
|
302
|
+
console.log(intersects)
|
|
303
|
+
return intersects
|
|
304
|
+
})
|
|
305
|
+
}
|
|
203
306
|
}
|
|
204
|
-
}
|
|
307
|
+
})
|
|
205
308
|
}
|