@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
|
@@ -6,51 +6,6 @@
|
|
|
6
6
|
* Buffer is initialized with ring capacity and buffer is created with that capacity. It might be called buffer orphaning.
|
|
7
7
|
*
|
|
8
8
|
* */
|
|
9
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
10
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
13
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
15
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
19
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
20
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
21
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
22
|
-
function step(op) {
|
|
23
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
24
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
25
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
26
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
27
|
-
switch (op[0]) {
|
|
28
|
-
case 0: case 1: t = op; break;
|
|
29
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
30
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
31
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
32
|
-
default:
|
|
33
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
34
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
35
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
36
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
37
|
-
if (t[2]) _.ops.pop();
|
|
38
|
-
_.trys.pop(); continue;
|
|
39
|
-
}
|
|
40
|
-
op = body.call(thisArg, _);
|
|
41
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
42
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
46
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
47
|
-
if (ar || !(i in from)) {
|
|
48
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
49
|
-
ar[i] = from[i];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
53
|
-
};
|
|
54
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
10
|
/**
|
|
56
11
|
* TODO
|
|
@@ -58,16 +13,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
58
13
|
*
|
|
59
14
|
*
|
|
60
15
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
16
|
+
const RING_SIZE = 9;
|
|
17
|
+
class default_1 {
|
|
63
18
|
/**
|
|
64
19
|
* @param {WebGL2RenderingContext} gl
|
|
65
20
|
* @param {Object} options
|
|
66
21
|
* @param {Number} options.initialRingCapacity
|
|
67
22
|
* @param {String} options.bufferType - "static" or "dynamic"
|
|
68
23
|
* */
|
|
69
|
-
|
|
70
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.initialRingCapacity, initialRingCapacity = _c === void 0 ? 20 : _c, _d = _b.bufferType, bufferType = _d === void 0 ? "STATIC_DRAW" : _d, _e = _b.implicitExtentionRate, implicitExtentionRate = _e === void 0 ? 1.2 : _e;
|
|
24
|
+
constructor(gl, globe, { initialRingCapacity = 20, bufferType = "STATIC_DRAW", implicitExtentionRate = 1.2 } = {}) {
|
|
71
25
|
this.gl = gl;
|
|
72
26
|
this.globe = globe;
|
|
73
27
|
this._capacity = initialRingCapacity;
|
|
@@ -131,103 +85,86 @@ var default_1 = /** @class */ (function () {
|
|
|
131
85
|
* @param {Number} options.x
|
|
132
86
|
* @param {Number} options.y
|
|
133
87
|
* */
|
|
134
|
-
|
|
135
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d;
|
|
88
|
+
registerCenter(centerID, { x = 0, y = 0 } = {}) {
|
|
136
89
|
this._centerMap.set(centerID, new Map([
|
|
137
90
|
["x", x],
|
|
138
91
|
["y", y],
|
|
139
92
|
["rings", []] // ring keys
|
|
140
93
|
]));
|
|
141
|
-
}
|
|
94
|
+
}
|
|
142
95
|
/**
|
|
143
96
|
*
|
|
144
97
|
* @param {null | number} newCapacity if null, vacuum defragmentation is applied -> capacity is set to the current ring count
|
|
145
98
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var _a = this, _removedRingsOffsetStack = _a._removedRingsOffsetStack, _ringOffsets = _a._ringOffsets;
|
|
99
|
+
defrag(newCapacity = null) {
|
|
100
|
+
const { _removedRingsOffsetStack, _ringOffsets } = this;
|
|
149
101
|
_removedRingsOffsetStack.sort();
|
|
150
102
|
this._capacity = newCapacity || this._ringCounter;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var ringData = bufferData.slice(ringOffset, ringOffset + RING_SIZE);
|
|
103
|
+
const arrayToLoad = new Float32Array(this._capacity * RING_SIZE);
|
|
104
|
+
const bufferData = this._getBufferData();
|
|
105
|
+
let arrayOffset = 0;
|
|
106
|
+
const newRingOffsets = new Map();
|
|
107
|
+
for (const [key, offset] of _ringOffsets) {
|
|
108
|
+
const ringOffset = offset / 4;
|
|
109
|
+
const ringData = bufferData.slice(ringOffset, ringOffset + RING_SIZE);
|
|
159
110
|
arrayToLoad.set(ringData, arrayOffset);
|
|
160
111
|
newRingOffsets.set(key, arrayOffset * 4);
|
|
161
112
|
arrayOffset += RING_SIZE;
|
|
162
113
|
}
|
|
163
|
-
|
|
114
|
+
const { gl, buffer } = this;
|
|
164
115
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
165
116
|
gl.bufferData(gl.ARRAY_BUFFER, arrayToLoad, this._bufferType);
|
|
166
117
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
167
118
|
this._ringOffsets = newRingOffsets;
|
|
168
119
|
this._removedRingsOffsetStack = [];
|
|
169
120
|
this._length = this._ringCounter;
|
|
170
|
-
}
|
|
171
|
-
|
|
121
|
+
}
|
|
122
|
+
extendBuffer(newCapacity) {
|
|
172
123
|
if (this._capacity >= newCapacity) {
|
|
173
124
|
console.warn("New capacity is smaller than the current capacity");
|
|
174
125
|
return;
|
|
175
126
|
}
|
|
176
127
|
this._capacity = newCapacity;
|
|
177
|
-
|
|
178
|
-
|
|
128
|
+
const { gl, buffer } = this;
|
|
129
|
+
const bufferData = this._getBufferData();
|
|
179
130
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
180
131
|
gl.bufferData(gl.ARRAY_BUFFER, newCapacity * RING_SIZE * 4, this._bufferType);
|
|
181
132
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
182
133
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (sizeLeft === void 0) { sizeLeft = 1; }
|
|
134
|
+
}
|
|
135
|
+
checkCapacity(sizeLeft = 1) {
|
|
186
136
|
return sizeLeft <= this._capacity - this._ringCounter;
|
|
187
|
-
}
|
|
188
|
-
|
|
137
|
+
}
|
|
138
|
+
capacityLeft() {
|
|
189
139
|
return this._capacity - this._ringCounter;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return this._length;
|
|
201
|
-
},
|
|
202
|
-
enumerable: false,
|
|
203
|
-
configurable: true
|
|
204
|
-
});
|
|
205
|
-
Object.defineProperty(default_1.prototype, "ringCount", {
|
|
206
|
-
get: function () {
|
|
207
|
-
return this._ringCounter;
|
|
208
|
-
},
|
|
209
|
-
enumerable: false,
|
|
210
|
-
configurable: true
|
|
211
|
-
});
|
|
140
|
+
}
|
|
141
|
+
get capacity() {
|
|
142
|
+
return this._capacity;
|
|
143
|
+
}
|
|
144
|
+
get length() {
|
|
145
|
+
return this._length;
|
|
146
|
+
}
|
|
147
|
+
get ringCount() {
|
|
148
|
+
return this._ringCounter;
|
|
149
|
+
}
|
|
212
150
|
/**
|
|
213
151
|
* @param {Array<string>} centerIDs
|
|
214
152
|
* */
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
153
|
+
removeCenters(centerIDs) {
|
|
154
|
+
const { gl, buffer } = this;
|
|
155
|
+
const zero = new Float32Array([0]);
|
|
218
156
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
219
|
-
for (
|
|
220
|
-
var centerID = centerIDs_1[_i];
|
|
157
|
+
for (let centerID of centerIDs) {
|
|
221
158
|
if (!this._centerMap.has(centerID)) {
|
|
222
159
|
// console.warn("Center is not registered yet");
|
|
223
160
|
// return;
|
|
224
161
|
continue;
|
|
225
162
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
for (
|
|
163
|
+
const center = this._centerMap.get(centerID);
|
|
164
|
+
const rings = center.get("rings");
|
|
165
|
+
for (let i = 0; i < rings.length; i++) {
|
|
229
166
|
// set range to 0, 3rd index of float32array
|
|
230
|
-
|
|
167
|
+
const offset = this._ringOffsets.get(rings[i]);
|
|
231
168
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 8, zero);
|
|
232
169
|
this._removedRingsOffsetStack.push(offset);
|
|
233
170
|
this._ringOffsets.delete(rings[i]);
|
|
@@ -237,7 +174,7 @@ var default_1 = /** @class */ (function () {
|
|
|
237
174
|
}
|
|
238
175
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
239
176
|
this.globe.DrawRender();
|
|
240
|
-
}
|
|
177
|
+
}
|
|
241
178
|
/**
|
|
242
179
|
*
|
|
243
180
|
* @property {String} centerID
|
|
@@ -245,46 +182,43 @@ var default_1 = /** @class */ (function () {
|
|
|
245
182
|
* @property {Number} y radians y
|
|
246
183
|
* @param {*} centerIDxyList
|
|
247
184
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
185
|
+
updateCentersXY(centerIDxyList) {
|
|
186
|
+
const { gl, buffer } = this;
|
|
250
187
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
251
|
-
for (
|
|
252
|
-
|
|
253
|
-
var center = this._centerMap.get(centerID);
|
|
188
|
+
for (let { centerID, x, y } of centerIDxyList) {
|
|
189
|
+
const center = this._centerMap.get(centerID);
|
|
254
190
|
center.set("x", x);
|
|
255
191
|
center.set("y", y);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
for (
|
|
259
|
-
|
|
192
|
+
const xyBlock = new Float32Array([x, y]);
|
|
193
|
+
const rings = center.get("rings");
|
|
194
|
+
for (let i = 0; i < rings.length; i++) {
|
|
195
|
+
const offset = this._ringOffsets.get(rings[i]);
|
|
260
196
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset, xyBlock);
|
|
261
197
|
}
|
|
262
198
|
}
|
|
263
199
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
264
200
|
this.globe.DrawRender();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
201
|
+
}
|
|
202
|
+
updateCentersHide(data) {
|
|
203
|
+
const { gl, buffer } = this;
|
|
268
204
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
269
|
-
for (
|
|
270
|
-
var _b = data_1[_i], centerID = _b.centerID, _c = _b.hide, hide = _c === void 0 ? null : _c;
|
|
205
|
+
for (let { centerID, hide = null } of data) {
|
|
271
206
|
if (hide === null)
|
|
272
207
|
continue;
|
|
273
|
-
|
|
274
|
-
for (
|
|
275
|
-
|
|
208
|
+
const rings = this._centerMap.get(centerID).get("rings");
|
|
209
|
+
for (let i = 0; i < rings.length; i++) {
|
|
210
|
+
const offset = this._ringOffsets.get(rings[i]);
|
|
276
211
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 32, new Float32Array([hide]));
|
|
277
212
|
}
|
|
278
213
|
}
|
|
279
214
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
280
215
|
this.globe.DrawRender();
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
216
|
+
}
|
|
217
|
+
insertBulk(rangeRingDatas) {
|
|
218
|
+
const { gl, buffer } = this;
|
|
284
219
|
{ // remove existring centers
|
|
285
|
-
|
|
286
|
-
for (
|
|
287
|
-
var centerID = rangeRingDatas_1[_i].centerID;
|
|
220
|
+
const existingCenterIDs = [];
|
|
221
|
+
for (let { centerID } of rangeRingDatas) {
|
|
288
222
|
if (this._centerMap.has(centerID)) {
|
|
289
223
|
existingCenterIDs.push(centerID);
|
|
290
224
|
}
|
|
@@ -292,9 +226,8 @@ var default_1 = /** @class */ (function () {
|
|
|
292
226
|
this.removeCenters(existingCenterIDs);
|
|
293
227
|
}
|
|
294
228
|
{ // capacity check
|
|
295
|
-
|
|
296
|
-
for (
|
|
297
|
-
var rings = rangeRingDatas_2[_b].rings;
|
|
229
|
+
let incomingRingSize = 0;
|
|
230
|
+
for (let { rings } of rangeRingDatas) {
|
|
298
231
|
incomingRingSize += rings.length;
|
|
299
232
|
// It should check if ring is already registered but for now it is not implemented.
|
|
300
233
|
// Reasons: increase in complexity and performance
|
|
@@ -302,14 +235,12 @@ var default_1 = /** @class */ (function () {
|
|
|
302
235
|
this._implicitExtendBufferInNeed(incomingRingSize);
|
|
303
236
|
}
|
|
304
237
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
305
|
-
for (
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
var bufferData = new Float32Array(__spreadArray(__spreadArray([x, y, radius, padding], rgba, true), [hide], false));
|
|
312
|
-
var offset = this._nextBufferOffset();
|
|
238
|
+
for (const { centerID, x, y, rings, hide = 0 } of rangeRingDatas) {
|
|
239
|
+
this.registerCenter(centerID, { x, y });
|
|
240
|
+
for (const { ringID, radius, padding, rgba } of rings) {
|
|
241
|
+
const key = this._ringKey(centerID, ringID);
|
|
242
|
+
const bufferData = new Float32Array([x, y, radius, padding, ...rgba, hide]);
|
|
243
|
+
const offset = this._nextBufferOffset();
|
|
313
244
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
|
|
314
245
|
this._ringOffsets.set(key, offset);
|
|
315
246
|
this._centerMap.get(centerID).get("rings").push(key);
|
|
@@ -317,61 +248,60 @@ var default_1 = /** @class */ (function () {
|
|
|
317
248
|
}
|
|
318
249
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
319
250
|
this.globe.DrawRender();
|
|
320
|
-
}
|
|
251
|
+
}
|
|
321
252
|
/**
|
|
322
253
|
*
|
|
323
254
|
* @param {Array<{centerID, rgba}} centersColors
|
|
324
255
|
*/
|
|
325
|
-
|
|
326
|
-
|
|
256
|
+
updateCentersColor(centersColors) {
|
|
257
|
+
const { gl, buffer } = this;
|
|
327
258
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
328
|
-
for (
|
|
329
|
-
var _b = centersColors_1[_i], centerID = _b.centerID, rgba = _b.rgba;
|
|
259
|
+
for (let { centerID, rgba } of centersColors) {
|
|
330
260
|
if (!this._centerMap.has(centerID)) {
|
|
331
261
|
console.warn("Center is not registered yet");
|
|
332
262
|
continue;
|
|
333
263
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
for (
|
|
337
|
-
|
|
264
|
+
const rings = this._centerMap.get(centerID).get("rings");
|
|
265
|
+
const block = new Float32Array(rgba);
|
|
266
|
+
for (let i = 0; i < rings.length; i++) {
|
|
267
|
+
const offset = this._ringOffsets.get(rings[i]);
|
|
338
268
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 16, block);
|
|
339
269
|
}
|
|
340
270
|
}
|
|
341
271
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
342
272
|
this.globe.DrawRender();
|
|
343
|
-
}
|
|
273
|
+
}
|
|
344
274
|
// ----------------- INTERNAL METHODS ----------------- //
|
|
345
|
-
|
|
275
|
+
bindCircleVAO() {
|
|
346
276
|
this.gl.bindVertexArray(this._circleVAO);
|
|
347
|
-
}
|
|
348
|
-
|
|
277
|
+
}
|
|
278
|
+
bindPaddingVAO() {
|
|
349
279
|
this.gl.bindVertexArray(this._paddingVAO);
|
|
350
|
-
}
|
|
351
|
-
|
|
280
|
+
}
|
|
281
|
+
free() {
|
|
352
282
|
this.gl.deleteBuffer(this.buffer);
|
|
353
283
|
this.gl.deleteVertexArray(this._circleVAO);
|
|
354
284
|
this.gl.deleteVertexArray(this._paddingVAO);
|
|
355
|
-
}
|
|
285
|
+
}
|
|
356
286
|
// ----------------- PRIVATE METHODS ----------------- //
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
287
|
+
_getBufferData() {
|
|
288
|
+
const { gl, buffer } = this;
|
|
289
|
+
const size = new Float32Array(this._length * RING_SIZE);
|
|
290
|
+
const bufferData = new Float32Array(size);
|
|
361
291
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
362
292
|
gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
363
293
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
364
294
|
return bufferData;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
return
|
|
368
|
-
}
|
|
369
|
-
|
|
295
|
+
}
|
|
296
|
+
_ringKey(centerID, ringID) {
|
|
297
|
+
return `C=${centerID},R=${ringID}`;
|
|
298
|
+
}
|
|
299
|
+
_nextBufferOffset() {
|
|
370
300
|
if (!this.checkCapacity()) {
|
|
371
301
|
throw new Error("Buffer is full");
|
|
372
302
|
return;
|
|
373
303
|
}
|
|
374
|
-
|
|
304
|
+
let offset;
|
|
375
305
|
if (this._removedRingsOffsetStack.length > 0) {
|
|
376
306
|
offset = this._removedRingsOffsetStack.pop();
|
|
377
307
|
}
|
|
@@ -381,41 +311,35 @@ var default_1 = /** @class */ (function () {
|
|
|
381
311
|
}
|
|
382
312
|
this._ringCounter++;
|
|
383
313
|
return offset;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
314
|
+
}
|
|
315
|
+
_implicitExtendBufferInNeed(incomingRingSize) {
|
|
316
|
+
const overCapacity = incomingRingSize - this.capacityLeft();
|
|
387
317
|
if (overCapacity <= 0)
|
|
388
318
|
return;
|
|
389
|
-
|
|
319
|
+
const newCapacity = Math.ceil((this._capacity + overCapacity) * this.implicitExtentionRate);
|
|
390
320
|
this.extendBuffer(newCapacity);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}];
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
};
|
|
417
|
-
return default_1;
|
|
418
|
-
}());
|
|
321
|
+
}
|
|
322
|
+
async readRing(centerID, ringID) {
|
|
323
|
+
const key = this._ringKey(centerID, ringID);
|
|
324
|
+
if (!this._ringOffsets.has(key)) {
|
|
325
|
+
console.warn("Ring is not registered yet");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const offset = this._ringOffsets.get(key);
|
|
329
|
+
const { gl, buffer } = this;
|
|
330
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
331
|
+
const bufferData = new Float32Array(9);
|
|
332
|
+
gl.getBufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
|
|
333
|
+
return {
|
|
334
|
+
centerX: bufferData[0],
|
|
335
|
+
centerY: bufferData[1],
|
|
336
|
+
range: bufferData[2],
|
|
337
|
+
padding: bufferData[3],
|
|
338
|
+
rgba: [bufferData[4], bufferData[5], bufferData[6], bufferData[7]],
|
|
339
|
+
hide: bufferData[8]
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
419
343
|
exports.default = default_1;
|
|
420
344
|
/**
|
|
421
345
|
* Documentation
|
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PaddingFreeAngleCache = exports.CirclePaddySharedBuffer = exports.PaddingProgramCache = exports.circleProgramCache = void 0;
|
|
7
|
-
|
|
7
|
+
const circleflatprogram_1 = require("./circleflatprogram");
|
|
8
8
|
Object.defineProperty(exports, "circleProgramCache", { enumerable: true, get: function () { return circleflatprogram_1.programCache; } });
|
|
9
|
-
|
|
9
|
+
const paddyflatprogram_1 = require("./paddyflatprogram");
|
|
10
10
|
Object.defineProperty(exports, "PaddingProgramCache", { enumerable: true, get: function () { return paddyflatprogram_1.PaddingProgramCache; } });
|
|
11
|
-
|
|
11
|
+
const circlepaddysharedbuffer_1 = __importDefault(require("./circlepaddysharedbuffer"));
|
|
12
12
|
exports.CirclePaddySharedBuffer = circlepaddysharedbuffer_1.default;
|
|
13
|
-
|
|
13
|
+
const circlepaddingfreeangleprogram_1 = require("./circlepaddingfreeangleprogram");
|
|
14
14
|
Object.defineProperty(exports, "PaddingFreeAngleCache", { enumerable: true, get: function () { return circlepaddingfreeangleprogram_1.PaddingFreeAngleCache; } });
|
|
@@ -34,10 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.PaddingProgramCache = void 0;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const util_1 = require("../../../util");
|
|
38
|
+
const camerauniformblock_1 = __importStar(require("../../totems/camerauniformblock"));
|
|
39
|
+
const programcache_1 = require("../../programcache");
|
|
40
|
+
const vertexShader = `#version 300 es ` +
|
|
41
41
|
util_1.shaderfunctions.PI +
|
|
42
42
|
util_1.shaderfunctions.R +
|
|
43
43
|
util_1.shaderfunctions.POLE +
|
|
@@ -48,11 +48,65 @@ var vertexShader = "#version 300 es " +
|
|
|
48
48
|
util_1.shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
49
49
|
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
50
50
|
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
51
|
-
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance +
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
52
|
+
|
|
53
|
+
in vec2 center;
|
|
54
|
+
in float radius;
|
|
55
|
+
in float pad_range;
|
|
56
|
+
in vec4 color;
|
|
57
|
+
in float flag;
|
|
58
|
+
|
|
59
|
+
uniform int compass;
|
|
60
|
+
uniform float pad_count;
|
|
61
|
+
|
|
62
|
+
uniform float opacity;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
out vec2 v_limp;
|
|
66
|
+
out vec4 v_color;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
void main() {
|
|
70
|
+
|
|
71
|
+
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
72
|
+
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
73
|
+
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
74
|
+
|
|
75
|
+
gl_PointSize = 2.0;
|
|
76
|
+
|
|
77
|
+
float odd = mod(float(gl_VertexID), 2.0);
|
|
78
|
+
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
79
|
+
float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
|
|
80
|
+
float radius_ = radius - (pad_range * odd);
|
|
81
|
+
|
|
82
|
+
if ( is3D){
|
|
83
|
+
gl_Position = projection * view * vec4(
|
|
84
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
85
|
+
v_limp = vec2(0.0, 0.0);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
vec2 limp;
|
|
89
|
+
if ( compass == 1 ){
|
|
90
|
+
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
91
|
+
} else {
|
|
92
|
+
// limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
|
|
93
|
+
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
94
|
+
}
|
|
95
|
+
v_limp = limp;
|
|
96
|
+
gl_Position = mercatorXYToGLPosition(limp);
|
|
97
|
+
}`;
|
|
98
|
+
const fragmentShader = `#version 300 es
|
|
99
|
+
precision highp float; ` +
|
|
100
|
+
util_1.shaderfunctions.POLE + `
|
|
101
|
+
in vec4 v_color;
|
|
102
|
+
in vec2 v_limp;
|
|
103
|
+
out vec4 outColor;
|
|
104
|
+
void main() {
|
|
105
|
+
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
106
|
+
outColor = v_color;
|
|
107
|
+
}`;
|
|
108
|
+
class Logic {
|
|
109
|
+
constructor(globe) {
|
|
56
110
|
this.globe = globe;
|
|
57
111
|
this.gl = globe.gl;
|
|
58
112
|
this.program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
@@ -64,7 +118,7 @@ var Logic = /** @class */ (function () {
|
|
|
64
118
|
this.gl.bindAttribLocation(this.program, 4, "flag");
|
|
65
119
|
}
|
|
66
120
|
this.cameraBlockBindingPoint = 0;
|
|
67
|
-
|
|
121
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
68
122
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
69
123
|
this.cameraBlockTotem = programcache_1.globeProgramCache.getProgram(globe, camerauniformblock_1.default);
|
|
70
124
|
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
@@ -74,7 +128,7 @@ var Logic = /** @class */ (function () {
|
|
|
74
128
|
this._opacity = 1.0;
|
|
75
129
|
this._padCount = 360;
|
|
76
130
|
{
|
|
77
|
-
|
|
131
|
+
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
78
132
|
this.gl.useProgram(this.program);
|
|
79
133
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
80
134
|
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
@@ -82,8 +136,8 @@ var Logic = /** @class */ (function () {
|
|
|
82
136
|
this.gl.useProgram(currentProgram);
|
|
83
137
|
}
|
|
84
138
|
}
|
|
85
|
-
|
|
86
|
-
|
|
139
|
+
draw(attrBufferManager, padCount, compass, opacity) {
|
|
140
|
+
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
87
141
|
gl.useProgram(program);
|
|
88
142
|
attrBufferManager.bindPaddingVAO();
|
|
89
143
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -106,14 +160,13 @@ var Logic = /** @class */ (function () {
|
|
|
106
160
|
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
107
161
|
gl.bindVertexArray(null);
|
|
108
162
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
109
|
-
}
|
|
110
|
-
|
|
163
|
+
}
|
|
164
|
+
free() {
|
|
111
165
|
this.gl.deleteProgram(this.program);
|
|
112
166
|
programcache_1.globeProgramCache.releaseProgram(this.globe, camerauniformblock_1.default);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}());
|
|
167
|
+
}
|
|
168
|
+
}
|
|
116
169
|
exports.PaddingProgramCache = Object.freeze({
|
|
117
|
-
getProgram:
|
|
118
|
-
releaseProgram:
|
|
170
|
+
getProgram: (globe) => { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
171
|
+
releaseProgram: (globe) => { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
119
172
|
});
|