@ohuoy/easymap 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.
@@ -0,0 +1,1104 @@
1
+ import * as THREE from 'three'
2
+ import { getBBox } from '../../utils/util';
3
+ import {Threebox} from '../../../lib/threebox-plugin';
4
+ import { lnglatsToWorld ,normalizeVertices,flattenVectors,projectToWorld} from '../../utils/mapUtil';
5
+ import CameraSync from '../../utils/CameraSync';
6
+ const WORLD_SIZE = 1024000;
7
+ // var this.
8
+ // let this.scene;
9
+ let cameraTransform;
10
+ // var this.group = new THREE.Group();
11
+ export default class ThreeWallLayer{
12
+ tb = {};
13
+ group = new THREE.Group();
14
+ scene;
15
+ opacity = 0.8
16
+ scale = 2
17
+ limit = 6
18
+ colorFun = ()=>{
19
+ return [0,0,0,0]
20
+ }
21
+ addedFun = null
22
+ constructor(id,config) {
23
+ this.id = id;
24
+ this.opacity = Number(config.opacity)
25
+ if(config.colorFun){
26
+ this.colorFun = config.colorFun
27
+ }
28
+ this.type = 'custom';
29
+ this.renderingMode = '2d';
30
+ this.addedFun = config.addedFun
31
+ }
32
+
33
+ drawWallPoints2(dataList){
34
+ let center = [dataList[0].lng,dataList[0].lat]
35
+ let width = 10,height = 10,depth = 10,widthSegments = 1,heightSegments = 1,depthSegments = 1;
36
+ widthSegments = Math.floor( widthSegments );
37
+ heightSegments = Math.floor( heightSegments );
38
+ depthSegments = Math.floor( depthSegments );
39
+ const indices = [];
40
+ const vertices = [];
41
+ const normals = [];
42
+ const colors = []
43
+ const uvs = [];
44
+ let numberOfVertices = 0;
45
+ let groupStart = 0;
46
+ function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {
47
+ const segmentWidth = width / gridX;
48
+ const segmentHeight = height / gridY;
49
+ const widthHalf = width / 2;
50
+ const heightHalf = height / 2;
51
+ const depthHalf = depth / 2;
52
+ const gridX1 = gridX + 1;
53
+ const gridY1 = gridY + 1;
54
+ let vertexCounter = 0;
55
+ let groupCount = 0;
56
+ const vector = new THREE.Vector3();
57
+ const color= new THREE.Color();
58
+ // generate vertices, normals and uvs
59
+ for ( let iy = 0; iy < gridY1; iy ++ ) {
60
+ const y = iy * segmentHeight - heightHalf;
61
+ for ( let ix = 0; ix < gridX1; ix ++ ) {
62
+ const x = ix * segmentWidth - widthHalf;
63
+ // set values to correct vector component
64
+ vector[ u ] = x * udir;
65
+ vector[ v ] = y * vdir;
66
+ vector[ w ] = depthHalf;
67
+ // now apply vector to vertex buffer
68
+ vertices.push( vector.x, vector.y, vector.z );
69
+ // set values to correct vector component
70
+ vector[ u ] = 0;
71
+ vector[ v ] = 0;
72
+ vector[ w ] = depth > 0 ? 1 : - 1;
73
+ // now apply vector to normal buffer
74
+ normals.push( vector.x, vector.y, vector.z );
75
+ // uvs
76
+ uvs.push( ix / gridX );
77
+ uvs.push( 1 - ( iy / gridY ) );
78
+ // counters
79
+ vertexCounter += 1;
80
+ }
81
+ }
82
+ // indices
83
+ // 1. you need three indices to draw a single face
84
+ // 2. a single segment consists of two faces
85
+ // 3. so we need to generate six (2*3) indices per segment
86
+ for ( let iy = 0; iy < gridY; iy ++ ) {
87
+
88
+ for ( let ix = 0; ix < gridX; ix ++ ) {
89
+
90
+ const a = numberOfVertices + ix + gridX1 * iy;
91
+ const b = numberOfVertices + ix + gridX1 * ( iy + 1 );
92
+ const c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
93
+ const d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
94
+ // faces
95
+ indices.push( a, b, d );
96
+ indices.push( b, c, d );
97
+ // let _color = color.setRGB(Math.random(),Math.random(),Math.random(),THREE.SRGBColorSpace )
98
+ colors.push(Math.random(),Math.random(),Math.random())
99
+ colors.push(Math.random(),Math.random(),Math.random())
100
+ colors.push(Math.random(),Math.random(),Math.random())
101
+ colors.push(Math.random(),Math.random(),Math.random())
102
+ // increase counter
103
+ groupCount += 6;
104
+ }
105
+ }
106
+ // add a group to the geometry. this will ensure multi material support
107
+ // scope.addGroup( groupStart, groupCount, materialIndex );
108
+ // calculate new start value for groups
109
+ groupStart += groupCount;
110
+ // update total number of vertices
111
+ numberOfVertices += vertexCounter;
112
+ }
113
+ buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px
114
+ buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx
115
+ // buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py
116
+ // buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny
117
+ buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz
118
+ buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz
119
+ let geometry = new THREE.BufferGeometry();
120
+ geometry.setIndex( indices );
121
+ geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
122
+ geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
123
+ geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
124
+ geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
125
+ let material = new THREE.MeshBasicMaterial( {
126
+ side: THREE.BackSide,
127
+ // wireframe:true,
128
+ color: 0xFFFFFF,
129
+ // forceSinglePass:false,
130
+ // depthWrite:false,
131
+ // depthTest:false,
132
+ //transparent:true,
133
+ // opacity:this.opacity,
134
+ // opacity:1,
135
+ // shadowSide: THREE.DoubleSide,
136
+ // depthFunc:THREE.LessDepth,
137
+ // depthTest:false,
138
+ // depthWrite:false,
139
+ vertexColors: true,
140
+ // forceSinglePass:true
141
+ } );
142
+
143
+ // material.needsUpdate = true;
144
+ material.color.convertSRGBToLinear();
145
+ let mesh = new THREE.Mesh( geometry, material );
146
+ mesh = this.tb.Object3D({ obj: mesh, fixedZoom :15 ,anchor:'center'});
147
+ mesh.setCoords(center)
148
+ this.tb.renderer.outputEncoding = THREE.sRGBEncoding;
149
+ this.tb.add(mesh);
150
+
151
+ // let geometry2 = new THREE.BoxGeometry( 1, 1, 1 );
152
+ // geometry2.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
153
+ // debugger
154
+ // const material2 = new THREE.MeshBasicMaterial( {color: 0xFFFF00} );
155
+ // let cube = new THREE.Mesh( geometry2, material );
156
+ // cube = this.tb.Object3D({ obj: cube, fixedZoom :15 ,anchor:'center'});
157
+ // cube.setCoords([center[0] + 0.1,center[1]])
158
+ // this.tb.add(cube);
159
+ }
160
+
161
+
162
+ drawWallPoints3(dataList){
163
+ this.removeObj(this.group);
164
+ let center = [dataList[0].lng,dataList[0].lat]
165
+ let geometry = new THREE.BufferGeometry();
166
+ let indices =[]
167
+ let vertices = []
168
+ let normals = [];
169
+ let colors = []
170
+ let uvs = [];
171
+ let distance = dataList[0].distance;
172
+ let noDataLenth = distance[0] / distance[1]
173
+ let limitIndex = this.limit / distance[1]
174
+ limitIndex = limitIndex >= distance[2] -1 ? distance[2] -1 : limitIndex
175
+ // dataList = dataList.slice(0,5)
176
+ let len = limitIndex + noDataLenth;
177
+ let index = 0;
178
+ const _color = new THREE.Color();
179
+ for(let i in dataList){
180
+ i = Number(i)
181
+ let item = dataList[i]
182
+ let lng = item.lng;
183
+ let lat = item.lat;
184
+ let position = projectToWorld([lng,lat])
185
+ if(i < dataList.length -1){
186
+ let next = dataList[i+1]
187
+ if(lng == next.lng && lat == next.lat){
188
+ continue;
189
+ }
190
+ }
191
+
192
+ for(let j in item.data){
193
+ j = Number(j)
194
+ if(j > -noDataLenth && j <= limitIndex){
195
+ //let position = mapboxgl.MercatorCoordinate.fromLngLat({lng: lng, lat: lat}, (j+noDataLenth) * this.scale);
196
+ //(Math.floor(position.x * 1000000 )/10000,(j+noDataLenth) * this.scale ,Math.floor(position.y * 1000000)/10000)
197
+ vertices.push(position.x ,position.y,position.z+(j+noDataLenth) * this.scale )
198
+ // uvs.push(j)
199
+ // uvs.push(j-0.5)
200
+ // // debugger
201
+ // normals.push( 1, 1, 1);
202
+ let color = this.colorFun(item.data[j])
203
+ _color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
204
+ colors.push( _color.r, _color.g, _color.b );
205
+ if(i < (dataList.length -2) && j< (limitIndex -1)){
206
+ let a = index +1
207
+ let b = index
208
+ let c = index +len
209
+ let d = index +len +1
210
+ indices.push( a,b,d); // face one
211
+ indices.push( b, c, d ); // face two
212
+ index = index +1;
213
+ }
214
+ }
215
+ }
216
+ index = vertices.length / 3
217
+ }
218
+ geometry.setIndex( indices );
219
+ geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
220
+ geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
221
+ geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3) );
222
+ // geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
223
+ geometry.computeBoundingSphere();
224
+ geometry.computeVertexNormals();
225
+ let material = new THREE.MeshBasicMaterial( {
226
+ // side:THREE.BackSide,
227
+ // wireframe:true,
228
+ depthFunc:THREE.NotEqualDepth ,
229
+ color: 0xFFFFFF,
230
+ // forceSinglePass:false,
231
+ // depthWrite:false,
232
+ // depthTest:false,
233
+ //transparent:true,
234
+ // opacity:this.opacity,
235
+ // opacity:1,
236
+ // shadowSide: THREE.DoubleSide,
237
+ // depthFunc:THREE.LessDepth,
238
+ // depthTest:false,
239
+ // depthWrite:false,
240
+ vertexColors: true,
241
+ // forceSinglePass:true
242
+ } );
243
+ // const material = new THREE.RawShaderMaterial({
244
+ // // uniforms:{},
245
+ // // attributes:{},
246
+ // // side:THREE.DoubleSide,
247
+ // wireframe:true,
248
+ // depthTest:false,
249
+ // depthWrite:false,
250
+ // vertexColors:true,
251
+ // vertexShader: `
252
+ // precision highp float;
253
+ // uniform mat4 projectionMatrix;
254
+ // uniform mat4 modelViewMatrix;
255
+ // attribute vec3 position;
256
+ // attribute vec3 color;
257
+
258
+ // varying vec3 vColor;
259
+ // void main(){
260
+ // vColor = color;
261
+ // gl_Position =projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
262
+ // }
263
+ // `,// 顶点着色器
264
+ // fragmentShader: `
265
+ // varying vec3 vColor;
266
+ // void main() {
267
+ // gl_FragColor = vec4(vColor,1.0);
268
+ // }`,// 片元着色器
269
+ // });
270
+
271
+
272
+ // material.needsUpdate = true;
273
+ // material.color.convertSRGBToLinear();
274
+ let mesh = new THREE.Mesh( geometry, material ); ;
275
+ this.group.add( mesh );
276
+ this.map.fitBounds(getBBox(dataList.map(a=>[a.lng,a.lat])), {
277
+ padding: {top: 45, bottom:45, left: 35, right: 35},
278
+ maxZoom:11,
279
+ pitch:30
280
+ });
281
+ }
282
+
283
+
284
+ drawWallPoints5(dataList){
285
+ this.removeObj(this.group);
286
+ // let center = [dataList[0].lng,dataList[0].lat]
287
+ let geometry = new THREE.BufferGeometry();
288
+ let indices =[]
289
+ let vertices = []
290
+ let normals = [];
291
+ let colors = []
292
+ let uvs = [];
293
+ let distance = dataList[0].distance;
294
+ let noDataLenth = distance[0] / distance[1]
295
+ let limitIndex = this.limit / distance[1]
296
+ limitIndex = limitIndex >= distance[2] -1 ? distance[2] -1 : limitIndex
297
+ // dataList = dataList.slice(0,5)
298
+ let len = limitIndex + noDataLenth;
299
+ let index = 0;
300
+ const _color = new THREE.Color();
301
+ let setData=(dir)=>{
302
+ for(let i in dataList){
303
+ let _i = Number(i);
304
+ let bo = i < dataList.length -1;
305
+ let nextIndex = _i +1;
306
+ if(dir == 1){
307
+ _i = dataList.length -1 -Number(i);
308
+ bo = _i > 0
309
+ nextIndex = _i-1;
310
+ }
311
+ let item = dataList[_i]
312
+ let lng = item.lng;
313
+ let lat = item.lat;
314
+ let position = projectToWorld([lng,lat])
315
+
316
+ if(bo){
317
+ let next = dataList[nextIndex]
318
+ if(lng == next.lng && lat == next.lat){
319
+ continue;
320
+ }
321
+ let nposition = projectToWorld([next.lng,next.lat])
322
+ let x = position.x,y = position.y,z= position.z;
323
+ let nx = nposition.x ,ny =nposition.y,nz = position.z;
324
+ let c,_n;
325
+ if(dir == 1){
326
+ let p1 = new THREE.Vector3(x,y,(z+this.scale))
327
+ let p2 = new THREE.Vector3(x,y,(z+2*this.scale) )
328
+ let p3 = new THREE.Vector3(nx,ny,(nz+this.scale) )
329
+ let p4 = new THREE.Vector3(nx,ny,(nz+2*this.scale) )
330
+ const a = p2.clone().sub(p1);
331
+ const b = p2.clone().sub(p4);
332
+ const d = p4.clone().sub(p3);
333
+ c = a.clone().cross(b) ;
334
+ // d = b.clone().cross(d) ;
335
+ _n= c.normalize();
336
+ // let _n2 = d.normalize();
337
+ normals.push(_n.x,_n.y,_n.z)
338
+ // normals.push(_n.x,_n.y,_n.z)
339
+ // normals.push(_n2.x,_n2.y,_n2.z)
340
+ }
341
+ else{
342
+ let p1 = new THREE.Vector3(x,y,z+this.scale )
343
+ let p2 = new THREE.Vector3(x,y,z+2*this.scale)
344
+ let p3 = new THREE.Vector3(nx,ny,nz+2*this.scale)
345
+ const a = p2.clone().sub(p1);
346
+ const b = p2.clone().sub(p3);
347
+ c = a.clone().cross(b) ;
348
+ _n= c.normalize();
349
+ normals.push(_n.x,_n.y,_n.z)
350
+ }
351
+ for(let j in item.data){
352
+ let h = (j * 1 +noDataLenth) * this.scale
353
+ j = Number(j)
354
+ if(j > -noDataLenth && j <= limitIndex){
355
+ //let position = mapboxgl.MercatorCoordinate.fromLngLat({lng: lng, lat: lat}, (j+noDataLenth) * this.scale);
356
+ //(Math.floor(position.x * 1000000 )/10000,(j+noDataLenth) * this.scale ,Math.floor(position.y * 1000000)/10000)
357
+ //正面
358
+ vertices.push(position.x ,position.y,position.z+h )
359
+ //设置法线
360
+ normals.push(_n.x,_n.y,_n.z)
361
+ uvs.push(j/limitIndex);
362
+ uvs.push(1-_i/dataList.length-1);
363
+ // uvs.push(j)
364
+ // uvs.push(j-0.5)
365
+ // // debugger
366
+ // normals.push( 1, 1, 1);
367
+ let color = this.colorFun(item.data[j])
368
+ _color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
369
+ colors.push( _color.r, _color.g, _color.b );
370
+ if(i < (dataList.length -2) && j< (limitIndex -1)){
371
+ let a = index +1
372
+ let b = index
373
+ let c = index +len
374
+ let d = index +len +1
375
+ // if(dir==1){
376
+ // indices.push( a,d,b); // face one
377
+ // indices.push( b, d, c ); // face two
378
+ // }else{
379
+ // indices.push( b,d,a); // face one
380
+ // indices.push( c,d,b ); // face two
381
+ // }
382
+ if(dir==-1){
383
+ if(_n.x >= 0){
384
+ if(_n.y >= 0){
385
+ indices.push( a,d,b); // face one
386
+ indices.push( b, d, c );
387
+ // indices.push( a,b,d); // face one
388
+ // indices.push( b,c,d ); // face two
389
+ }else{
390
+ indices.push( a,d,b); // face one
391
+ indices.push( b, d, c );
392
+ }
393
+
394
+ }
395
+ else if(_n.x < 0 ){
396
+ if(_n.y >= 0){
397
+ indices.push( a,b,d); // face one
398
+ indices.push( b,c,d ); // face two
399
+ }
400
+ else{
401
+ indices.push( a,b,d); // face one
402
+ indices.push( b,c,d ); // face two
403
+ }
404
+ }
405
+ }
406
+ else{
407
+ if(_n.x > 0){
408
+ if(_n.y >= 0){
409
+ // indices.push( a,d,b); // face one
410
+ // indices.push( b, d, c );
411
+ // indices.push( a,d,b); // face one
412
+ // indices.push( b, d, c );
413
+ indices.push( a,b,d); // face one
414
+ indices.push( b,c,d ); // face two
415
+ }else{
416
+ indices.push( a,b,d); // face one
417
+ indices.push( b,c,d ); // face two
418
+ // indices.push( a,d,b); // face one
419
+ // indices.push( b, d, c );
420
+ }
421
+
422
+ }
423
+ if(_n.x <= 0 ){
424
+ if(_n.y >= 0){
425
+ // indices.push( a,b,d); // face one
426
+ // indices.push( b,c,d ); //
427
+ indices.push( a,d,b); // face one
428
+ indices.push( b, d, c );
429
+ }
430
+ else{
431
+ // indices.push( a,b,d); // face one
432
+ // indices.push( b,c,d ); //
433
+ indices.push( a,d,b); // face one
434
+ indices.push( b, d, c );
435
+ }
436
+ }
437
+ }
438
+ index = index +1;
439
+ }
440
+ }
441
+ }
442
+ index = vertices.length / 3
443
+ }
444
+
445
+ }
446
+ }
447
+ setData(-1)
448
+ geometry.setIndex( indices );
449
+ geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
450
+ geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
451
+ geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3) );
452
+ geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
453
+ // geometry.computeBoundingSphere();
454
+ // geometry.computeVertexNormals();
455
+ let material = new THREE.MeshBasicMaterial( {
456
+ //side:THREE.BackSide,
457
+ // wireframe:true,
458
+ color: 0xFFFFFF,
459
+ // forceSinglePass:false,
460
+ depthWrite:false,
461
+ depthTest:false,
462
+ //transparent:true,
463
+ // opacity:this.opacity,
464
+ // opacity:1,
465
+ // shadowSide: THREE.DoubleSide,
466
+ // depthFunc:THREE.LessDepth,
467
+ // depthTest:false,
468
+ // depthWrite:false,
469
+ vertexColors: true,
470
+ // forceSinglePass:true
471
+ } );
472
+
473
+ // material.needsUpdate = true;
474
+ material.color.convertSRGBToLinear();
475
+ let mesh = new THREE.Mesh( geometry, material );
476
+ indices =[]
477
+ vertices = []
478
+ normals = []
479
+ colors = []
480
+ uvs = [];
481
+ // mesh = this.tb.Object3D({ obj: mesh, fixedZoom :15 ,anchor:'center'});
482
+ // mesh.setCoords(center)
483
+ // this.tb.renderer.outputEncoding = THREE.sRGBEncoding;
484
+ // this.tb.add(mesh);
485
+ setData(1)
486
+ let geometry2 = new THREE.BufferGeometry();
487
+ geometry2.setIndex( indices );
488
+ geometry2.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
489
+ geometry2.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
490
+ geometry2.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3) );
491
+ geometry2.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
492
+ // geometry.computeBoundingSphere();
493
+ // geometry.computeVertexNormals();
494
+ let material2 = new THREE.MeshBasicMaterial( {
495
+ // side:THREE.BackSide,
496
+ // wireframe:true,
497
+ color: 0xFFFFFF,
498
+ // forceSinglePass:false,
499
+ // depthWrite:false,
500
+ // depthTest:false,
501
+ //transparent:true,
502
+ // opacity:this.opacity,
503
+ // opacity:1,
504
+ // shadowSide: THREE.DoubleSide,
505
+ // depthFunc:THREE.LessDepth,
506
+ // depthTest:false,
507
+ // depthWrite:false,
508
+ vertexColors: true,
509
+ // forceSinglePass:true
510
+ } );
511
+ let mesh2 = new THREE.Mesh( geometry2, material2 );
512
+ // mesh2 = this.tb.Object3D({ obj: mesh2, fixedZoom :15 ,anchor:'center'});
513
+ // mesh2.setCoords(center)
514
+ // this.tb.renderer.outputEncoding = THREE.sRGBEncoding;
515
+ // this.tb.add(mesh2);
516
+ // mesh.renderOrder = 1;
517
+ // mesh = this.tb.Object3D({ obj: mesh, units: 'meters',anchor:'center'});
518
+ // this.tb.add(mesh);
519
+ this.group.add( mesh );
520
+ this.group.add( mesh2 );
521
+ this.map.fitBounds(getBBox(dataList.map(a=>[a.lng,a.lat])), {
522
+ padding: {top: 45, bottom:45, left: 35, right: 35},
523
+ maxZoom:11,
524
+ pitch:30
525
+ });
526
+ }
527
+
528
+
529
+
530
+ drawWallPoints(dataList){
531
+ this.removeObj(this.group);
532
+ let center = [dataList[0].lng,dataList[0].lat]
533
+ // let geometry = new THREE.BufferGeometry();
534
+ // let indices =[]
535
+ // let vertices = []
536
+ // let normals = [];
537
+ // let colors = []
538
+ // let uvs = [];
539
+
540
+ // let indices2 =[]
541
+ // let vertices2 = []
542
+ // let normals2 = [];
543
+ // let colors2 = []
544
+ // let uvs2 = [];
545
+ // let distance = dataList[0].distance;
546
+ // let noDataLenth = distance[0] / distance[1]
547
+ // let limitIndex = this.limit / distance[1]
548
+ // limitIndex = limitIndex >= distance[2] -1 ? distance[2] -1 : limitIndex
549
+ // // dataList = dataList.slice(0,5)
550
+ // let len = limitIndex + noDataLenth;
551
+ // let index = 0;
552
+ // const _color = new THREE.Color();
553
+ // for(let i in dataList){
554
+ // let _i = Number(i);
555
+ // let bo = i < dataList.length -1;
556
+ // let nextIndex = _i +1;
557
+ // let item = dataList[_i]
558
+ // let lng = item.lng;
559
+ // let lat = item.lat;
560
+ // let position = projectToWorld([lng,lat])
561
+ // if(bo){
562
+ // let itemN = dataList[dataList.length -1 -_i]
563
+ // let positionN = projectToWorld([itemN.lng,itemN.lat])
564
+ // let next = dataList[nextIndex]
565
+ // if(lng == next.lng && lat == next.lat){
566
+ // continue;
567
+ // }
568
+ // let nposition = projectToWorld([next.lng,next.lat])
569
+ // let x = position.x,y = position.y,z= position.z;
570
+ // let nx = nposition.x ,ny =nposition.y,nz = position.z;
571
+ // let c,_n;
572
+
573
+ // let p1 = new THREE.Vector3(x,y,z+this.scale )
574
+ // let p2 = new THREE.Vector3(x,y,z+2*this.scale)
575
+ // let p3 = new THREE.Vector3(nx,ny,nz+2*this.scale)
576
+ // const a = p2.clone().sub(p1);
577
+ // const b = p2.clone().sub(p3);
578
+ // c = a.clone().cross(b) ;
579
+ // _n= c.normalize();
580
+ // // normals.push(_n.x,_n.y,_n.z)
581
+
582
+ // for(let j in item.data){
583
+ // let h = (j * 1 +noDataLenth) * this.scale
584
+ // j = Number(j)
585
+ // if(j > -noDataLenth && j <= limitIndex){
586
+ // //let position = mapboxgl.MercatorCoordinate.fromLngLat({lng: lng, lat: lat}, (j+noDataLenth) * this.scale);
587
+ // //(Math.floor(position.x * 1000000 )/10000,(j+noDataLenth) * this.scale ,Math.floor(position.y * 1000000)/10000)
588
+ // let point = [position.x ,position.y,position.z+h ]
589
+ // let pointR = [positionN.x + _n.x+1,positionN.y + _n.y+1,positionN.z+h ]
590
+ // //正面
591
+ // vertices.push(...point)
592
+ // vertices.push(...pointR)
593
+
594
+ // //设置法线
595
+ // normals.push(_n.x,_n.y,_n.z)
596
+ // normals.push(_n.x,_n.y,_n.z)
597
+
598
+ // uvs.push(j/limitIndex);
599
+ // uvs.push(1-_i/dataList.length-1);
600
+
601
+ // // uvs.push(j)
602
+ // // uvs.push(j-0.5)
603
+ // // // debugger
604
+ // // normals.push( 1, 1, 1);
605
+ // let color = this.colorFun(item.data[j])
606
+ // _color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
607
+ // colors.push( _color.r, _color.g, _color.b );
608
+ // color = this.colorFun(itemN.data[j])
609
+ // _color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
610
+ // colors.push( _color.r, _color.g, _color.b );
611
+ // if(i < (dataList.length -2) && j< (limitIndex -1)){
612
+ // let a = index +2
613
+ // let b = index
614
+ // let c = index +len*2
615
+ // let d = index +len*2 +2
616
+
617
+ // //正
618
+ // indices.push( a,b,d); // face one
619
+ // indices.push( b, c, d );
620
+ // //背
621
+ // indices.push( a+1,b+1,d+1); // face one
622
+ // indices.push( b+1, c+1, d+1 );
623
+
624
+ // }
625
+ // index = index +2;
626
+ // }
627
+ // }
628
+ // }
629
+ // index = vertices.length / 3
630
+ // }
631
+
632
+
633
+ // geometry.setIndex( indices );
634
+ // geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
635
+ // geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
636
+ // geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3) );
637
+ // geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
638
+ // // geometry.computeBoundingSphere();
639
+ // // geometry.computeVertexNormals();
640
+ // let material = new THREE.MeshBasicMaterial( {
641
+ // color: 0xFFFFFF,
642
+ // vertexColors: true,
643
+ // // forceSinglePass:true
644
+ // } );
645
+
646
+ // // material.needsUpdate = true;
647
+ // material.color.convertSRGBToLinear();
648
+ // let mesh = new THREE.Mesh( geometry, material );
649
+ // // indices2.reverse()
650
+ // // vertices2.reverse()
651
+ // // // normals2.reverse()
652
+ // // colors2.reverse();
653
+ // // let geometry2 = new THREE.BufferGeometry();
654
+ // // geometry2.setIndex( indices2);
655
+ // // geometry2.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
656
+ // // geometry2.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals2, 3 ) );
657
+ // // geometry2.setAttribute( 'color', new THREE.Float32BufferAttribute( colors2, 3) );
658
+ // // geometry2.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
659
+ // // let material2 = new THREE.MeshBasicMaterial( {
660
+
661
+ // // color: 0xFFFFFF,
662
+ // // vertexColors: true,
663
+ // // // forceSinglePass:true
664
+ // // } );
665
+
666
+ // // let mesh2 = new THREE.Mesh( geometry2, material2 );
667
+ // // mesh.renderOrder = 1
668
+ // // mesh2.renderOrder = 0
669
+ // this.group.add( mesh );
670
+ // this.group.add( mesh2 );
671
+ // 定义路径点和墙面参数
672
+ const pathPoints = [
673
+ new THREE.Vector3(-4, 0, 0),
674
+ new THREE.Vector3(-2, 0, 2),
675
+ new THREE.Vector3(0, 0, 0),
676
+ new THREE.Vector3(2, 0, -2),
677
+ new THREE.Vector3(4, 0, 0)
678
+ ];
679
+ const wallHeight = 3;
680
+ const wallWidth = 0.5; // 新增墙面宽度参数
681
+
682
+ // 创建几何数据容器
683
+ const vertices = [];
684
+ const colors = [];
685
+ const indices = [];
686
+
687
+ // 生成双墙面几何数据
688
+ for (let i = 0; i < pathPoints.length - 1; i++) {
689
+ const p0 = pathPoints[i];
690
+ const p1 = pathPoints[i + 1];
691
+
692
+ // 计算路径方向和左右偏移量
693
+ const dir = new THREE.Vector3().subVectors(p1, p0);
694
+ const leftOffset = new THREE.Vector3(-dir.z, 0, dir.x)
695
+ .normalize()
696
+ .multiplyScalar(wallWidth/2);
697
+
698
+ // 生成左右墙面的八个顶点
699
+ const createWallVertices = (offset) => [
700
+ new THREE.Vector3(p0.x, wallHeight/2, p0.z).add(offset), // 左上
701
+ new THREE.Vector3(p0.x, -wallHeight/2, p0.z).add(offset), // 左下
702
+ new THREE.Vector3(p1.x, -wallHeight/2, p1.z).add(offset), // 右下
703
+ new THREE.Vector3(p1.x, wallHeight/2, p1.z).add(offset) // 右上
704
+ ];
705
+
706
+ // 左墙面顶点
707
+ const leftVertices = createWallVertices(leftOffset);
708
+ // 右墙面顶点(反向偏移)
709
+ const rightVertices = createWallVertices(leftOffset.clone().negate());
710
+
711
+ // 合并顶点数据
712
+ const allVertices = [...leftVertices, ...rightVertices];
713
+ allVertices.forEach(v => vertices.push(v.x, v.z,v.y));
714
+
715
+ // 为左右墙面生成不同颜色
716
+ const colorsLeft = new THREE.Color().setHSL(Math.random(), 0.8, 0.6);
717
+ const colorsRight = new THREE.Color().setHSL(Math.random(), 0.8, 0.6);
718
+
719
+ // 添加颜色数据(每个墙面4个顶点)
720
+ for (let j = 0; j < 4; j++) colors.push(...[colorsLeft.r, colorsLeft.g, colorsLeft.b]);
721
+ for (let j = 0; j < 4; j++) colors.push(...[colorsRight.r, colorsRight.g, colorsRight.b]);
722
+
723
+ // 构建索引数据
724
+ const base = i * 8; // 每段8个顶点
725
+ indices.push(
726
+ // 左墙面
727
+ base, base+1, base+2, // 下三角形
728
+ base, base+2, base+3, // 上三角形
729
+ // 右墙面
730
+ base+4, base+6,base+5, // 下三角形
731
+ base+4, base+7 ,base+6 // 上三角形
732
+ );
733
+ }
734
+
735
+ // 创建BufferGeometry并设置属性
736
+ const geometry = new THREE.BufferGeometry();
737
+ geometry.setAttribute(
738
+ 'position',
739
+ new THREE.BufferAttribute(new Float32Array(vertices), 3)
740
+ );
741
+ geometry.setAttribute(
742
+ 'color',
743
+ new THREE.BufferAttribute(new Float32Array(colors), 3)
744
+ );
745
+ geometry.setIndex(indices);
746
+
747
+ // 创建材质和网格对象
748
+ const material = new THREE.MeshBasicMaterial({
749
+ vertexColors: true,
750
+ side: THREE.FrontSide // 单面材质
751
+ });
752
+ let wall = new THREE.Mesh(geometry, material);
753
+ wall = this.tb.Object3D({ obj: wall, fixedZoom :15 ,anchor:'center'})
754
+ wall.setCoords(center)
755
+ this.tb.add(wall);
756
+ this.map.fitBounds(getBBox(dataList.map(a=>[a.lng,a.lat])), {
757
+ padding: {top: 45, bottom:45, left: 35, right: 35},
758
+ maxZoom:11,
759
+ pitch:30
760
+ });
761
+ }
762
+
763
+
764
+
765
+
766
+ removeObj = (obj) => {
767
+ const clearCache = (item) => {
768
+ item.geometry.dispose();
769
+ item.material.dispose();
770
+ };
771
+ let arr = obj.children.filter((x) =>!! x);
772
+ arr.forEach((item) => {
773
+ if (item.children.length) {
774
+ removeObj(item);
775
+ } else {
776
+ clearCache(item);
777
+ item.clear();
778
+ }
779
+ });
780
+ obj.clear();
781
+ arr = null;
782
+ };
783
+
784
+ drawWall(dataList){
785
+ this.removeObj(this.group);
786
+ let center = [dataList[0].lng,dataList[0].lat]
787
+ let geometry = new THREE.BufferGeometry();
788
+ let indices =[]
789
+ let vertices = []
790
+ let normals = [];
791
+ let colors = []
792
+ let uvs = [];
793
+ let distance = dataList[0].distance;
794
+ let noDataLenth = distance[0] / distance[1]
795
+ let limitIndex = this.limit / distance[1]
796
+ limitIndex = limitIndex >= distance[2] -1 ? distance[2] -1 : limitIndex
797
+ // dataList = dataList.slice(0,5)
798
+ let len = limitIndex + noDataLenth;
799
+ let index = 0;
800
+ const _color = new THREE.Color();
801
+ for(let i in dataList){
802
+ i = Number(i)
803
+ let item = dataList[i]
804
+ let lng = item.lng;
805
+ let lat = item.lat;
806
+ let position = projectToWorld([lng,lat])
807
+ if(i < dataList.length -1){
808
+ let next = dataList[i+1]
809
+ if(lng == next.lng && lat == next.lat){
810
+ continue;
811
+ }
812
+ }
813
+
814
+ for(let j in item.data){
815
+ j = Number(j)
816
+ let indexJ = j+noDataLenth-1;
817
+ if(j > -noDataLenth && j <= limitIndex){
818
+ //let position = mapboxgl.MercatorCoordinate.fromLngLat({lng: lng, lat: lat}, (j+noDataLenth) * this.scale);
819
+ //(Math.floor(position.x * 1000000 )/10000,(j+noDataLenth) * this.scale ,Math.floor(position.y * 1000000)/10000)
820
+ vertices.push(position.x ,position.y,position.z+(j+noDataLenth) * this.scale )
821
+ // uvs.push(j)
822
+ // uvs.push(j-0.5)
823
+ // // debugger
824
+ // normals.push( 1, 1, 1);
825
+ let color = this.colorFun(item.data[j])
826
+ _color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
827
+ colors.push( _color.r, _color.g, _color.b );
828
+ if(i < (dataList.length -2) && j< (limitIndex -1)){
829
+ let cb = new THREE.Vector3();//方向向量
830
+ let ab = new THREE.Vector3();
831
+ let a = index +1
832
+ let b = index
833
+ let c = index +len
834
+ let d = index +len +1
835
+ let pA = new THREE.Vector3(vertices[a],vertices[a+1],vertices[a+2]);
836
+ let pB = new THREE.Vector3(vertices[b],vertices[b+1],vertices[b+2]);
837
+ let pC = new THREE.Vector3(vertices[c],vertices[c+1],vertices[c+2]);
838
+ let pD = new THREE.Vector3(vertices[d],vertices[d+1],vertices[d+2]);
839
+ cb.subVectors(pC,pB)
840
+ ab.subVectors(pA,pB)
841
+ cb.cross(ab)
842
+ cb.normalize();
843
+ normals.push(cb.x,cb.y,cb.z)
844
+ normals.push(cb.x,cb.y,cb.z)
845
+ indices.push( a,b,d); // face one
846
+ indices.push( b, c, d ); // face two
847
+ index = index +1;
848
+ }
849
+ }
850
+ }
851
+ index = vertices.length / 3
852
+ }
853
+ geometry.setIndex( indices );
854
+ geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
855
+ geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
856
+ geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3) );
857
+ // geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
858
+ geometry.computeBoundingSphere();
859
+ geometry.computeVertexNormals();
860
+ let material = new THREE.MeshBasicMaterial( {
861
+ // wireframe:true,
862
+ color: 0xFFFFFF,
863
+ // forceSinglePass:false,
864
+ // depthWrite:false,
865
+ // depthTest:false,
866
+ //transparent:true,
867
+ // opacity:this.opacity,
868
+ // opacity:1,
869
+ // shadowSide: THREE.DoubleSide,
870
+ // depthFunc:THREE.LessDepth,
871
+ // depthTest:false,
872
+ // depthWrite:false,
873
+ vertexColors: true,
874
+ // forceSinglePass:true
875
+ } );
876
+
877
+ // material.needsUpdate = true;
878
+ material.color.convertSRGBToLinear();
879
+ let mesh = new THREE.Mesh( geometry, material );
880
+ mesh = this.tb.Object3D({ obj: mesh, fixedZoom :15 ,anchor:'center'});
881
+ mesh.setCoords(center)
882
+ this.tb.renderer.outputEncoding = THREE.sRGBEncoding;
883
+ this.tb.add(mesh);
884
+ // mesh.renderOrder = 1;
885
+ // mesh = this.tb.Object3D({ obj: mesh, units: 'meters',anchor:'center'});
886
+ // this.tb.add(mesh);
887
+ // this.group.add( mesh );
888
+ this.map.fitBounds(getBBox(dataList.map(a=>[a.lng,a.lat])), {
889
+ padding: {top: 45, bottom:45, left: 35, right: 35},
890
+ maxZoom:11,
891
+ pitch:30
892
+ });
893
+
894
+ }
895
+
896
+ drawWallTest(dataList){
897
+ let geometry = new THREE.BufferGeometry();
898
+ let indices =[]
899
+ let vertices = []
900
+ let normals = [];
901
+ let colors = []
902
+ let size = 20;
903
+ let segments = 10;
904
+
905
+ let halfSize = size / 2;
906
+ let segmentSize = size / segments;
907
+
908
+ let _color = new THREE.Color();
909
+
910
+ // generate vertices, normals and color data for a simple grid geometry
911
+
912
+ for ( let i = 0; i <= segments; i ++ ) {
913
+
914
+ let y = ( i * segmentSize ) - halfSize;
915
+
916
+ for ( let j = 0; j <= segments; j ++ ) {
917
+
918
+ let x = ( j * segmentSize ) - halfSize;
919
+
920
+ vertices.push( x, - y, 0 );
921
+ normals.push( 0, 0, 1 );
922
+
923
+ let r = ( x / size ) + 0.5;
924
+ let g = ( y / size ) + 0.5;
925
+
926
+ _color.setRGB( r, g, 1, THREE.SRGBColorSpace );
927
+
928
+ colors.push( _color.r, _color.g, _color.b );
929
+
930
+ }
931
+
932
+ }
933
+
934
+ // generate indices (data for element array buffer)
935
+
936
+ for ( let i = 0; i < segments; i ++ ) {
937
+
938
+ for ( let j = 0; j < segments; j ++ ) {
939
+
940
+ let a = i * ( segments + 1 ) + ( j + 1 );
941
+ let b = i * ( segments + 1 ) + j;
942
+ let c = ( i + 1 ) * ( segments + 1 ) + j;
943
+ let d = ( i + 1 ) * ( segments + 1 ) + ( j + 1 );
944
+
945
+ // generate two faces (triangles) per iteration
946
+
947
+ indices.push( a, b, d ); // face one
948
+ indices.push( b, c, d ); // face two
949
+
950
+ }
951
+
952
+ }
953
+
954
+ //
955
+
956
+ geometry.setIndex( indices );
957
+ geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
958
+ geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
959
+ geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
960
+
961
+ let material = new THREE.MeshBasicMaterial( {
962
+ // side: THREE.DoubleSide,
963
+ vertexColors: true
964
+ } );
965
+
966
+ let mesh = new THREE.Mesh( geometry, material );
967
+ this.scene.add( mesh );
968
+ // mesh = this.tb.Object3D({ obj: mesh, units: 'meters',anchor:'center'});
969
+ // this.tb.add(mesh);
970
+ // for(let line of lines){
971
+ // this.createLine(line.coords,`rgba(${line.color.join(',')})`)
972
+ // }
973
+ }
974
+
975
+ createLine(path,color){
976
+ let line = this.tb.line({
977
+ width:this.width,
978
+ opacity:this.opacity,
979
+ color:color,
980
+ geometry:path
981
+ })
982
+ this.tb.add(line)
983
+ }
984
+
985
+ onAdd(map, gl) {
986
+ this.map = map;
987
+ let container = map.getCanvas();
988
+ const w = container.clientWidth;
989
+ const h = container.clientHeight;
990
+ this.camera = new THREE.PerspectiveCamera(map.transform.fov, w / h, 0.1, 1);
991
+ this.scene = new THREE.Scene();
992
+ this.scene.add(this.group)
993
+ // new CameraSync(this.map, this.camera, this.group);
994
+ // // let centerlngLat = map.getCenter()
995
+ // // let center = mapboxgl.MercatorCoordinate.fromLngLat(centerlngLat)
996
+ // // const scale = center.meterInMercatorCoordinateUnits();
997
+ // // //this.scale = scale;
998
+ // // let {x,y,z} = center;
999
+ // // const modelRotate = [Math.PI / 2, 0, 0];
1000
+
1001
+
1002
+ // // cameraTransform = new THREE.Matrix4()
1003
+ // // .makeTranslation(
1004
+ // // x,
1005
+ // // y,
1006
+ // // z
1007
+ // // )
1008
+ // // .scale(
1009
+ // // new THREE.Vector3(
1010
+ // // scale,
1011
+ // // -scale,
1012
+ // // scale
1013
+ // // )
1014
+ // // )
1015
+ // // .multiply( new THREE.Matrix4().makeRotationAxis(
1016
+ // // new THREE.Vector3(1, 0, 0),
1017
+ // // modelRotate[0]
1018
+ // // ))
1019
+ // // .multiply(new THREE.Matrix4().makeRotationAxis(
1020
+ // // new THREE.Vector3(0, 1, 0),
1021
+ // // modelRotate[1]
1022
+ // // ))
1023
+ // // .multiply(new THREE.Matrix4().makeRotationAxis(
1024
+ // // new THREE.Vector3(0, 0, 1),
1025
+ // // modelRotate[2]
1026
+ // // ));
1027
+ // // create two three.js lights to illuminate the model
1028
+ // // let directionalLight = new THREE.DirectionalLight(0xffffff);
1029
+ // // directionalLight.position.set(0, -70, 100).normalize();
1030
+ // // this.scene.add(directionalLight);
1031
+
1032
+ // // let directionalLight2 = new THREE.DirectionalLight(0xffffff);
1033
+ // // directionalLight2.position.set(0, 70, 100).normalize();
1034
+ // // this.scene.add(directionalLight2);
1035
+ // // this.tb = new Threebox(
1036
+ // // map,
1037
+ // // gl, //get the context from Mapbox
1038
+ // // { defaultLights: true ,passiveRendering:false}
1039
+ // // );
1040
+ this.scene.add(new THREE.AxesHelper(1000));
1041
+ // // this.scene.add(new THREE.CameraHelper( this.camera ));
1042
+ // // var ambient = new THREE.AmbientLight(0x444444);
1043
+ // // this.scene.add(ambient);
1044
+ this.renderer = new THREE.WebGLRenderer({
1045
+ canvas: map.getCanvas(),
1046
+ context: gl,
1047
+ logarithmicDepthBuffer: true,
1048
+ antialias: true
1049
+ });
1050
+ this.renderer.outputEncoding = THREE.sRGBEncoding;
1051
+
1052
+ this.renderer.autoClear = false;
1053
+ this.tb = new Threebox(
1054
+ map,
1055
+ gl, //get the context from Mapbox
1056
+ { defaultLights: true ,passiveRendering:false}
1057
+ );
1058
+ if(this.addedFun)
1059
+ this.addedFun()
1060
+ }
1061
+
1062
+ render(gl, matrix) {
1063
+ this.tb.update();
1064
+ // const rotationX = new THREE.Matrix4().makeRotationAxis(
1065
+ // new THREE.Vector3(1, 0, 0),
1066
+ // modelTransform.rotateX
1067
+ // );
1068
+ // const rotationY = new THREE.Matrix4().makeRotationAxis(
1069
+ // new THREE.Vector3(0, 1, 0),
1070
+ // modelTransform.rotateY
1071
+ // );
1072
+ // const rotationZ = new THREE.Matrix4().makeRotationAxis(
1073
+ // new THREE.Vector3(0, 0, 1),
1074
+ // modelTransform.rotateZ
1075
+ // );
1076
+
1077
+ // const m = new THREE.Matrix4().fromArray(matrix);
1078
+ // const l = new THREE.Matrix4()
1079
+ // .makeTranslation(
1080
+ // modelTransform.translateX,
1081
+ // modelTransform.translateY,
1082
+ // modelTransform.translateZ
1083
+ // )
1084
+ // .scale(
1085
+ // new THREE.Vector3(
1086
+ // modelTransform.scale,
1087
+ // -modelTransform.scale,
1088
+ // modelTransform.scale
1089
+ // )
1090
+ // )
1091
+ // .multiply(rotationX)
1092
+ // .multiply(rotationY)
1093
+ // .multiply(rotationZ);
1094
+
1095
+ //this.camera.projectionMatrix = m.multiply(l);
1096
+ // var m = new THREE.Matrix4().fromArray(matrix);
1097
+ // this.camera.projectionMatrix = m.multiply(cameraTransform);;
1098
+ this.renderer.resetState();
1099
+
1100
+ this.renderer.render(this.scene, this.camera);
1101
+ this.map.triggerRepaint();
1102
+ }
1103
+
1104
+ }