@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.
Files changed (166) hide show
  1. package/Math/angle-calculation.js +8 -8
  2. package/Math/arc.js +18 -18
  3. package/Math/bounds/line-bbox.js +80 -78
  4. package/Math/constants.js +3 -3
  5. package/Math/juction/arc-plane.js +23 -23
  6. package/Math/juction/line-sphere.js +11 -11
  7. package/Math/juction/plane-plane.js +11 -11
  8. package/Math/line.js +16 -14
  9. package/Math/methods.js +72 -67
  10. package/Math/plane.js +18 -16
  11. package/Math/quaternion.js +49 -45
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +45 -42
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +8 -7
  16. package/altitude-locator/plugin.js +113 -97
  17. package/arrowfield/adaptor.js +4 -3
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +65 -62
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +225 -200
  22. package/circle-line-chain/chain-list-map.js +88 -82
  23. package/circle-line-chain/plugin.js +154 -129
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +126 -104
  26. package/compass-rose/compass-text-writer.js +70 -62
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +50 -46
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +48 -44
  32. package/heatwave/isobar/plugin.js +123 -104
  33. package/heatwave/isobar/quadtreecontours.js +92 -76
  34. package/heatwave/plugins/heatwaveglobeshell.js +87 -69
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +64 -32
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +84 -48
  40. package/partialrings/program.js +47 -136
  41. package/pin/pin-object-array.js +86 -83
  42. package/pin/pin-point-totem.js +22 -21
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +45 -40
  45. package/point-heat-map/point-to-heat-map-flow.js +42 -40
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +142 -127
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +62 -170
  50. package/programs/arrowfield/object.js +35 -33
  51. package/programs/data2legend/density-to-legend.js +21 -45
  52. package/programs/data2legend/point-to-density-texture.js +27 -52
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +42 -88
  55. package/programs/float2legendwithratio/object.js +46 -43
  56. package/programs/globe-util/is-globe-moved.js +11 -10
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +98 -191
  60. package/programs/globeshell/wiggle/object.js +35 -33
  61. package/programs/helpers/blender/program.js +19 -36
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +13 -35
  64. package/programs/helpers/fadeaway/object.js +10 -9
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +32 -91
  68. package/programs/line-on-globe/circle-accurate-3d.js +32 -82
  69. package/programs/line-on-globe/circle-accurate-flat.js +50 -108
  70. package/programs/line-on-globe/circle-accurate.js +33 -103
  71. package/programs/line-on-globe/circle.js +32 -97
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
  74. package/programs/line-on-globe/linestrip.js +39 -100
  75. package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
  76. package/programs/line-on-globe/to-the-surface.js +29 -58
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +33 -117
  79. package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
  80. package/programs/point-on-globe/element-point-glow.js +35 -103
  81. package/programs/point-on-globe/square-pixel-point.js +27 -76
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +21 -63
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +20 -73
  88. package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
  89. package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
  90. package/programs/rings/partial-ring/piece-of-pie.js +35 -137
  91. package/programs/totems/camerauniformblock.js +51 -64
  92. package/programs/totems/canvas-webglobe-info.js +40 -48
  93. package/programs/totems/gpu-selection-uniform-block.js +40 -44
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +29 -90
  96. package/programs/util.js +7 -6
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +35 -91
  101. package/programs/vectorfields/logics/ubo.js +25 -31
  102. package/programs/vectorfields/pingpongbuffermanager.js +34 -30
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +252 -202
  105. package/rangerings/rangeringangletext.js +120 -108
  106. package/rangerings/ring-account.js +69 -52
  107. package/shaders/fragment-toy/firework.js +1 -55
  108. package/shaders/fragment-toy/singularity.js +1 -55
  109. package/timetracks/adaptors-line-strip.js +37 -26
  110. package/timetracks/adaptors.js +61 -47
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -59
  113. package/timetracks/plugin.js +69 -65
  114. package/timetracks/program-line-strip.js +103 -296
  115. package/timetracks/program.js +113 -419
  116. package/timetracks/programpoint-line-strip.js +44 -97
  117. package/timetracks/programpoint.js +44 -90
  118. package/util/account/bufferoffsetmanager.js +95 -72
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +30 -28
  124. package/util/account/util.js +4 -2
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +15 -13
  128. package/util/geometry/index.js +11 -9
  129. package/util/gl-util/buffer/attribute-loader.js +20 -8
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +7 -7
  132. package/util/gl-util/uniform-block/manager.js +67 -55
  133. package/util/heatwavedatamanager/datamanager.js +116 -56
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
  140. package/util/interpolation/timetrack/web-worker-str.js +1 -179
  141. package/util/interpolation/timetrack/web-worker.js +4 -4
  142. package/util/jshelpers/data-filler.js +7 -7
  143. package/util/jshelpers/timefilters.js +7 -7
  144. package/util/picking/fence.js +7 -7
  145. package/util/picking/picker-displayer.js +52 -46
  146. package/util/programs/draw-texture-on-canvas.js +21 -39
  147. package/util/programs/shapesonglobe.js +64 -104
  148. package/util/programs/supersampletotextures.js +39 -45
  149. package/util/programs/texturetoglobe.js +48 -98
  150. package/util/shaderfunctions/geometrytransformations.js +27 -322
  151. package/util/shaderfunctions/nodata.js +1 -7
  152. package/util/shaderfunctions/noisefunctions.js +9 -39
  153. package/util/surface-line-data/arcs-to-cuts.js +23 -20
  154. package/util/webglobe/rasteroverlay.js +37 -35
  155. package/util/webglobjectbuilders.js +60 -55
  156. package/util/webglobjectbuilders1.js +49 -48
  157. package/waveparticles/adaptor.js +7 -6
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +84 -79
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +251 -453
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +48 -46
  165. package/write-text/context-text.js +58 -51
  166. package/write-text/context-text3.js +74 -69
