@openglobus/og 0.11.5 → 0.11.6
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/package.json +5 -7
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +18 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +0 -1
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +0 -1
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +22 -12
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/ellipsoid/Ellipsoid.js +148 -56
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +65 -14
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +310 -64
- package/src/og/entity/Entity.js +39 -1
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +53 -18
- package/src/og/entity/LabelHandler.js +42 -244
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -16
- package/src/og/layer/GeoImage.js +6 -6
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +3 -3
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -16
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +60 -30
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +31 -17
- package/src/og/renderer/Renderer.js +23 -6
- package/src/og/renderer/RendererEvents.js +1 -1
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +2 -2
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shapes/BaseShape.js +107 -35
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/utils/TextureAtlas.js +16 -18
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Handler.js +68 -49
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +2 -2
- package/types/Extent.d.ts +1 -1
- package/types/Rectangle.d.ts +1 -1
- package/types/ajax.d.ts +1 -1
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +1 -1
- package/types/camera/Camera.d.ts +5 -5
- package/types/camera/Frustum.d.ts +6 -6
- package/types/camera/PlanetCamera.d.ts +8 -8
- package/types/control/Control.d.ts +1 -1
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Sun.d.ts +1 -1
- package/types/entity/BaseBillboard.d.ts +15 -8
- package/types/entity/Entity.d.ts +24 -9
- package/types/entity/EntityCollection.d.ts +15 -9
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +1 -1
- package/types/entity/GeometryHandler.d.ts +1 -1
- package/types/entity/Label.d.ts +3 -3
- package/types/entity/LabelHandler.d.ts +2 -0
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +1 -1
- package/types/entity/Polyline.d.ts +5 -5
- package/types/entity/Ray.d.ts +1 -1
- package/types/entity/Strip.d.ts +1 -1
- package/types/layer/BaseGeoImage.d.ts +3 -3
- package/types/layer/CanvasTiles.d.ts +5 -5
- package/types/layer/GeoImage.d.ts +1 -1
- package/types/layer/GeoVideo.d.ts +1 -1
- package/types/layer/Layer.d.ts +5 -5
- package/types/layer/Vector.d.ts +9 -9
- package/types/layer/XYZ.d.ts +3 -3
- package/types/light/LightSource.d.ts +7 -7
- package/types/math/Plane.d.ts +1 -1
- package/types/math/Ray.d.ts +1 -1
- package/types/math/Vec2.d.ts +34 -34
- package/types/math/Vec3.d.ts +1 -1
- package/types/math/Vec4.d.ts +1 -1
- package/types/math/coder.d.ts +1 -1
- package/types/math.d.ts +1 -1
- package/types/proj/Proj.d.ts +2 -2
- package/types/quadTree/Node.d.ts +1 -1
- package/types/renderer/Renderer.d.ts +12 -10
- package/types/renderer/RendererEvents.d.ts +1 -1
- package/types/scene/BaseNode.d.ts +4 -4
- package/types/scene/Planet.d.ts +40 -40
- package/types/scene/RenderNode.d.ts +9 -9
- package/types/segment/Segment.d.ts +9 -9
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +5 -5
- package/types/terrain/EmptyTerrain.d.ts +2 -2
- package/types/terrain/GlobusTerrain.d.ts +4 -4
- package/types/utils/TextureAtlas.d.ts +4 -4
- package/types/utils/shared.d.ts +9 -9
- package/types/webgl/Framebuffer.d.ts +1 -1
- package/types/webgl/Handler.d.ts +16 -7
- package/types/webgl/Multisample.d.ts +2 -2
- package/types/webgl/Program.d.ts +6 -0
- package/types/webgl/ProgramController.d.ts +1 -1
package/src/og/entity/Strip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as utils from
|
|
4
|
-
import { Vec3 } from
|
|
5
|
-
import { Line3 } from
|
|
3
|
+
import * as utils from "../utils/shared.js";
|
|
4
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
5
|
+
import { Line3 } from "../math/Line3.js";
|
|
6
6
|
|
|
7
7
|
let _tempHigh = new Vec3(),
|
|
8
8
|
_tempLow = new Vec3();
|
|
@@ -25,7 +25,6 @@ let _tempHigh = new Vec3(),
|
|
|
25
25
|
*/
|
|
26
26
|
class Strip {
|
|
27
27
|
constructor(options) {
|
|
28
|
-
|
|
29
28
|
options = options || {};
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -41,7 +40,7 @@ class Strip {
|
|
|
41
40
|
* @public
|
|
42
41
|
* @type {boolean}
|
|
43
42
|
*/
|
|
44
|
-
this.visibility =
|
|
43
|
+
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
45
44
|
|
|
46
45
|
this.color = new Float32Array([1.0, 1.0, 1.0, 0.5]);
|
|
47
46
|
|
|
@@ -125,7 +124,6 @@ class Strip {
|
|
|
125
124
|
* @public
|
|
126
125
|
*/
|
|
127
126
|
clear() {
|
|
128
|
-
|
|
129
127
|
this._path.length = 0;
|
|
130
128
|
this._path = [];
|
|
131
129
|
|
|
@@ -219,11 +217,30 @@ class Strip {
|
|
|
219
217
|
gl.uniform4fv(shu.uColor, this.color);
|
|
220
218
|
gl.uniform1f(shu.uOpacity, this._entity._entityCollection._fadingOpacity);
|
|
221
219
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
222
|
-
gl.vertexAttribPointer(
|
|
220
|
+
gl.vertexAttribPointer(
|
|
221
|
+
sha.aVertexPositionHigh,
|
|
222
|
+
this._verticesHighBuffer.itemSize,
|
|
223
|
+
gl.FLOAT,
|
|
224
|
+
false,
|
|
225
|
+
0,
|
|
226
|
+
0
|
|
227
|
+
);
|
|
223
228
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
224
|
-
gl.vertexAttribPointer(
|
|
229
|
+
gl.vertexAttribPointer(
|
|
230
|
+
sha.aVertexPositionLow,
|
|
231
|
+
this._verticesLowBuffer.itemSize,
|
|
232
|
+
gl.FLOAT,
|
|
233
|
+
false,
|
|
234
|
+
0,
|
|
235
|
+
0
|
|
236
|
+
);
|
|
225
237
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
226
|
-
gl.drawElements(
|
|
238
|
+
gl.drawElements(
|
|
239
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
240
|
+
this._indexBuffer.numItems,
|
|
241
|
+
gl.UNSIGNED_INT,
|
|
242
|
+
0
|
|
243
|
+
);
|
|
227
244
|
gl.enable(gl.CULL_FACE);
|
|
228
245
|
}
|
|
229
246
|
}
|
|
@@ -254,11 +271,30 @@ class Strip {
|
|
|
254
271
|
|
|
255
272
|
gl.uniform4fv(shu.uColor, this._pickingColor);
|
|
256
273
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
257
|
-
gl.vertexAttribPointer(
|
|
274
|
+
gl.vertexAttribPointer(
|
|
275
|
+
sha.aVertexPositionHigh,
|
|
276
|
+
this._verticesHighBuffer.itemSize,
|
|
277
|
+
gl.FLOAT,
|
|
278
|
+
false,
|
|
279
|
+
0,
|
|
280
|
+
0
|
|
281
|
+
);
|
|
258
282
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
259
|
-
gl.vertexAttribPointer(
|
|
283
|
+
gl.vertexAttribPointer(
|
|
284
|
+
sha.aVertexPositionLow,
|
|
285
|
+
this._verticesLowBuffer.itemSize,
|
|
286
|
+
gl.FLOAT,
|
|
287
|
+
false,
|
|
288
|
+
0,
|
|
289
|
+
0
|
|
290
|
+
);
|
|
260
291
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
261
|
-
gl.drawElements(
|
|
292
|
+
gl.drawElements(
|
|
293
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
294
|
+
this._indexBuffer.numItems,
|
|
295
|
+
gl.UNSIGNED_INT,
|
|
296
|
+
0
|
|
297
|
+
);
|
|
262
298
|
gl.enable(gl.CULL_FACE);
|
|
263
299
|
}
|
|
264
300
|
}
|
|
@@ -289,9 +325,21 @@ class Strip {
|
|
|
289
325
|
gl.deleteBuffer(this._verticesHighBuffer);
|
|
290
326
|
gl.deleteBuffer(this._verticesLowBuffer);
|
|
291
327
|
|
|
292
|
-
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
293
|
-
|
|
294
|
-
|
|
328
|
+
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
329
|
+
new Float32Array(this._verticesHigh),
|
|
330
|
+
3,
|
|
331
|
+
this._verticesHigh.length / 3
|
|
332
|
+
);
|
|
333
|
+
this._verticesLowBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
334
|
+
new Float32Array(this._verticesLow),
|
|
335
|
+
3,
|
|
336
|
+
this._verticesLow.length / 3
|
|
337
|
+
);
|
|
338
|
+
this._indexBuffer = this._renderNode.renderer.handler.createElementArrayBuffer(
|
|
339
|
+
new Uint32Array(this._indexes),
|
|
340
|
+
1,
|
|
341
|
+
this._indexes.length
|
|
342
|
+
);
|
|
295
343
|
}
|
|
296
344
|
}
|
|
297
345
|
|
|
@@ -299,11 +347,8 @@ class Strip {
|
|
|
299
347
|
let length = this._path.length;
|
|
300
348
|
|
|
301
349
|
if (length === 0) {
|
|
302
|
-
|
|
303
350
|
this._path.push([p2.clone(), p3.clone()]);
|
|
304
|
-
|
|
305
351
|
} else {
|
|
306
|
-
|
|
307
352
|
let p0 = this._path[length - 1][0],
|
|
308
353
|
p1 = this._path[length - 1][1];
|
|
309
354
|
|
|
@@ -323,19 +368,17 @@ class Strip {
|
|
|
323
368
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
324
369
|
|
|
325
370
|
for (let i = 0; i < gs1; i++) {
|
|
326
|
-
|
|
327
371
|
let di = i / gs;
|
|
328
372
|
let p02 = p0.lerp(p2, di),
|
|
329
373
|
p13 = p1.lerp(p3, di);
|
|
330
374
|
|
|
331
375
|
for (let j = 0; j < gs1; j++) {
|
|
332
|
-
|
|
333
376
|
let dj = j / gs;
|
|
334
377
|
let p01 = p0.lerp(p1, dj),
|
|
335
378
|
p23 = p2.lerp(p3, dj);
|
|
336
379
|
|
|
337
380
|
if (d !== 1.0) {
|
|
338
|
-
|
|
381
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
339
382
|
} else {
|
|
340
383
|
p = p23;
|
|
341
384
|
}
|
|
@@ -369,17 +412,15 @@ class Strip {
|
|
|
369
412
|
}
|
|
370
413
|
|
|
371
414
|
setEdge3v(p2, p3, index) {
|
|
372
|
-
|
|
373
415
|
if (index === this._path.length) {
|
|
374
416
|
this.addEdge3v(p2, p3);
|
|
375
417
|
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
418
|
+
}
|
|
419
|
+
if (this._path[index]) {
|
|
378
420
|
this._path[index][0] = p2;
|
|
379
421
|
this._path[index][1] = p3;
|
|
380
422
|
|
|
381
423
|
if (this._path.length > 1) {
|
|
382
|
-
|
|
383
424
|
let gs = this._gridSize,
|
|
384
425
|
gs1 = gs + 1;
|
|
385
426
|
|
|
@@ -391,7 +432,6 @@ class Strip {
|
|
|
391
432
|
vLow = this._verticesLow;
|
|
392
433
|
|
|
393
434
|
if (index === this._path.length - 1) {
|
|
394
|
-
|
|
395
435
|
let p0 = this._path[index - 1][0],
|
|
396
436
|
p1 = this._path[index - 1][1];
|
|
397
437
|
|
|
@@ -401,19 +441,17 @@ class Strip {
|
|
|
401
441
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
402
442
|
|
|
403
443
|
for (let i = 0; i < gs1; i++) {
|
|
404
|
-
|
|
405
444
|
let di = i / gs;
|
|
406
445
|
let p02 = p0.lerp(p2, di),
|
|
407
446
|
p13 = p1.lerp(p3, di);
|
|
408
447
|
|
|
409
448
|
for (let j = 0; j < gs1; j++) {
|
|
410
|
-
|
|
411
449
|
let dj = j / gs;
|
|
412
450
|
let p01 = p0.lerp(p1, dj),
|
|
413
451
|
p23 = p2.lerp(p3, dj);
|
|
414
452
|
|
|
415
453
|
if (d !== 1.0) {
|
|
416
|
-
|
|
454
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
417
455
|
} else {
|
|
418
456
|
p = p23;
|
|
419
457
|
}
|
|
@@ -433,9 +471,7 @@ class Strip {
|
|
|
433
471
|
vLow[ind3 + 2] = _tempLow.z;
|
|
434
472
|
}
|
|
435
473
|
}
|
|
436
|
-
|
|
437
474
|
} else if (index === 0) {
|
|
438
|
-
|
|
439
475
|
let ind = 0;
|
|
440
476
|
|
|
441
477
|
let p0 = p2,
|
|
@@ -445,18 +481,16 @@ class Strip {
|
|
|
445
481
|
p3 = this._path[1][1];
|
|
446
482
|
|
|
447
483
|
for (let i = 0; i < gs1; i++) {
|
|
448
|
-
|
|
449
484
|
let di = i / gs;
|
|
450
485
|
let p02 = p0.lerp(p2, di),
|
|
451
486
|
p13 = p1.lerp(p3, di);
|
|
452
487
|
|
|
453
488
|
for (let j = 0; j < gs1; j++) {
|
|
454
|
-
|
|
455
489
|
let dj = j / gs;
|
|
456
490
|
let p01 = p0.lerp(p1, dj),
|
|
457
491
|
p23 = p2.lerp(p3, dj);
|
|
458
492
|
|
|
459
|
-
|
|
493
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
460
494
|
|
|
461
495
|
ind = i * gs1 + j;
|
|
462
496
|
|
|
@@ -474,7 +508,6 @@ class Strip {
|
|
|
474
508
|
}
|
|
475
509
|
}
|
|
476
510
|
} else if (index > 0 && index < this._path.length) {
|
|
477
|
-
|
|
478
511
|
let p0 = this._path[index - 1][0],
|
|
479
512
|
p1 = this._path[index - 1][1];
|
|
480
513
|
|
|
@@ -486,7 +519,6 @@ class Strip {
|
|
|
486
519
|
ind = prev;
|
|
487
520
|
|
|
488
521
|
for (let i = 0; i < gs1; i++) {
|
|
489
|
-
|
|
490
522
|
let di = i / gs;
|
|
491
523
|
let p02 = p0.lerp(p2, di),
|
|
492
524
|
p35 = p3.lerp(p5, di),
|
|
@@ -494,13 +526,12 @@ class Strip {
|
|
|
494
526
|
p13 = p1.lerp(p3, di);
|
|
495
527
|
|
|
496
528
|
for (let j = 0; j < gs1; j++) {
|
|
497
|
-
|
|
498
529
|
let dj = j / gs;
|
|
499
530
|
let p01 = p0.lerp(p1, dj),
|
|
500
531
|
p23 = p2.lerp(p3, dj);
|
|
501
532
|
|
|
502
533
|
// prev
|
|
503
|
-
|
|
534
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
504
535
|
|
|
505
536
|
let ij = i * gs1 + j;
|
|
506
537
|
|
|
@@ -523,7 +554,7 @@ class Strip {
|
|
|
523
554
|
|
|
524
555
|
p23 = p2.lerp(p3, dj);
|
|
525
556
|
|
|
526
|
-
|
|
557
|
+
new Line3(p24, p35).intersects(new Line3(p23, p45), p);
|
|
527
558
|
|
|
528
559
|
ind = next + ij;
|
|
529
560
|
|
|
@@ -564,14 +595,12 @@ class Strip {
|
|
|
564
595
|
}
|
|
565
596
|
|
|
566
597
|
setPath(path) {
|
|
567
|
-
|
|
568
598
|
this._verticesHigh = [];
|
|
569
599
|
this._verticesLow = [];
|
|
570
600
|
this._indexes = [];
|
|
571
601
|
this._path = [];
|
|
572
602
|
|
|
573
603
|
for (let i = 0; i < path.length; i++) {
|
|
574
|
-
|
|
575
604
|
let p0 = path[i][0],
|
|
576
605
|
p1 = path[i][1];
|
|
577
606
|
|
|
@@ -598,4 +627,4 @@ class Strip {
|
|
|
598
627
|
}
|
|
599
628
|
}
|
|
600
629
|
|
|
601
|
-
export { Strip };
|
|
630
|
+
export { Strip };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Program } from
|
|
3
|
+
import { Program } from "../webgl/Program.js";
|
|
4
4
|
|
|
5
5
|
class StripHandler {
|
|
6
6
|
constructor(entityCollection) {
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Picking rendering option.
|
|
10
9
|
* @public
|
|
@@ -50,21 +49,21 @@ class StripHandler {
|
|
|
50
49
|
_initProgram() {
|
|
51
50
|
if (this._renderer.handler) {
|
|
52
51
|
!this._renderer.handler.programs.strip &&
|
|
53
|
-
this._renderer.handler.addProgram(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`attribute vec3 aVertexPositionHigh;
|
|
52
|
+
this._renderer.handler.addProgram(
|
|
53
|
+
new Program("strip", {
|
|
54
|
+
uniforms: {
|
|
55
|
+
projectionMatrix: { type: "mat4" },
|
|
56
|
+
viewMatrix: { type: "mat4" },
|
|
57
|
+
eyePositionHigh: "vec3",
|
|
58
|
+
eyePositionLow: "vec3",
|
|
59
|
+
uColor: { type: "vec4" },
|
|
60
|
+
uOpacity: { type: "float" }
|
|
61
|
+
},
|
|
62
|
+
attributes: {
|
|
63
|
+
aVertexPositionHigh: { type: "vec3" },
|
|
64
|
+
aVertexPositionLow: { type: "vec3" }
|
|
65
|
+
},
|
|
66
|
+
vertexShader: `attribute vec3 aVertexPositionHigh;
|
|
68
67
|
attribute vec3 aVertexPositionLow;
|
|
69
68
|
uniform mat4 projectionMatrix;
|
|
70
69
|
uniform mat4 viewMatrix;
|
|
@@ -80,14 +79,14 @@ class StripHandler {
|
|
|
80
79
|
|
|
81
80
|
gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
|
|
82
81
|
}`,
|
|
83
|
-
|
|
84
|
-
`precision highp float;
|
|
82
|
+
fragmentShader: `precision highp float;
|
|
85
83
|
uniform vec4 uColor;
|
|
86
84
|
uniform float uOpacity;
|
|
87
85
|
void main(void) {
|
|
88
86
|
gl_FragColor = vec4(uColor.rgb, uColor.a * uOpacity);
|
|
89
87
|
}`
|
|
90
|
-
|
|
88
|
+
})
|
|
89
|
+
);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -104,7 +103,8 @@ class StripHandler {
|
|
|
104
103
|
strip._handler = this;
|
|
105
104
|
strip._handlerIndex = this._strips.length;
|
|
106
105
|
this._strips.push(strip);
|
|
107
|
-
this._entityCollection &&
|
|
106
|
+
this._entityCollection &&
|
|
107
|
+
this._entityCollection.renderNode &&
|
|
108
108
|
strip.setRenderNode(this._entityCollection.renderNode);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -155,4 +155,4 @@ class StripHandler {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
export { StripHandler };
|
|
158
|
+
export { StripHandler };
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module og/layer/BaseGeoImage
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as mercator from
|
|
8
|
-
import { Extent } from
|
|
9
|
-
import { Layer } from
|
|
10
|
-
import { LonLat } from
|
|
7
|
+
import * as mercator from "../mercator.js";
|
|
8
|
+
import { Extent } from "../Extent.js";
|
|
9
|
+
import { Layer } from "./Layer.js";
|
|
10
|
+
import { LonLat } from "../LonLat.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* BaseGeoImage layer represents square imagery layer that could be an static image, or animated video or webgl buffer object displayed on the globe.
|
|
@@ -58,8 +58,12 @@ class BaseGeoImage extends Layer {
|
|
|
58
58
|
*/
|
|
59
59
|
getCornersLonLat() {
|
|
60
60
|
var c = this._cornersWgs84;
|
|
61
|
-
return [
|
|
62
|
-
|
|
61
|
+
return [
|
|
62
|
+
new LonLat(c[0].lon, c[0].lat),
|
|
63
|
+
new LonLat(c[1].lon, c[1].lat),
|
|
64
|
+
new LonLat(c[2].lon, c[2].lat),
|
|
65
|
+
new LonLat(c[3].lon, c[3].lat)
|
|
66
|
+
];
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -69,7 +73,12 @@ class BaseGeoImage extends Layer {
|
|
|
69
73
|
*/
|
|
70
74
|
getCorners() {
|
|
71
75
|
var c = this._cornersWgs84;
|
|
72
|
-
return [
|
|
76
|
+
return [
|
|
77
|
+
[c[0].lon, c[0].lat],
|
|
78
|
+
[c[1].lon, c[1].lat],
|
|
79
|
+
[c[2].lon, c[2].lat],
|
|
80
|
+
[c[3].lon, c[3].lat]
|
|
81
|
+
];
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
/**
|
|
@@ -92,7 +101,12 @@ class BaseGeoImage extends Layer {
|
|
|
92
101
|
*/
|
|
93
102
|
setCornersLonLat(corners) {
|
|
94
103
|
this._refreshFrame = true;
|
|
95
|
-
this._cornersWgs84 = [
|
|
104
|
+
this._cornersWgs84 = [
|
|
105
|
+
corners[0].clone(),
|
|
106
|
+
corners[1].clone(),
|
|
107
|
+
corners[2].clone(),
|
|
108
|
+
corners[3].clone()
|
|
109
|
+
] || [0, 0, 0, 0];
|
|
96
110
|
|
|
97
111
|
for (var i = 0; i < this._cornersWgs84.length; i++) {
|
|
98
112
|
if (this._cornersWgs84[i].lat >= 89.9) {
|
|
@@ -105,8 +119,7 @@ class BaseGeoImage extends Layer {
|
|
|
105
119
|
this._extent.setByCoordinates(this._cornersWgs84);
|
|
106
120
|
|
|
107
121
|
var me = this._extent;
|
|
108
|
-
if (me.southWest.lat > mercator.MAX_LAT ||
|
|
109
|
-
me.northEast.lat < mercator.MIN_LAT) {
|
|
122
|
+
if (me.southWest.lat > mercator.MAX_LAT || me.northEast.lat < mercator.MIN_LAT) {
|
|
110
123
|
this._projType = 0;
|
|
111
124
|
this.rendering = this._renderingProjType0;
|
|
112
125
|
} else {
|
|
@@ -126,15 +139,32 @@ class BaseGeoImage extends Layer {
|
|
|
126
139
|
_createFrame() {
|
|
127
140
|
this._extentWgs84 = this._extent.clone();
|
|
128
141
|
|
|
129
|
-
this._cornersMerc = [
|
|
130
|
-
|
|
142
|
+
this._cornersMerc = [
|
|
143
|
+
this._cornersWgs84[0].forwardMercatorEPS01(),
|
|
144
|
+
this._cornersWgs84[1].forwardMercatorEPS01(),
|
|
145
|
+
this._cornersWgs84[2].forwardMercatorEPS01(),
|
|
146
|
+
this._cornersWgs84[3].forwardMercatorEPS01()
|
|
147
|
+
];
|
|
131
148
|
|
|
132
|
-
this._extentMerc = new Extent(
|
|
149
|
+
this._extentMerc = new Extent(
|
|
150
|
+
this._extentWgs84.southWest.forwardMercatorEPS01(),
|
|
151
|
+
this._extentWgs84.northEast.forwardMercatorEPS01()
|
|
152
|
+
);
|
|
133
153
|
|
|
134
154
|
if (this._projType === 0) {
|
|
135
|
-
this._extentWgs84Params = [
|
|
155
|
+
this._extentWgs84Params = [
|
|
156
|
+
this._extentWgs84.southWest.lon,
|
|
157
|
+
this._extentWgs84.southWest.lat,
|
|
158
|
+
2.0 / this._extentWgs84.getWidth(),
|
|
159
|
+
2.0 / this._extentWgs84.getHeight()
|
|
160
|
+
];
|
|
136
161
|
} else {
|
|
137
|
-
this._extentMercParams = [
|
|
162
|
+
this._extentMercParams = [
|
|
163
|
+
this._extentMerc.southWest.lon,
|
|
164
|
+
this._extentMerc.southWest.lat,
|
|
165
|
+
2.0 / this._extentMerc.getWidth(),
|
|
166
|
+
2.0 / this._extentMerc.getHeight()
|
|
167
|
+
];
|
|
138
168
|
}
|
|
139
169
|
|
|
140
170
|
// creates material frame textures
|
|
@@ -146,7 +176,10 @@ class BaseGeoImage extends Layer {
|
|
|
146
176
|
gl.deleteTexture(this._materialTexture);
|
|
147
177
|
this._materialTexture = h.createEmptyTexture_l(this._frameWidth, this._frameHeight);
|
|
148
178
|
|
|
149
|
-
this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
|
|
179
|
+
this._gridBuffer = this._planet._geoImageCreator.createGridBuffer(
|
|
180
|
+
this._cornersWgs84,
|
|
181
|
+
this._projType
|
|
182
|
+
);
|
|
150
183
|
|
|
151
184
|
this._refreshFrame = false;
|
|
152
185
|
}
|
|
@@ -200,7 +233,6 @@ class BaseGeoImage extends Layer {
|
|
|
200
233
|
*/
|
|
201
234
|
setVisibility(visibility) {
|
|
202
235
|
if (visibility !== this._visibility) {
|
|
203
|
-
|
|
204
236
|
super.setVisibility(visibility);
|
|
205
237
|
|
|
206
238
|
// remove from creator
|
|
@@ -231,7 +263,6 @@ class BaseGeoImage extends Layer {
|
|
|
231
263
|
* @returns {Array<number> } -
|
|
232
264
|
*/
|
|
233
265
|
applyMaterial(material) {
|
|
234
|
-
|
|
235
266
|
var segment = material.segment;
|
|
236
267
|
|
|
237
268
|
if (this._ready) {
|
|
@@ -160,24 +160,24 @@ class CanvasTiles extends Layer {
|
|
|
160
160
|
if (e.handlers.length) {
|
|
161
161
|
that.events.dispatch(e, material);
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
requestAnimationFrame(() => {
|
|
164
|
+
that.drawTile(
|
|
165
|
+
material,
|
|
166
|
+
/**
|
|
167
|
+
* Apply canvas.
|
|
168
|
+
* @callback applyCanvasCallback
|
|
169
|
+
* @param {Object} canvas -
|
|
170
|
+
*/
|
|
171
|
+
function (canvas) {
|
|
172
|
+
that._counter--;
|
|
173
|
+
CanvasTiles.__requestsCounter--;
|
|
174
|
+
if (material.isLoading) {
|
|
175
175
|
material.applyImage(canvas);
|
|
176
|
-
}
|
|
176
|
+
}
|
|
177
|
+
that._dequeueRequest();
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
181
|
} else {
|
|
182
182
|
material.textureNotExists();
|
|
183
183
|
}
|
package/src/og/layer/GeoImage.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module og/layer/GeoImage
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { BaseGeoImage } from
|
|
7
|
+
import { BaseGeoImage } from "./BaseGeoImage.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Used to load and display a single image over specific corner coordinates on the globe, implements og.layer.BaseGeoImage interface.
|
|
@@ -95,14 +95,14 @@ class GeoImage extends BaseGeoImage {
|
|
|
95
95
|
this._onLoad(this._image);
|
|
96
96
|
} else if (this._image.src) {
|
|
97
97
|
let that = this;
|
|
98
|
-
this._image.addEventListener(
|
|
98
|
+
this._image.addEventListener("load", function (e) {
|
|
99
99
|
that._onLoad(this);
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
} else {
|
|
103
103
|
let that = this;
|
|
104
104
|
this._image = new Image();
|
|
105
|
-
this._image.addEventListener(
|
|
105
|
+
this._image.addEventListener("load", function (e) {
|
|
106
106
|
that._onLoad(this);
|
|
107
107
|
});
|
|
108
108
|
this._image.src = this._src;
|
|
@@ -117,7 +117,7 @@ class GeoImage extends BaseGeoImage {
|
|
|
117
117
|
* @param {Material} material - GeoImage material.
|
|
118
118
|
*/
|
|
119
119
|
abortMaterialLoading(material) {
|
|
120
|
-
this._image && (this._image.src =
|
|
120
|
+
this._image && (this._image.src = "");
|
|
121
121
|
this._creationProceeding = false;
|
|
122
122
|
material.isLoading = false;
|
|
123
123
|
material.isReady = false;
|
|
@@ -220,4 +220,4 @@ class GeoImage extends BaseGeoImage {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
export { GeoImage };
|
|
223
|
+
export { GeoImage };
|