@openglobus/og 0.15.0 → 0.15.2
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/README.md +10 -4
- package/css/og.css +44 -45
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +12 -12
- package/src/og/Clock.js +1 -1
- package/src/og/Events.js +1 -1
- package/src/og/Extent.js +1 -1
- package/src/og/Globe.js +3 -5
- package/src/og/Popup.js +38 -63
- package/src/og/astro/earth.js +2 -2
- package/src/og/astro/rotation.js +2 -2
- package/src/og/bv/Box.js +1 -0
- package/src/og/bv/index.js +1 -1
- package/src/og/camera/Camera.js +4 -4
- package/src/og/camera/PlanetCamera.js +26 -6
- package/src/og/camera/index.js +1 -1
- package/src/og/control/Atmosphere.js +3 -8
- package/src/og/control/CompassButton.js +4 -5
- package/src/og/control/Control.js +25 -15
- package/src/og/control/EarthCoordinates.js +3 -2
- package/src/og/control/EarthNavigation.js +0 -1
- package/src/og/control/GeoImageDragControl.js +2 -2
- package/src/og/control/KeyboardNavigation.js +3 -2
- package/src/og/control/LayerAnimation.js +2 -2
- package/src/og/control/LayerSwitcher.js +5 -4
- package/src/og/control/Lighting.js +106 -35
- package/src/og/control/MouseNavigation.js +4 -4
- package/src/og/control/MouseWheelZoomControl.js +2 -2
- package/src/og/control/RulerSwitcher.js +4 -3
- package/src/og/control/ScaleControl.js +2 -2
- package/src/og/control/ShowFps.js +2 -1
- package/src/og/control/SimpleNavigation.js +2 -1
- package/src/og/control/SimpleSkyBackground.js +2 -2
- package/src/og/control/Sun.js +9 -2
- package/src/og/control/ToggleWireframe.js +2 -1
- package/src/og/control/TouchNavigation.js +4 -3
- package/src/og/control/ZoomControl.js +6 -5
- package/src/og/control/index.js +10 -10
- package/src/og/control/ruler/RulerScene.js +19 -11
- package/src/og/control/selection/Selection.js +1 -1
- package/src/og/control/selection/SelectionScene.js +5 -8
- package/src/og/control/timeline/TimelineControl.js +3 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +10 -5
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/VisibleExtent.js +1 -1
- package/src/og/ellipsoid/Ellipsoid.js +3 -3
- package/src/og/entity/BaseBillboard.js +2 -2
- package/src/og/entity/BillboardHandler.js +10 -2
- package/src/og/entity/Entity.js +10 -51
- package/src/og/entity/EntityCollection.js +3 -20
- package/src/og/entity/GeoObject.js +2 -4
- package/src/og/entity/GeoObjectHandler.js +12 -11
- package/src/og/entity/Geometry.js +2 -2
- package/src/og/entity/GeometryHandler.js +2 -2
- package/src/og/entity/Label.js +2 -2
- package/src/og/entity/LabelHandler.js +7 -5
- package/src/og/entity/Polyline.js +8 -7
- package/src/og/entity/Ray.js +1 -2
- package/src/og/entity/RayHandler.js +4 -0
- package/src/og/entity/Strip.js +8 -5
- package/src/og/entity/index.js +1 -1
- package/src/og/index.core.js +4 -4
- package/src/og/index.js +7 -5
- package/src/og/index.webgl.js +3 -3
- package/src/og/layer/BaseGeoImage.js +2 -2
- package/src/og/layer/GeoImage.js +2 -2
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/Layer.js +3 -3
- package/src/og/layer/Vector.js +7 -11
- package/src/og/layer/WMS.js +2 -1
- package/src/og/layer/XYZ.js +2 -4
- package/src/og/math/Line3.js +0 -1
- package/src/og/math/Plane.js +0 -1
- package/src/og/math/Ray.js +0 -1
- package/src/og/math/Vec2.js +62 -62
- package/src/og/math/Vec3.js +1 -1
- package/src/og/math/Vec4.js +1 -1
- package/src/og/math/index.js +1 -1
- package/src/og/proj/EPSG3857.js +1 -1
- package/src/og/proj/EPSG4326.js +1 -1
- package/src/og/quadTree/EarthQuadTreeStrategy.js +4 -4
- package/src/og/quadTree/MarsQuadTreeStrategy.js +4 -4
- package/src/og/quadTree/Node.js +1 -1
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +4 -4
- package/src/og/quadTree/index.js +2 -2
- package/src/og/renderer/Renderer.js +196 -77
- package/src/og/renderer/RendererEvents.js +35 -10
- package/src/og/scene/Axes.js +2 -2
- package/src/og/scene/Planet.js +52 -80
- package/src/og/scene/RenderNode.js +2 -13
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/scene/index.js +2 -2
- package/src/og/segment/Segment.js +5 -5
- package/src/og/segment/SegmentLonLatWgs84.js +2 -3
- package/src/og/shaders/drawnode.js +5 -1
- package/src/og/shaders/geoObject.js +2 -6
- package/src/og/shaders/pickingMask.js +31 -0
- package/src/og/terrain/BilTerrain.js +4 -4
- package/src/og/terrain/GlobusTerrain.js +7 -7
- package/src/og/terrain/MapboxTerrain.js +2 -2
- package/src/og/terrain/index.js +2 -2
- package/src/og/ui/Button.js +5 -4
- package/src/og/ui/Dialog.js +3 -6
- package/src/og/ui/Slider.js +29 -3
- package/src/og/ui/View.js +5 -5
- package/src/og/ui/icons.js +3 -0
- package/src/og/utils/FontAtlas.js +2 -2
- package/src/og/utils/GeoImageCreator.js +0 -1
- package/src/og/utils/NormalMapCreator.js +6 -5
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/VectorTileCreator.js +4 -4
- package/src/og/utils/shared.js +1 -1
- package/src/og/webgl/Framebuffer.js +3 -1
- package/src/og/webgl/Handler.js +77 -62
- package/src/og/webgl/Multisample.js +18 -7
- package/src/og/webgl/Program.js +2 -2
- package/src/og/webgl/index.js +2 -2
- package/types/Popup.d.ts +8 -21
- package/types/camera/PlanetCamera.d.ts +1 -0
- package/types/control/Sun.d.ts +1 -0
- package/types/control/ruler/RulerScene.d.ts +4 -3
- package/types/entity/Entity.d.ts +2 -19
- package/types/entity/EntityCollection.d.ts +0 -7
- package/types/index.d.ts +2 -1
- package/types/math/Vec2.d.ts +95 -95
- package/types/renderer/Renderer.d.ts +28 -16
- package/types/scene/Planet.d.ts +2 -7
- package/types/shaders/pickingMask.d.ts +2 -0
- package/types/ui/Slider.d.ts +3 -0
- package/types/ui/View.d.ts +1 -0
- package/types/ui/icons.d.ts +1 -0
- package/types/webgl/Framebuffer.d.ts +1 -0
- package/types/webgl/Handler.d.ts +3 -2
- package/src/og/entity/ShapeHandler.js +0 -99
- package/src/og/shaders/shape.js +0 -135
- package/src/og/shapes/BaseShape.js +0 -557
- package/src/og/shapes/Icosphere.js +0 -179
- package/src/og/shapes/Sphere.js +0 -100
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/shaders/shape.d.ts +0 -4
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
package/src/og/scene/Planet.js
CHANGED
|
@@ -4,43 +4,39 @@
|
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import * as segmentHelper from "../segment/segmentHelper.js";
|
|
12
|
-
import { decodeFloatFromRGBAArr } from "../math/coder.js";
|
|
7
|
+
import { PlanetCamera } from "../camera/PlanetCamera.js";
|
|
8
|
+
import { Atmosphere } from "../control/Atmosphere.js";
|
|
9
|
+
import { SimpleSkyBackground } from "../control/SimpleSkyBackground.js";
|
|
10
|
+
import { wgs84 } from "../ellipsoid/wgs84.js";
|
|
13
11
|
import { Extent } from "../Extent.js";
|
|
14
|
-
import { Framebuffer } from "../webgl/Framebuffer.js";
|
|
15
|
-
import { GeoImageCreator } from "../utils/GeoImageCreator.js";
|
|
16
|
-
import { Quat, Vec3, Vec4 } from "../math/index.js";
|
|
17
12
|
import { Vector } from "../layer/Vector.js";
|
|
18
|
-
import { Loader } from "../utils/Loader.js";
|
|
19
13
|
import { Key, Lock } from "../Lock.js";
|
|
20
14
|
import { LonLat } from "../LonLat.js";
|
|
21
|
-
import
|
|
15
|
+
import * as math from "../math.js";
|
|
16
|
+
import { decodeFloatFromRGBAArr } from "../math/coder.js";
|
|
17
|
+
import { Quat, Vec3, Vec4 } from "../math/index.js";
|
|
18
|
+
import { EarthQuadTreeStrategy } from "../quadTree/EarthQuadTreeStrategy.js";
|
|
19
|
+
import { NIGHT, SPECULAR } from "../res/images.js";
|
|
20
|
+
import * as segmentHelper from "../segment/segmentHelper.js";
|
|
21
|
+
import * as shaders from "../shaders/drawnode.js";
|
|
22
|
+
import { Geoid } from "../terrain/Geoid.js";
|
|
23
|
+
import { GeoImageCreator } from "../utils/GeoImageCreator.js";
|
|
24
|
+
import { Loader } from "../utils/Loader.js";
|
|
22
25
|
import { NormalMapCreator } from "../utils/NormalMapCreator.js";
|
|
23
|
-
import { PlanetCamera } from "../camera/PlanetCamera.js";
|
|
24
|
-
import { RenderNode } from "./RenderNode.js";
|
|
25
|
-
import { Segment } from "../segment/Segment.js";
|
|
26
|
-
import { SegmentLonLat } from "../segment/SegmentLonLat.js";
|
|
27
26
|
import { PlainSegmentWorker } from "../utils/PlainSegmentWorker.js";
|
|
27
|
+
import * as utils from "../utils/shared.js";
|
|
28
|
+
import { createColorRGB, isUndef } from "../utils/shared.js";
|
|
28
29
|
import { TerrainWorker } from "../utils/TerrainWorker.js";
|
|
29
30
|
import { VectorTileCreator } from "../utils/VectorTileCreator.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { Geoid } from "../terrain/Geoid.js";
|
|
33
|
-
import { createColorRGB, isUndef } from "../utils/shared.js";
|
|
34
|
-
import { MAX_RENDERED_NODES } from "../quadTree/quadTree.js";
|
|
35
|
-
import { EarthQuadTreeStrategy } from "../quadTree/EarthQuadTreeStrategy.js";
|
|
36
|
-
import { SimpleSkyBackground } from "../control/SimpleSkyBackground.js";
|
|
37
|
-
import { Atmosphere } from "../control/Atmosphere.js";
|
|
31
|
+
import { Framebuffer } from "../webgl/Framebuffer.js";
|
|
32
|
+
import { RenderNode } from "./RenderNode.js";
|
|
38
33
|
|
|
39
34
|
const CUR_LOD_SIZE = 250; //px
|
|
40
35
|
const MIN_LOD_SIZE = 312; //px
|
|
41
36
|
const MAX_LOD_SIZE = 190; //px
|
|
42
37
|
|
|
43
|
-
let _tempPickingPix_ = new Uint8Array(4)
|
|
38
|
+
let _tempPickingPix_ = new Uint8Array(4);
|
|
39
|
+
let _tempDepthColor_ = new Uint8Array(4);
|
|
44
40
|
|
|
45
41
|
const DEPTH_DISTANCE = 11;//m
|
|
46
42
|
|
|
@@ -320,13 +316,6 @@ export class Planet extends RenderNode {
|
|
|
320
316
|
*/
|
|
321
317
|
this._textureCoordsBufferCache = [];
|
|
322
318
|
|
|
323
|
-
/**
|
|
324
|
-
* Framebuffer for relief. Is null when WEBGL_draw_buffers extension initialized.
|
|
325
|
-
* @protected
|
|
326
|
-
* @type {Object}
|
|
327
|
-
*/
|
|
328
|
-
this._heightPickingFramebuffer = null;
|
|
329
|
-
|
|
330
319
|
this.quadTreeStrategy = options.quadTreeStrategyPrototype ? new options.quadTreeStrategyPrototype({ planet: this }) : new EarthQuadTreeStrategy({ planet: this });
|
|
331
320
|
|
|
332
321
|
/**
|
|
@@ -342,10 +331,10 @@ export class Planet extends RenderNode {
|
|
|
342
331
|
this._specularTexture = null;
|
|
343
332
|
|
|
344
333
|
//TODO: replace to a function
|
|
345
|
-
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.
|
|
346
|
-
let d = utils.createColorRGB(options.diffuse, new Vec3(0
|
|
347
|
-
let s = utils.createColorRGB(options.specular, new Vec3(0.
|
|
348
|
-
let shininess = options.shininess ||
|
|
334
|
+
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.3));
|
|
335
|
+
let d = utils.createColorRGB(options.diffuse, new Vec3(1.0, 1.0, 1.0));
|
|
336
|
+
let s = utils.createColorRGB(options.specular, new Vec3(0.00063, 0.00055, 0.00032));
|
|
337
|
+
let shininess = options.shininess || 18.0;
|
|
349
338
|
|
|
350
339
|
this._ambient = new Float32Array([a.x, a.y, a.z]);
|
|
351
340
|
this._diffuse = new Float32Array([d.x, d.y, d.z]);
|
|
@@ -430,7 +419,7 @@ export class Planet extends RenderNode {
|
|
|
430
419
|
* Night texture brightness coefficient
|
|
431
420
|
* @type {number}
|
|
432
421
|
*/
|
|
433
|
-
this.nightTextureCoefficient =
|
|
422
|
+
this.nightTextureCoefficient = 2.0;
|
|
434
423
|
|
|
435
424
|
this._renderScreenNodesPASS = this._renderScreenNodesPASSNoAtmos;
|
|
436
425
|
|
|
@@ -754,13 +743,7 @@ export class Planet extends RenderNode {
|
|
|
754
743
|
|
|
755
744
|
this.renderer.addDepthCallback(this, this._renderDepthFramebufferPASS);
|
|
756
745
|
|
|
757
|
-
this.
|
|
758
|
-
width: 320, height: 240
|
|
759
|
-
});
|
|
760
|
-
|
|
761
|
-
this._heightPickingFramebuffer.init();
|
|
762
|
-
|
|
763
|
-
this.renderer.screenTexture.height = this._heightPickingFramebuffer.textures[0];
|
|
746
|
+
this.renderer.addDistanceCallback(this, this._renderDistanceFramebufferPASS);
|
|
764
747
|
}
|
|
765
748
|
|
|
766
749
|
_onLayerLoadend(layer) {
|
|
@@ -939,6 +922,10 @@ export class Planet extends RenderNode {
|
|
|
939
922
|
});
|
|
940
923
|
}
|
|
941
924
|
|
|
925
|
+
_getLayerAttributionHTML(layer) {
|
|
926
|
+
return `<div class="og-attribution__layer">${layer._attribution}</div>`;
|
|
927
|
+
}
|
|
928
|
+
|
|
942
929
|
/**
|
|
943
930
|
* Updates attribution lists
|
|
944
931
|
* @public
|
|
@@ -949,11 +936,10 @@ export class Planet extends RenderNode {
|
|
|
949
936
|
let li = this._layers[i];
|
|
950
937
|
if (li._visibility) {
|
|
951
938
|
if (li._attribution.length) {
|
|
952
|
-
html +=
|
|
939
|
+
html += this._getLayerAttributionHTML(li);
|
|
953
940
|
}
|
|
954
941
|
}
|
|
955
942
|
}
|
|
956
|
-
|
|
957
943
|
this._applyAttribution(html)
|
|
958
944
|
}
|
|
959
945
|
|
|
@@ -990,7 +976,7 @@ export class Planet extends RenderNode {
|
|
|
990
976
|
}
|
|
991
977
|
|
|
992
978
|
if (li._attribution.length) {
|
|
993
|
-
html +=
|
|
979
|
+
html += this._getLayerAttributionHTML(li);
|
|
994
980
|
}
|
|
995
981
|
|
|
996
982
|
} else if (li._fading && li._fadingOpacity > 0) {
|
|
@@ -1016,13 +1002,12 @@ export class Planet extends RenderNode {
|
|
|
1016
1002
|
_applyAttribution(html) {
|
|
1017
1003
|
if (this.renderer) {
|
|
1018
1004
|
if (html.length) {
|
|
1019
|
-
html = "<ul>" + html + "</ul>";
|
|
1020
1005
|
if (this.renderer.div.attributions.innerHTML !== html) {
|
|
1021
|
-
this.renderer.div.attributions.style.display = "block";
|
|
1006
|
+
//this.renderer.div.attributions.style.display = "block";
|
|
1022
1007
|
this.renderer.div.attributions.innerHTML = html;
|
|
1023
1008
|
}
|
|
1024
1009
|
} else {
|
|
1025
|
-
this.renderer.div.attributions.style.display = "none";
|
|
1010
|
+
//this.renderer.div.attributions.style.display = "none";
|
|
1026
1011
|
this.renderer.div.attributions.innerHTML = "";
|
|
1027
1012
|
}
|
|
1028
1013
|
}
|
|
@@ -1128,6 +1113,10 @@ export class Planet extends RenderNode {
|
|
|
1128
1113
|
_globalPreDraw() {
|
|
1129
1114
|
let cam = this.camera;
|
|
1130
1115
|
|
|
1116
|
+
// Might be it's better to replace it in setTerrain,
|
|
1117
|
+
// but we have to be sure that setTerrain exists with renderer insttance
|
|
1118
|
+
this.renderer.__useDistanceFramebuffer__ = !this.terrain.isEmpty;
|
|
1119
|
+
|
|
1131
1120
|
this._distBeforeMemClear += this._prevCamEye.distance(cam.eye);
|
|
1132
1121
|
this._prevCamEye.copy(cam.eye);
|
|
1133
1122
|
cam.checkFly();
|
|
@@ -1160,7 +1149,7 @@ export class Planet extends RenderNode {
|
|
|
1160
1149
|
|
|
1161
1150
|
this._renderScreenNodesPASS();
|
|
1162
1151
|
|
|
1163
|
-
this._renderHeightPickingFramebufferPASS();
|
|
1152
|
+
//this._renderHeightPickingFramebufferPASS();
|
|
1164
1153
|
|
|
1165
1154
|
this.drawEntityCollections(this._frustumEntityCollections);
|
|
1166
1155
|
}
|
|
@@ -1326,8 +1315,6 @@ export class Planet extends RenderNode {
|
|
|
1326
1315
|
}
|
|
1327
1316
|
}
|
|
1328
1317
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1329
|
-
|
|
1330
|
-
gl.disable(gl.BLEND);
|
|
1331
1318
|
}
|
|
1332
1319
|
|
|
1333
1320
|
/**
|
|
@@ -1450,31 +1437,19 @@ export class Planet extends RenderNode {
|
|
|
1450
1437
|
}
|
|
1451
1438
|
}
|
|
1452
1439
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1453
|
-
|
|
1454
|
-
gl.disable(gl.BLEND);
|
|
1455
1440
|
}
|
|
1456
1441
|
|
|
1457
1442
|
/**
|
|
1458
1443
|
* @protected
|
|
1459
1444
|
*/
|
|
1460
|
-
|
|
1445
|
+
_renderDistanceFramebufferPASS() {
|
|
1461
1446
|
if (!this.terrain.isEmpty) {
|
|
1462
1447
|
|
|
1463
|
-
this._heightPickingFramebuffer.activate();
|
|
1464
|
-
|
|
1465
1448
|
let sh;
|
|
1466
1449
|
let renderer = this.renderer;
|
|
1467
1450
|
let h = renderer.handler;
|
|
1468
1451
|
let gl = h.gl;
|
|
1469
1452
|
let cam = renderer.activeCamera;
|
|
1470
|
-
let frustumIndex = cam.currentFrustumIndex;
|
|
1471
|
-
|
|
1472
|
-
if (frustumIndex === cam.FARTHEST_FRUSTUM_INDEX) {
|
|
1473
|
-
gl.clearColor(0.0, 0.0, 0.0, 1.0);
|
|
1474
|
-
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
1475
|
-
} else {
|
|
1476
|
-
gl.clear(gl.DEPTH_BUFFER_BIT);
|
|
1477
|
-
}
|
|
1478
1453
|
|
|
1479
1454
|
h.programs.drawnode_heightPicking.activate();
|
|
1480
1455
|
sh = h.programs.drawnode_heightPicking._program;
|
|
@@ -1487,14 +1462,13 @@ export class Planet extends RenderNode {
|
|
|
1487
1462
|
gl.uniform3fv(shu.eyePositionLow, cam.eyeLow);
|
|
1488
1463
|
|
|
1489
1464
|
// drawing planet nodes
|
|
1490
|
-
let rn = this._renderedNodesInFrustum[
|
|
1465
|
+
let rn = this._renderedNodesInFrustum[cam.currentFrustumIndex];
|
|
1466
|
+
let sl = this._visibleTileLayerSlices;
|
|
1491
1467
|
|
|
1492
1468
|
let i = rn.length;
|
|
1493
1469
|
while (i--) {
|
|
1494
1470
|
rn[i].segment.heightPickingRendering(sh, sl[0]);
|
|
1495
1471
|
}
|
|
1496
|
-
|
|
1497
|
-
this._heightPickingFramebuffer.deactivate();
|
|
1498
1472
|
}
|
|
1499
1473
|
}
|
|
1500
1474
|
|
|
@@ -1514,6 +1488,7 @@ export class Planet extends RenderNode {
|
|
|
1514
1488
|
gl.blendEquation(gl.FUNC_ADD);
|
|
1515
1489
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
1516
1490
|
gl.enable(gl.BLEND);
|
|
1491
|
+
|
|
1517
1492
|
gl.enable(gl.CULL_FACE);
|
|
1518
1493
|
|
|
1519
1494
|
gl.uniformMatrix4fv(shu.viewMatrix, false, cam.getViewMatrix());
|
|
@@ -1523,7 +1498,8 @@ export class Planet extends RenderNode {
|
|
|
1523
1498
|
gl.uniform3fv(shu.eyePositionLow, cam.eyeLow);
|
|
1524
1499
|
|
|
1525
1500
|
// drawing planet nodes
|
|
1526
|
-
|
|
1501
|
+
let rn = this._renderedNodesInFrustum[cam.getCurrentFrustum()];
|
|
1502
|
+
let sl = this._visibleTileLayerSlices;
|
|
1527
1503
|
|
|
1528
1504
|
let i = rn.length;
|
|
1529
1505
|
while (i--) {
|
|
@@ -1539,8 +1515,6 @@ export class Planet extends RenderNode {
|
|
|
1539
1515
|
}
|
|
1540
1516
|
}
|
|
1541
1517
|
gl.disable(gl.POLYGON_OFFSET_FILL);
|
|
1542
|
-
|
|
1543
|
-
gl.disable(gl.BLEND);
|
|
1544
1518
|
}
|
|
1545
1519
|
|
|
1546
1520
|
/**
|
|
@@ -1574,6 +1548,8 @@ export class Planet extends RenderNode {
|
|
|
1574
1548
|
while (i--) {
|
|
1575
1549
|
rn[i].segment.depthRendering(sh, sl[0]);
|
|
1576
1550
|
}
|
|
1551
|
+
|
|
1552
|
+
gl.enable(gl.BLEND);
|
|
1577
1553
|
}
|
|
1578
1554
|
|
|
1579
1555
|
_collectVectorLayerCollections() {
|
|
@@ -1762,23 +1738,19 @@ export class Planet extends RenderNode {
|
|
|
1762
1738
|
return this.getDistanceFromPixelEllipsoid(px) || 0;
|
|
1763
1739
|
} else {
|
|
1764
1740
|
|
|
1765
|
-
let r = this.renderer
|
|
1741
|
+
let r = this.renderer;
|
|
1742
|
+
let cnv = this.renderer.handler.canvas;
|
|
1766
1743
|
|
|
1767
|
-
let spx = px.x / cnv.width
|
|
1744
|
+
let spx = px.x / cnv.width;
|
|
1745
|
+
let spy = (cnv.height - px.y) / cnv.height;
|
|
1768
1746
|
|
|
1769
1747
|
_tempPickingPix_[0] = _tempPickingPix_[1] = _tempPickingPix_[2] = 0.0;
|
|
1770
1748
|
|
|
1771
1749
|
let dist = 0;
|
|
1772
1750
|
|
|
1773
|
-
|
|
1774
|
-
this._heightPickingFramebuffer.activate();
|
|
1751
|
+
r.readDistanceColor(spx, spy, _tempPickingPix_);
|
|
1775
1752
|
|
|
1776
|
-
//if (this._heightPickingFramebuffer.isComplete()) {
|
|
1777
|
-
this._heightPickingFramebuffer.readPixels(_tempPickingPix_, spx, spy);
|
|
1778
1753
|
dist = decodeFloatFromRGBAArr(_tempPickingPix_);
|
|
1779
|
-
//}
|
|
1780
|
-
|
|
1781
|
-
this._heightPickingFramebuffer.deactivate();
|
|
1782
1754
|
|
|
1783
1755
|
if (!(_tempPickingPix_[0] || _tempPickingPix_[1] || _tempPickingPix_[2])) {
|
|
1784
1756
|
dist = this.getDistanceFromPixelEllipsoid(px) || 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { BaseNode } from "./BaseNode.js";
|
|
4
3
|
import { Events } from "../Events.js";
|
|
4
|
+
import { BaseNode } from "./BaseNode.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Render node is a logical part of a render mechanism. Represents scene rendering.
|
|
@@ -294,12 +294,9 @@ class RenderNode extends BaseNode {
|
|
|
294
294
|
*/
|
|
295
295
|
drawPickingEntityCollections(ec) {
|
|
296
296
|
if (ec.length) {
|
|
297
|
-
var gl = this.renderer.handler.gl;
|
|
298
|
-
|
|
299
|
-
gl.disable(gl.CULL_FACE);
|
|
300
297
|
|
|
301
298
|
// billoard pass
|
|
302
|
-
|
|
299
|
+
let i = ec.length;
|
|
303
300
|
while (i--) {
|
|
304
301
|
ec[i]._fadingOpacity && ec[i].billboardHandler.drawPicking();
|
|
305
302
|
}
|
|
@@ -322,20 +319,12 @@ class RenderNode extends BaseNode {
|
|
|
322
319
|
ec[i]._fadingOpacity && ec[i].rayHandler.drawPicking();
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
gl.enable(gl.CULL_FACE);
|
|
326
|
-
|
|
327
322
|
// polylines pass
|
|
328
323
|
i = ec.length;
|
|
329
324
|
while (i--) {
|
|
330
325
|
ec[i]._visibility && ec[i].polylineHandler.drawPicking();
|
|
331
326
|
}
|
|
332
327
|
|
|
333
|
-
//shapes pass
|
|
334
|
-
i = ec.length;
|
|
335
|
-
while (i--) {
|
|
336
|
-
ec[i]._visibility && ec[i].shapeHandler.drawPicking();
|
|
337
|
-
}
|
|
338
|
-
|
|
339
328
|
//Strip pass
|
|
340
329
|
i = ec.length;
|
|
341
330
|
while (i--) {
|
package/src/og/scene/SkyBox.js
CHANGED
package/src/og/scene/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { EPSG3857 } from "../proj/EPSG3857.js";
|
|
3
|
+
import { Box } from "../bv/Box.js";
|
|
4
|
+
import { Sphere } from "../bv/Sphere.js";
|
|
6
5
|
import { Extent } from "../Extent.js";
|
|
7
6
|
import { Layer } from "../layer/Layer.js";
|
|
8
7
|
import { LonLat } from "../LonLat.js";
|
|
9
8
|
import { Ray } from "../math/Ray.js";
|
|
10
|
-
import { Sphere } from "../bv/Sphere.js";
|
|
11
|
-
import { Box } from "../bv/Box.js";
|
|
12
9
|
import { Vec3 } from "../math/Vec3.js";
|
|
10
|
+
import * as mercator from "../mercator.js";
|
|
11
|
+
import { EPSG3857 } from "../proj/EPSG3857.js";
|
|
12
|
+
import { E, N, NOTRENDERING, OPSIDE, S, W } from "../quadTree/quadTree.js";
|
|
13
13
|
import * as segmentHelper from "../segment/segmentHelper.js";
|
|
14
14
|
import { getMatrixSubArray } from "../utils/shared.js";
|
|
15
15
|
import { Slice } from "./Slice.js";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import * as mercator from "../mercator.js";
|
|
3
|
+
import { TILEGROUP_COMMON } from "./Segment.js";
|
|
4
|
+
import { SegmentLonLat } from "./SegmentLonLat.js";
|
|
6
5
|
|
|
7
6
|
export class SegmentLonLatWgs84 extends SegmentLonLat {
|
|
8
7
|
constructor(node, planet, tileZoom, extent) {
|
|
@@ -725,7 +725,7 @@ export function drawnode_screen_wl_webgl2Atmos() {
|
|
|
725
725
|
float maxDist = sqrt(c * c - BOTTOM_RADIUS * BOTTOM_RADIUS);
|
|
726
726
|
float minDist = c - BOTTOM_RADIUS;
|
|
727
727
|
float vertDist = distance(cameraPosition, v_vertex);
|
|
728
|
-
opacity = maxMinOpacity.y + ( maxMinOpacity.x - maxMinOpacity.y) * getLerpValue(minDist, maxDist, vertDist);
|
|
728
|
+
opacity = clamp(maxMinOpacity.y + ( maxMinOpacity.x - maxMinOpacity.y) * getLerpValue(minDist, maxDist, vertDist), 0.0, 1.0);
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
void main(void) {
|
|
@@ -768,6 +768,10 @@ export function drawnode_screen_wl_webgl2Atmos() {
|
|
|
768
768
|
|
|
769
769
|
float fadingOpacity;
|
|
770
770
|
getAtmosFadingOpacity(fadingOpacity);
|
|
771
|
+
|
|
772
|
+
getSunIlluminance(cameraPosition, viewDir * SPHERE_TO_ELLIPSOID_SCALE, sunIlluminance);
|
|
773
|
+
|
|
774
|
+
spec *= sunIlluminance;
|
|
771
775
|
|
|
772
776
|
diffuseColor = texture( defaultTexture, vTextureCoord.xy );
|
|
773
777
|
if( samplerCount == 0 ) {
|
|
@@ -176,7 +176,6 @@ export const geo_object_picking = () =>
|
|
|
176
176
|
eyePositionHigh: "vec3",
|
|
177
177
|
eyePositionLow: "vec3",
|
|
178
178
|
pickingScale: "float"
|
|
179
|
-
|
|
180
179
|
},
|
|
181
180
|
attributes: {
|
|
182
181
|
aVertexPosition: "vec3",
|
|
@@ -207,14 +206,12 @@ export const geo_object_picking = () =>
|
|
|
207
206
|
uniform vec3 eyePositionHigh;
|
|
208
207
|
uniform vec3 eyePositionLow;
|
|
209
208
|
|
|
210
|
-
varying float vDispose;
|
|
211
209
|
varying vec3 vColor;
|
|
212
210
|
|
|
213
211
|
const float RADIANS = 3.141592653589793 / 180.0;
|
|
214
212
|
|
|
215
213
|
void main(void) {
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
|
|
218
215
|
if (aDispose == 0.0) {
|
|
219
216
|
return;
|
|
220
217
|
}
|
|
@@ -258,8 +255,7 @@ export const geo_object_picking = () =>
|
|
|
258
255
|
fragmentShader:
|
|
259
256
|
`precision highp float;
|
|
260
257
|
varying vec3 vColor;
|
|
261
|
-
varying float vDispose;
|
|
262
258
|
void main () {
|
|
263
|
-
gl_FragColor = vec4(vColor,
|
|
259
|
+
gl_FragColor = vec4(vColor, 1.0);
|
|
264
260
|
}`
|
|
265
261
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module og/shaders/pickingMask
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
import { Program } from '../webgl/Program.js';
|
|
8
|
+
|
|
9
|
+
export function pickingMask() {
|
|
10
|
+
return new Program("pickingMask", {
|
|
11
|
+
uniforms: {
|
|
12
|
+
offset: "vec2"
|
|
13
|
+
},
|
|
14
|
+
attributes: {
|
|
15
|
+
coordinates: "vec2"
|
|
16
|
+
},
|
|
17
|
+
vertexShader:
|
|
18
|
+
`attribute vec2 coordinates;
|
|
19
|
+
uniform vec2 offset;
|
|
20
|
+
void main() {
|
|
21
|
+
|
|
22
|
+
gl_Position = vec4(coordinates + offset, 0.0, 1.0);
|
|
23
|
+
gl_PointSize = 20.0;
|
|
24
|
+
}`,
|
|
25
|
+
fragmentShader:
|
|
26
|
+
`precision highp float;
|
|
27
|
+
void main(void) {
|
|
28
|
+
gl_FragColor = vec4(1.0);
|
|
29
|
+
}`
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Layer } from "../layer/Layer.js";
|
|
4
4
|
import { WMS } from "../layer/WMS.js";
|
|
5
5
|
import { isPowerOfTwo, nextHighestPowerOfTwo } from "../math.js";
|
|
6
6
|
import { getTileExtent } from "../mercator.js";
|
|
7
|
-
import {
|
|
7
|
+
import { GlobusTerrain } from "./GlobusTerrain.js";
|
|
8
8
|
|
|
9
9
|
class BilTerrain extends GlobusTerrain {
|
|
10
10
|
constructor(options) {
|
|
@@ -34,8 +34,8 @@ class BilTerrain extends GlobusTerrain {
|
|
|
34
34
|
options.plainGridSize != undefined
|
|
35
35
|
? options.plainGridSize
|
|
36
36
|
: isPowerOfTwo(this._imageSize)
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
? this._imageSize / 2
|
|
38
|
+
: nextHighestPowerOfTwo(this._imageSize) / 2;
|
|
39
39
|
|
|
40
40
|
this._dataType = "arrayBuffer";
|
|
41
41
|
}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
import { Events } from "../Events.js";
|
|
6
7
|
import * as mercator from "../mercator.js";
|
|
7
|
-
import { EmptyTerrain } from "./EmptyTerrain.js";
|
|
8
8
|
import { EPSG3857 } from "../proj/EPSG3857.js";
|
|
9
|
-
import { Events } from "../Events.js";
|
|
10
|
-
import { Loader } from "../utils/Loader.js";
|
|
11
9
|
import { NOTRENDERING } from "../quadTree/quadTree.js";
|
|
10
|
+
import { Loader } from "../utils/Loader.js";
|
|
11
|
+
import { EmptyTerrain } from "./EmptyTerrain.js";
|
|
12
12
|
// import { QueueArray } from '../QueueArray.js';
|
|
13
|
-
import { createExtent, stringTemplate } from "../utils/shared.js";
|
|
14
|
-
import { Layer } from "../layer/Layer.js";
|
|
15
|
-
import { Vec3 } from "../math/Vec3.js";
|
|
16
|
-
import { Ray } from "../math/Ray.js";
|
|
17
13
|
import { Extent } from "../Extent.js";
|
|
14
|
+
import { Layer } from "../layer/Layer.js";
|
|
18
15
|
import { LonLat } from "../LonLat.js";
|
|
16
|
+
import { Ray } from "../math/Ray.js";
|
|
17
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
18
|
+
import { createExtent, stringTemplate } from "../utils/shared.js";
|
|
19
19
|
|
|
20
20
|
const EVENT_NAMES = [
|
|
21
21
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getTileExtent } from "../mercator.js";
|
|
2
1
|
import { Layer } from "../layer/Layer.js";
|
|
3
|
-
import { GlobusTerrain } from "./GlobusTerrain.js";
|
|
4
2
|
import { isPowerOfTwo } from "../math.js";
|
|
5
3
|
import * as mercator from "../mercator.js";
|
|
4
|
+
import { getTileExtent } from "../mercator.js";
|
|
5
|
+
import { GlobusTerrain } from "./GlobusTerrain.js";
|
|
6
6
|
|
|
7
7
|
const KEY =
|
|
8
8
|
"pk.eyJ1IjoiZm94bXVsZGVyODMiLCJhIjoiY2pqYmR3dG5oM2Z1bzNrczJqYm5pODhuNSJ9.Y4DRmEPhb-XSlCR9CAXACQ";
|
package/src/og/terrain/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { BilTerrain } from './BilTerrain';
|
|
1
2
|
import { EmptyTerrain } from './EmptyTerrain';
|
|
2
3
|
import { GlobusTerrain } from './GlobusTerrain';
|
|
3
4
|
import { MapboxTerrain } from './MapboxTerrain';
|
|
4
|
-
import { BilTerrain } from './BilTerrain';
|
|
5
5
|
|
|
6
|
-
export { EmptyTerrain, GlobusTerrain, MapboxTerrain, BilTerrain };
|
|
6
|
+
export { EmptyTerrain, GlobusTerrain, MapboxTerrain, BilTerrain };
|
package/src/og/ui/Button.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { View } from './View.js';
|
|
4
3
|
import { stringTemplate } from '../utils/shared.js';
|
|
4
|
+
import { View } from './View.js';
|
|
5
5
|
|
|
6
6
|
const TEMPLATE =
|
|
7
|
-
`<div class="og-button">
|
|
7
|
+
`<div class="og-button" title="{title}">
|
|
8
8
|
<div class="og-button-icon">{icon}</div>
|
|
9
9
|
<div class="og-button-text">{text}</div>
|
|
10
10
|
</div>`;
|
|
@@ -14,7 +14,8 @@ class Button extends View {
|
|
|
14
14
|
super({
|
|
15
15
|
template: stringTemplate(TEMPLATE, {
|
|
16
16
|
icon: options.icon || "",
|
|
17
|
-
text: options.text || ""
|
|
17
|
+
text: options.text || "",
|
|
18
|
+
title: options.title || ""
|
|
18
19
|
}),
|
|
19
20
|
...options,
|
|
20
21
|
eventList: ["click", "mousedown", "mouseup", "touchstart", "touchend", "touchcancel", ...(options.eventList || [])]
|
|
@@ -103,4 +104,4 @@ class Button extends View {
|
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
export { Button }
|
|
107
|
+
export { Button };
|
package/src/og/ui/Dialog.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { View } from './View.js';
|
|
4
3
|
import { getDefault, stringTemplate } from '../utils/shared.js';
|
|
5
4
|
import { Button } from './Button.js';
|
|
5
|
+
import { CLOSE_ICON } from './icons.js';
|
|
6
|
+
import { View } from './View.js';
|
|
6
7
|
|
|
7
8
|
const TEMPLATE = `<div class="og-ddialog"
|
|
8
9
|
style="display:{display}; resize:{resize}; width: {width}px; {height}; top: {top}px; left: {left}px; min-height: {minHeight}; max-height: {maxHeight}; min-width: {minWidth}; max-width: {maxWidth};">
|
|
@@ -13,10 +14,6 @@ const TEMPLATE = `<div class="og-ddialog"
|
|
|
13
14
|
<div class="og-ddialog-container"></div>
|
|
14
15
|
</div>>`;
|
|
15
16
|
|
|
16
|
-
const CLOSE_ICON = `<svg className="svg-icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor; overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
17
|
-
<path d="M777.856 280.192l-33.92-33.952-231.872 231.872-231.84-231.872-33.984 33.888 231.872 231.904-231.84 231.84 33.888 33.984 231.904-231.904 231.84 231.872 33.952-33.888-231.872-231.904z"/>
|
|
18
|
-
</svg>`
|
|
19
|
-
|
|
20
17
|
class Dialog extends View {
|
|
21
18
|
constructor(options = {}) {
|
|
22
19
|
super({
|
|
@@ -239,4 +236,4 @@ class Dialog extends View {
|
|
|
239
236
|
}
|
|
240
237
|
}
|
|
241
238
|
|
|
242
|
-
export { Dialog }
|
|
239
|
+
export { Dialog };
|