@ohuoy/easymap 1.0.22 → 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/dist/bundle.js +79 -46
- package/dist/example - /345/211/257/346/234/254/bundle.js" +79 -46
- package/dist/example - /345/211/257/346/234/254/index.html" +33 -3
- package/index.js +192 -6
- package/lib/threebox-plugin/src/three.module.js +1 -0
- package/package.json +2 -2
- package/src/components/EasyMapMarker.js +7 -3
- package/src/components/control/TilesBar.js +87 -12
- package/src/components/control/Toobars.js +63 -24
- package/src/components/index.js +9 -2
- package/src/components/layer/AnimationBarbsLayer.js +1 -1
- package/src/components/layer/AnimationLayer.js +26 -12
- package/src/components/layer/PathLineLayer.js +23 -8
- package/src/components/layer/ScanWallLayer.js +467 -0
- package/src/components/layer/ThreeBoxWallLayer.js +253 -0
- package/src/components/layer/ThreeScanLayer.js +28 -9
- package/src/components/layer/ThreeWallLayer copy 2.js +1104 -0
- package/src/components/layer/ThreeWallLayer copy.js +517 -0
- package/src/components/layer/ThreeWallLayer.js +221 -250
- package/src/components/layer/WallLayer.js +3 -2
- package/src/components/layer/WebGlWallLayer.js +320 -0
- package/src/components/mapOutScreen.js +15 -3
- package/src/utils/CameraSync.js +6 -3
- package/src/utils/mapWatch.js +70 -0
- package/src/utils/util.js +3 -0
|
@@ -30,301 +30,269 @@ export default class ThreeWallLayer{
|
|
|
30
30
|
this.addedFun = config.addedFun
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
drawWall(dataList){
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
drawWall(dataList,offx = 0,offy = 0,r = false){
|
|
35
|
+
this.removeObj(this.group);
|
|
36
|
+
let geometry = new THREE.BufferGeometry();
|
|
37
|
+
// let geometryList = []
|
|
36
38
|
let indices =[]
|
|
37
|
-
let vertices = [
|
|
38
|
-
// 82.71083,
|
|
39
|
-
// 2,
|
|
40
|
-
// 40.68735,
|
|
41
|
-
|
|
42
|
-
// 82.71083,
|
|
43
|
-
// 4,
|
|
44
|
-
// 40.68735,
|
|
45
|
-
|
|
46
|
-
// 82.71083,
|
|
47
|
-
// 6,
|
|
48
|
-
// 40.68735,
|
|
49
|
-
|
|
50
|
-
// 82.42999,
|
|
51
|
-
// 2,
|
|
52
|
-
// 40.58893,
|
|
53
|
-
|
|
54
|
-
// 82.42999,
|
|
55
|
-
// 4,
|
|
56
|
-
// 40.58893,
|
|
57
|
-
|
|
58
|
-
// 82.42999,
|
|
59
|
-
// 6,
|
|
60
|
-
// 40.58893,
|
|
61
|
-
|
|
62
|
-
// 82.3689,
|
|
63
|
-
// 2,
|
|
64
|
-
// 40.79668,
|
|
65
|
-
|
|
66
|
-
// 82.3689,
|
|
67
|
-
// 4,
|
|
68
|
-
// 40.79668,
|
|
69
|
-
|
|
70
|
-
// 82.3689,
|
|
71
|
-
// 6,
|
|
72
|
-
// 40.79668,
|
|
73
|
-
|
|
74
|
-
// 82.30361,
|
|
75
|
-
// 2,
|
|
76
|
-
// 40.76822,
|
|
77
|
-
|
|
78
|
-
// 82.30361,
|
|
79
|
-
// 4,
|
|
80
|
-
// 40.76822,
|
|
81
|
-
|
|
82
|
-
// 82.30361,
|
|
83
|
-
// 6,
|
|
84
|
-
// 40.76822,
|
|
85
|
-
|
|
86
|
-
// 82.15195,
|
|
87
|
-
// 2,
|
|
88
|
-
// 40.261634,
|
|
89
|
-
|
|
90
|
-
// 82.15195,
|
|
91
|
-
// 4,
|
|
92
|
-
// 40.261634,
|
|
93
|
-
|
|
94
|
-
// 82.15195,
|
|
95
|
-
// 6,
|
|
96
|
-
// 40.261634
|
|
97
|
-
]
|
|
39
|
+
let vertices = []
|
|
98
40
|
let normals = [];
|
|
99
41
|
let colors = []
|
|
42
|
+
let uvs = [];
|
|
100
43
|
let distance = dataList[0].distance;
|
|
101
44
|
let noDataLenth = distance[0] / distance[1]
|
|
102
|
-
let limitIndex = this.limit / distance[1]
|
|
45
|
+
let limitIndex = Math.floor(this.limit / distance[1])
|
|
103
46
|
limitIndex = limitIndex >= distance[2] -1 ? distance[2] -1 : limitIndex
|
|
104
|
-
dataList = dataList
|
|
47
|
+
// dataList = dataList.slice(0,5)
|
|
105
48
|
let len = limitIndex + noDataLenth;
|
|
106
49
|
let index = 0;
|
|
107
50
|
const _color = new THREE.Color();
|
|
51
|
+
let positionList = [];
|
|
52
|
+
|
|
108
53
|
for(let i in dataList){
|
|
109
|
-
|
|
110
|
-
let
|
|
54
|
+
let _i = Number(i);
|
|
55
|
+
let bo = i < dataList.length -1;
|
|
56
|
+
let nextIndex = _i +1;
|
|
57
|
+
let item = dataList[_i]
|
|
111
58
|
let lng = item.lng;
|
|
112
59
|
let lat = item.lat;
|
|
113
|
-
let position = projectToWorld([lng,lat])
|
|
114
|
-
|
|
115
|
-
|
|
60
|
+
let position = projectToWorld([lng,lat])
|
|
61
|
+
// let position = mapboxgl.MercatorCoordinate.fromLngLat({lng:item.lng,lat:item.lat})
|
|
62
|
+
if(bo){
|
|
63
|
+
let next = dataList[nextIndex]
|
|
116
64
|
if(lng == next.lng && lat == next.lat){
|
|
117
65
|
continue;
|
|
118
66
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
67
|
+
let nposition = projectToWorld([next.lng,next.lat])
|
|
68
|
+
let x = position.x,y = position.y,z= position.z;
|
|
69
|
+
|
|
70
|
+
let nx = nposition.x ,ny =nposition.y,nz = position.z;
|
|
71
|
+
let c,_n;
|
|
72
|
+
positionList.push(position)
|
|
73
|
+
|
|
74
|
+
let p1 = new THREE.Vector3(x,y,z+this.scale )
|
|
75
|
+
let p2 = new THREE.Vector3(x,y,z+2*this.scale)
|
|
76
|
+
let p3 = new THREE.Vector3(nx,ny,nz+2*this.scale)
|
|
77
|
+
const a = p2.clone().sub(p1);
|
|
78
|
+
const b = p2.clone().sub(p3);
|
|
79
|
+
c = a.clone().cross(b) ;
|
|
80
|
+
_n= c.normalize();
|
|
81
|
+
// normals.push(_n.x,_n.y,_n.z)
|
|
82
|
+
// let arrowHelper = new THREE.ArrowHelper( new THREE.Vector3(_n.x, _n.y, _n.z), new THREE.Vector3( 0, 0, 0 ), 100, 0xffff00 );
|
|
83
|
+
// this.scene.add(arrowHelper)
|
|
84
|
+
// console.log(_n)
|
|
85
|
+
for(let j in item.data){
|
|
86
|
+
let h = (j * 1 -1 +noDataLenth) * this.scale
|
|
87
|
+
j = Number(j)
|
|
88
|
+
if(j > -noDataLenth && j <= limitIndex){
|
|
89
|
+
//let position = mapboxgl.MercatorCoordinate.fromLngLat({lng: lng, lat: lat}, (j+noDataLenth) * this.scale);
|
|
90
|
+
//(Math.floor(position.x * 1000000 )/10000,(j+noDataLenth) * this.scale ,Math.floor(position.y * 1000000)/10000)
|
|
91
|
+
let point = [position.x + offx, position.y +offy ,position.z+h]
|
|
92
|
+
this.point = point
|
|
93
|
+
//正面
|
|
94
|
+
vertices.push(...point)
|
|
95
|
+
|
|
96
|
+
//设置法线
|
|
97
|
+
normals.push(_n.x,_n.z,_n.y)
|
|
98
|
+
uvs.push(j/limitIndex);
|
|
99
|
+
uvs.push(1-_i/dataList.length-1);
|
|
100
|
+
|
|
101
|
+
// uvs.push(j)
|
|
102
|
+
// uvs.push(j-0.5)
|
|
103
|
+
// // debugger
|
|
104
|
+
// normals.push( 1, 1, 1);
|
|
105
|
+
let color = this.colorFun(item.data[j])
|
|
106
|
+
_color.setRGB( color[0]/255, color[1]/255, color[2]/255, THREE.SRGBColorSpace );
|
|
107
|
+
colors.push( _color.r, _color.g, _color.b);
|
|
108
|
+
if(i < (dataList.length -2) && j< (limitIndex -1)){
|
|
109
|
+
let a = index
|
|
110
|
+
let b = index +1
|
|
111
|
+
let c = index +len
|
|
112
|
+
let d = index +len +1
|
|
113
|
+
// if(_n.x < 0 && _n.y > 0){
|
|
114
|
+
|
|
115
|
+
// // indices.push(a, b, c);
|
|
116
|
+
// // indices.push(c, b,d);
|
|
117
|
+
// }
|
|
118
|
+
// else if(_n.x > 0 && _n.y > 0){
|
|
119
|
+
// // indices.push( b, c,a);
|
|
120
|
+
// // indices.push( b,d,c);
|
|
121
|
+
// indices.push(c, a, b);
|
|
122
|
+
// indices.push( d,c,b);
|
|
123
|
+
// }
|
|
124
|
+
// else{
|
|
125
|
+
// // indices.push(a, c, b);
|
|
126
|
+
// // indices.push(c, d,b);
|
|
127
|
+
|
|
128
|
+
// }
|
|
129
|
+
//正
|
|
130
|
+
if(r){
|
|
131
|
+
indices.push( b,d,a); // face one
|
|
132
|
+
indices.push( a, d, c );
|
|
133
|
+
}else{
|
|
134
|
+
indices.push( b,a,d); // face one
|
|
135
|
+
indices.push( a, c, d );
|
|
136
|
+
}
|
|
137
|
+
// indices.push( b,d,a); // face one
|
|
138
|
+
// indices.push( a, d, c );
|
|
139
|
+
|
|
140
|
+
// geometry.addGroup(b,6,0)
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
index = index +1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
index = vertices.length / 3
|
|
146
148
|
}
|
|
149
|
+
|
|
150
|
+
|
|
147
151
|
geometry.setIndex( indices );
|
|
148
|
-
geometry.setAttribute( 'position', new THREE.
|
|
149
|
-
geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
|
|
150
|
-
geometry.setAttribute( 'color', new THREE.
|
|
152
|
+
geometry.setAttribute( 'position', new THREE.BufferAttribute(new Float32Array(vertices), 3));
|
|
153
|
+
// geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
|
|
154
|
+
geometry.setAttribute( 'color', new THREE.BufferAttribute(new Float32Array(colors), 3) );
|
|
155
|
+
|
|
156
|
+
geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
|
|
157
|
+
geometry.computeBoundingSphere();
|
|
158
|
+
geometry.computeVertexNormals();
|
|
151
159
|
let material = new THREE.MeshBasicMaterial( {
|
|
160
|
+
vertexColors: true,
|
|
152
161
|
side: THREE.DoubleSide,
|
|
153
|
-
transparent:true,
|
|
154
|
-
|
|
162
|
+
transparent: true,
|
|
163
|
+
opacity: this.opacity,
|
|
164
|
+
depthWrite: false, // 关闭深度写入,避免透明物体干扰
|
|
165
|
+
depthTest: true,
|
|
166
|
+
// polygonOffset: true, // 启用深度偏移
|
|
167
|
+
// polygonOffsetFactor: 1, // 偏移系数,正值将物体"推近"相机
|
|
168
|
+
// polygonOffsetUnits: 1
|
|
155
169
|
} );
|
|
156
|
-
|
|
170
|
+
|
|
171
|
+
// const material = new THREE.MeshPhongMaterial({
|
|
172
|
+
// vertexColors: true,
|
|
173
|
+
// side: THREE.DoubleSide,
|
|
174
|
+
// transparent: true,
|
|
175
|
+
// opacity: this.opacity,
|
|
176
|
+
// depthWrite: true,
|
|
177
|
+
// depthTest: true,
|
|
178
|
+
// polygonOffset: true, // 启用深度偏移
|
|
179
|
+
// polygonOffsetFactor: 1, // 偏移系数,正值将物体"推近"相机
|
|
180
|
+
// polygonOffsetUnits: 1
|
|
181
|
+
// });
|
|
182
|
+
|
|
183
|
+
// const shader = {
|
|
184
|
+
// vertexShader: `
|
|
185
|
+
// ${THREE.ShaderChunk.common}
|
|
186
|
+
// ${THREE.ShaderChunk.logdepthbuf_pars_vertex}
|
|
187
|
+
// attribute vec3 color;
|
|
188
|
+
// varying vec3 v_color;
|
|
189
|
+
// void main() {
|
|
190
|
+
// gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
191
|
+
// v_color = color;
|
|
192
|
+
// ${THREE.ShaderChunk.logdepthbuf_vertex}
|
|
193
|
+
// }
|
|
194
|
+
// `,
|
|
195
|
+
// fragmentShader: `
|
|
196
|
+
// ${THREE.ShaderChunk.logdepthbuf_pars_fragment}
|
|
197
|
+
// varying vec3 v_color;
|
|
198
|
+
// void main() {
|
|
199
|
+
// float depth = gl_FragCoord.z;
|
|
200
|
+
// gl_FragColor = vec4(vec3(depth), 1.0);
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
// }
|
|
204
|
+
// `,
|
|
205
|
+
// };
|
|
206
|
+
// gl_FragDepth = 1.0 /gl_FragCoord.y;
|
|
207
|
+
// gl_FragColor = vec4(v_color,1);
|
|
208
|
+
// #gl_FragDepth = gl_FragCoord.x * -1.0;
|
|
209
|
+
// const material = new THREE.ShaderMaterial({
|
|
210
|
+
// ...shader,
|
|
211
|
+
|
|
212
|
+
// depthTest: true,
|
|
213
|
+
// depthWrite:true,
|
|
214
|
+
// transparent: true,
|
|
215
|
+
// side:THREE.DoubleSide,
|
|
216
|
+
// });
|
|
217
|
+
|
|
218
|
+
// material.needsUpdate = true;
|
|
219
|
+
// material.color.convertSRGBToLinear();
|
|
157
220
|
let mesh = new THREE.Mesh( geometry, material );
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.group.add( mesh );
|
|
221
|
+
this.group.add( mesh );
|
|
222
|
+
// 定义路径点和墙面参数
|
|
161
223
|
this.map.fitBounds(getBBox(dataList.map(a=>[a.lng,a.lat])), {
|
|
162
224
|
padding: {top: 45, bottom:45, left: 35, right: 35},
|
|
163
225
|
maxZoom:11,
|
|
164
226
|
pitch:30
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
drawWallTest(dataList){
|
|
170
|
-
let geometry = new THREE.BufferGeometry();
|
|
171
|
-
let indices =[]
|
|
172
|
-
let vertices = []
|
|
173
|
-
let normals = [];
|
|
174
|
-
let colors = []
|
|
175
|
-
let size = 20;
|
|
176
|
-
let segments = 10;
|
|
177
|
-
|
|
178
|
-
let halfSize = size / 2;
|
|
179
|
-
let segmentSize = size / segments;
|
|
180
|
-
|
|
181
|
-
let _color = new THREE.Color();
|
|
182
|
-
|
|
183
|
-
// generate vertices, normals and color data for a simple grid geometry
|
|
184
|
-
|
|
185
|
-
for ( let i = 0; i <= segments; i ++ ) {
|
|
186
|
-
|
|
187
|
-
let y = ( i * segmentSize ) - halfSize;
|
|
188
|
-
|
|
189
|
-
for ( let j = 0; j <= segments; j ++ ) {
|
|
190
|
-
|
|
191
|
-
let x = ( j * segmentSize ) - halfSize;
|
|
192
|
-
|
|
193
|
-
vertices.push( x, - y, 0 );
|
|
194
|
-
normals.push( 0, 0, 1 );
|
|
195
|
-
|
|
196
|
-
let r = ( x / size ) + 0.5;
|
|
197
|
-
let g = ( y / size ) + 0.5;
|
|
198
|
-
|
|
199
|
-
_color.setRGB( r, g, 1, THREE.SRGBColorSpace );
|
|
200
|
-
|
|
201
|
-
colors.push( _color.r, _color.g, _color.b );
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// generate indices (data for element array buffer)
|
|
208
|
-
|
|
209
|
-
for ( let i = 0; i < segments; i ++ ) {
|
|
210
|
-
|
|
211
|
-
for ( let j = 0; j < segments; j ++ ) {
|
|
212
|
-
|
|
213
|
-
let a = i * ( segments + 1 ) + ( j + 1 );
|
|
214
|
-
let b = i * ( segments + 1 ) + j;
|
|
215
|
-
let c = ( i + 1 ) * ( segments + 1 ) + j;
|
|
216
|
-
let d = ( i + 1 ) * ( segments + 1 ) + ( j + 1 );
|
|
217
|
-
|
|
218
|
-
// generate two faces (triangles) per iteration
|
|
219
|
-
|
|
220
|
-
indices.push( a, b, d ); // face one
|
|
221
|
-
indices.push( b, c, d ); // face two
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
geometry.setIndex( indices );
|
|
230
|
-
geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
|
|
231
|
-
geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
|
|
232
|
-
geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
|
|
233
|
-
|
|
234
|
-
let material = new THREE.MeshPhongMaterial( {
|
|
235
|
-
side: THREE.DoubleSide,
|
|
236
|
-
vertexColors: true
|
|
237
|
-
} );
|
|
227
|
+
});
|
|
228
|
+
}
|
|
238
229
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// for(let line of lines){
|
|
244
|
-
// this.createLine(line.coords,`rgba(${line.color.join(',')})`)
|
|
245
|
-
// }
|
|
230
|
+
drawWallPoints(dataList){
|
|
231
|
+
// this.drawWall(dataList)
|
|
232
|
+
this.drawWall(dataList)
|
|
233
|
+
// this.drawWall(dataList.reverse(),-100,100,true)
|
|
246
234
|
}
|
|
247
235
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
geometry
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
removeObj = (obj) => {
|
|
240
|
+
const clearCache = (item) => {
|
|
241
|
+
item.geometry.dispose();
|
|
242
|
+
item.material.dispose();
|
|
243
|
+
};
|
|
244
|
+
let arr = obj.children.filter((x) =>!! x);
|
|
245
|
+
arr.forEach((item) => {
|
|
246
|
+
if (item.children.length) {
|
|
247
|
+
removeObj(item);
|
|
248
|
+
} else {
|
|
249
|
+
clearCache(item);
|
|
250
|
+
item.clear();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
obj.clear();
|
|
254
|
+
arr = null;
|
|
255
|
+
};
|
|
257
256
|
|
|
258
257
|
onAdd(map, gl) {
|
|
259
258
|
this.map = map;
|
|
260
259
|
let container = map.getCanvas();
|
|
261
260
|
const w = container.clientWidth;
|
|
262
261
|
const h = container.clientHeight;
|
|
263
|
-
this.camera = new THREE.PerspectiveCamera(map.transform.fov, w / h, 0.1,
|
|
262
|
+
this.camera = new THREE.PerspectiveCamera(map.transform.fov, w / h, 0.1, 1000);
|
|
264
263
|
this.scene = new THREE.Scene();
|
|
265
|
-
this.scene.add(this.group)
|
|
264
|
+
this.scene.add(this.group)
|
|
266
265
|
new CameraSync(this.map, this.camera, this.group);
|
|
267
|
-
// let centerlngLat = map.getCenter()
|
|
268
|
-
// let center = mapboxgl.MercatorCoordinate.fromLngLat(centerlngLat)
|
|
269
|
-
// const scale = center.meterInMercatorCoordinateUnits();
|
|
270
|
-
// //this.scale = scale;
|
|
271
|
-
// let {x,y,z} = center;
|
|
272
|
-
// const modelRotate = [Math.PI / 2, 0, 0];
|
|
273
|
-
|
|
274
266
|
|
|
275
|
-
//
|
|
276
|
-
// .
|
|
277
|
-
// x,
|
|
278
|
-
// y,
|
|
279
|
-
// z
|
|
280
|
-
// )
|
|
281
|
-
// .scale(
|
|
282
|
-
// new THREE.Vector3(
|
|
283
|
-
// scale,
|
|
284
|
-
// -scale,
|
|
285
|
-
// scale
|
|
286
|
-
// )
|
|
287
|
-
// )
|
|
288
|
-
// .multiply( new THREE.Matrix4().makeRotationAxis(
|
|
289
|
-
// new THREE.Vector3(1, 0, 0),
|
|
290
|
-
// modelRotate[0]
|
|
291
|
-
// ))
|
|
292
|
-
// .multiply(new THREE.Matrix4().makeRotationAxis(
|
|
293
|
-
// new THREE.Vector3(0, 1, 0),
|
|
294
|
-
// modelRotate[1]
|
|
295
|
-
// ))
|
|
296
|
-
// .multiply(new THREE.Matrix4().makeRotationAxis(
|
|
297
|
-
// new THREE.Vector3(0, 0, 1),
|
|
298
|
-
// modelRotate[2]
|
|
299
|
-
// ));
|
|
300
|
-
// create two three.js lights to illuminate the model
|
|
301
|
-
// let directionalLight = new THREE.DirectionalLight(0xffffff);
|
|
302
|
-
// directionalLight.position.set(0, -70, 100).normalize();
|
|
303
|
-
// this.scene.add(directionalLight);
|
|
267
|
+
// this.scene.add(new THREE.AxesHelper(1000));
|
|
268
|
+
// this.scene.add(new THREE.CameraHelper( this.camera ));
|
|
304
269
|
|
|
305
|
-
// let directionalLight2 = new THREE.DirectionalLight(0xffffff);
|
|
306
|
-
// directionalLight2.position.set(0, 70, 100).normalize();
|
|
307
|
-
// this.scene.add(directionalLight2);
|
|
308
|
-
// this.tb = new Threebox(
|
|
309
|
-
// map,
|
|
310
|
-
// gl, //get the context from Mapbox
|
|
311
|
-
// { defaultLights: true ,passiveRendering:false}
|
|
312
|
-
// );
|
|
313
|
-
//this.scene.add(new THREE.AxesHelper(1000));
|
|
314
270
|
this.renderer = new THREE.WebGLRenderer({
|
|
315
271
|
canvas: map.getCanvas(),
|
|
316
|
-
context: gl,
|
|
317
|
-
|
|
272
|
+
context: gl,
|
|
273
|
+
logarithmicDepthBuffer: true // 启用对数深度缓冲
|
|
274
|
+
// logarithmicDepthBuffer: true,
|
|
275
|
+
// antialias: true
|
|
318
276
|
});
|
|
277
|
+
// gl.disable(gl.DEPTH_TEST);
|
|
278
|
+
// gl.clear(gl.DEPTH_BUFFER_BIT);
|
|
319
279
|
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
320
|
-
|
|
321
|
-
|
|
280
|
+
// this.map
|
|
281
|
+
// .on('move',()=> {
|
|
282
|
+
// //console.log(111)
|
|
283
|
+
// this.update();
|
|
284
|
+
// })
|
|
285
|
+
// .on('resize', ()=> {
|
|
286
|
+
// this.setup();
|
|
287
|
+
// })
|
|
288
|
+
|
|
289
|
+
this.renderer.autoClear = false;
|
|
322
290
|
if(this.addedFun)
|
|
323
291
|
this.addedFun()
|
|
292
|
+
|
|
324
293
|
}
|
|
325
294
|
|
|
326
|
-
render(gl, matrix) {
|
|
327
|
-
//this.tb.update();
|
|
295
|
+
render(gl, matrix) {
|
|
328
296
|
// const rotationX = new THREE.Matrix4().makeRotationAxis(
|
|
329
297
|
// new THREE.Vector3(1, 0, 0),
|
|
330
298
|
// modelTransform.rotateX
|
|
@@ -359,7 +327,10 @@ export default class ThreeWallLayer{
|
|
|
359
327
|
//this.camera.projectionMatrix = m.multiply(l);
|
|
360
328
|
// var m = new THREE.Matrix4().fromArray(matrix);
|
|
361
329
|
// this.camera.projectionMatrix = m.multiply(cameraTransform);;
|
|
362
|
-
|
|
330
|
+
// this.camera.lookAt(0, 0, 0);
|
|
331
|
+
// console.log(this.group.position)
|
|
332
|
+
// this.renderer.clearDepth();
|
|
333
|
+
this.renderer.resetState();
|
|
363
334
|
|
|
364
335
|
this.renderer.render(this.scene, this.camera);
|
|
365
336
|
this.map.triggerRepaint();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {hasProperty,transform} from '../../utils/util'
|
|
3
|
-
import mapboxgl from '
|
|
2
|
+
import {hasProperty,transform} from '../../utils/util.js'
|
|
3
|
+
import mapboxgl from 'mapbox-gl';
|
|
4
4
|
export default class ScanLayer{
|
|
5
5
|
drawArray = []
|
|
6
6
|
defaultDrawInfo = {
|
|
@@ -84,6 +84,7 @@ export default class ScanLayer{
|
|
|
84
84
|
this.draw()
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
|
|
87
88
|
//添加object 支持多路径添加
|
|
88
89
|
//data 二维数组 croods 路径列表 colors 二维数组
|
|
89
90
|
drawList(_scanInfo){
|