@pirireis/webglobeplugins 0.9.11 → 0.9.12
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 +78 -80
- 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 +14 -16
- package/Math/methods.js +65 -70
- package/Math/plane.js +16 -18
- package/Math/quaternion.js +45 -49
- package/Math/utils.js +2 -2
- package/Math/vec3.js +42 -45
- package/algorithms/search-binary.js +4 -4
- package/altitude-locator/draw-subset-obj.js +7 -8
- package/altitude-locator/plugin.js +98 -114
- package/arrowfield/adaptor.js +3 -4
- package/arrowfield/index.js +2 -2
- package/arrowfield/plugin.js +62 -65
- package/bearing-line/index.js +1 -1
- package/bearing-line/plugin.js +200 -226
- package/circle-line-chain/chain-list-map.js +82 -88
- package/circle-line-chain/plugin.js +134 -165
- package/circle-line-chain/util.js +1 -1
- package/compass-rose/compass-rose-padding-flat.js +108 -133
- package/compass-rose/compass-text-writer.js +62 -70
- package/compass-rose/index.js +2 -2
- package/compassrose/compassrose.js +46 -50
- package/compassrose/index.js +1 -1
- package/heatwave/index.js +2 -2
- package/heatwave/isobar/objectarraylabels.js +44 -48
- package/heatwave/isobar/plugin.js +104 -123
- package/heatwave/isobar/quadtreecontours.js +76 -92
- package/heatwave/plugins/heatwaveglobeshell.js +69 -87
- package/index.js +11 -11
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -64
- package/partialrings/index.js +1 -1
- package/partialrings/plugin.js +48 -84
- package/partialrings/program.js +136 -47
- package/pin/pin-object-array.js +83 -86
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
- package/point-heat-map/plugin-webworker.js +40 -45
- package/point-heat-map/point-to-heat-map-flow.js +40 -42
- package/point-tracks/key-methods.js +1 -1
- package/point-tracks/plugin.js +137 -162
- package/programs/arrowfield/index.js +1 -1
- package/programs/arrowfield/logic.js +170 -62
- package/programs/arrowfield/object.js +33 -35
- package/programs/data2legend/density-to-legend.js +45 -21
- package/programs/data2legend/point-to-density-texture.js +52 -27
- package/programs/float2legendwithratio/index.js +1 -1
- package/programs/float2legendwithratio/logic.js +88 -42
- package/programs/float2legendwithratio/object.js +43 -46
- package/programs/globe-util/is-globe-moved.js +10 -11
- package/programs/globeshell/index.js +1 -1
- package/programs/globeshell/wiggle/index.js +1 -1
- package/programs/globeshell/wiggle/logic.js +191 -98
- package/programs/globeshell/wiggle/object.js +33 -35
- package/programs/helpers/blender/program.js +36 -19
- package/programs/helpers/fadeaway/index.js +1 -1
- package/programs/helpers/fadeaway/logic.js +35 -13
- package/programs/helpers/fadeaway/object.js +9 -10
- package/programs/helpers/index.js +1 -1
- package/programs/index.js +8 -8
- package/programs/line-on-globe/angled-line.js +91 -32
- package/programs/line-on-globe/circle-accurate-3d.js +82 -32
- package/programs/line-on-globe/circle-accurate-flat.js +108 -50
- package/programs/line-on-globe/circle-accurate.js +103 -33
- package/programs/line-on-globe/circle.js +97 -32
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
- package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
- package/programs/line-on-globe/linestrip.js +111 -45
- package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
- package/programs/line-on-globe/to-the-surface.js +58 -29
- package/programs/line-on-globe/util.js +1 -1
- package/programs/picking/pickable-renderer.js +117 -33
- package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
- package/programs/point-on-globe/element-point-glow.js +103 -35
- package/programs/point-on-globe/square-pixel-point.js +76 -27
- package/programs/programcache.js +13 -13
- package/programs/rings/distancering/circleflatprogram.js +63 -21
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
- package/programs/rings/distancering/index.js +4 -4
- package/programs/rings/distancering/paddyflatprogram.js +73 -20
- package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
- package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
- package/programs/rings/partial-ring/piece-of-pie.js +137 -35
- package/programs/totems/camerauniformblock.js +64 -51
- package/programs/totems/canvas-webglobe-info.js +48 -40
- package/programs/totems/gpu-selection-uniform-block.js +44 -40
- package/programs/totems/index.js +1 -1
- package/programs/two-d/pixel-padding-for-compass.js +90 -29
- package/programs/util.js +6 -7
- package/programs/vectorfields/index.js +1 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
- package/programs/vectorfields/logics/index.js +3 -3
- package/programs/vectorfields/logics/pixelbased.js +91 -35
- package/programs/vectorfields/logics/ubo.js +31 -25
- package/programs/vectorfields/pingpongbuffermanager.js +30 -34
- package/rangerings/index.js +4 -4
- package/rangerings/plugin.js +202 -258
- package/rangerings/rangeringangletext.js +108 -120
- package/rangerings/ring-account.js +52 -69
- package/shaders/fragment-toy/firework.js +55 -1
- package/shaders/fragment-toy/singularity.js +55 -1
- package/timetracks/adaptors-line-strip.js +26 -37
- package/timetracks/adaptors.js +47 -61
- package/timetracks/index.js +4 -4
- package/timetracks/plugin-line-strip.js +63 -71
- package/timetracks/plugin.js +69 -77
- package/timetracks/program-line-strip.js +296 -103
- package/timetracks/program.js +419 -113
- package/timetracks/programpoint-line-strip.js +97 -44
- package/timetracks/programpoint.js +90 -44
- package/util/account/bufferoffsetmanager.js +72 -95
- package/util/account/index.js +1 -1
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
- package/util/account/single-attribute-buffer-management/index.js +3 -3
- package/util/account/single-attribute-buffer-management/object-store.js +29 -30
- package/util/account/util.js +2 -4
- package/util/algorithms/search-binary.js +4 -4
- package/util/check/get.js +5 -5
- package/util/check/typecheck.js +13 -15
- package/util/geometry/index.js +9 -11
- package/util/gl-util/buffer/attribute-loader.js +8 -20
- package/util/gl-util/buffer/index.js +1 -1
- package/util/gl-util/draw-options/methods.js +8 -9
- package/util/gl-util/uniform-block/manager.js +67 -67
- package/util/heatwavedatamanager/datamanager.js +56 -116
- package/util/heatwavedatamanager/index.js +2 -2
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
- package/util/index.js +6 -6
- package/util/interpolation/timetrack/index.js +1 -1
- package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
- package/util/interpolation/timetrack/web-worker-str.js +179 -1
- 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 +46 -52
- package/util/programs/draw-texture-on-canvas.js +39 -21
- package/util/programs/shapesonglobe.js +104 -64
- package/util/programs/supersampletotextures.js +45 -39
- package/util/programs/texturetoglobe.js +98 -48
- package/util/shaderfunctions/geometrytransformations.js +322 -27
- package/util/shaderfunctions/nodata.js +7 -1
- package/util/shaderfunctions/noisefunctions.js +39 -9
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/rasteroverlay.js +35 -37
- package/util/webglobjectbuilders.js +55 -60
- package/util/webglobjectbuilders1.js +48 -49
- package/waveparticles/adaptor.js +6 -7
- package/waveparticles/index.js +2 -2
- package/waveparticles/plugin.js +79 -84
- package/wind/imagetovectorfieldandmagnitude.js +15 -15
- package/wind/index.js +4 -4
- package/wind/plugin.js +453 -251
- package/wind/vectorfieldimage.js +5 -5
- package/write-text/attached-text-writer.js +46 -48
- package/write-text/context-text.js +51 -58
- package/write-text/context-text3.js +69 -74
|
@@ -19,10 +19,13 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.BufferManager = void 0;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
class BufferManager {
|
|
23
|
+
gl;
|
|
24
|
+
buffer;
|
|
25
|
+
itemSize;
|
|
26
|
+
bufferType;
|
|
27
|
+
isFreed = false;
|
|
28
|
+
constructor(gl, itemSize, { bufferType = "STATIC_DRAW", buffer = null, initialCapacity = null } = {}) {
|
|
26
29
|
this.gl = gl;
|
|
27
30
|
this.itemSize = itemSize;
|
|
28
31
|
this.bufferType = bufferType;
|
|
@@ -30,47 +33,45 @@ var BufferManager = /** @class */ (function () {
|
|
|
30
33
|
if (initialCapacity !== null)
|
|
31
34
|
this.resetWithCapacity(initialCapacity);
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
resetWithCapacity(capacity) {
|
|
37
|
+
const { gl, buffer, bufferType, itemSize } = this;
|
|
35
38
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
36
39
|
// @ts-ignore
|
|
37
40
|
gl.bufferData(gl.ARRAY_BUFFER, capacity * itemSize * 4, gl[bufferType]);
|
|
38
41
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
}
|
|
43
|
+
deleteBulk(offsets) {
|
|
44
|
+
const { gl, buffer, itemSize } = this;
|
|
45
|
+
const emptyBlock = new Float32Array(this.itemSize).fill(NaN);
|
|
46
|
+
const offsetMultiplier = itemSize * 4;
|
|
44
47
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
45
|
-
for (
|
|
46
|
-
var offset = offsets_1[_i];
|
|
48
|
+
for (let offset of offsets) {
|
|
47
49
|
if (offset !== undefined) {
|
|
48
50
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset * offsetMultiplier, emptyBlock);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
}
|
|
55
|
+
insertBulk(blocks, offsets) {
|
|
56
|
+
const { gl, buffer, itemSize } = this;
|
|
55
57
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
56
|
-
|
|
57
|
-
for (
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
const offsetMultiplier = itemSize * 4;
|
|
59
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
60
|
+
const block = blocks[i];
|
|
61
|
+
const offset = offsets[i] * offsetMultiplier;
|
|
60
62
|
if (offset !== undefined)
|
|
61
63
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
|
|
62
64
|
}
|
|
63
65
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
64
|
-
}
|
|
66
|
+
}
|
|
65
67
|
// TODO: this is broken
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (
|
|
72
|
-
|
|
73
|
-
var itemOffset = offset * itemSize;
|
|
68
|
+
defrag(offsetValues, occupiedCapacity, newCapacity) {
|
|
69
|
+
const { gl, buffer, bufferType, itemSize } = this;
|
|
70
|
+
const newArray = new Float32Array(newCapacity * itemSize);
|
|
71
|
+
const bufferData = this._getBufferData(occupiedCapacity);
|
|
72
|
+
let newOffset = 0;
|
|
73
|
+
for (const offset of offsetValues) {
|
|
74
|
+
const itemOffset = offset * itemSize;
|
|
74
75
|
newArray.set(bufferData.slice(itemOffset, itemOffset + itemSize), newOffset);
|
|
75
76
|
newOffset += itemSize;
|
|
76
77
|
}
|
|
@@ -79,34 +80,33 @@ var BufferManager = /** @class */ (function () {
|
|
|
79
80
|
gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
|
|
80
81
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, newArray);
|
|
81
82
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
}
|
|
84
|
+
extendBuffer(occupiedCapacity, newCapacity) {
|
|
85
|
+
const { gl, buffer, bufferType } = this;
|
|
86
|
+
const itemSize = this.itemSize;
|
|
87
|
+
const bufferData = this._getBufferData(occupiedCapacity);
|
|
87
88
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
88
89
|
// @ts-ignore
|
|
89
90
|
gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
|
|
90
91
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
91
92
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
}
|
|
94
|
+
_getBufferData(occupiedCapacity) {
|
|
95
|
+
const { gl, buffer } = this;
|
|
96
|
+
const size = occupiedCapacity * this.itemSize;
|
|
97
|
+
const bufferData = new Float32Array(size);
|
|
97
98
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
98
99
|
gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
99
100
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
100
101
|
return bufferData;
|
|
101
|
-
}
|
|
102
|
-
|
|
102
|
+
}
|
|
103
|
+
free() {
|
|
103
104
|
if (this.isFreed)
|
|
104
105
|
return;
|
|
105
106
|
this.gl.deleteBuffer(this.buffer);
|
|
106
107
|
// this.buffer = null;
|
|
107
108
|
// this.gl = null;
|
|
108
109
|
this.isFreed = true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
112
|
exports.BufferManager = BufferManager;
|
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BufferOrchestrator = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const EXTRA_SIZE = 10;
|
|
5
|
+
class BufferOrchestrator {
|
|
6
|
+
_capacity;
|
|
7
|
+
offsetMap;
|
|
8
|
+
tombstoneOffsets;
|
|
9
|
+
_length;
|
|
10
|
+
constructor({ capacity = 10 } = {}) {
|
|
8
11
|
this._capacity = capacity;
|
|
9
12
|
this.offsetMap = new Map();
|
|
10
13
|
this.tombstoneOffsets = [];
|
|
11
14
|
this._length = 0;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
if (capacity === void 0) { capacity = null; }
|
|
16
|
+
resetWithCapacity(bufferManagersMap, capacity = null) {
|
|
15
17
|
this._capacity = capacity !== null ? capacity : this._capacity;
|
|
16
|
-
for (
|
|
17
|
-
var _a = bufferManagersMap_1[_i], key = _a[0], bufferManager = _a[1].bufferManager;
|
|
18
|
+
for (const [key, { bufferManager }] of bufferManagersMap) {
|
|
18
19
|
bufferManager.resetWithCapacity(this._capacity);
|
|
19
20
|
}
|
|
20
21
|
this.offsetMap.clear();
|
|
21
22
|
this.tombstoneOffsets = [];
|
|
22
23
|
this._length = 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
24
|
+
}
|
|
25
|
+
insertBulk(items, bufferManagersMap) {
|
|
25
26
|
this.autoExtendBuffers(items.length, bufferManagersMap);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var offset = o !== undefined ? o : this.nextOffset();
|
|
27
|
+
const { offsetMap } = this;
|
|
28
|
+
const offsets = [];
|
|
29
|
+
for (const item of items) {
|
|
30
|
+
let o = offsetMap.get(item.key);
|
|
31
|
+
const offset = o !== undefined ? o : this.nextOffset();
|
|
32
32
|
offsetMap.set(item.key, offset);
|
|
33
33
|
offsets.push(offset);
|
|
34
34
|
}
|
|
35
|
-
for (
|
|
36
|
-
var _b = bufferManagersMap_2[_a], key = _b[0], _c = _b[1], bufferManager = _c.bufferManager, adaptor = _c.adaptor;
|
|
35
|
+
for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
37
36
|
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
38
37
|
}
|
|
39
|
-
}
|
|
38
|
+
}
|
|
40
39
|
// does not assign offset to the new items.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var item = items_2[_i];
|
|
47
|
-
var offset = offsetMap.get(item.key);
|
|
40
|
+
updateBulk(items, bufferManagersMap, bufferKeys = null) {
|
|
41
|
+
const { offsetMap } = this;
|
|
42
|
+
const offsets = [];
|
|
43
|
+
for (const item of items) {
|
|
44
|
+
const offset = offsetMap.get(item.key);
|
|
48
45
|
if (offset !== undefined) {
|
|
49
46
|
offsets.push(offset);
|
|
50
47
|
}
|
|
@@ -53,79 +50,71 @@ var BufferOrchestrator = /** @class */ (function () {
|
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
if (bufferKeys) {
|
|
56
|
-
for (
|
|
57
|
-
|
|
58
|
-
var bufferManagerComp = bufferManagersMap.get(key);
|
|
53
|
+
for (const key of bufferKeys) {
|
|
54
|
+
const bufferManagerComp = bufferManagersMap.get(key);
|
|
59
55
|
if (bufferManagerComp === undefined)
|
|
60
56
|
throw new Error("updateBulk bufferKey does not exist");
|
|
61
|
-
|
|
57
|
+
const { bufferManager, adaptor } = bufferManagerComp;
|
|
62
58
|
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
else {
|
|
66
|
-
for (
|
|
67
|
-
var _c = bufferManagersMap_3[_b], key = _c[0], _d = _c[1], bufferManager = _d.bufferManager, adaptor = _d.adaptor;
|
|
62
|
+
for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
|
|
68
63
|
bufferManager.insertBulk(items.map(adaptor), offsets);
|
|
69
64
|
}
|
|
70
65
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
for (
|
|
75
|
-
|
|
76
|
-
var offset = this.getOffset(key);
|
|
66
|
+
}
|
|
67
|
+
deleteBulk(keys, bufferManagersMap) {
|
|
68
|
+
const offsets = [];
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
const offset = this.getOffset(key);
|
|
77
71
|
if (offset !== undefined) {
|
|
78
72
|
offsets.push(offset);
|
|
79
73
|
this.offsetMap.delete(key);
|
|
80
74
|
this.tombstoneOffsets.push(offset);
|
|
81
75
|
}
|
|
82
76
|
}
|
|
83
|
-
for (
|
|
84
|
-
var _b = bufferManagersMap_4[_a], key = _b[0], bufferManager = _b[1].bufferManager;
|
|
77
|
+
for (const [key, { bufferManager }] of bufferManagersMap) {
|
|
85
78
|
bufferManager.deleteBulk(offsets);
|
|
86
79
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
80
|
+
}
|
|
81
|
+
getOffset(key) {
|
|
89
82
|
return this.offsetMap.get(key);
|
|
90
|
-
}
|
|
91
|
-
|
|
83
|
+
}
|
|
84
|
+
nextOffset() {
|
|
92
85
|
if (this.tombstoneOffsets.length > 0) {
|
|
93
|
-
|
|
86
|
+
const offset = this.tombstoneOffsets.pop();
|
|
94
87
|
return offset;
|
|
95
88
|
}
|
|
96
89
|
if (this._length < this._capacity) {
|
|
97
90
|
return this._length++;
|
|
98
91
|
}
|
|
99
92
|
return false;
|
|
100
|
-
}
|
|
101
|
-
|
|
93
|
+
}
|
|
94
|
+
autoExtendBuffers(itemsLength, bufferManagersMap) {
|
|
102
95
|
if (itemsLength <= this.emptySpace)
|
|
103
96
|
return;
|
|
104
|
-
|
|
105
|
-
for (
|
|
106
|
-
var _a = bufferManagersMap_5[_i], key = _a[0], bufferManager = _a[1].bufferManager;
|
|
97
|
+
const newCapacity = this.length + itemsLength;
|
|
98
|
+
for (const [key, { bufferManager }] of bufferManagersMap) {
|
|
107
99
|
bufferManager.extendBuffer(this.length, newCapacity);
|
|
108
100
|
}
|
|
109
101
|
this._capacity = newCapacity;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
}
|
|
103
|
+
defrag(bufferManagers, bufferKeys) {
|
|
104
|
+
const offsetMap = this.offsetMap;
|
|
105
|
+
const newCapacity = offsetMap.size + EXTRA_SIZE;
|
|
114
106
|
if (bufferKeys) {
|
|
115
|
-
for (
|
|
116
|
-
|
|
117
|
-
var offset = offsetMap.get(key);
|
|
107
|
+
for (const key of bufferKeys) {
|
|
108
|
+
const offset = offsetMap.get(key);
|
|
118
109
|
if (offset !== undefined) {
|
|
119
|
-
for (
|
|
120
|
-
var _b = bufferManagers_1[_a], key_1 = _b[0], bufferManager = _b[1].bufferManager;
|
|
110
|
+
for (const [key, { bufferManager }] of bufferManagers) {
|
|
121
111
|
bufferManager.defrag([offset], this.length, newCapacity);
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
}
|
|
125
115
|
}
|
|
126
116
|
else {
|
|
127
|
-
for (
|
|
128
|
-
var _d = bufferManagers_2[_c], key = _d[0], bufferManager = _d[1].bufferManager;
|
|
117
|
+
for (const [key, { bufferManager }] of bufferManagers) {
|
|
129
118
|
bufferManager.defrag(offsetMap.values(), this.length, newCapacity);
|
|
130
119
|
}
|
|
131
120
|
}
|
|
@@ -133,48 +122,33 @@ var BufferOrchestrator = /** @class */ (function () {
|
|
|
133
122
|
this._length = offsetMap.size;
|
|
134
123
|
this._capacity = newCapacity;
|
|
135
124
|
this.tombstoneOffsets = [];
|
|
136
|
-
}
|
|
125
|
+
}
|
|
137
126
|
/**
|
|
138
127
|
* Flushes metadata and sets length to 0 without actualize change on buffers
|
|
139
128
|
* This method created for cases in which data is loaded on each frame
|
|
140
129
|
*/
|
|
141
|
-
|
|
142
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.capacity, capacity = _c === void 0 ? 10 : _c;
|
|
130
|
+
flush({ capacity = 10 } = {}) {
|
|
143
131
|
this._length = 0;
|
|
144
132
|
this._capacity = capacity;
|
|
145
133
|
this.tombstoneOffsets = [];
|
|
146
134
|
this.offsetMap.clear();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
for (
|
|
152
|
-
var _b = _a[_i], key = _b[0], offset = _b[1];
|
|
135
|
+
}
|
|
136
|
+
_defrag() {
|
|
137
|
+
const newOffsetMap = new Map();
|
|
138
|
+
let newOffset = 0;
|
|
139
|
+
for (const [key, offset] of this.offsetMap) {
|
|
153
140
|
newOffsetMap.set(key, newOffset++);
|
|
154
141
|
}
|
|
155
142
|
this.offsetMap = newOffsetMap;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
enumerable: false,
|
|
169
|
-
configurable: true
|
|
170
|
-
});
|
|
171
|
-
Object.defineProperty(BufferOrchestrator.prototype, "capacity", {
|
|
172
|
-
get: function () {
|
|
173
|
-
return this._capacity;
|
|
174
|
-
},
|
|
175
|
-
enumerable: false,
|
|
176
|
-
configurable: true
|
|
177
|
-
});
|
|
178
|
-
return BufferOrchestrator;
|
|
179
|
-
}());
|
|
143
|
+
}
|
|
144
|
+
get length() {
|
|
145
|
+
return this._length;
|
|
146
|
+
}
|
|
147
|
+
get emptySpace() {
|
|
148
|
+
return this._capacity - this.offsetMap.size;
|
|
149
|
+
}
|
|
150
|
+
get capacity() {
|
|
151
|
+
return this._capacity;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
180
154
|
exports.BufferOrchestrator = BufferOrchestrator;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectStore = exports.BufferManager = exports.BufferOrchestrator = void 0;
|
|
4
|
-
|
|
4
|
+
const buffer_orchestrator_1 = require("./buffer-orchestrator");
|
|
5
5
|
Object.defineProperty(exports, "BufferOrchestrator", { enumerable: true, get: function () { return buffer_orchestrator_1.BufferOrchestrator; } });
|
|
6
|
-
|
|
6
|
+
const buffer_manager_1 = require("./buffer-manager");
|
|
7
7
|
Object.defineProperty(exports, "BufferManager", { enumerable: true, get: function () { return buffer_manager_1.BufferManager; } });
|
|
8
|
-
|
|
8
|
+
const object_store_1 = require("./object-store");
|
|
9
9
|
Object.defineProperty(exports, "ObjectStore", { enumerable: true, get: function () { return object_store_1.ObjectStore; } });
|
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectStore = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
class ObjectStore {
|
|
5
|
+
_container;
|
|
6
|
+
constructor({ initialCapcity = 10 } = {}) {
|
|
7
7
|
this._container = this._createEmptyList(initialCapcity);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
resetWithCapacity(capacity) {
|
|
10
10
|
this._container = this._createEmptyList(capacity);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
for (
|
|
14
|
-
|
|
11
|
+
}
|
|
12
|
+
deleteBulk(offsets) {
|
|
13
|
+
for (let i = 0; i < offsets.length; i++) {
|
|
14
|
+
const offset = offsets[i];
|
|
15
15
|
if (offset !== undefined) {
|
|
16
16
|
this._container[offset] = null;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
for (
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
}
|
|
20
|
+
insertBulk(objects, offsets) {
|
|
21
|
+
for (let i = 0; i < objects.length; i++) {
|
|
22
|
+
const object = objects[i];
|
|
23
|
+
const offset = offsets[i];
|
|
24
24
|
if (offset !== undefined) {
|
|
25
25
|
this._container[offset] = object;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (
|
|
32
|
-
|
|
28
|
+
}
|
|
29
|
+
defrag(offsetValues, occupiedCapacity, newCapacity) {
|
|
30
|
+
const hold = this._createEmptyList(newCapacity);
|
|
31
|
+
for (let i = 0; i < offsetValues.length; i++) {
|
|
32
|
+
const offset = offsetValues[i];
|
|
33
33
|
if (offset !== undefined) {
|
|
34
34
|
hold[i] = this._container[offset];
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
this._container = hold;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}
|
|
39
|
+
extendBuffer(occupiedCapacity, newCapacity) {
|
|
40
|
+
const oldCapacity = this._container.length;
|
|
41
41
|
this._container = this._container.concat(this._createEmptyList(newCapacity - oldCapacity));
|
|
42
|
-
}
|
|
43
|
-
|
|
42
|
+
}
|
|
43
|
+
_createEmptyList(size) {
|
|
44
44
|
return new Array(size).fill(null);
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
get(index) {
|
|
47
47
|
return this._container[index];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}());
|
|
48
|
+
}
|
|
49
|
+
free() {
|
|
50
|
+
}
|
|
51
|
+
}
|
|
53
52
|
exports.ObjectStore = ObjectStore;
|
package/util/account/util.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaoAttributeLoader = void 0;
|
|
4
|
-
|
|
5
|
-
if (divisor === void 0) { divisor = null; }
|
|
6
|
-
if (type === void 0) { type = null; }
|
|
4
|
+
const vaoAttributeLoader = (gl, buffer, index, size, stride, offset, divisor = null, type = null) => {
|
|
7
5
|
if (!gl || !buffer) {
|
|
8
6
|
throw new Error("Invalid WebGL context or buffer");
|
|
9
7
|
}
|
|
@@ -13,7 +11,7 @@ var vaoAttributeLoader = function (gl, buffer, index, size, stride, offset, divi
|
|
|
13
11
|
if (stride < 0 || offset < 0) {
|
|
14
12
|
throw new Error("Stride and offset must be non-negative");
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
const attribType = type === null ? gl.FLOAT : type;
|
|
17
15
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
18
16
|
gl.enableVertexAttribArray(index);
|
|
19
17
|
gl.vertexAttribPointer(index, size, attribType, false, stride, offset);
|
|
@@ -10,10 +10,10 @@ exports.findFirstIndexInRange = void 0;
|
|
|
10
10
|
* @param {number} value
|
|
11
11
|
* @returns {Index}
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const findFirstIndexInRange = (container, value) => {
|
|
14
|
+
let start = 0;
|
|
15
|
+
let end = container.length - 1;
|
|
16
|
+
let mid = 0;
|
|
17
17
|
while (start <= end) {
|
|
18
18
|
mid = Math.floor((start + end) / 2);
|
|
19
19
|
if (container[mid] <= value && value <= container[mid + 1])
|
package/util/check/get.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapGetOrThrow = void 0;
|
|
4
|
-
|
|
5
|
-
return
|
|
4
|
+
const mapGetOrThrow = (errorNote) => {
|
|
5
|
+
return (mapInstance, ids) => {
|
|
6
6
|
if (!ids)
|
|
7
7
|
throw new Error("There is no map keys to get");
|
|
8
|
-
|
|
9
|
-
for (
|
|
10
|
-
|
|
8
|
+
const result = [];
|
|
9
|
+
for (let i = 0; i < ids.length; i++) {
|
|
10
|
+
const e = mapInstance.get(ids[i]);
|
|
11
11
|
if (e === undefined)
|
|
12
12
|
throw new Error(errorNote + " " + ids[i]);
|
|
13
13
|
result.push(e);
|
package/util/check/typecheck.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// Generic
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.isBoolean = exports.constraintFloat = exports.isTextFont = exports.opacityCheck = exports.isHexColorWithOpacity = exports.isHexColor = void 0;
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
properties.forEach(
|
|
5
|
+
const doesOwnProperties = (properties, errorMessage) => {
|
|
6
|
+
return (object) => {
|
|
7
|
+
properties.forEach(element => {
|
|
8
8
|
if (!Object.hasOwn(object, element))
|
|
9
9
|
throw new TypeError(errorMessage + ':' + element);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
const isHexColor = (hexColor) => /^#[0-9A-F]{6}$/i.test(hexColor);
|
|
14
14
|
exports.isHexColor = isHexColor;
|
|
15
|
-
|
|
15
|
+
const isHexColorWithOpacity = (hexColor) => /^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(hexColor);
|
|
16
16
|
exports.isHexColorWithOpacity = isHexColorWithOpacity;
|
|
17
|
-
|
|
17
|
+
const opacityCheck = (opacity) => {
|
|
18
18
|
if (typeof opacity !== "number")
|
|
19
19
|
throw new TypeError("style.opacity must a number");
|
|
20
20
|
if (opacity < 0 || 1 < opacity)
|
|
@@ -22,29 +22,27 @@ var opacityCheck = function (opacity) {
|
|
|
22
22
|
};
|
|
23
23
|
exports.opacityCheck = opacityCheck;
|
|
24
24
|
// Text Related
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const fontCheckTypes = doesOwnProperties(["name", "textColor", "hollowColor", "size", "bold", "italic"], "font does not have");
|
|
26
|
+
const fontCheckColors = (textColor, hollowColor) => (0, exports.isHexColor)(textColor) && (0, exports.isHexColor)(hollowColor);
|
|
27
|
+
const isTextFont = (textFont) => {
|
|
28
28
|
fontCheckTypes(textFont);
|
|
29
29
|
fontCheckColors(textFont.textColor, textFont.hollowColor);
|
|
30
30
|
if (typeof textFont.size !== "number")
|
|
31
31
|
throw new TypeError("textFont size is not a number");
|
|
32
32
|
};
|
|
33
33
|
exports.isTextFont = isTextFont;
|
|
34
|
-
|
|
35
|
-
if (lowerBound === void 0) { lowerBound = null; }
|
|
36
|
-
if (upperBound === void 0) { upperBound = null; }
|
|
34
|
+
const constraintFloat = (x, lowerBound = null, upperBound = null) => {
|
|
37
35
|
if (typeof x !== "number")
|
|
38
36
|
throw new Error("type must be numberic");
|
|
39
37
|
if (lowerBound === null && upperBound === null)
|
|
40
38
|
return;
|
|
41
39
|
if (lowerBound !== null && lowerBound > x)
|
|
42
|
-
throw new Error(
|
|
40
|
+
throw new Error(`input must be greater than ${lowerBound}`);
|
|
43
41
|
if (upperBound !== null && x > upperBound)
|
|
44
|
-
throw new Error(
|
|
42
|
+
throw new Error(`input must be less than ${upperBound}`);
|
|
45
43
|
};
|
|
46
44
|
exports.constraintFloat = constraintFloat;
|
|
47
|
-
|
|
45
|
+
const isBoolean = (x) => {
|
|
48
46
|
if (typeof x !== "boolean")
|
|
49
47
|
throw new TypeError("type must be boolean");
|
|
50
48
|
};
|
package/util/geometry/index.js
CHANGED
|
@@ -25,8 +25,8 @@ function createBBoxMatrix(minX, maxX, minY, maxY) {
|
|
|
25
25
|
]);
|
|
26
26
|
}
|
|
27
27
|
function latLongBboxtoPixelXYBbox(minX, minY, maxX, maxY) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const minXY = latLongToPixelXY(minY, minX);
|
|
29
|
+
const maxXY = latLongToPixelXY(maxY, maxX);
|
|
30
30
|
return createBBoxMatrix(minXY.x, maxXY.x, minXY.y, maxXY.y);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
@@ -34,20 +34,18 @@ function latLongBboxtoPixelXYBbox(minX, minY, maxX, maxY) {
|
|
|
34
34
|
* @param {Float32List} array
|
|
35
35
|
* @returns {Float32Array}
|
|
36
36
|
*/
|
|
37
|
-
function normalize(array, newLength) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (var i = 0; i < array.length; i++) {
|
|
37
|
+
function normalize(array, newLength = 1) {
|
|
38
|
+
let total = 0;
|
|
39
|
+
for (let i = 0; i < array.length; i++) {
|
|
41
40
|
total += array[i] * array[i];
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
for (
|
|
42
|
+
const len = newLength / Math.sqrt(total);
|
|
43
|
+
const result = new Float32Array(array.length);
|
|
44
|
+
for (let i = 0; i < array.length; i++) {
|
|
46
45
|
result[i] = array[i] * len;
|
|
47
46
|
}
|
|
48
47
|
return result;
|
|
49
48
|
}
|
|
50
|
-
function sphereCoord(long, lat, globe, height) {
|
|
51
|
-
if (height === void 0) { height = 0; }
|
|
49
|
+
function sphereCoord(long, lat, globe, height = 0) {
|
|
52
50
|
return normalize(globe.api_GetCartesian3DPoint(long, lat, 0, 0), 6378.137 + height);
|
|
53
51
|
}
|