@@ -6,6 +6,51 @@
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
+ };
9
54
  Object.defineProperty(exports, "__esModule", { value: true });
10
55
  /**
11
56
  * TODO
@@ -13,15 +58,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
58
  *
14
59
  *
15
60
  */
16
- const RING_SIZE = 9;
17
- class default_1 {
61
+ var RING_SIZE = 9;
62
+ var default_1 = /** @class */ (function () {
18
63
  /**
19
64
  * @param {WebGL2RenderingContext} gl
20
65
  * @param {Object} options
21
66
  * @param {Number} options.initialRingCapacity
22
67
  * @param {String} options.bufferType - "static" or "dynamic"
23
68
  * */
24
- constructor(gl, globe, { initialRingCapacity = 20, bufferType = "STATIC_DRAW", implicitExtentionRate = 1.2 } = {}) {
69
+ function default_1(gl, globe, _a) {
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;
25
71
  this.gl = gl;
26
72
  this.globe = globe;
27
73
  this._capacity = initialRingCapacity;
@@ -85,86 +131,103 @@ class default_1 {
85
131
  * @param {Number} options.x
86
132
  * @param {Number} options.y
87
133
  * */
88
- registerCenter(centerID, { x = 0, y = 0 } = {}) {
134
+ default_1.prototype.registerCenter = function (centerID, _a) {
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;
89
136
  this._centerMap.set(centerID, new Map([
90
137
  ["x", x],
91
138
  ["y", y],
92
139
  ["rings", []] // ring keys
93
140
  ]));
94
- }
141
+ };
95
142
  /**
96
143
  *
97
144
  * @param {null | number} newCapacity if null, vacuum defragmentation is applied -> capacity is set to the current ring count
98
145
  */
99
- defrag(newCapacity = null) {
100
- const { _removedRingsOffsetStack, _ringOffsets } = this;
146
+ default_1.prototype.defrag = function (newCapacity) {
147
+ if (newCapacity === void 0) { newCapacity = null; }
148
+ var _a = this, _removedRingsOffsetStack = _a._removedRingsOffsetStack, _ringOffsets = _a._ringOffsets;
101
149
  _removedRingsOffsetStack.sort();
102
150
  this._capacity = newCapacity || this._ringCounter;
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);
151
+ var arrayToLoad = new Float32Array(this._capacity * RING_SIZE);
152
+ var bufferData = this._getBufferData();
153
+ var arrayOffset = 0;
154
+ var newRingOffsets = new Map();
155
+ for (var _i = 0, _ringOffsets_1 = _ringOffsets; _i < _ringOffsets_1.length; _i++) {
156
+ var _b = _ringOffsets_1[_i], key = _b[0], offset = _b[1];
157
+ var ringOffset = offset / 4;
158
+ var ringData = bufferData.slice(ringOffset, ringOffset + RING_SIZE);
110
159
  arrayToLoad.set(ringData, arrayOffset);
111
160
  newRingOffsets.set(key, arrayOffset * 4);
112
161
  arrayOffset += RING_SIZE;
113
162
  }
114
- const { gl, buffer } = this;
163
+ var _c = this, gl = _c.gl, buffer = _c.buffer;
115
164
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
116
165
  gl.bufferData(gl.ARRAY_BUFFER, arrayToLoad, this._bufferType);
117
166
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
118
167
  this._ringOffsets = newRingOffsets;
119
168
  this._removedRingsOffsetStack = [];
120
169
  this._length = this._ringCounter;
121
- }
122
- extendBuffer(newCapacity) {
170
+ };
171
+ default_1.prototype.extendBuffer = function (newCapacity) {
123
172
  if (this._capacity >= newCapacity) {
124
173
  console.warn("New capacity is smaller than the current capacity");
125
174
  return;
126
175
  }
127
176
  this._capacity = newCapacity;
128
- const { gl, buffer } = this;
129
- const bufferData = this._getBufferData();
177
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
178
+ var bufferData = this._getBufferData();
130
179
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
131
180
  gl.bufferData(gl.ARRAY_BUFFER, newCapacity * RING_SIZE * 4, this._bufferType);
132
181
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
133
182
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
134
- }
135
- checkCapacity(sizeLeft = 1) {
183
+ };
184
+ default_1.prototype.checkCapacity = function (sizeLeft) {
185
+ if (sizeLeft === void 0) { sizeLeft = 1; }
136
186
  return sizeLeft <= this._capacity - this._ringCounter;
137
- }
138
- capacityLeft() {
187
+ };
188
+ default_1.prototype.capacityLeft = function () {
139
189
  return this._capacity - this._ringCounter;
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
- }
190
+ };
191
+ Object.defineProperty(default_1.prototype, "capacity", {
192
+ get: function () {
193
+ return this._capacity;
194
+ },
195
+ enumerable: false,
196
+ configurable: true
197
+ });
198
+ Object.defineProperty(default_1.prototype, "length", {
199
+ get: function () {
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
+ });
150
212
  /**
151
213
  * @param {Array<string>} centerIDs
152
214
  * */
153
- removeCenters(centerIDs) {
154
- const { gl, buffer } = this;
155
- const zero = new Float32Array([0]);
215
+ default_1.prototype.removeCenters = function (centerIDs) {
216
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
217
+ var zero = new Float32Array([0]);
156
218
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
157
- for (let centerID of centerIDs) {
219
+ for (var _i = 0, centerIDs_1 = centerIDs; _i < centerIDs_1.length; _i++) {
220
+ var centerID = centerIDs_1[_i];
158
221
  if (!this._centerMap.has(centerID)) {
159
222
  // console.warn("Center is not registered yet");
160
223
  // return;
161
224
  continue;
162
225
  }
163
- const center = this._centerMap.get(centerID);
164
- const rings = center.get("rings");
165
- for (let i = 0; i < rings.length; i++) {
226
+ var center = this._centerMap.get(centerID);
227
+ var rings = center.get("rings");
228
+ for (var i = 0; i < rings.length; i++) {
166
229
  // set range to 0, 3rd index of float32array
167
- const offset = this._ringOffsets.get(rings[i]);
230
+ var offset = this._ringOffsets.get(rings[i]);
168
231
  gl.bufferSubData(gl.ARRAY_BUFFER, offset + 8, zero);
169
232
  this._removedRingsOffsetStack.push(offset);
170
233
  this._ringOffsets.delete(rings[i]);
@@ -174,7 +237,7 @@ class default_1 {
174
237
  }
175
238
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
176
239
  this.globe.DrawRender();
177
- }
240
+ };
178
241
  /**
179
242
  *
180
243
  * @property {String} centerID
@@ -182,43 +245,46 @@ class default_1 {
182
245
  * @property {Number} y radians y
183
246
  * @param {*} centerIDxyList
184
247
  */
185
- updateCentersXY(centerIDxyList) {
186
- const { gl, buffer } = this;
248
+ default_1.prototype.updateCentersXY = function (centerIDxyList) {
249
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
187
250
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
188
- for (let { centerID, x, y } of centerIDxyList) {
189
- const center = this._centerMap.get(centerID);
251
+ for (var _i = 0, centerIDxyList_1 = centerIDxyList; _i < centerIDxyList_1.length; _i++) {
252
+ var _b = centerIDxyList_1[_i], centerID = _b.centerID, x = _b.x, y = _b.y;
253
+ var center = this._centerMap.get(centerID);
190
254
  center.set("x", x);
191
255
  center.set("y", y);
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]);
256
+ var xyBlock = new Float32Array([x, y]);
257
+ var rings = center.get("rings");
258
+ for (var i = 0; i < rings.length; i++) {
259
+ var offset = this._ringOffsets.get(rings[i]);
196
260
  gl.bufferSubData(gl.ARRAY_BUFFER, offset, xyBlock);
197
261
  }
198
262
  }
199
263
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
200
264
  this.globe.DrawRender();
201
- }
202
- updateCentersHide(data) {
203
- const { gl, buffer } = this;
265
+ };
266
+ default_1.prototype.updateCentersHide = function (data) {
267
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
204
268
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
205
- for (let { centerID, hide = null } of data) {
269
+ for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
270
+ var _b = data_1[_i], centerID = _b.centerID, _c = _b.hide, hide = _c === void 0 ? null : _c;
206
271
  if (hide === null)
207
272
  continue;
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]);
273
+ var rings = this._centerMap.get(centerID).get("rings");
274
+ for (var i = 0; i < rings.length; i++) {
275
+ var offset = this._ringOffsets.get(rings[i]);
211
276
  gl.bufferSubData(gl.ARRAY_BUFFER, offset + 32, new Float32Array([hide]));
212
277
  }
213
278
  }
214
279
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
215
280
  this.globe.DrawRender();
216
- }
217
- insertBulk(rangeRingDatas) {
218
- const { gl, buffer } = this;
281
+ };
282
+ default_1.prototype.insertBulk = function (rangeRingDatas) {
283
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
219
284
  { // remove existring centers
220
- const existingCenterIDs = [];
221
- for (let { centerID } of rangeRingDatas) {
285
+ var existingCenterIDs = [];
286
+ for (var _i = 0, rangeRingDatas_1 = rangeRingDatas; _i < rangeRingDatas_1.length; _i++) {
287
+ var centerID = rangeRingDatas_1[_i].centerID;
222
288
  if (this._centerMap.has(centerID)) {
223
289
  existingCenterIDs.push(centerID);
224
290
  }
@@ -226,8 +292,9 @@ class default_1 {
226
292
  this.removeCenters(existingCenterIDs);
227
293
  }
228
294
  { // capacity check
229
- let incomingRingSize = 0;
230
- for (let { rings } of rangeRingDatas) {
295
+ var incomingRingSize = 0;
296
+ for (var _b = 0, rangeRingDatas_2 = rangeRingDatas; _b < rangeRingDatas_2.length; _b++) {
297
+ var rings = rangeRingDatas_2[_b].rings;
231
298
  incomingRingSize += rings.length;
232
299
  // It should check if ring is already registered but for now it is not implemented.
233
300
  // Reasons: increase in complexity and performance
@@ -235,12 +302,14 @@ class default_1 {
235
302
  this._implicitExtendBufferInNeed(incomingRingSize);
236
303
  }
237
304
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
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();
305
+ for (var _c = 0, rangeRingDatas_3 = rangeRingDatas; _c < rangeRingDatas_3.length; _c++) {
306
+ var _d = rangeRingDatas_3[_c], centerID = _d.centerID, x = _d.x, y = _d.y, rings = _d.rings, _e = _d.hide, hide = _e === void 0 ? 0 : _e;
307
+ this.registerCenter(centerID, { x: x, y: y });
308
+ for (var _f = 0, rings_1 = rings; _f < rings_1.length; _f++) {
309
+ var _g = rings_1[_f], ringID = _g.ringID, radius = _g.radius, padding = _g.padding, rgba = _g.rgba;
310
+ var key = this._ringKey(centerID, ringID);
311
+ var bufferData = new Float32Array(__spreadArray(__spreadArray([x, y, radius, padding], rgba, true), [hide], false));
312
+ var offset = this._nextBufferOffset();
244
313
  gl.bufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
245
314
  this._ringOffsets.set(key, offset);
246
315
  this._centerMap.get(centerID).get("rings").push(key);
@@ -248,60 +317,61 @@ class default_1 {
248
317
  }
249
318
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
250
319
  this.globe.DrawRender();
251
- }
320
+ };
252
321
  /**
253
322
  *
254
323
  * @param {Array<{centerID, rgba}} centersColors
255
324
  */
256
- updateCentersColor(centersColors) {
257
- const { gl, buffer } = this;
325
+ default_1.prototype.updateCentersColor = function (centersColors) {
326
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
258
327
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
259
- for (let { centerID, rgba } of centersColors) {
328
+ for (var _i = 0, centersColors_1 = centersColors; _i < centersColors_1.length; _i++) {
329
+ var _b = centersColors_1[_i], centerID = _b.centerID, rgba = _b.rgba;
260
330
  if (!this._centerMap.has(centerID)) {
261
331
  console.warn("Center is not registered yet");
262
332
  continue;
263
333
  }
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]);
334
+ var rings = this._centerMap.get(centerID).get("rings");
335
+ var block = new Float32Array(rgba);
336
+ for (var i = 0; i < rings.length; i++) {
337
+ var offset = this._ringOffsets.get(rings[i]);
268
338
  gl.bufferSubData(gl.ARRAY_BUFFER, offset + 16, block);
269
339
  }
270
340
  }
271
341
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
272
342
  this.globe.DrawRender();
273
- }
343
+ };
274
344
  // ----------------- INTERNAL METHODS ----------------- //
275
- bindCircleVAO() {
345
+ default_1.prototype.bindCircleVAO = function () {
276
346
  this.gl.bindVertexArray(this._circleVAO);
277
- }
278
- bindPaddingVAO() {
347
+ };
348
+ default_1.prototype.bindPaddingVAO = function () {
279
349
  this.gl.bindVertexArray(this._paddingVAO);
280
- }
281
- free() {
350
+ };
351
+ default_1.prototype.free = function () {
282
352
  this.gl.deleteBuffer(this.buffer);
283
353
  this.gl.deleteVertexArray(this._circleVAO);
284
354
  this.gl.deleteVertexArray(this._paddingVAO);
285
- }
355
+ };
286
356
  // ----------------- PRIVATE METHODS ----------------- //
287
- _getBufferData() {
288
- const { gl, buffer } = this;
289
- const size = new Float32Array(this._length * RING_SIZE);
290
- const bufferData = new Float32Array(size);
357
+ default_1.prototype._getBufferData = function () {
358
+ var _a = this, gl = _a.gl, buffer = _a.buffer;
359
+ var size = new Float32Array(this._length * RING_SIZE);
360
+ var bufferData = new Float32Array(size);
291
361
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
292
362
  gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
293
363
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
294
364
  return bufferData;
295
- }
296
- _ringKey(centerID, ringID) {
297
- return `C=${centerID},R=${ringID}`;
298
- }
299
- _nextBufferOffset() {
365
+ };
366
+ default_1.prototype._ringKey = function (centerID, ringID) {
367
+ return "C=".concat(centerID, ",R=").concat(ringID);
368
+ };
369
+ default_1.prototype._nextBufferOffset = function () {
300
370
  if (!this.checkCapacity()) {
301
371
  throw new Error("Buffer is full");
302
372
  return;
303
373
  }
304
- let offset;
374
+ var offset;
305
375
  if (this._removedRingsOffsetStack.length > 0) {
306
376
  offset = this._removedRingsOffsetStack.pop();
307
377
  }
@@ -311,35 +381,41 @@ class default_1 {
311
381
  }
312
382
  this._ringCounter++;
313
383
  return offset;
314
- }
315
- _implicitExtendBufferInNeed(incomingRingSize) {
316
- const overCapacity = incomingRingSize - this.capacityLeft();
384
+ };
385
+ default_1.prototype._implicitExtendBufferInNeed = function (incomingRingSize) {
386
+ var overCapacity = incomingRingSize - this.capacityLeft();
317
387
  if (overCapacity <= 0)
318
388
  return;
319
- const newCapacity = Math.ceil((this._capacity + overCapacity) * this.implicitExtentionRate);
389
+ var newCapacity = Math.ceil((this._capacity + overCapacity) * this.implicitExtentionRate);
320
390
  this.extendBuffer(newCapacity);
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
- }
391
+ };
392
+ default_1.prototype.readRing = function (centerID, ringID) {
393
+ return __awaiter(this, void 0, void 0, function () {
394
+ var key, offset, _a, gl, buffer, bufferData;
395
+ return __generator(this, function (_b) {
396
+ key = this._ringKey(centerID, ringID);
397
+ if (!this._ringOffsets.has(key)) {
398
+ console.warn("Ring is not registered yet");
399
+ return [2 /*return*/];
400
+ }
401
+ offset = this._ringOffsets.get(key);
402
+ _a = this, gl = _a.gl, buffer = _a.buffer;
403
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
404
+ bufferData = new Float32Array(9);
405
+ gl.getBufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
406
+ return [2 /*return*/, {
407
+ centerX: bufferData[0],
408
+ centerY: bufferData[1],
409
+ range: bufferData[2],
410
+ padding: bufferData[3],
411
+ rgba: [bufferData[4], bufferData[5], bufferData[6], bufferData[7]],
412
+ hide: bufferData[8]
413
+ }];
414
+ });
415
+ });
416
+ };
417
+ return default_1;
418
+ }());
343
419
  exports.default = default_1;
344
420
  /**
345
421
  * 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
- const circleflatprogram_1 = require("./circleflatprogram");
7
+ var circleflatprogram_1 = require("./circleflatprogram");
8
8
  Object.defineProperty(exports, "circleProgramCache", { enumerable: true, get: function () { return circleflatprogram_1.programCache; } });
9
- const paddyflatprogram_1 = require("./paddyflatprogram");
9
+ var paddyflatprogram_1 = require("./paddyflatprogram");
10
10
  Object.defineProperty(exports, "PaddingProgramCache", { enumerable: true, get: function () { return paddyflatprogram_1.PaddingProgramCache; } });
11
- const circlepaddysharedbuffer_1 = __importDefault(require("./circlepaddysharedbuffer"));
11
+ var circlepaddysharedbuffer_1 = __importDefault(require("./circlepaddysharedbuffer"));
12
12
  exports.CirclePaddySharedBuffer = circlepaddysharedbuffer_1.default;
13
- const circlepaddingfreeangleprogram_1 = require("./circlepaddingfreeangleprogram");
13
+ var 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
- 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 ` +
37
+ var util_1 = require("../../../util");
38
+ var camerauniformblock_1 = __importStar(require("../../totems/camerauniformblock"));
39
+ var programcache_1 = require("../../programcache");
40
+ var vertexShader = "#version 300 es " +
41
41
  util_1.shaderfunctions.PI +
42
42
  util_1.shaderfunctions.R +
43
43
  util_1.shaderfunctions.POLE +
@@ -48,65 +48,11 @@ const 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
- 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) {
51
+ util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + "\n\nin vec2 center;\nin float radius;\nin float pad_range;\nin vec4 color;\nin float flag;\n\nuniform int compass;\nuniform float pad_count;\n\nuniform float opacity;\n\n\nout vec2 v_limp;\nout vec4 v_color;\n\n\nvoid main() { \n\n float alpha_padding = z_level * z_level / (pad_range/ 100.0 );\n if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide \n v_color = vec4(color.rgb, color.a * alpha_padding * opacity);\n\n gl_PointSize = 2.0;\n\n float odd = mod(float(gl_VertexID), 2.0);\n float index = (float(gl_VertexID)- odd ) / 2.0;\n float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );\n float radius_ = radius - (pad_range * odd);\n\n if ( is3D){ \n gl_Position = projection * view * vec4(\n circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);\n v_limp = vec2(0.0, 0.0);\n return;\n }\n vec2 limp;\n if ( compass == 1 ){\n limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);\n } else {\n // limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);\n limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);\n }\n v_limp = limp;\n gl_Position = mercatorXYToGLPosition(limp);\n}";
52
+ var fragmentShader = "#version 300 es\nprecision highp float; " +
53
+ util_1.shaderfunctions.POLE + "\nin vec4 v_color;\nin vec2 v_limp;\nout vec4 outColor;\nvoid main() {\n if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }\n outColor = v_color;\n}";
54
+ var Logic = /** @class */ (function () {
55
+ function Logic(globe) {
110
56
  this.globe = globe;
111
57
  this.gl = globe.gl;
112
58
  this.program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
@@ -118,7 +64,7 @@ class Logic {
118
64
  this.gl.bindAttribLocation(this.program, 4, "flag");
119
65
  }
120
66
  this.cameraBlockBindingPoint = 0;
121
- const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
67
+ var cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
122
68
  this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
123
69
  this.cameraBlockTotem = programcache_1.globeProgramCache.getProgram(globe, camerauniformblock_1.default);
124
70
  this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
@@ -128,7 +74,7 @@ class Logic {
128
74
  this._opacity = 1.0;
129
75
  this._padCount = 360;
130
76
  {
131
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
77
+ var currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
132
78
  this.gl.useProgram(this.program);
133
79
  this.gl.uniform1i(this._compassLocation, 1);
134
80
  this.gl.uniform1f(this._opacityLocation, 1.0);
@@ -136,8 +82,8 @@ class Logic {
136
82
  this.gl.useProgram(currentProgram);
137
83
  }
138
84
  }
139
- draw(attrBufferManager, padCount, compass, opacity) {
140
- const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
85
+ Logic.prototype.draw = function (attrBufferManager, padCount, compass, opacity) {
86
+ var _a = this, gl = _a.gl, program = _a.program, _padCountLocation = _a._padCountLocation, cameraBlockBindingPoint = _a.cameraBlockBindingPoint, cameraBlockTotem = _a.cameraBlockTotem, _compassLocation = _a._compassLocation;
141
87
  gl.useProgram(program);
142
88
  attrBufferManager.bindPaddingVAO();
143
89
  cameraBlockTotem.bind(cameraBlockBindingPoint);
@@ -160,13 +106,14 @@ class Logic {
160
106
  gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
161
107
  gl.bindVertexArray(null);
162
108
  cameraBlockTotem.unbind(cameraBlockBindingPoint);
163
- }
164
- free() {
109
+ };
110
+ Logic.prototype.free = function () {
165
111
  this.gl.deleteProgram(this.program);
166
112
  programcache_1.globeProgramCache.releaseProgram(this.globe, camerauniformblock_1.default);
167
- }
168
- }
113
+ };
114
+ return Logic;
115
+ }());
169
116
  exports.PaddingProgramCache = Object.freeze({
170
- getProgram: (globe) => { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
171
- releaseProgram: (globe) => { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
117
+ getProgram: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
118
+ releaseProgram: function (globe) { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
172
119
  });