@openglobus/og 0.12.1 → 0.12.3
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/@openglobus/og.css +1 -0
- package/dist/@openglobus/og.esm.js +21 -0
- package/dist/@openglobus/og.esm.js.map +1 -0
- package/dist/@openglobus/og.umd.js +21 -0
- package/dist/@openglobus/og.umd.js.map +1 -0
- package/package.json +2 -2
- package/src/og/entity/GeoObjectHandler.js +35 -16
- package/src/og/layer/KML.js +19 -12
- package/src/og/layer/Layer.js +4 -1
- package/src/og/scene/Planet.js +14 -14
- package/src/og/shaders/geoObject.js +15 -6
- package/types/Clock.d.ts +94 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +77 -0
- package/types/Extent.d.ts +166 -0
- package/types/Globe.d.ts +85 -0
- package/types/ImageCanvas.d.ts +123 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +42 -0
- package/types/QueueArray.d.ts +19 -0
- package/types/Rectangle.d.ts +80 -0
- package/types/Stack.d.ts +19 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +7 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +30 -0
- package/types/bv/Sphere.d.ts +38 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +312 -0
- package/types/camera/Frustum.d.ts +133 -0
- package/types/camera/PlanetCamera.d.ts +219 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +104 -0
- package/types/control/DebugInfo.d.ts +15 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/EarthNavigation.d.ts +43 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +21 -0
- package/types/control/LayerSwitcher.d.ts +21 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/MouseNavigation.d.ts +48 -0
- package/types/control/MouseWheelZoomControl.d.ts +45 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +11 -0
- package/types/control/SimpleNavigation.d.ts +25 -0
- package/types/control/Sun.d.ts +50 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +27 -0
- package/types/control/index.d.ts +18 -0
- package/types/ellipsoid/Ellipsoid.d.ts +146 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +6 -0
- package/types/entity/BaseBillboard.d.ts +215 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +79 -0
- package/types/entity/Entity.d.ts +348 -0
- package/types/entity/EntityCollection.d.ts +317 -0
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +81 -0
- package/types/entity/Geometry.d.ts +74 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +189 -0
- package/types/entity/LabelHandler.d.ts +31 -0
- package/types/entity/LabelWorker.d.ts +11 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +306 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +124 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +119 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- 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/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +94 -0
- package/types/layer/CanvasTiles.d.ts +67 -0
- package/types/layer/GeoImage.d.ts +52 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +55 -0
- package/types/layer/KML.d.ts +68 -0
- package/types/layer/Layer.d.ts +310 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +61 -0
- package/types/layer/XYZ.d.ts +119 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +178 -0
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +65 -0
- package/types/math/Mat4.d.ts +176 -0
- package/types/math/Plane.d.ts +18 -0
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +309 -0
- package/types/math/Vec3.d.ts +467 -0
- package/types/math/Vec4.d.ts +162 -0
- package/types/math/coder.d.ts +43 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +6 -0
- package/types/proj/EPSG4326.d.ts +6 -0
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +60 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/Renderer.d.ts +290 -0
- package/types/renderer/RendererEvents.d.ts +237 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +576 -0
- package/types/scene/RenderNode.d.ts +142 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/Segment.d.ts +275 -0
- package/types/segment/SegmentLonLat.d.ts +17 -0
- package/types/segment/Slice.d.ts +10 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +250 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +7 -0
- package/types/terrain/EmptyTerrain.d.ts +73 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +116 -0
- package/types/terrain/MapboxTerrain.d.ts +7 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +15 -0
- package/types/utils/GeoImageCreator.d.ts +30 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +231 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +417 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +161 -0
- package/types/webgl/ProgramController.d.ts +89 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"core": "rollup -c --environment entry:core",
|
|
17
17
|
"test": "jest --env=jsdom",
|
|
18
18
|
"test_watch": "jest --env=jsdom --watch",
|
|
19
|
-
"lint": "eslint src/og",
|
|
19
|
+
"lint": "eslint -c ./.eslintrc.js src/og",
|
|
20
20
|
"generate_types": "rm -rf types; tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
|
21
21
|
"compile_js_as_ts": "tsc src/og/index.js --AllowJs --checkJs --outDir dist/@openglobus/src/"
|
|
22
22
|
},
|
|
@@ -14,7 +14,8 @@ const VERTEX_BUFFER = 0,
|
|
|
14
14
|
DIRECTION_BUFFER = 5,
|
|
15
15
|
PITCH_ROLL_BUFFER = 6,
|
|
16
16
|
SIZE_BUFFER = 7,
|
|
17
|
-
PICKINGCOLOR_BUFFER = 8
|
|
17
|
+
PICKINGCOLOR_BUFFER = 8,
|
|
18
|
+
VISIBLE_BUFFER = 9;
|
|
18
19
|
|
|
19
20
|
const setParametersToArray = (arr = [], index = 0, length, itemSize, ...params) => {
|
|
20
21
|
const currIndex = index * length;
|
|
@@ -48,6 +49,7 @@ class GeoObjectHandler {
|
|
|
48
49
|
this._normalsArr = [[]];
|
|
49
50
|
this._indicesArr = [[]];
|
|
50
51
|
this._pickingColorArr = [[]];
|
|
52
|
+
this._vehicleVisibleArr = [[]];
|
|
51
53
|
|
|
52
54
|
this._pitchRollBuffer = [];
|
|
53
55
|
this._sizeBuffer = [];
|
|
@@ -59,6 +61,7 @@ class GeoObjectHandler {
|
|
|
59
61
|
this._normalsBuffer = [];
|
|
60
62
|
this._indicesBuffer = [];
|
|
61
63
|
this._pickingColorBuffer = [];
|
|
64
|
+
this._vehicleVisibleBuffer = [];
|
|
62
65
|
|
|
63
66
|
this.__staticId = GeoObjectHandler._staticCounter++;
|
|
64
67
|
this._buffersUpdateCallbacks = [];
|
|
@@ -71,6 +74,7 @@ class GeoObjectHandler {
|
|
|
71
74
|
this._buffersUpdateCallbacks[VERTEX_BUFFER] = this.createVertexBuffer;
|
|
72
75
|
this._buffersUpdateCallbacks[SIZE_BUFFER] = this.createSizeBuffer;
|
|
73
76
|
this._buffersUpdateCallbacks[PITCH_ROLL_BUFFER] = this.createPitchRollBuffer;
|
|
77
|
+
this._buffersUpdateCallbacks[VISIBLE_BUFFER] = this.createVisibleBuffer;
|
|
74
78
|
|
|
75
79
|
this._changedBuffers = new Array(this._buffersUpdateCallbacks.length);
|
|
76
80
|
|
|
@@ -100,6 +104,15 @@ class GeoObjectHandler {
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
createVisibleBuffer() {
|
|
108
|
+
const h = this._renderer.handler;
|
|
109
|
+
for (let i = 0, len = this._vehicleVisibleArr.length; i < len; i++) {
|
|
110
|
+
this._vehicleVisibleBuffer && h.gl.deleteBuffer(this._vehicleVisibleBuffer[i]);
|
|
111
|
+
this._vehicleVisibleArr[i] = makeArrayTyped(this._vehicleVisibleArr[i]);
|
|
112
|
+
this._vehicleVisibleBuffer[i] = h.createArrayBuffer(this._vehicleVisibleArr[i], 1, this._vehicleVisibleArr[i].length);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
103
116
|
createSizeBuffer() {
|
|
104
117
|
const h = this._renderer.handler;
|
|
105
118
|
for (let i = 0, len = this._sizeArr.length; i < len; i++) {
|
|
@@ -225,7 +238,7 @@ class GeoObjectHandler {
|
|
|
225
238
|
* mark object by index for recalc indices array
|
|
226
239
|
*/
|
|
227
240
|
geoObject._tagIndex = tagData.iCounts - 1;
|
|
228
|
-
|
|
241
|
+
|
|
229
242
|
if (!this._vertexArr[ti] || this._vertexArr[ti].length !== geoObject._vertices.length) {
|
|
230
243
|
|
|
231
244
|
this._vertexArr[ti] = concatArrays(
|
|
@@ -250,12 +263,11 @@ class GeoObjectHandler {
|
|
|
250
263
|
)
|
|
251
264
|
);
|
|
252
265
|
}
|
|
253
|
-
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
266
|
+
this._vehicleVisibleArr[ti] = concatArrays(
|
|
267
|
+
this._vehicleVisibleArr[ti],
|
|
268
|
+
setParametersToArray([], 0, 1, 1, geoObject._visibility ? 1 : 0)
|
|
269
|
+
);
|
|
270
|
+
|
|
259
271
|
let x = geoObject._positionHigh.x,
|
|
260
272
|
y = geoObject._positionHigh.y,
|
|
261
273
|
z = geoObject._positionHigh.z,
|
|
@@ -366,6 +378,9 @@ class GeoObjectHandler {
|
|
|
366
378
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._rgbaBuffer[ti]);
|
|
367
379
|
gl.vertexAttribPointer(a.aColor, this._rgbaBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
368
380
|
|
|
381
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._vehicleVisibleBuffer[ti]);
|
|
382
|
+
gl.vertexAttribPointer(a.aDispose, this._vehicleVisibleBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
383
|
+
|
|
369
384
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._positionHighBuffer[ti]);
|
|
370
385
|
gl.vertexAttribPointer(
|
|
371
386
|
a.aPositionHigh,
|
|
@@ -503,6 +518,9 @@ class GeoObjectHandler {
|
|
|
503
518
|
0
|
|
504
519
|
);
|
|
505
520
|
|
|
521
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._vehicleVisibleBuffer[ti]);
|
|
522
|
+
gl.vertexAttribPointer(a.aDispose, this._vehicleVisibleBuffer[ti].itemSize, gl.FLOAT, false, 0, 0);
|
|
523
|
+
|
|
506
524
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indicesBuffer[ti]);
|
|
507
525
|
|
|
508
526
|
if (tagData.iCounts) {
|
|
@@ -627,14 +645,12 @@ class GeoObjectHandler {
|
|
|
627
645
|
}
|
|
628
646
|
|
|
629
647
|
setVisibility(index, visibility) {
|
|
630
|
-
const ob = this.getObjectByIndex(index)
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
this.setVertexArr(index, vArr);
|
|
648
|
+
const ob = this.getObjectByIndex(index),
|
|
649
|
+
ti = this.getTagIndexByObjectIndex(index);
|
|
650
|
+
|
|
651
|
+
setParametersToArray(this._vehicleVisibleArr[ti], ob._tagIndex, 1, 1, visibility ? 1 : 0);
|
|
652
|
+
|
|
653
|
+
this._changedBuffers[VISIBLE_BUFFER] = true;
|
|
638
654
|
}
|
|
639
655
|
|
|
640
656
|
setPositionArr(index, positionHigh, positionLow) {
|
|
@@ -753,6 +769,7 @@ class GeoObjectHandler {
|
|
|
753
769
|
this._normalsArr = null;
|
|
754
770
|
this._indicesArr = null;
|
|
755
771
|
this._pickingColorArr = null;
|
|
772
|
+
this._vehicleVisibleArr = null;
|
|
756
773
|
|
|
757
774
|
this._pitchRollArr = [new Float32Array()];
|
|
758
775
|
this._sizeArr = [new Float32Array()];
|
|
@@ -764,6 +781,7 @@ class GeoObjectHandler {
|
|
|
764
781
|
this._normalsArr = [new Float32Array()];
|
|
765
782
|
this._indicesArr = [new Uint16Array()];
|
|
766
783
|
this._pickingColorArr = [new Float32Array()];
|
|
784
|
+
this._vehicleVisibleArr = [new Int8Array()];
|
|
767
785
|
|
|
768
786
|
this._removeGeoObjects();
|
|
769
787
|
this._deleteBuffers();
|
|
@@ -880,6 +898,7 @@ class GeoObjectHandler {
|
|
|
880
898
|
this._pitchRollArr[ti] = spliceArray(this._pitchRollArr[ti], i, 2);
|
|
881
899
|
i = geoObject._tagIndex;
|
|
882
900
|
this._sizeArr[ti] = spliceArray(this._sizeArr[ti], i, 1);
|
|
901
|
+
this._vehicleVisibleArr[ti] = spliceArray(this._vehicleVisibleArr[ti], i, 1);
|
|
883
902
|
|
|
884
903
|
this._removeIndices(geoObject);
|
|
885
904
|
|
package/src/og/layer/KML.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
6
|
+
import { Billboard } from "../entity/Billboard.js";
|
|
6
7
|
import { Entity } from "../entity/Entity.js";
|
|
7
8
|
import { Extent } from "../Extent.js";
|
|
8
9
|
import { LonLat } from "../LonLat.js";
|
|
@@ -40,12 +41,14 @@ export class KML extends Vector {
|
|
|
40
41
|
*/
|
|
41
42
|
_extractCoordonatesFromKml(xmlDoc) {
|
|
42
43
|
const raw = Array.from(xmlDoc.getElementsByTagName("coordinates"));
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const rawText = raw.map(item => item.textContent.trim());
|
|
45
|
+
const coordinates = rawText.map(item =>
|
|
46
|
+
item
|
|
47
|
+
.replace(/\n/g, " ")
|
|
48
|
+
.replace(/\t/g, " ")
|
|
49
|
+
.replace(/ +/g," ")
|
|
50
|
+
.split(" ")
|
|
51
|
+
.map((co) => co.split(",").map(parseFloat))
|
|
49
52
|
);
|
|
50
53
|
return coordinates;
|
|
51
54
|
}
|
|
@@ -121,15 +124,17 @@ export class KML extends Vector {
|
|
|
121
124
|
/**
|
|
122
125
|
* @public
|
|
123
126
|
* @param {File[]} kmls
|
|
127
|
+
* @param {string} [color]
|
|
128
|
+
* @param {Billboard} [billboard]
|
|
124
129
|
* @returns {Promise<{entities: Entity[], extent: Extent}>}
|
|
125
130
|
*/
|
|
126
|
-
async addKmlFromFiles(kmls) {
|
|
131
|
+
async addKmlFromFiles(kmls, color = null, billboard = null) {
|
|
127
132
|
const kmlObjs = await Promise.all(kmls.map(this._getXmlContent));
|
|
128
133
|
const coordonates = kmlObjs.map(this._extractCoordonatesFromKml);
|
|
129
134
|
const { entities, extent } = this._convertCoordonatesIntoEntities(
|
|
130
135
|
coordonates,
|
|
131
|
-
this._color,
|
|
132
|
-
this._billboard
|
|
136
|
+
color || this._color,
|
|
137
|
+
billboard || this._billboard
|
|
133
138
|
);
|
|
134
139
|
this._extent = this._expandExtents(this._extent, extent);
|
|
135
140
|
entities.forEach(this.add.bind(this));
|
|
@@ -168,15 +173,17 @@ export class KML extends Vector {
|
|
|
168
173
|
/**
|
|
169
174
|
* @public
|
|
170
175
|
* @param {string} url - Url of the KML to display. './myFile.kml' or 'http://mySite/myFile.kml' for example.
|
|
176
|
+
* @param {string} [color]
|
|
177
|
+
* @param {Billboard} [billboard]
|
|
171
178
|
* @returns {Promise<{entities: Entity[], extent: Extent}>}
|
|
172
179
|
*/
|
|
173
|
-
async addKmlFromUrl(url) {
|
|
180
|
+
async addKmlFromUrl(url, color = null, billboard = null) {
|
|
174
181
|
const kml = await this._getKmlFromUrl(url);
|
|
175
182
|
const coordonates = this._extractCoordonatesFromKml(kml);
|
|
176
183
|
const { entities, extent } = this._convertCoordonatesIntoEntities(
|
|
177
184
|
[coordonates],
|
|
178
|
-
this._color,
|
|
179
|
-
this._billboard
|
|
185
|
+
color || this._color,
|
|
186
|
+
billboard || this._billboard
|
|
180
187
|
);
|
|
181
188
|
this._extent = this._expandExtents(this._extent, extent);
|
|
182
189
|
entities.forEach(this.add.bind(this));
|
package/src/og/layer/Layer.js
CHANGED
|
@@ -497,7 +497,10 @@ class Layer {
|
|
|
497
497
|
if (this._isBaseLayer && visibility) {
|
|
498
498
|
this._planet.setBaseLayer(this);
|
|
499
499
|
}
|
|
500
|
-
this._planet.updateVisibleLayers();
|
|
500
|
+
this._planet.updateVisibleLayers();
|
|
501
|
+
if (visibility) {
|
|
502
|
+
this._planet._preLoad();
|
|
503
|
+
}
|
|
501
504
|
}
|
|
502
505
|
this.events.dispatch(this.events.visibilitychange, this);
|
|
503
506
|
}
|
package/src/og/scene/Planet.js
CHANGED
|
@@ -843,19 +843,9 @@ export class Planet extends RenderNode {
|
|
|
843
843
|
}
|
|
844
844
|
|
|
845
845
|
_preLoad() {
|
|
846
|
-
this.
|
|
847
|
-
|
|
848
|
-
// Zoom 0
|
|
849
|
-
this._quadTree.segment.passReady = true;
|
|
850
|
-
this._quadTree.renderNode(true);
|
|
851
|
-
this._normalMapCreator.drawSingle(this._quadTree.segment);
|
|
846
|
+
this._clearRenderedNodeList();
|
|
852
847
|
|
|
853
|
-
|
|
854
|
-
for (let i = 0; i < this._quadTree.nodes.length; i++) {
|
|
855
|
-
this._quadTree.nodes[i].segment.passReady = true;
|
|
856
|
-
this._quadTree.nodes[i].renderNode(true);
|
|
857
|
-
this._normalMapCreator.drawSingle(this._quadTree.nodes[i].segment);
|
|
858
|
-
}
|
|
848
|
+
this._skipPreRender = false;
|
|
859
849
|
|
|
860
850
|
// Same for poles
|
|
861
851
|
this._quadTreeNorth.segment.passReady = true;
|
|
@@ -877,6 +867,18 @@ export class Planet extends RenderNode {
|
|
|
877
867
|
this._quadTreeSouth.nodes[i].renderNode(true);
|
|
878
868
|
this._normalMapCreator.drawSingle(this._quadTreeSouth.nodes[i].segment);
|
|
879
869
|
}
|
|
870
|
+
|
|
871
|
+
// Zoom 1
|
|
872
|
+
for (let i = 0; i < this._quadTree.nodes.length; i++) {
|
|
873
|
+
this._quadTree.nodes[i].segment.passReady = true;
|
|
874
|
+
this._quadTree.nodes[i].renderNode(true);
|
|
875
|
+
this._normalMapCreator.drawSingle(this._quadTree.nodes[i].segment);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// Zoom 0
|
|
879
|
+
this._quadTree.segment.passReady = true;
|
|
880
|
+
this._quadTree.renderNode(true);
|
|
881
|
+
this._normalMapCreator.drawSingle(this._quadTree.segment);
|
|
880
882
|
}
|
|
881
883
|
|
|
882
884
|
/**
|
|
@@ -955,8 +957,6 @@ export class Planet extends RenderNode {
|
|
|
955
957
|
html += "<li>" + li._attribution + "</li>";
|
|
956
958
|
}
|
|
957
959
|
|
|
958
|
-
this._preLoad();
|
|
959
|
-
|
|
960
960
|
} else if (li._fading && li._fadingOpacity > 0) {
|
|
961
961
|
if (li.hasImageryTiles()) {
|
|
962
962
|
this.visibleTileLayers.push(li);
|
|
@@ -30,7 +30,8 @@ export const geo_object = () =>
|
|
|
30
30
|
aDirection: { type: "vec3", divisor: 1 },
|
|
31
31
|
aPitchRoll: { type: "vec2", divisor: 1 },
|
|
32
32
|
aColor: { type: "vec4", divisor: 1 },
|
|
33
|
-
aScale: { type: "float", divisor: 1 }
|
|
33
|
+
aScale: { type: "float", divisor: 1 },
|
|
34
|
+
aDispose: { type: "float", divisor: 1 }
|
|
34
35
|
},
|
|
35
36
|
vertexShader: `precision highp float;
|
|
36
37
|
|
|
@@ -42,6 +43,7 @@ export const geo_object = () =>
|
|
|
42
43
|
attribute vec2 aPitchRoll;
|
|
43
44
|
attribute vec4 aColor;
|
|
44
45
|
attribute float aScale;
|
|
46
|
+
attribute float aDispose;
|
|
45
47
|
|
|
46
48
|
uniform vec3 uScaleByDistance;
|
|
47
49
|
uniform mat4 projectionMatrix;
|
|
@@ -54,11 +56,13 @@ export const geo_object = () =>
|
|
|
54
56
|
varying vec3 vNormal;
|
|
55
57
|
varying vec4 vPosition;
|
|
56
58
|
varying vec4 vColor;
|
|
59
|
+
varying float vDispose;
|
|
57
60
|
|
|
58
61
|
const float RADIANS = 3.141592653589793 / 180.0;
|
|
59
62
|
|
|
60
63
|
void main(void) {
|
|
61
64
|
|
|
65
|
+
vDispose = aDispose;
|
|
62
66
|
vColor = aColor;
|
|
63
67
|
float roll = aPitchRoll.y * RADIANS;
|
|
64
68
|
mat3 rotZ = mat3(
|
|
@@ -91,7 +95,7 @@ export const geo_object = () =>
|
|
|
91
95
|
|
|
92
96
|
vPosition = viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
|
|
93
97
|
|
|
94
|
-
gl_Position = projectionMatrix * vPosition;
|
|
98
|
+
gl_Position = mix(vec4(0.0, 0.0, 0.0, 0.0), projectionMatrix * vPosition, aDispose);
|
|
95
99
|
}`,
|
|
96
100
|
fragmentShader: `precision highp float;
|
|
97
101
|
|
|
@@ -135,7 +139,7 @@ export const geo_object_picking = () =>
|
|
|
135
139
|
|
|
136
140
|
eyePositionHigh: "vec3",
|
|
137
141
|
eyePositionLow: "vec3",
|
|
138
|
-
pickingScale: "float"
|
|
142
|
+
pickingScale: "float"
|
|
139
143
|
|
|
140
144
|
},
|
|
141
145
|
attributes: {
|
|
@@ -145,7 +149,8 @@ export const geo_object_picking = () =>
|
|
|
145
149
|
aDirection: { type: "vec3", divisor: 1 },
|
|
146
150
|
aPitchRoll: { type: "vec2", divisor: 1 },
|
|
147
151
|
aPickingColor: { type: "vec3", divisor: 1 },
|
|
148
|
-
aScale: { type: "float", divisor: 1 }
|
|
152
|
+
aScale: { type: "float", divisor: 1 },
|
|
153
|
+
aDispose: { type: "float", divisor: 1 }
|
|
149
154
|
},
|
|
150
155
|
vertexShader: `precision highp float;
|
|
151
156
|
|
|
@@ -156,6 +161,7 @@ export const geo_object_picking = () =>
|
|
|
156
161
|
attribute vec2 aPitchRoll;
|
|
157
162
|
attribute vec3 aPickingColor;
|
|
158
163
|
attribute float aScale;
|
|
164
|
+
attribute float aDispose;
|
|
159
165
|
|
|
160
166
|
uniform vec3 uScaleByDistance;
|
|
161
167
|
uniform mat4 projectionMatrix;
|
|
@@ -165,12 +171,14 @@ export const geo_object_picking = () =>
|
|
|
165
171
|
uniform vec3 eyePositionHigh;
|
|
166
172
|
uniform vec3 eyePositionLow;
|
|
167
173
|
|
|
174
|
+
varying float vDispose;
|
|
168
175
|
varying vec3 vColor;
|
|
169
176
|
|
|
170
177
|
const float RADIANS = 3.141592653589793 / 180.0;
|
|
171
178
|
|
|
172
179
|
void main(void) {
|
|
173
180
|
|
|
181
|
+
vDispose = aDispose;
|
|
174
182
|
vColor = aPickingColor;
|
|
175
183
|
float roll = aPitchRoll.y * RADIANS;
|
|
176
184
|
mat3 rotZ = mat3(
|
|
@@ -200,12 +208,13 @@ export const geo_object_picking = () =>
|
|
|
200
208
|
mat4 viewMatrixRTE = viewMatrix;
|
|
201
209
|
viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
|
|
202
210
|
|
|
203
|
-
gl_Position = projectionMatrix *viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
|
|
211
|
+
gl_Position = mix(vec4(0.0, 0.0, 0.0, 0.0), projectionMatrix *viewMatrixRTE * vec4(highDiff + lowDiff, 1.0), aDispose);
|
|
204
212
|
}`,
|
|
205
213
|
fragmentShader:
|
|
206
214
|
`precision highp float;
|
|
207
215
|
varying vec3 vColor;
|
|
216
|
+
varying float vDispose;
|
|
208
217
|
void main () {
|
|
209
|
-
gl_FragColor = vec4(vColor,
|
|
218
|
+
gl_FragColor = vec4(vColor, vDispose);
|
|
210
219
|
}`
|
|
211
220
|
});
|
package/types/Clock.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class represents application timer that stores custom current julian datetime, and time speed multiplier.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {Object} [params] - Clock parameters:
|
|
5
|
+
* @param {number} [params.startDate=0.0] - Julian start date.
|
|
6
|
+
* @param {number} [params.endDate=0.0] - Julian end date.
|
|
7
|
+
* @param {number} [params.currentDate] - Julian current date. Default: current date.
|
|
8
|
+
* @param {number} [params.multiplier=1.0] - Time speed multiolier.
|
|
9
|
+
*/
|
|
10
|
+
export class Clock {
|
|
11
|
+
static set _staticCounter(arg: any);
|
|
12
|
+
static get _staticCounter(): any;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} [params] - Clock parameters:
|
|
16
|
+
*/
|
|
17
|
+
constructor(params?: any);
|
|
18
|
+
_id: number;
|
|
19
|
+
/**
|
|
20
|
+
* Clock name.
|
|
21
|
+
* @public
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
public name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Clock events.
|
|
27
|
+
* @public
|
|
28
|
+
* @type {Events}
|
|
29
|
+
*/
|
|
30
|
+
public events: Events;
|
|
31
|
+
/**
|
|
32
|
+
* Start julian date clock loop.
|
|
33
|
+
* @public
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
public startDate: number;
|
|
37
|
+
/**
|
|
38
|
+
* End julian date clock loop.
|
|
39
|
+
* @public
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
public endDate: number;
|
|
43
|
+
/**
|
|
44
|
+
* Current julian datetime.
|
|
45
|
+
* @public
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
public currentDate: number;
|
|
49
|
+
/**
|
|
50
|
+
* Timer speed multiplier.
|
|
51
|
+
* @public
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
public multiplier: number;
|
|
55
|
+
/**
|
|
56
|
+
* Animation frame delta time.
|
|
57
|
+
* @public
|
|
58
|
+
* @readonly
|
|
59
|
+
* @type {number}
|
|
60
|
+
*/
|
|
61
|
+
public readonly deltaTicks: number;
|
|
62
|
+
/**
|
|
63
|
+
* Timer activity.
|
|
64
|
+
* @public
|
|
65
|
+
* @type {boolean}
|
|
66
|
+
*/
|
|
67
|
+
public active: boolean;
|
|
68
|
+
_intervalDelay: number;
|
|
69
|
+
_intervalStart: number;
|
|
70
|
+
_intervalCallback: any;
|
|
71
|
+
clearInterval(): void;
|
|
72
|
+
setInterval(delay: any, callback: any): void;
|
|
73
|
+
/**
|
|
74
|
+
* Sets current clock datetime.
|
|
75
|
+
* @public
|
|
76
|
+
* @param {Object} date - JavaScript Date object.
|
|
77
|
+
*/
|
|
78
|
+
public setDate(date: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* Returns current application date.
|
|
81
|
+
* @public
|
|
82
|
+
* @returns {Date} - Current date.
|
|
83
|
+
*/
|
|
84
|
+
public getDate(): Date;
|
|
85
|
+
reset(): void;
|
|
86
|
+
_tick(dt: any): void;
|
|
87
|
+
/**
|
|
88
|
+
* @public
|
|
89
|
+
* @param {Clock} clock - Clock instance to compare.
|
|
90
|
+
* @returns {boolean} - Returns true if a clock is the same instance.
|
|
91
|
+
*/
|
|
92
|
+
public equal(clock: Clock): boolean;
|
|
93
|
+
}
|
|
94
|
+
import { Events } from "./Events.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base events class to handle custom events.
|
|
3
|
+
* @class
|
|
4
|
+
*/
|
|
5
|
+
export class Events {
|
|
6
|
+
static set _staticCounter(arg: any);
|
|
7
|
+
static get _staticCounter(): any;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {Array.<string>} [eventNames] - Event names that could be dispatched.
|
|
11
|
+
* @param {*} [sender]
|
|
12
|
+
*/
|
|
13
|
+
constructor(eventNames?: Array<string>, sender?: any);
|
|
14
|
+
/**
|
|
15
|
+
* Registered event names.
|
|
16
|
+
* @protected
|
|
17
|
+
* @type {Array.<string>}
|
|
18
|
+
*/
|
|
19
|
+
protected _eventNames: Array<string>;
|
|
20
|
+
_sender: any;
|
|
21
|
+
/**
|
|
22
|
+
* Stop propagation flag
|
|
23
|
+
* @protected
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
protected _stopPropagation: boolean;
|
|
27
|
+
_stampCache: {};
|
|
28
|
+
__id: number;
|
|
29
|
+
bindSender(sender: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* Function that creates event object properties that would be dispatched.
|
|
32
|
+
* @public
|
|
33
|
+
* @param {Array.<string>} eventNames - Specified event names list.
|
|
34
|
+
*/
|
|
35
|
+
public registerNames(eventNames: Array<string>): void;
|
|
36
|
+
_getStamp(name: any, id: any, ogid: any): string;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if event callback has stamped.
|
|
39
|
+
* @protected
|
|
40
|
+
* @param {Object} name - Event identifier.
|
|
41
|
+
* @param {Object} obj - Event callback.
|
|
42
|
+
* @return {boolean} -
|
|
43
|
+
*/
|
|
44
|
+
protected _stamp(name: any, obj: any): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Attach listener.
|
|
47
|
+
* @public
|
|
48
|
+
* @param {string} name - Event name to listen.
|
|
49
|
+
* @param {eventCallback} callback - Event callback function.
|
|
50
|
+
* @param {Object} sender - Event callback function owner.
|
|
51
|
+
*/
|
|
52
|
+
public on(name: string, callback: eventCallback, sender: any, priority?: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* Stop listening event name with specified callback function.
|
|
55
|
+
* @public
|
|
56
|
+
* @param {string} name - Event name.
|
|
57
|
+
* @param {eventCallback} callback - Attached event callback.
|
|
58
|
+
*/
|
|
59
|
+
public off(name: string, callback: eventCallback): void;
|
|
60
|
+
/**
|
|
61
|
+
* Dispatch event.
|
|
62
|
+
* @public
|
|
63
|
+
* @param {Object} event - Event instance property that created by event name.
|
|
64
|
+
* @param {Object} [obj] - Event object.
|
|
65
|
+
*/
|
|
66
|
+
public dispatch(event: any, ...args: any[]): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Brakes events propagation.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
public stopPropagation(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Removes all events.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
public clear(): void;
|
|
77
|
+
}
|