@openglobus/og 0.11.1 → 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 +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
|
@@ -17,7 +17,6 @@ import { Vec3 } from "../math/Vec3.js";
|
|
|
17
17
|
import { Ray } from "../math/Ray.js";
|
|
18
18
|
import { Extent } from "../Extent.js";
|
|
19
19
|
import { LonLat } from "../LonLat.js";
|
|
20
|
-
import { MAX_NORMAL_ZOOM } from "../segment/Segment.js";
|
|
21
20
|
|
|
22
21
|
const EVENT_NAMES = [
|
|
23
22
|
/**
|
|
@@ -36,7 +35,7 @@ const EVENT_NAMES = [
|
|
|
36
35
|
/**
|
|
37
36
|
* Class that loads segment elevation data, converts it to the array and passes it to the planet segment.
|
|
38
37
|
* @class
|
|
39
|
-
* @extends {
|
|
38
|
+
* @extends {EmptyTerrain}
|
|
40
39
|
* @param {string} [name=""] - Terrain provider name.
|
|
41
40
|
* @param {Object} [options] - Provider options:
|
|
42
41
|
* @param {number} [options.minZoom=3] - Minimal visible zoom index when terrain handler works.
|
|
@@ -63,7 +62,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
63
62
|
/**
|
|
64
63
|
* Events handler.
|
|
65
64
|
* @public
|
|
66
|
-
* @type {
|
|
65
|
+
* @type {Events}
|
|
67
66
|
*/
|
|
68
67
|
this.events = new Events(EVENT_NAMES, this);
|
|
69
68
|
|
|
@@ -81,7 +80,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
81
80
|
* @public
|
|
82
81
|
* @type {number}
|
|
83
82
|
*/
|
|
84
|
-
this.minZoom = options.minZoom ||
|
|
83
|
+
this.minZoom = options.minZoom || 2;
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* Maximal visible zoom index when terrain handler works.
|
|
@@ -140,7 +139,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
140
139
|
* Rewrites elevation storage url query.
|
|
141
140
|
* @private
|
|
142
141
|
* @callback og.terrain.GlobusTerrain~_urlRewriteCallback
|
|
143
|
-
* @param {
|
|
142
|
+
* @param {Segment} segment - Segment to load.
|
|
144
143
|
* @param {string} url - Created url.
|
|
145
144
|
* @returns {string} - Url query string.
|
|
146
145
|
*/
|
|
@@ -350,7 +349,8 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
350
349
|
* Starts to load segment data.
|
|
351
350
|
* @public
|
|
352
351
|
* @virtual
|
|
353
|
-
* @param {
|
|
352
|
+
* @param {Segment} segment - Segment that wants a terrain data.
|
|
353
|
+
* @param {boolean} forceLoading
|
|
354
354
|
*/
|
|
355
355
|
loadTerrain(segment, forceLoading) {
|
|
356
356
|
if (this._planet.terrainLock.isFree()) {
|
|
@@ -400,7 +400,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
400
400
|
* Creates query url.
|
|
401
401
|
* @protected
|
|
402
402
|
* @virtual
|
|
403
|
-
* @param {
|
|
403
|
+
* @param {Segment} segment -
|
|
404
404
|
* @returns {string} -
|
|
405
405
|
*/
|
|
406
406
|
_createUrl(segment) {
|
|
@@ -414,7 +414,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
414
414
|
/**
|
|
415
415
|
* Returns actual url query string.
|
|
416
416
|
* @protected
|
|
417
|
-
* @param {
|
|
417
|
+
* @param {Segment} segment - Segment that loads image data.
|
|
418
418
|
* @returns {string} - Url string.
|
|
419
419
|
*/
|
|
420
420
|
_getHTTPRequestString(segment) {
|
|
@@ -426,7 +426,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
426
426
|
/**
|
|
427
427
|
* Sets url rewrite callback, used for custom url rewriting for every tile laoding.
|
|
428
428
|
* @public
|
|
429
|
-
* @param {
|
|
429
|
+
* @param {GlobusTerrain~_urlRewriteCallback} ur - The callback that returns tile custom created url.
|
|
430
430
|
*/
|
|
431
431
|
setUrlRewriteCallback(ur) {
|
|
432
432
|
this._urlRewriteCallback = ur;
|
|
@@ -445,7 +445,7 @@ class GlobusTerrain extends EmptyTerrain {
|
|
|
445
445
|
|
|
446
446
|
/**
|
|
447
447
|
* @protected
|
|
448
|
-
* @param {
|
|
448
|
+
* @param {Segment} segment -
|
|
449
449
|
* @param {*} data -
|
|
450
450
|
*/
|
|
451
451
|
_applyElevationsData(segment, elevations) {
|
|
@@ -17,7 +17,7 @@ class MapboxTerrain extends GlobusTerrain {
|
|
|
17
17
|
|
|
18
18
|
this.equalizeNormals = options.equalizeNormals || false;
|
|
19
19
|
|
|
20
|
-
this.minZoom = options.minZoom != undefined ? options.minZoom :
|
|
20
|
+
this.minZoom = options.minZoom != undefined ? options.minZoom : 2;
|
|
21
21
|
|
|
22
22
|
this.maxZoom = options.maxZoom != undefined ? options.maxZoom : 17;
|
|
23
23
|
|
|
@@ -19,17 +19,17 @@ export class GeoImageCreator {
|
|
|
19
19
|
this._queue = [];
|
|
20
20
|
this._animate = [];
|
|
21
21
|
this._initialize();
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
24
|
_initialize() {
|
|
25
25
|
this._initShaders();
|
|
26
26
|
this._initBuffers();
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates geoImage corners coordinates grid buffer.
|
|
31
31
|
* @public
|
|
32
|
-
* @param{Array.<
|
|
32
|
+
* @param{Array.<LonLat>} c - GeoImage corners coordinates.
|
|
33
33
|
* @return{WebGLBuffer} Grid coordinates buffer.
|
|
34
34
|
*/
|
|
35
35
|
createGridBuffer(c, toMerc) {
|
|
@@ -62,7 +62,7 @@ export class GeoImageCreator {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return this._planet.renderer.handler.createArrayBuffer(grid, 2, grid.length / 2);
|
|
65
|
-
}
|
|
65
|
+
}
|
|
66
66
|
|
|
67
67
|
frame() {
|
|
68
68
|
var i = this.MAX_FRAMES;
|
|
@@ -76,7 +76,7 @@ export class GeoImageCreator {
|
|
|
76
76
|
while (i--) {
|
|
77
77
|
this._animate[i].rendering();
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
add(geoImage) {
|
|
82
82
|
if (!geoImage._isRendering) {
|
|
@@ -87,7 +87,7 @@ export class GeoImageCreator {
|
|
|
87
87
|
this._queue.push(geoImage);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
}
|
|
90
|
+
}
|
|
91
91
|
|
|
92
92
|
remove(geoImage) {
|
|
93
93
|
if (geoImage._isRendering) {
|
|
@@ -106,7 +106,7 @@ export class GeoImageCreator {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
}
|
|
109
|
+
}
|
|
110
110
|
|
|
111
111
|
_initBuffers() {
|
|
112
112
|
|
|
@@ -126,7 +126,7 @@ export class GeoImageCreator {
|
|
|
126
126
|
|
|
127
127
|
this._quadTexCoordsBuffer = h.createArrayBuffer(new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]), 2, 4);
|
|
128
128
|
this._quadVertexBuffer = h.createArrayBuffer(new Float32Array([-1, 1, 1, 1, -1, -1, 1, -1]), 2, 4);
|
|
129
|
-
}
|
|
129
|
+
}
|
|
130
130
|
|
|
131
131
|
_initShaders() {
|
|
132
132
|
|
|
@@ -155,6 +155,6 @@ export class GeoImageCreator {
|
|
|
155
155
|
gl_FragColor = texture2D(sourceTexture, v_texCoords);
|
|
156
156
|
}`
|
|
157
157
|
}));
|
|
158
|
-
}
|
|
158
|
+
}
|
|
159
159
|
|
|
160
160
|
}
|
package/src/og/utils/Loader.js
CHANGED
|
@@ -12,7 +12,7 @@ if (window && !('createImageBitmap' in window)) {
|
|
|
12
12
|
img.src = URL.createObjectURL(blob);
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
export class Loader {
|
|
18
18
|
|
|
@@ -33,12 +33,12 @@ export class Loader {
|
|
|
33
33
|
'imageBitmap': r => r.blob().then(createImageBitmap),
|
|
34
34
|
'text': r => r.text()
|
|
35
35
|
};
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
|
|
38
38
|
load(params, callback) {
|
|
39
39
|
this._queue.push({ 'params': params, 'callback': callback });
|
|
40
40
|
this._exec();
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
|
|
43
43
|
fetch(params) {
|
|
44
44
|
return fetch(
|
|
@@ -60,7 +60,7 @@ export class Loader {
|
|
|
60
60
|
.catch(err => {
|
|
61
61
|
return { 'status': "error", 'msg': err.toString() };
|
|
62
62
|
});
|
|
63
|
-
}
|
|
63
|
+
}
|
|
64
64
|
|
|
65
65
|
_exec() {
|
|
66
66
|
|
|
@@ -98,7 +98,7 @@ export class Loader {
|
|
|
98
98
|
} else if (this._loading === 0) {
|
|
99
99
|
this.events.dispatch(this.events.loadend);
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
}
|
|
102
102
|
|
|
103
103
|
abort() {
|
|
104
104
|
//this._queue.each(e => e.callback({ 'status': "abort" }));
|
|
@@ -109,5 +109,5 @@ export class Loader {
|
|
|
109
109
|
this._queue[i] = null;
|
|
110
110
|
}
|
|
111
111
|
this._queue = [];
|
|
112
|
-
}
|
|
112
|
+
}
|
|
113
113
|
}
|
|
@@ -35,7 +35,7 @@ export class NormalMapCreator {
|
|
|
35
35
|
this._lock = new Lock();
|
|
36
36
|
|
|
37
37
|
this._init();
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
|
|
40
40
|
_init() {
|
|
41
41
|
var isWebkit = false; //('WebkitAppearance' in document.documentElement.style) && !/^((?!chrome).)*safari/i.test(navigator.userAgent);
|
|
@@ -161,7 +161,7 @@ export class NormalMapCreator {
|
|
|
161
161
|
var positions = new Float32Array([-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0]);
|
|
162
162
|
|
|
163
163
|
this._positionBuffer = this._handler.createArrayBuffer(positions, 2, positions.length / 2);
|
|
164
|
-
}
|
|
164
|
+
}
|
|
165
165
|
|
|
166
166
|
_drawNormalMapBlur(segment) {
|
|
167
167
|
var normals = segment.normalMapNormals;
|
|
@@ -242,7 +242,7 @@ export class NormalMapCreator {
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
return false;
|
|
245
|
-
}
|
|
245
|
+
}
|
|
246
246
|
|
|
247
247
|
_drawNormalMapNoBlur(segment) {
|
|
248
248
|
var normals = segment.normalMapNormals;
|
|
@@ -302,7 +302,7 @@ export class NormalMapCreator {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
return false;
|
|
305
|
-
}
|
|
305
|
+
}
|
|
306
306
|
|
|
307
307
|
_drawNormalMap(segment) {
|
|
308
308
|
let t = segment.planet.terrain;
|
|
@@ -312,7 +312,7 @@ export class NormalMapCreator {
|
|
|
312
312
|
} else {
|
|
313
313
|
return this._drawNormalMapNoBlur(segment);
|
|
314
314
|
}
|
|
315
|
-
}
|
|
315
|
+
}
|
|
316
316
|
|
|
317
317
|
drawSingle(segment) {
|
|
318
318
|
var h = this._handler,
|
|
@@ -337,7 +337,7 @@ export class NormalMapCreator {
|
|
|
337
337
|
gl.enable(gl.CULL_FACE);
|
|
338
338
|
|
|
339
339
|
this._framebuffer.deactivate();
|
|
340
|
-
}
|
|
340
|
+
}
|
|
341
341
|
|
|
342
342
|
frame() {
|
|
343
343
|
if (this._queue.length) {
|
|
@@ -371,28 +371,28 @@ export class NormalMapCreator {
|
|
|
371
371
|
|
|
372
372
|
this._framebuffer.deactivate();
|
|
373
373
|
}
|
|
374
|
-
}
|
|
374
|
+
}
|
|
375
375
|
|
|
376
376
|
queue(segment) {
|
|
377
377
|
segment._inTheQueue = true;
|
|
378
378
|
this._queue.push(segment);
|
|
379
|
-
}
|
|
379
|
+
}
|
|
380
380
|
|
|
381
381
|
unshift(segment) {
|
|
382
382
|
segment._inTheQueue = true;
|
|
383
383
|
this._queue.unshift(segment);
|
|
384
|
-
}
|
|
384
|
+
}
|
|
385
385
|
|
|
386
386
|
remove(segment) {
|
|
387
387
|
//...
|
|
388
|
-
}
|
|
388
|
+
}
|
|
389
389
|
|
|
390
390
|
clear() {
|
|
391
391
|
while (this._queue.length) {
|
|
392
392
|
var s = this._queue.pop();
|
|
393
393
|
s._inTheQueue = false;
|
|
394
394
|
}
|
|
395
|
-
}
|
|
395
|
+
}
|
|
396
396
|
|
|
397
397
|
/**
|
|
398
398
|
* Set activity off
|
|
@@ -400,7 +400,7 @@ export class NormalMapCreator {
|
|
|
400
400
|
*/
|
|
401
401
|
lock(key) {
|
|
402
402
|
this._lock.lock(key);
|
|
403
|
-
}
|
|
403
|
+
}
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
406
|
* Set activity on
|
|
@@ -408,6 +408,6 @@ export class NormalMapCreator {
|
|
|
408
408
|
*/
|
|
409
409
|
free(key) {
|
|
410
410
|
this._lock.free(key);
|
|
411
|
-
}
|
|
411
|
+
}
|
|
412
412
|
|
|
413
413
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { ImageCanvas } from
|
|
4
|
-
import { Rectangle } from
|
|
5
|
-
import { ImagesCacheManager } from
|
|
3
|
+
import { ImageCanvas } from "../ImageCanvas.js";
|
|
4
|
+
import { Rectangle } from "../Rectangle.js";
|
|
5
|
+
import { ImagesCacheManager } from "./ImagesCacheManager.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Texture atlas stores images in one texture. Each image has its own
|
|
8
|
+
* Texture atlas stores images in one texture. Each image has its own
|
|
9
9
|
* atlas texture coordinates.
|
|
10
10
|
* @class
|
|
11
11
|
* @param {number} [width] - Texture atlas width, if it hasn't 1024 default.
|
|
@@ -13,11 +13,10 @@ import { ImagesCacheManager } from './ImagesCacheManager.js';
|
|
|
13
13
|
*/
|
|
14
14
|
class TextureAtlas {
|
|
15
15
|
constructor(width, height) {
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Atlas nodes where input images store. It can be access by image.__nodeIndex.
|
|
19
18
|
* @public
|
|
20
|
-
* @type {Array.<
|
|
19
|
+
* @type {Array.<utils.TextureAtlasNode >}
|
|
21
20
|
*/
|
|
22
21
|
this.nodes = [];
|
|
23
22
|
|
|
@@ -71,7 +70,7 @@ class TextureAtlas {
|
|
|
71
70
|
/**
|
|
72
71
|
* Sets openglobus gl handler that creates gl texture.
|
|
73
72
|
* @public
|
|
74
|
-
* @param {
|
|
73
|
+
* @param {Handler} handler - WebGL handler.
|
|
75
74
|
*/
|
|
76
75
|
assignHandler(handler) {
|
|
77
76
|
this._handler = handler;
|
|
@@ -93,12 +92,11 @@ class TextureAtlas {
|
|
|
93
92
|
* Adds image to the atlas and returns creted node with texture coordinates of the stored image.
|
|
94
93
|
* @public
|
|
95
94
|
* @param {Object} image - Input javascript image object.
|
|
96
|
-
* @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
|
|
95
|
+
* @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
|
|
97
96
|
* and store image in the curent atlas sheme.
|
|
98
|
-
* @returns {
|
|
97
|
+
* @returns {utils.TextureAtlasNode} -
|
|
99
98
|
*/
|
|
100
99
|
addImage(image, fastInsert) {
|
|
101
|
-
|
|
102
100
|
if (!(image.width && image.height)) {
|
|
103
101
|
return;
|
|
104
102
|
}
|
|
@@ -145,11 +143,10 @@ class TextureAtlas {
|
|
|
145
143
|
/**
|
|
146
144
|
* Main atlas making function.
|
|
147
145
|
* @private
|
|
148
|
-
* @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
|
|
146
|
+
* @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
|
|
149
147
|
* and store image in the curent atlas sheme.
|
|
150
148
|
*/
|
|
151
149
|
_makeAtlas(fastInsert) {
|
|
152
|
-
|
|
153
150
|
if (fastInsert && this._btree) {
|
|
154
151
|
let im = this._images[this._images.length - 1];
|
|
155
152
|
this._completeNode(this.nodes, this._btree.insert(im));
|
|
@@ -157,10 +154,15 @@ class TextureAtlas {
|
|
|
157
154
|
let im = this._images.slice(0);
|
|
158
155
|
|
|
159
156
|
im.sort(function (b, a) {
|
|
160
|
-
return (
|
|
157
|
+
return (
|
|
158
|
+
(a.atlasWidth || a.width) - (b.atlasWidth || b.width) ||
|
|
159
|
+
(a.atlasHeight || a.height) - (b.atlasHeight || b.height)
|
|
160
|
+
);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
this._btree = new TextureAtlasNode(
|
|
163
|
+
this._btree = new TextureAtlasNode(
|
|
164
|
+
new Rectangle(0, 0, this.canvas.getWidth(), this.canvas.getHeight())
|
|
165
|
+
);
|
|
164
166
|
this._btree.atlas = this;
|
|
165
167
|
|
|
166
168
|
this.clearCanvas();
|
|
@@ -190,7 +192,7 @@ class TextureAtlas {
|
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
/**
|
|
193
|
-
* Image handler callback.
|
|
195
|
+
* Image handler callback.
|
|
194
196
|
* @callback Object~successCallback
|
|
195
197
|
* @param {Image} img - Loaded image.
|
|
196
198
|
*/
|
|
@@ -215,7 +217,7 @@ class TextureAtlas {
|
|
|
215
217
|
/**
|
|
216
218
|
* Atlas binary tree node.
|
|
217
219
|
* @class
|
|
218
|
-
* @param {
|
|
220
|
+
* @param {Rectangle} rect - Node image rectangle.
|
|
219
221
|
*/
|
|
220
222
|
class TextureAtlasNode {
|
|
221
223
|
constructor(rect, texCoords) {
|
|
@@ -227,9 +229,7 @@ class TextureAtlasNode {
|
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
insert(img) {
|
|
230
|
-
|
|
231
232
|
if (this.childNodes) {
|
|
232
|
-
|
|
233
233
|
var newNode = this.childNodes[0].insert(img);
|
|
234
234
|
|
|
235
235
|
if (newNode != null) {
|
|
@@ -237,9 +237,7 @@ class TextureAtlasNode {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
return this.childNodes[1].insert(img);
|
|
240
|
-
|
|
241
240
|
} else {
|
|
242
|
-
|
|
243
241
|
if (this.image != null) {
|
|
244
242
|
return null;
|
|
245
243
|
}
|
|
@@ -279,4 +277,4 @@ class TextureAtlasNode {
|
|
|
279
277
|
}
|
|
280
278
|
}
|
|
281
279
|
|
|
282
|
-
export { TextureAtlas, TextureAtlasNode };
|
|
280
|
+
export { TextureAtlas, TextureAtlasNode };
|
|
@@ -24,7 +24,7 @@ export class VectorTileCreator {
|
|
|
24
24
|
this._currentFrame = 0;
|
|
25
25
|
this._queue = [];
|
|
26
26
|
this._initialize();
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
_initialize() {
|
|
30
30
|
|
|
@@ -189,7 +189,7 @@ export class VectorTileCreator {
|
|
|
189
189
|
useDepth: false
|
|
190
190
|
});
|
|
191
191
|
this._framebuffer.init();
|
|
192
|
-
}
|
|
192
|
+
}
|
|
193
193
|
|
|
194
194
|
frame() {
|
|
195
195
|
if (this._planet.layerLock.isFree() && this._queue.length) {
|
|
@@ -404,13 +404,13 @@ export class VectorTileCreator {
|
|
|
404
404
|
|
|
405
405
|
f.deactivate();
|
|
406
406
|
}
|
|
407
|
-
}
|
|
407
|
+
}
|
|
408
408
|
|
|
409
409
|
add(material) {
|
|
410
410
|
this._queue.push(material);
|
|
411
|
-
}
|
|
411
|
+
}
|
|
412
412
|
|
|
413
413
|
remove(material) {
|
|
414
414
|
//...
|
|
415
|
-
}
|
|
415
|
+
}
|
|
416
416
|
}
|
package/src/og/utils/earcut.js
CHANGED
|
@@ -629,7 +629,7 @@ function deviation(data, holeIndices, dim, triangles) {
|
|
|
629
629
|
|
|
630
630
|
return polygonArea === 0 && trianglesArea === 0 ? 0 :
|
|
631
631
|
Math.abs((trianglesArea - polygonArea) / polygonArea);
|
|
632
|
-
}
|
|
632
|
+
}
|
|
633
633
|
|
|
634
634
|
function signedArea(data, start, end, dim) {
|
|
635
635
|
var sum = 0;
|
package/src/og/utils/shared.js
CHANGED
|
@@ -56,7 +56,7 @@ export function readTextFile(fileUrl) {
|
|
|
56
56
|
* Convert html color string to the RGBA number vector.
|
|
57
57
|
* @param {string} htmlColor - HTML string("#C6C6C6" or "#EF5" or "rgb(8,8,8)" or "rgba(8,8,8)") color.
|
|
58
58
|
* @param {number} [opacity] - Opacity for the output vector.
|
|
59
|
-
* @returns {
|
|
59
|
+
* @returns {math.Vec4} -
|
|
60
60
|
*/
|
|
61
61
|
export function htmlColorToRgba(htmlColor, opacity) {
|
|
62
62
|
var hColor = colorTable[htmlColor];
|
|
@@ -99,7 +99,7 @@ export function htmlColorToFloat32Array(htmlColor, opacity) {
|
|
|
99
99
|
* Convert html color string to the RGB number vector.
|
|
100
100
|
* @param {string} htmlColor - HTML string("#C6C6C6" or "#EF5" or "rgb(8,8,8)" or "rgba(8,8,8)") color.
|
|
101
101
|
* @param {number} [opacity] - Opacity for the output vector.
|
|
102
|
-
* @returns {
|
|
102
|
+
* @returns {Vec3} -
|
|
103
103
|
*/
|
|
104
104
|
export function htmlColorToRgb(htmlColor) {
|
|
105
105
|
var hColor = colorTable[htmlColor];
|
|
@@ -283,7 +283,7 @@ export function binarySearchFast(arr, x) {
|
|
|
283
283
|
* Finds an item in a sorted array.
|
|
284
284
|
* @param {Array} ar The sorted array to search.
|
|
285
285
|
* @param {Object} el The item to find in the array.
|
|
286
|
-
* @param {
|
|
286
|
+
* @param {utils.binarySearch~compare_fn} compare_fn comparator The function to use to compare the item to
|
|
287
287
|
* elements in the array.
|
|
288
288
|
* @returns {Number} a negative number if a is less than b; 0 if a is equal to b;a positive number of a is greater than b.
|
|
289
289
|
*
|
|
@@ -316,7 +316,7 @@ export function binarySearch(ar, el, compare_fn) {
|
|
|
316
316
|
* Binary insertion that uses binarySearch algorithm.
|
|
317
317
|
* @param {Array} ar - The sorted array to insert.
|
|
318
318
|
* @param {Object} el - The item to insert.
|
|
319
|
-
* @param {
|
|
319
|
+
* @param {utils.binarySearch~compare_fn} compare_fn - comparator The function to use to compare the item to
|
|
320
320
|
* elements in the array.
|
|
321
321
|
* @returns {Number} Array index position in which item inserted in.
|
|
322
322
|
*/
|
|
@@ -332,12 +332,12 @@ export function binaryInsert(ar, el, compare_fn) {
|
|
|
332
332
|
/**
|
|
333
333
|
* Returns two segment lines intersection coordinate.
|
|
334
334
|
* @static
|
|
335
|
-
* @param {
|
|
336
|
-
* @param {
|
|
337
|
-
* @param {
|
|
338
|
-
* @param {
|
|
335
|
+
* @param {math.Vec2} start1 - First line first coordinate.
|
|
336
|
+
* @param {math.Vec2} end1 - First line second coordinate.
|
|
337
|
+
* @param {math.Vec2} start2 - Second line first coordinate.
|
|
338
|
+
* @param {math.Vec2} end2 - Second line second coordinate.
|
|
339
339
|
* @param {boolean} [isSegment] - Lines are segments.
|
|
340
|
-
* @return {
|
|
340
|
+
* @return {math.Vec2} - Intersection coordinate.
|
|
341
341
|
*/
|
|
342
342
|
export function getLinesIntersection2v(start1, end1, start2, end2, isSegment) {
|
|
343
343
|
var dir1 = end1.sub(start1);
|
|
@@ -372,12 +372,12 @@ export function getLinesIntersection2v(start1, end1, start2, end2, isSegment) {
|
|
|
372
372
|
/**
|
|
373
373
|
* Returns two segment lines intersection coordinate.
|
|
374
374
|
* @static
|
|
375
|
-
* @param {
|
|
376
|
-
* @param {
|
|
377
|
-
* @param {
|
|
378
|
-
* @param {
|
|
375
|
+
* @param {math.Vec2} start1 - First line first coordinate.
|
|
376
|
+
* @param {math.Vec2} end1 - First line second coordinate.
|
|
377
|
+
* @param {math.Vec2} start2 - Second line first coordinate.
|
|
378
|
+
* @param {math.Vec2} end2 - Second line second coordinate.
|
|
379
379
|
* @param {boolean} [isSegment] - Lines are segments.
|
|
380
|
-
* @return {
|
|
380
|
+
* @return {math.Vec2} - Intersection coordinate.
|
|
381
381
|
*/
|
|
382
382
|
export function getLinesIntersectionLonLat(start1, end1, start2, end2, isSegment) {
|
|
383
383
|
var dir1 = new LonLat(end1.lon - start1.lon, end1.lat - start1.lat);
|
|
@@ -752,7 +752,7 @@ export function concatTypedArrays(a, b) {
|
|
|
752
752
|
* @param {TypedArray | Array} a
|
|
753
753
|
* @param {TypedArray | Array} b
|
|
754
754
|
*/
|
|
755
|
-
export function concatArrays(a, b) {
|
|
755
|
+
export function concatArrays(a = [], b) {
|
|
756
756
|
if (ArrayBuffer.isView(a)) {
|
|
757
757
|
return concatTypedArrays(a, b);
|
|
758
758
|
} else {
|