@pirireis/webglobeplugins 0.9.10 → 0.9.11
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/Math/angle-calculation.js +8 -8
- package/Math/arc.js +18 -18
- package/Math/bounds/line-bbox.js +80 -78
- package/Math/constants.js +3 -3
- package/Math/juction/arc-plane.js +23 -23
- package/Math/juction/line-sphere.js +11 -11
- package/Math/juction/plane-plane.js +11 -11
- package/Math/line.js +16 -14
- package/Math/methods.js +72 -67
- package/Math/plane.js +18 -16
- package/Math/quaternion.js +49 -45
- package/Math/utils.js +2 -2
- package/Math/vec3.js +45 -42
- package/algorithms/search-binary.js +4 -4
- package/altitude-locator/draw-subset-obj.js +8 -7
- package/altitude-locator/plugin.js +113 -97
- package/arrowfield/adaptor.js +4 -3
- package/arrowfield/index.js +2 -2
- package/arrowfield/plugin.js +65 -62
- package/bearing-line/index.js +1 -1
- package/bearing-line/plugin.js +225 -200
- package/circle-line-chain/chain-list-map.js +88 -82
- package/circle-line-chain/plugin.js +154 -129
- package/circle-line-chain/util.js +1 -1
- package/compass-rose/compass-rose-padding-flat.js +126 -104
- package/compass-rose/compass-text-writer.js +70 -62
- package/compass-rose/index.js +2 -2
- package/compassrose/compassrose.js +50 -46
- package/compassrose/index.js +1 -1
- package/heatwave/index.js +2 -2
- package/heatwave/isobar/objectarraylabels.js +48 -44
- package/heatwave/isobar/plugin.js +123 -104
- package/heatwave/isobar/quadtreecontours.js +92 -76
- package/heatwave/plugins/heatwaveglobeshell.js +87 -69
- package/index.js +11 -11
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +64 -32
- package/partialrings/index.js +1 -1
- package/partialrings/plugin.js +84 -48
- package/partialrings/program.js +47 -136
- package/pin/pin-object-array.js +86 -83
- package/pin/pin-point-totem.js +22 -21
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
- package/point-heat-map/plugin-webworker.js +45 -40
- package/point-heat-map/point-to-heat-map-flow.js +42 -40
- package/point-tracks/key-methods.js +1 -1
- package/point-tracks/plugin.js +142 -127
- package/programs/arrowfield/index.js +1 -1
- package/programs/arrowfield/logic.js +62 -170
- package/programs/arrowfield/object.js +35 -33
- package/programs/data2legend/density-to-legend.js +21 -45
- package/programs/data2legend/point-to-density-texture.js +27 -52
- package/programs/float2legendwithratio/index.js +1 -1
- package/programs/float2legendwithratio/logic.js +42 -88
- package/programs/float2legendwithratio/object.js +46 -43
- package/programs/globe-util/is-globe-moved.js +11 -10
- package/programs/globeshell/index.js +1 -1
- package/programs/globeshell/wiggle/index.js +1 -1
- package/programs/globeshell/wiggle/logic.js +98 -191
- package/programs/globeshell/wiggle/object.js +35 -33
- package/programs/helpers/blender/program.js +19 -36
- package/programs/helpers/fadeaway/index.js +1 -1
- package/programs/helpers/fadeaway/logic.js +13 -35
- package/programs/helpers/fadeaway/object.js +10 -9
- package/programs/helpers/index.js +1 -1
- package/programs/index.js +8 -8
- package/programs/line-on-globe/angled-line.js +32 -91
- package/programs/line-on-globe/circle-accurate-3d.js +32 -82
- package/programs/line-on-globe/circle-accurate-flat.js +50 -108
- package/programs/line-on-globe/circle-accurate.js +33 -103
- package/programs/line-on-globe/circle.js +32 -97
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
- package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
- package/programs/line-on-globe/linestrip.js +39 -100
- package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
- package/programs/line-on-globe/to-the-surface.js +29 -58
- package/programs/line-on-globe/util.js +1 -1
- package/programs/picking/pickable-renderer.js +33 -117
- package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
- package/programs/point-on-globe/element-point-glow.js +35 -103
- package/programs/point-on-globe/square-pixel-point.js +27 -76
- package/programs/programcache.js +13 -13
- package/programs/rings/distancering/circleflatprogram.js +21 -63
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
- package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
- package/programs/rings/distancering/index.js +4 -4
- package/programs/rings/distancering/paddyflatprogram.js +20 -73
- package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
- package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
- package/programs/rings/partial-ring/piece-of-pie.js +35 -137
- package/programs/totems/camerauniformblock.js +51 -64
- package/programs/totems/canvas-webglobe-info.js +40 -48
- package/programs/totems/gpu-selection-uniform-block.js +40 -44
- package/programs/totems/index.js +1 -1
- package/programs/two-d/pixel-padding-for-compass.js +29 -90
- package/programs/util.js +7 -6
- package/programs/vectorfields/index.js +1 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
- package/programs/vectorfields/logics/index.js +3 -3
- package/programs/vectorfields/logics/pixelbased.js +35 -91
- package/programs/vectorfields/logics/ubo.js +25 -31
- package/programs/vectorfields/pingpongbuffermanager.js +34 -30
- package/rangerings/index.js +4 -4
- package/rangerings/plugin.js +252 -202
- package/rangerings/rangeringangletext.js +120 -108
- package/rangerings/ring-account.js +69 -52
- package/shaders/fragment-toy/firework.js +1 -55
- package/shaders/fragment-toy/singularity.js +1 -55
- package/timetracks/adaptors-line-strip.js +37 -26
- package/timetracks/adaptors.js +61 -47
- package/timetracks/index.js +4 -4
- package/timetracks/plugin-line-strip.js +63 -59
- package/timetracks/plugin.js +69 -65
- package/timetracks/program-line-strip.js +103 -296
- package/timetracks/program.js +113 -419
- package/timetracks/programpoint-line-strip.js +44 -97
- package/timetracks/programpoint.js +44 -90
- package/util/account/bufferoffsetmanager.js +95 -72
- package/util/account/index.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
- package/util/account/single-attribute-buffer-management/index.js +3 -3
- package/util/account/single-attribute-buffer-management/object-store.js +30 -28
- package/util/account/util.js +4 -2
- package/util/algorithms/search-binary.js +4 -4
- package/util/check/get.js +5 -5
- package/util/check/typecheck.js +15 -13
- package/util/geometry/index.js +11 -9
- package/util/gl-util/buffer/attribute-loader.js +20 -8
- package/util/gl-util/buffer/index.js +1 -1
- package/util/gl-util/draw-options/methods.js +7 -7
- package/util/gl-util/uniform-block/manager.js +67 -55
- package/util/heatwavedatamanager/datamanager.js +116 -56
- package/util/heatwavedatamanager/index.js +2 -2
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
- package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
- package/util/index.js +6 -6
- package/util/interpolation/timetrack/index.js +1 -1
- package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
- package/util/interpolation/timetrack/web-worker-str.js +1 -179
- package/util/interpolation/timetrack/web-worker.js +4 -4
- package/util/jshelpers/data-filler.js +7 -7
- package/util/jshelpers/timefilters.js +7 -7
- package/util/picking/fence.js +7 -7
- package/util/picking/picker-displayer.js +52 -46
- package/util/programs/draw-texture-on-canvas.js +21 -39
- package/util/programs/shapesonglobe.js +64 -104
- package/util/programs/supersampletotextures.js +39 -45
- package/util/programs/texturetoglobe.js +48 -98
- package/util/shaderfunctions/geometrytransformations.js +27 -322
- package/util/shaderfunctions/nodata.js +1 -7
- package/util/shaderfunctions/noisefunctions.js +9 -39
- package/util/surface-line-data/arcs-to-cuts.js +23 -20
- package/util/webglobe/rasteroverlay.js +37 -35
- package/util/webglobjectbuilders.js +60 -55
- package/util/webglobjectbuilders1.js +49 -48
- package/waveparticles/adaptor.js +7 -6
- package/waveparticles/index.js +2 -2
- package/waveparticles/plugin.js +84 -79
- package/wind/imagetovectorfieldandmagnitude.js +15 -15
- package/wind/index.js +4 -4
- package/wind/plugin.js +251 -453
- package/wind/vectorfieldimage.js +5 -5
- package/write-text/attached-text-writer.js +48 -46
- package/write-text/context-text.js +58 -51
- package/write-text/context-text3.js +74 -69
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return { long, lat, posIndex, callback };
|
|
6
|
+
var pointcoordsmeta_1 = __importDefault(require("./pointcoordsmeta"));
|
|
7
|
+
var pointObject = function (long, lat, posIndex, callback) {
|
|
8
|
+
return { long: long, lat: lat, posIndex: posIndex, callback: callback };
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var PointCoordinatesDataCalculator = /** @class */ (function () {
|
|
11
|
+
function PointCoordinatesDataCalculator(bbox, width, height) {
|
|
12
12
|
this._pointObjects = {};
|
|
13
13
|
this._ratio = 0.0;
|
|
14
14
|
this._bbox = bbox;
|
|
@@ -25,49 +25,51 @@ class PointCoordinatesDataCalculator {
|
|
|
25
25
|
* @param {*} long
|
|
26
26
|
* @param {*} callback | callback(data0, data1, interpolated)
|
|
27
27
|
*/
|
|
28
|
-
registerPoint(key, long, lat, callback) {
|
|
28
|
+
PointCoordinatesDataCalculator.prototype.registerPoint = function (key, long, lat, callback) {
|
|
29
29
|
if (key in this._pointObjects) {
|
|
30
30
|
console.warn("key already registered, old one is unregistered");
|
|
31
31
|
this.unregisterPoint(key);
|
|
32
32
|
}
|
|
33
33
|
if (!this._isInBBox(long, lat))
|
|
34
34
|
return false;
|
|
35
|
-
|
|
35
|
+
var meta = this._metaCalculater.getFlooredMeta(long, lat);
|
|
36
36
|
this._pointObjects[key] = pointObject(long, lat, meta.index, callback);
|
|
37
37
|
if (this._texture0 && this._texture1) {
|
|
38
|
-
|
|
38
|
+
var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
|
|
39
39
|
callback(data0, data1, interpolated);
|
|
40
40
|
}
|
|
41
41
|
return true;
|
|
42
|
-
}
|
|
43
|
-
_isInBBox(long, lat) {
|
|
42
|
+
};
|
|
43
|
+
PointCoordinatesDataCalculator.prototype._isInBBox = function (long, lat) {
|
|
44
44
|
return lat >= this._bbox[1] && lat <= this._bbox[3] && long >= this._bbox[0] && long <= this._bbox[2];
|
|
45
|
-
}
|
|
46
|
-
unregisterPoint(key) {
|
|
45
|
+
};
|
|
46
|
+
PointCoordinatesDataCalculator.prototype.unregisterPoint = function (key) {
|
|
47
47
|
if (!(key in this._pointObjects))
|
|
48
48
|
return false;
|
|
49
49
|
delete this._pointObjects[key];
|
|
50
50
|
return true;
|
|
51
|
-
}
|
|
52
|
-
updatePoint(key, long, lat) {
|
|
51
|
+
};
|
|
52
|
+
PointCoordinatesDataCalculator.prototype.updatePoint = function (key, long, lat) {
|
|
53
53
|
if (!(key in this._pointObjects))
|
|
54
54
|
return false;
|
|
55
55
|
if (!this._isInBBox(long, lat))
|
|
56
56
|
return false;
|
|
57
57
|
this._pointObjects[key].long = long;
|
|
58
58
|
this._pointObjects[key].lat = lat;
|
|
59
|
-
|
|
59
|
+
var meta = this._metaCalculater.getFlooredMeta(long, lat);
|
|
60
60
|
this._pointObjects[key].posIndex = meta.index;
|
|
61
|
-
|
|
61
|
+
var _a = this._findAPoint(meta.index), data0 = _a.data0, data1 = _a.data1, interpolated = _a.interpolated;
|
|
62
62
|
this._pointObjects[key].callback(data0, data1, interpolated);
|
|
63
63
|
return true;
|
|
64
|
-
}
|
|
64
|
+
};
|
|
65
65
|
/**
|
|
66
66
|
* @param {Number} ratio 0-1
|
|
67
67
|
* @param {} textureData0
|
|
68
68
|
* @param {*} textureData1
|
|
69
69
|
*/
|
|
70
|
-
updateData(ratio, textureData0
|
|
70
|
+
PointCoordinatesDataCalculator.prototype.updateData = function (ratio, textureData0, textureData1) {
|
|
71
|
+
if (textureData0 === void 0) { textureData0 = null; }
|
|
72
|
+
if (textureData1 === void 0) { textureData1 = null; }
|
|
71
73
|
if (!textureData0 && !textureData1) {
|
|
72
74
|
this._pushPointCallBackEmpty();
|
|
73
75
|
return;
|
|
@@ -78,30 +80,31 @@ class PointCoordinatesDataCalculator {
|
|
|
78
80
|
}
|
|
79
81
|
this._ratio = ratio;
|
|
80
82
|
this._pushPointCallbackAll();
|
|
81
|
-
}
|
|
82
|
-
_findAPoint(posIndex) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return { data0, data1, interpolated };
|
|
87
|
-
}
|
|
88
|
-
_pushPointCallbackAll() {
|
|
89
|
-
for (
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
};
|
|
84
|
+
PointCoordinatesDataCalculator.prototype._findAPoint = function (posIndex) {
|
|
85
|
+
var data0 = this._texture0[posIndex];
|
|
86
|
+
var data1 = this._texture1[posIndex];
|
|
87
|
+
var interpolated = data0 * (1 - this._ratio) + data1 * this._ratio;
|
|
88
|
+
return { data0: data0, data1: data1, interpolated: interpolated };
|
|
89
|
+
};
|
|
90
|
+
PointCoordinatesDataCalculator.prototype._pushPointCallbackAll = function () {
|
|
91
|
+
for (var key in this._pointObjects) {
|
|
92
|
+
var _a = this._pointObjects[key], posIndex = _a.posIndex, callback = _a.callback;
|
|
93
|
+
var _b = this._findAPoint(posIndex), data0 = _b.data0, data1 = _b.data1, interpolated = _b.interpolated;
|
|
92
94
|
callback(data0, data1, interpolated);
|
|
93
95
|
}
|
|
94
|
-
}
|
|
95
|
-
_pushPointCallBackEmpty() {
|
|
96
|
-
for (
|
|
97
|
-
|
|
96
|
+
};
|
|
97
|
+
PointCoordinatesDataCalculator.prototype._pushPointCallBackEmpty = function () {
|
|
98
|
+
for (var key in this._pointObjects) {
|
|
99
|
+
var callback = this._pointObjects[key].callback;
|
|
98
100
|
callback(null, null, null);
|
|
99
101
|
}
|
|
100
|
-
}
|
|
101
|
-
flush() {
|
|
102
|
+
};
|
|
103
|
+
PointCoordinatesDataCalculator.prototype.flush = function () {
|
|
102
104
|
this._pointObjects = {};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
+
};
|
|
106
|
+
return PointCoordinatesDataCalculator;
|
|
107
|
+
}());
|
|
105
108
|
exports.default = PointCoordinatesDataCalculator;
|
|
106
109
|
// function test() {
|
|
107
110
|
// const cp = window.plugin.getPointCoordinatesDataCalculator();
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var PointCoordsMeta = /** @class */ (function () {
|
|
4
|
+
function PointCoordsMeta(bbox, width, height) {
|
|
5
5
|
this._bbox = bbox;
|
|
6
6
|
this._width = width;
|
|
7
7
|
this._height = height;
|
|
8
8
|
this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
|
|
9
9
|
this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
|
|
10
10
|
}
|
|
11
|
-
getFlooredMeta(long, lat) {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
PointCoordsMeta.prototype.getFlooredMeta = function (long, lat) {
|
|
12
|
+
var x = (long - this._bbox[0]) * this._xRatio;
|
|
13
|
+
var y = (this._bbox[3] - lat) * this._yRatio;
|
|
14
14
|
x = x > 0 ? x - 1 : 0;
|
|
15
15
|
y = y > 0 ? y - 1 : 0;
|
|
16
|
-
|
|
17
|
-
return { index };
|
|
18
|
-
}
|
|
19
|
-
|
|
16
|
+
var index = Math.floor(y) * this._width + Math.floor(x);
|
|
17
|
+
return { index: index };
|
|
18
|
+
};
|
|
19
|
+
return PointCoordsMeta;
|
|
20
|
+
}());
|
|
20
21
|
exports.default = PointCoordsMeta;
|
package/util/index.js
CHANGED
|
@@ -37,17 +37,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.heatwavedatamanager = exports.programs = exports.webglobe = exports.geometry = exports.shaderfunctions = exports.webglobjectbuilders = void 0;
|
|
40
|
-
|
|
40
|
+
var webglobjectbuilders = __importStar(require("./webglobjectbuilders"));
|
|
41
41
|
exports.webglobjectbuilders = webglobjectbuilders;
|
|
42
|
-
|
|
42
|
+
var shaderfunctions = __importStar(require("./shaderfunctions"));
|
|
43
43
|
exports.shaderfunctions = shaderfunctions;
|
|
44
|
-
|
|
44
|
+
var geometry = __importStar(require("./geometry"));
|
|
45
45
|
exports.geometry = geometry;
|
|
46
|
-
|
|
46
|
+
var webglobe = __importStar(require("./webglobe"));
|
|
47
47
|
exports.webglobe = webglobe;
|
|
48
|
-
|
|
48
|
+
var programs = __importStar(require("./programs"));
|
|
49
49
|
exports.programs = programs;
|
|
50
|
-
|
|
50
|
+
var heatwavedatamanager = __importStar(require("./heatwavedatamanager"));
|
|
51
51
|
exports.heatwavedatamanager = heatwavedatamanager;
|
|
52
52
|
__exportStar(require("./webglobe"), exports);
|
|
53
53
|
__exportStar(require("./webglobjectbuilders"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createWorker = void 0;
|
|
4
|
-
|
|
4
|
+
var createWorker = function () { return new Worker(new URL('./web-worker.js', import.meta.url), { type: 'module' }); };
|
|
5
5
|
exports.createWorker = createWorker;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GEOMETRY = exports.TimeTrackInterpolator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var search_binary_1 = require("../../algorithms/search-binary");
|
|
5
|
+
var methods_1 = require("../../../Math/methods");
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {Array<number>} vec3 [x, y, z]
|
|
8
8
|
* @typedef {Array<number>} vec2 [x, y]
|
|
@@ -10,19 +10,20 @@ const methods_1 = require("../../../Math/methods");
|
|
|
10
10
|
* @typedef {number} fraction a number between 0 and 1
|
|
11
11
|
* @typedef {Array<number>} wgs84 [long, lat]
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
var GEOMETRY = Object.freeze({
|
|
14
14
|
CARTESIAN3D: 0,
|
|
15
15
|
MERCATOR: 1,
|
|
16
16
|
});
|
|
17
17
|
exports.GEOMETRY = GEOMETRY;
|
|
18
|
-
|
|
18
|
+
var TimeTrackInterpolator = /** @class */ (function () {
|
|
19
19
|
/**
|
|
20
20
|
* @typedef Timetrack
|
|
21
21
|
* @property {Array<vec4>}} coordinates [x,y,z, length]
|
|
22
22
|
* @property {Array<Number>} times
|
|
23
23
|
* @param {Array<Timetrack>} timeTracks
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
function TimeTrackInterpolator(_a) {
|
|
26
|
+
var _b = _a === void 0 ? {} : _a, timeTracks = _b.timeTracks, _c = _b.bbox, bbox = _c === void 0 ? null : _c, _d = _b.geometry, geometry = _d === void 0 ? GEOMETRY.CARTESIAN3D : _d;
|
|
26
27
|
this.timeTracks = null;
|
|
27
28
|
this.timeTracksStartTimes = null;
|
|
28
29
|
this.geometry = geometry;
|
|
@@ -31,49 +32,50 @@ class TimeTrackInterpolator {
|
|
|
31
32
|
if (bbox)
|
|
32
33
|
this.setBbox(bbox);
|
|
33
34
|
}
|
|
34
|
-
setGeometry(geometry) {
|
|
35
|
+
TimeTrackInterpolator.prototype.setGeometry = function (geometry) {
|
|
35
36
|
if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
|
|
36
37
|
throw new Error('Invalid geometry');
|
|
37
38
|
}
|
|
38
39
|
this.geometry = geometry;
|
|
39
|
-
}
|
|
40
|
-
setTimetracks(timeTracks) {
|
|
40
|
+
};
|
|
41
|
+
TimeTrackInterpolator.prototype.setTimetracks = function (timeTracks) {
|
|
41
42
|
this.timeTracks = timeTracks;
|
|
42
|
-
}
|
|
43
|
-
interpolate(time) {
|
|
44
|
-
|
|
43
|
+
};
|
|
44
|
+
TimeTrackInterpolator.prototype.interpolate = function (time) {
|
|
45
|
+
var _a = this, timeTracks = _a.timeTracks, geometry = _a.geometry;
|
|
45
46
|
if (!timeTracks) {
|
|
46
47
|
return null;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
var resultArray = [];
|
|
50
|
+
var info = {
|
|
50
51
|
outOfRange: 0,
|
|
51
52
|
processed: 0,
|
|
52
53
|
};
|
|
53
|
-
for (
|
|
54
|
-
|
|
54
|
+
for (var i = 0; i < timeTracks.length; i++) {
|
|
55
|
+
var _b = timeTracks[i], times = _b.times, coordinates = _b.coordinates;
|
|
55
56
|
if (times[times.length - 1] < time)
|
|
56
57
|
continue;
|
|
57
58
|
info.processed++;
|
|
58
|
-
|
|
59
|
+
var timeIndex = (0, search_binary_1.findFirstIndexInRange)(times, time);
|
|
59
60
|
if (timeIndex === null) {
|
|
60
61
|
info.outOfRange++;
|
|
61
62
|
continue;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
var timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
|
|
65
|
+
var interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
|
|
65
66
|
(0, methods_1.sphericalLinearInterpolation_Cartesian3d)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
|
|
66
67
|
(0, methods_1.sphericalLinearInterpolation_Mercator)(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
|
|
67
|
-
resultArray.push(
|
|
68
|
+
resultArray.push.apply(resultArray, interpolated);
|
|
68
69
|
}
|
|
69
70
|
return new Float32Array(resultArray);
|
|
70
|
-
}
|
|
71
|
+
};
|
|
71
72
|
// implicit methods
|
|
72
|
-
_orderTimeTracks() {
|
|
73
|
-
this.timeTracks.sort((a, b)
|
|
74
|
-
}
|
|
75
|
-
_setStartTimes() {
|
|
76
|
-
this.timeTracksStartTimes = this.timeTracks.map(tt
|
|
77
|
-
}
|
|
78
|
-
|
|
73
|
+
TimeTrackInterpolator.prototype._orderTimeTracks = function () {
|
|
74
|
+
this.timeTracks.sort(function (a, b) { return a.times[0] - b.times[0]; });
|
|
75
|
+
};
|
|
76
|
+
TimeTrackInterpolator.prototype._setStartTimes = function () {
|
|
77
|
+
this.timeTracksStartTimes = this.timeTracks.map(function (tt) { return tt.times[0]; });
|
|
78
|
+
};
|
|
79
|
+
return TimeTrackInterpolator;
|
|
80
|
+
}());
|
|
79
81
|
exports.TimeTrackInterpolator = TimeTrackInterpolator;
|
|
@@ -1,183 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webworkerStr = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const WORLD_RADIUS_3D = 6378.137;
|
|
7
|
-
const WORLD_RADIUS_MERCATOR = 6378136.99911;
|
|
8
|
-
|
|
9
|
-
const dot3 = (a, b) => {
|
|
10
|
-
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
|
|
14
|
-
const theta = Math.acos(dot3(normalizedA, normalizedB));
|
|
15
|
-
if (theta < 0.000001) return normalizedA; // CALIBRATE?
|
|
16
|
-
const sinTheta = Math.sin(theta);
|
|
17
|
-
const result = [
|
|
18
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
|
|
19
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
|
|
20
|
-
(Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
|
|
21
|
-
];
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const radianToMercator = (xy) => {
|
|
26
|
-
return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const cartesian3dToRadian = (cartesian) => {
|
|
31
|
-
const x = cartesian[0];
|
|
32
|
-
const y = cartesian[1];
|
|
33
|
-
const z = cartesian[2];
|
|
34
|
-
// const length = Math.sqrt(x * x + y * y + z * z);
|
|
35
|
-
const long = Math.atan2(y, x);
|
|
36
|
-
const lat = Math.asin(z)// length);
|
|
37
|
-
return [long, lat];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
|
|
42
|
-
const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
|
|
43
|
-
const angles = cartesian3dToRadian(unitVector);
|
|
44
|
-
return radianToMercator(angles);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
|
|
48
|
-
const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
|
|
49
|
-
const height = a[3] + (b[3] - a[3]) * ratio;
|
|
50
|
-
return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const findFirstIndexInRange = (container, value) => {
|
|
54
|
-
let start = 0;
|
|
55
|
-
let end = container.length - 1;
|
|
56
|
-
let mid = 0;
|
|
57
|
-
while (start <= end) {
|
|
58
|
-
mid = Math.floor((start + end) / 2);
|
|
59
|
-
if (container[mid] <= value && value <= container[mid + 1]) return mid;
|
|
60
|
-
if (container[mid] < value) start = mid + 1;
|
|
61
|
-
else end = mid - 1;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const GEOMETRY = Object.freeze({
|
|
67
|
-
CARTESIAN3D: 0,
|
|
68
|
-
MERCATOR: 1,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
class TimeTrackInterpolator {
|
|
72
|
-
/**
|
|
73
|
-
* @typedef Timetrack
|
|
74
|
-
* @property {Array<vec4>}} coordinates [x,y,z, length]
|
|
75
|
-
* @property {Array<Number>} times
|
|
76
|
-
* @param {Array<Timetrack>} timeTracks
|
|
77
|
-
*/
|
|
78
|
-
constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
|
|
79
|
-
this.timeTracks = null;
|
|
80
|
-
this.timeTracksStartTimes = null;
|
|
81
|
-
this.geometry = geometry;
|
|
82
|
-
if (timeTracks) this.setTimetracks(timeTracks);
|
|
83
|
-
if (bbox) this.setBbox(bbox);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
setGeometry(geometry) {
|
|
88
|
-
if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
|
|
89
|
-
throw new Error('Invalid geometry');
|
|
90
|
-
}
|
|
91
|
-
this.geometry = geometry;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setTimetracks(timeTracks) {
|
|
95
|
-
this.timeTracks = timeTracks;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
interpolate(time) {
|
|
100
|
-
const { timeTracks, geometry } = this;
|
|
101
|
-
if (!timeTracks) { return null; }
|
|
102
|
-
const resultArray = [];
|
|
103
|
-
const info = {
|
|
104
|
-
outOfRange: 0,
|
|
105
|
-
processed: 0,
|
|
106
|
-
}
|
|
107
|
-
for (let i = 0; i < timeTracks.length; i++) {
|
|
108
|
-
const { times, coordinates } = timeTracks[i];
|
|
109
|
-
|
|
110
|
-
if (times[times.length - 1] < time) continue;
|
|
111
|
-
info.processed++;
|
|
112
|
-
const timeIndex = findFirstIndexInRange(times, time);
|
|
113
|
-
if (timeIndex === null) { info.outOfRange++; continue; }
|
|
114
|
-
const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
|
|
115
|
-
const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
|
|
116
|
-
sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
|
|
117
|
-
sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
|
|
118
|
-
resultArray.push(...interpolated);
|
|
119
|
-
}
|
|
120
|
-
return new Float32Array(resultArray);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// implicit methods
|
|
125
|
-
|
|
126
|
-
_orderTimeTracks() {
|
|
127
|
-
this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
_setStartTimes() {
|
|
131
|
-
this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
|
|
136
|
-
|
|
137
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
138
|
-
self.onmessage = function (e) {
|
|
139
|
-
|
|
140
|
-
const { geometry = null, timeTracks = null, time = null } = e.data;
|
|
141
|
-
|
|
142
|
-
if (geometry !== null) {
|
|
143
|
-
try {
|
|
144
|
-
interpolator.setGeometry(geometry);
|
|
145
|
-
} catch (error) {
|
|
146
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
147
|
-
self.postMessage({ error: error.message });
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (timeTracks !== null) {
|
|
153
|
-
try {
|
|
154
|
-
interpolator.setTimetracks(timeTracks);
|
|
155
|
-
} catch (error) {
|
|
156
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
157
|
-
self.postMessage({ error: error.message });
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (time !== null) {
|
|
163
|
-
try {
|
|
164
|
-
const result = interpolator.interpolate(time);
|
|
165
|
-
if(result === null) {
|
|
166
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
167
|
-
self.postMessage({ error: 'No TimeTracks Data' });
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
171
|
-
self.postMessage(result, [result.buffer]);
|
|
172
|
-
return;
|
|
173
|
-
} catch (error) {
|
|
174
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
175
|
-
self.postMessage({ error: error.message });
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
/* eslint-disable-next-line no-restricted-globals */
|
|
180
|
-
self.postMessage(true);
|
|
181
|
-
}
|
|
182
|
-
`;
|
|
4
|
+
var webworkerStr = "\n\nconst WORLD_RADIUS_3D = 6378.137;\nconst WORLD_RADIUS_MERCATOR = 6378136.99911;\n\nconst dot3 = (a, b) => {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n\nconst sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {\n const theta = Math.acos(dot3(normalizedA, normalizedB));\n if (theta < 0.000001) return normalizedA; // CALIBRATE?\n const sinTheta = Math.sin(theta);\n const result = [\n (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,\n (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta\n ];\n return result;\n}\n\nconst radianToMercator = (xy) => {\n return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];\n}\n\n\nconst cartesian3dToRadian = (cartesian) => {\n const x = cartesian[0];\n const y = cartesian[1];\n const z = cartesian[2];\n // const length = Math.sqrt(x * x + y * y + z * z);\n const long = Math.atan2(y, x);\n const lat = Math.asin(z)// length);\n return [long, lat];\n}\n\n\nconst sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);\n const angles = cartesian3dToRadian(unitVector);\n return radianToMercator(angles);\n}\n\nconst sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {\n const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);\n const height = a[3] + (b[3] - a[3]) * ratio;\n return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];\n}\n\nconst findFirstIndexInRange = (container, value) => {\n let start = 0;\n let end = container.length - 1;\n let mid = 0;\n while (start <= end) {\n mid = Math.floor((start + end) / 2);\n if (container[mid] <= value && value <= container[mid + 1]) return mid;\n if (container[mid] < value) start = mid + 1;\n else end = mid - 1;\n }\n return null;\n}\n\nconst GEOMETRY = Object.freeze({\n CARTESIAN3D: 0,\n MERCATOR: 1,\n});\n\nclass TimeTrackInterpolator {\n /**\n * @typedef Timetrack\n * @property {Array<vec4>}} coordinates [x,y,z, length]\n * @property {Array<Number>} times\n * @param {Array<Timetrack>} timeTracks\n */\n constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {\n this.timeTracks = null;\n this.timeTracksStartTimes = null;\n this.geometry = geometry;\n if (timeTracks) this.setTimetracks(timeTracks);\n if (bbox) this.setBbox(bbox);\n }\n\n\n setGeometry(geometry) {\n if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {\n throw new Error('Invalid geometry');\n }\n this.geometry = geometry;\n }\n\n setTimetracks(timeTracks) {\n this.timeTracks = timeTracks;\n }\n\n\n interpolate(time) {\n const { timeTracks, geometry } = this;\n if (!timeTracks) { return null; }\n const resultArray = [];\n const info = {\n outOfRange: 0,\n processed: 0,\n }\n for (let i = 0; i < timeTracks.length; i++) {\n const { times, coordinates } = timeTracks[i];\n\n if (times[times.length - 1] < time) continue;\n info.processed++;\n const timeIndex = findFirstIndexInRange(times, time);\n if (timeIndex === null) { info.outOfRange++; continue; }\n const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);\n const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?\n sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :\n sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);\n resultArray.push(...interpolated);\n }\n return new Float32Array(resultArray);\n }\n\n\n // implicit methods\n\n _orderTimeTracks() {\n this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);\n }\n\n _setStartTimes() {\n this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);\n }\n}\n\nconst interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });\n\n/* eslint-disable-next-line no-restricted-globals */\nself.onmessage = function (e) {\n\n const { geometry = null, timeTracks = null, time = null } = e.data;\n\n if (geometry !== null) {\n try {\n interpolator.setGeometry(geometry);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (timeTracks !== null) {\n try {\n interpolator.setTimetracks(timeTracks);\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n\n if (time !== null) {\n try {\n const result = interpolator.interpolate(time);\n if(result === null) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: 'No TimeTracks Data' });\n return;\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(result, [result.buffer]);\n return;\n } catch (error) {\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage({ error: error.message });\n return;\n }\n }\n /* eslint-disable-next-line no-restricted-globals */\n self.postMessage(true);\n}\n ";
|
|
183
5
|
exports.webworkerStr = webworkerStr;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var timetrack_interpolator_1 = require("./timetrack-interpolator");
|
|
4
|
+
var interpolator = new timetrack_interpolator_1.TimeTrackInterpolator({ geometry: timetrack_interpolator_1.GEOMETRY.CARTESIAN3D });
|
|
5
5
|
/* eslint-disable-next-line no-restricted-globals */
|
|
6
6
|
self.onmessage = function (e) {
|
|
7
|
-
|
|
7
|
+
var _a = e.data, _b = _a.geometry, geometry = _b === void 0 ? null : _b, _c = _a.timeTracks, timeTracks = _c === void 0 ? null : _c, _d = _a.time, time = _d === void 0 ? null : _d;
|
|
8
8
|
if (geometry !== null) {
|
|
9
9
|
try {
|
|
10
10
|
interpolator.setGeometry(geometry);
|
|
@@ -27,7 +27,7 @@ self.onmessage = function (e) {
|
|
|
27
27
|
}
|
|
28
28
|
if (time !== null) {
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
var result = interpolator.interpolate(time);
|
|
31
31
|
if (result === null) {
|
|
32
32
|
/* eslint-disable-next-line no-restricted-globals */
|
|
33
33
|
self.postMessage({ error: 'No TimeTracks Data' });
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.populateFloat32Array = void 0;
|
|
4
|
-
|
|
5
|
-
fillFloat32Array: (length, data)
|
|
6
|
-
|
|
4
|
+
var populateFloat32Array = Object.freeze({
|
|
5
|
+
fillFloat32Array: function (length, data) {
|
|
6
|
+
var result = new Float32Array(length);
|
|
7
7
|
result.fill(data);
|
|
8
8
|
return result;
|
|
9
9
|
},
|
|
10
|
-
fillWithListData: (length, listdata)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (
|
|
10
|
+
fillWithListData: function (length, listdata) {
|
|
11
|
+
var result = new Float32Array(length * listdata.length);
|
|
12
|
+
var offset = 0;
|
|
13
|
+
for (var i = 0; i < length; i++) {
|
|
14
14
|
result.set(listdata, offset);
|
|
15
15
|
offset += listdata.length;
|
|
16
16
|
}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.instantDebounce = instantDebounce;
|
|
4
4
|
// TODO: fix logic error in instantDebounce
|
|
5
5
|
function instantDebounce(func, delay) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
setTimeout(()
|
|
6
|
+
var timeout = null;
|
|
7
|
+
var lastArgs = null;
|
|
8
|
+
var runAtEnd = false;
|
|
9
|
+
var timeoutMethod = function () {
|
|
10
|
+
setTimeout(function () {
|
|
11
11
|
if (runAtEnd) {
|
|
12
|
-
func(
|
|
12
|
+
func.apply(void 0, lastArgs);
|
|
13
13
|
lastArgs = null;
|
|
14
14
|
// console.log("processed with delay")
|
|
15
15
|
runAtEnd = false;
|
|
@@ -24,7 +24,7 @@ function instantDebounce(func, delay) {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
func(
|
|
27
|
+
func.apply(void 0, args);
|
|
28
28
|
// console.log("processed instantly")
|
|
29
29
|
timeout = timeoutMethod();
|
|
30
30
|
}
|
package/util/picking/fence.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fence = void 0;
|
|
4
|
-
|
|
4
|
+
var fence = function (gl) { return new Promise(function (resolve, reject) {
|
|
5
5
|
// This will create a fence. If this follows a `readPixels()` call, then it
|
|
6
6
|
// will signal to WebGL that the read instruction should be asynchronous.
|
|
7
7
|
// This means JS can continue to work on other tasks while the read instruction
|
|
8
8
|
// completes.
|
|
9
|
-
|
|
9
|
+
var sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
10
10
|
gl.flush();
|
|
11
11
|
// There are TWO possible ways to check on the status of a WebGLSync object.
|
|
12
12
|
// 1. This will check it using clientWaitSync()
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var checkStatus_v1 = function () {
|
|
14
|
+
var status = gl.clientWaitSync(sync, 0, 0);
|
|
15
15
|
// There are four possible values for status:
|
|
16
16
|
// a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
|
|
17
17
|
// b. TIMEOUT_EXPIRED (check again later)
|
|
@@ -29,8 +29,8 @@ const fence = (gl) => new Promise((resolve, reject) => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
// 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
var checkStatus_v2 = function () {
|
|
33
|
+
var status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
|
|
34
34
|
// There are only two possible values for status: SIGNALED and UNSIGNALED
|
|
35
35
|
// Note that there is no `error` signal, so there is no reason to use `reject()` here
|
|
36
36
|
if (status === gl.SIGNALED) {
|
|
@@ -42,5 +42,5 @@ const fence = (gl) => new Promise((resolve, reject) => {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
setTimeout(checkStatus_v2, 1);
|
|
45
|
-
});
|
|
45
|
+
}); };
|
|
46
46
|
exports.fence = fence;
|