@pirireis/webglobeplugins 0.9.11 → 0.9.13

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 (179) hide show
  1. package/Math/angle-calculation.js +9 -11
  2. package/Math/arc.js +38 -41
  3. package/Math/bounds/line-bbox.js +79 -83
  4. package/Math/constants.js +4 -9
  5. package/Math/frustum/types.js +1 -2
  6. package/Math/juction/arc-plane.js +33 -36
  7. package/Math/juction/line-sphere.js +15 -18
  8. package/Math/juction/plane-plane.js +20 -23
  9. package/Math/line.js +42 -47
  10. package/Math/methods.js +69 -92
  11. package/Math/plane.js +33 -38
  12. package/Math/quaternion.js +48 -55
  13. package/Math/types.js +1 -2
  14. package/Math/utils.js +2 -4
  15. package/Math/vec3.js +46 -52
  16. package/algorithms/search-binary.js +5 -8
  17. package/altitude-locator/draw-subset-obj.js +8 -11
  18. package/altitude-locator/plugin.js +114 -133
  19. package/altitude-locator/types.js +1 -3
  20. package/arrowfield/adaptor.js +3 -7
  21. package/arrowfield/index.js +3 -10
  22. package/arrowfield/plugin.js +63 -69
  23. package/bearing-line/index.js +2 -8
  24. package/bearing-line/plugin.js +218 -248
  25. package/circle-line-chain/chain-list-map.js +82 -92
  26. package/circle-line-chain/plugin.js +147 -182
  27. package/circle-line-chain/util.js +1 -5
  28. package/compass-rose/compass-rose-padding-flat.js +111 -140
  29. package/compass-rose/compass-text-writer.js +63 -75
  30. package/compass-rose/index.js +3 -7
  31. package/compassrose/compassrose.js +50 -57
  32. package/compassrose/index.js +2 -8
  33. package/heatwave/index.js +3 -10
  34. package/heatwave/isobar/objectarraylabels.js +50 -56
  35. package/heatwave/isobar/plugin.js +111 -170
  36. package/heatwave/isobar/quadtreecontours.js +78 -96
  37. package/heatwave/plugins/heatwaveglobeshell.js +73 -94
  38. package/index.js +12 -58
  39. package/package.json +1 -1
  40. package/partialrings/buffer-manager.js +32 -70
  41. package/partialrings/index.js +2 -41
  42. package/partialrings/plugin.js +55 -98
  43. package/partialrings/program.js +141 -59
  44. package/pin/pin-object-array.js +89 -97
  45. package/pin/pin-point-totem.js +21 -22
  46. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
  47. package/point-heat-map/plugin-webworker.js +45 -53
  48. package/point-heat-map/point-to-heat-map-flow.js +46 -51
  49. package/point-tracks/key-methods.js +2 -5
  50. package/point-tracks/plugin.js +141 -170
  51. package/programs/arrowfield/index.js +2 -7
  52. package/programs/arrowfield/logic.js +172 -67
  53. package/programs/arrowfield/object.js +35 -43
  54. package/programs/data2legend/density-to-legend.js +47 -26
  55. package/programs/data2legend/point-to-density-texture.js +56 -34
  56. package/programs/float2legendwithratio/index.js +2 -8
  57. package/programs/float2legendwithratio/logic.js +88 -45
  58. package/programs/float2legendwithratio/object.js +45 -54
  59. package/programs/globe-util/is-globe-moved.js +10 -13
  60. package/programs/globeshell/index.js +2 -8
  61. package/programs/globeshell/wiggle/index.js +2 -8
  62. package/programs/globeshell/wiggle/logic.js +191 -101
  63. package/programs/globeshell/wiggle/object.js +35 -43
  64. package/programs/helpers/blender/program.js +36 -22
  65. package/programs/helpers/fadeaway/index.js +2 -7
  66. package/programs/helpers/fadeaway/logic.js +36 -17
  67. package/programs/helpers/fadeaway/object.js +11 -18
  68. package/programs/helpers/index.js +2 -8
  69. package/programs/index.js +9 -58
  70. package/programs/line-on-globe/angled-line.js +95 -39
  71. package/programs/line-on-globe/circle-accurate-3d.js +86 -39
  72. package/programs/line-on-globe/circle-accurate-flat.js +116 -64
  73. package/programs/line-on-globe/circle-accurate.js +113 -46
  74. package/programs/line-on-globe/circle.js +106 -44
  75. package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
  76. package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
  77. package/programs/line-on-globe/linestrip.js +126 -63
  78. package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
  79. package/programs/line-on-globe/to-the-surface.js +62 -35
  80. package/programs/line-on-globe/util.js +2 -5
  81. package/programs/picking/pickable-renderer.js +127 -46
  82. package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
  83. package/programs/point-on-globe/element-point-glow.js +112 -47
  84. package/programs/point-on-globe/square-pixel-point.js +80 -34
  85. package/programs/programcache.js +14 -19
  86. package/programs/rings/distancering/circleflatprogram.js +76 -70
  87. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
  88. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
  89. package/programs/rings/distancering/index.js +5 -14
  90. package/programs/rings/distancering/paddyflatprogram.js +87 -70
  91. package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
  92. package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
  93. package/programs/rings/index.js +1 -17
  94. package/programs/rings/partial-ring/piece-of-pie.js +144 -44
  95. package/programs/totems/camerauniformblock.js +65 -56
  96. package/programs/totems/canvas-webglobe-info.js +49 -45
  97. package/programs/totems/gpu-selection-uniform-block.js +45 -45
  98. package/programs/totems/index.js +2 -40
  99. package/programs/two-d/pixel-padding-for-compass.js +94 -36
  100. package/programs/util.js +7 -10
  101. package/programs/vectorfields/index.js +3 -23
  102. package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
  103. package/programs/vectorfields/logics/index.js +4 -12
  104. package/programs/vectorfields/logics/pixelbased.js +94 -41
  105. package/programs/vectorfields/logics/ubo.js +32 -32
  106. package/programs/vectorfields/pingpongbuffermanager.js +30 -37
  107. package/rangerings/enum.js +2 -5
  108. package/rangerings/index.js +5 -15
  109. package/rangerings/plugin.js +223 -286
  110. package/rangerings/rangeringangletext.js +122 -137
  111. package/rangerings/ring-account.js +53 -75
  112. package/shaders/fragment-toy/firework.js +55 -4
  113. package/shaders/fragment-toy/singularity.js +56 -5
  114. package/timetracks/adaptors-line-strip.js +27 -44
  115. package/timetracks/adaptors.js +48 -67
  116. package/timetracks/index.js +5 -19
  117. package/timetracks/plugin-line-strip.js +65 -79
  118. package/timetracks/plugin.js +71 -85
  119. package/timetracks/program-line-strip.js +297 -107
  120. package/timetracks/program.js +421 -118
  121. package/timetracks/programpoint-line-strip.js +98 -48
  122. package/timetracks/programpoint.js +91 -48
  123. package/util/account/bufferoffsetmanager.js +72 -98
  124. package/util/account/index.js +3 -23
  125. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
  126. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
  127. package/util/account/single-attribute-buffer-management/index.js +4 -9
  128. package/util/account/single-attribute-buffer-management/object-store.js +29 -34
  129. package/util/account/single-attribute-buffer-management/types.js +1 -2
  130. package/util/account/util.js +2 -8
  131. package/util/algorithms/search-binary.js +5 -8
  132. package/util/check/get.js +5 -9
  133. package/util/check/typecheck.js +13 -24
  134. package/util/geometry/index.js +10 -18
  135. package/util/gl-util/buffer/attribute-loader.js +10 -26
  136. package/util/gl-util/buffer/index.js +2 -5
  137. package/util/gl-util/draw-options/methods.js +10 -15
  138. package/util/gl-util/uniform-block/manager.js +69 -72
  139. package/util/heatwavedatamanager/datamanager.js +56 -119
  140. package/util/heatwavedatamanager/index.js +3 -10
  141. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
  142. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
  143. package/util/index.js +13 -57
  144. package/util/interpolation/timetrack/index.js +2 -5
  145. package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
  146. package/util/interpolation/timetrack/web-worker-str.js +180 -5
  147. package/util/interpolation/timetrack/web-worker.js +4 -6
  148. package/util/jshelpers/data-filler.js +8 -11
  149. package/util/jshelpers/equality.js +1 -3
  150. package/util/jshelpers/index.js +2 -37
  151. package/util/jshelpers/timefilters.js +8 -10
  152. package/util/picking/fence.js +8 -11
  153. package/util/picking/picker-displayer.js +49 -58
  154. package/util/programs/draw-texture-on-canvas.js +41 -26
  155. package/util/programs/index.js +1 -17
  156. package/util/programs/shapesonglobe.js +104 -68
  157. package/util/programs/supersampletotextures.js +45 -43
  158. package/util/programs/texturetoglobe.js +99 -52
  159. package/util/shaderfunctions/geometrytransformations.js +323 -35
  160. package/util/shaderfunctions/index.js +2 -18
  161. package/util/shaderfunctions/nodata.js +8 -5
  162. package/util/shaderfunctions/noisefunctions.js +40 -12
  163. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  164. package/util/webglobe/gldefaultstates.js +1 -4
  165. package/util/webglobe/index.js +2 -18
  166. package/util/webglobe/rasteroverlay.js +36 -41
  167. package/util/webglobjectbuilders.js +70 -93
  168. package/util/webglobjectbuilders1.js +63 -82
  169. package/waveparticles/adaptor.js +7 -10
  170. package/waveparticles/index.js +3 -10
  171. package/waveparticles/plugin.js +82 -90
  172. package/wind/imagetovectorfieldandmagnitude.js +16 -19
  173. package/wind/index.js +5 -14
  174. package/wind/plugin.js +454 -291
  175. package/wind/vectorfieldimage.js +6 -8
  176. package/write-text/attached-text-writer.js +48 -54
  177. package/write-text/context-text.js +52 -63
  178. package/write-text/context-text3.js +71 -80
  179. package/write-text/index.js +1 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -1,113 +1,75 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var bufferoffsetmanager_1 = __importDefault(require("../util/account/bufferoffsetmanager"));
31
- var ITEM_SIZE = 10;
32
- var BufferManager = /** @class */ (function (_super) {
33
- __extends(BufferManager, _super);
34
- function BufferManager(globe, gl, buffer, _a) {
35
- var _b = _a === void 0 ? {} : _a, _c = _b.initialCapacity, initialCapacity = _c === void 0 ? 10 : _c, _d = _b.bufferType, bufferType = _d === void 0 ? "DYNAMIC_DRAW" : _d;
36
- var _this = _super.call(this, ITEM_SIZE, { capacity: initialCapacity }) || this;
37
- _this.globe = globe;
38
- _this.gl = gl;
39
- _this.buffer = buffer;
40
- _this.bufferType = bufferType;
1
+ import BufferOffsetManager from "../util/account/bufferoffsetmanager";
2
+ const ITEM_SIZE = 10;
3
+ export default class BufferManager extends BufferOffsetManager {
4
+ constructor(globe, gl, buffer, { initialCapacity = 10, bufferType = "DYNAMIC_DRAW" } = {}) {
5
+ super(ITEM_SIZE, { capacity: initialCapacity });
6
+ this.globe = globe;
7
+ this.gl = gl;
8
+ this.buffer = buffer;
9
+ this.bufferType = bufferType;
41
10
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
42
11
  gl.bufferData(gl.ARRAY_BUFFER, initialCapacity * ITEM_SIZE * 4, gl[bufferType]);
43
12
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
44
- return _this;
45
13
  }
46
14
  /**
47
15
  *
48
16
  * @param { Array<{key, long, lat, startAngle, tailAngle, radius, rgba[4], rgbaMode }>} rings
49
17
  * @returns
50
18
  */
51
- BufferManager.prototype.insertBulk = function (items) {
19
+ insertBulk(items) {
52
20
  if (items.length === 0)
53
21
  return;
54
22
  this.autoExtendBuffer(items.length);
55
- var _a = this, gl = _a.gl, buffer = _a.buffer;
23
+ const { gl, buffer } = this;
56
24
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
57
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
58
- var _b = items_1[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle, rgba = _b.rgba, radius = _b.radius, rgbaMode = _b.rgbaMode;
59
- var offset = this.getOffset(key) | this.nextOffset();
25
+ for (let { key, long, lat, startAngle, tailAngle, rgba, radius, rgbaMode } of items) {
26
+ const offset = this.getOffset(key) | this.nextOffset();
60
27
  this.setOffset(key, offset);
61
- var block = new Float32Array(__spreadArray(__spreadArray([
62
- long, lat, startAngle, tailAngle
63
- ], rgba, true), [
64
- radius, rgbaMode
65
- ], false));
28
+ const block = new Float32Array([
29
+ long, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
30
+ ]);
66
31
  gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
67
32
  // 2 1 1 1 4 1 = 10
68
33
  }
69
34
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
70
35
  this.globe.DrawRender();
71
- };
36
+ }
72
37
  /**
73
38
  * @param {Array<{key, long, lat, startAngle, tailAngle}>} items
74
39
  *
75
40
  * */
76
- BufferManager.prototype.updateCenterAndAngleBulk = function (items) {
77
- var _a = this, gl = _a.gl, buffer = _a.buffer;
41
+ updateCenterAndAngleBulk(items) {
42
+ const { gl, buffer } = this;
78
43
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
79
- for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
80
- var _b = items_2[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle;
81
- var offset = this.getOffset(key);
44
+ for (let { key, long, lat, startAngle, tailAngle } of items) {
45
+ const offset = this.getOffset(key);
82
46
  if (offset === null) {
83
- console.warn("key ".concat(key, " not found"));
47
+ console.warn(`key ${key} not found`);
84
48
  continue;
85
49
  }
86
- var block = new Float32Array([long, lat, startAngle, tailAngle]);
50
+ const block = new Float32Array([long, lat, startAngle, tailAngle]);
87
51
  gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
88
52
  }
89
53
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
90
54
  this.globe.DrawRender();
91
- };
55
+ }
92
56
  /**
93
57
  *
94
58
  * @param {Array<{key:string, payload:Float32Array}} items
95
59
  * @param {PART_OFFSET_LOOPUP} part | long, lat, START_ANGLE, ROTATION_ANGLE, RADIUS, rgba, rgba_MODE
96
60
  * @returns
97
61
  */
98
- BufferManager.prototype.updatePartial = function (items, part) {
99
- var _a = this, gl = _a.gl, buffer = _a.buffer;
62
+ updatePartial(items, part) {
63
+ const { gl, buffer } = this;
100
64
  this._updatePartial(items, part, gl, buffer);
101
65
  this.globe.DrawRender();
102
- };
103
- BufferManager.prototype.deleteBulk = function (keys) {
66
+ }
67
+ deleteBulk(keys) {
104
68
  this._deleteBulk(keys);
105
69
  this.globe.DrawRender();
106
- };
107
- BufferManager.prototype.free = function () {
70
+ }
71
+ free() {
108
72
  this.gl.deleteBuffer(this.buffer);
109
73
  this.buffer = null;
110
- };
111
- return BufferManager;
112
- }(bufferoffsetmanager_1.default));
113
- exports.default = BufferManager;
74
+ }
75
+ }
@@ -1,41 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.PART_OFFSET_LOOPUP = exports.RINGPARTIAL_DRAW_MODE = exports.RINGPARTIAL_ALPHA_MODE = exports.PartialRing = void 0;
37
- var plugin_1 = __importStar(require("./plugin"));
38
- exports.PartialRing = plugin_1.default;
39
- Object.defineProperty(exports, "RINGPARTIAL_ALPHA_MODE", { enumerable: true, get: function () { return plugin_1.RINGPARTIAL_ALPHA_MODE; } });
40
- Object.defineProperty(exports, "RINGPARTIAL_DRAW_MODE", { enumerable: true, get: function () { return plugin_1.RINGPARTIAL_DRAW_MODE; } });
41
- Object.defineProperty(exports, "PART_OFFSET_LOOPUP", { enumerable: true, get: function () { return plugin_1.PART_OFFSET_LOOPUP; } });
1
+ import PartialRing, { RINGPARTIAL_ALPHA_MODE, RINGPARTIAL_DRAW_MODE, PART_OFFSET_LOOPUP } from './plugin';
2
+ export { PartialRing, RINGPARTIAL_ALPHA_MODE, RINGPARTIAL_DRAW_MODE, PART_OFFSET_LOOPUP };
@@ -1,47 +1,17 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
- if (ar || !(i in from)) {
20
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
- ar[i] = from[i];
22
- }
23
- }
24
- return to.concat(ar || Array.prototype.slice.call(from));
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.PART_OFFSET_LOOPUP = exports.RINGPARTIAL_ALPHA_MODE = exports.RINGPARTIAL_DRAW_MODE = void 0;
31
- var bufferoffsetmanager_1 = __importDefault(require("../util/account/bufferoffsetmanager"));
32
- var program_1 = require("./program");
33
- var typecheck_1 = require("../util/check/typecheck");
34
- var emptyBlock = new Float32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
35
- exports.RINGPARTIAL_DRAW_MODE = Object.freeze({
1
+ import BufferOffsetManager from '../util/account/bufferoffsetmanager';
2
+ import { programCache, ITEM_SIZE } from './program';
3
+ import { opacityCheck } from '../util/check/typecheck';
4
+ const emptyBlock = new Float32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
5
+ export const RINGPARTIAL_DRAW_MODE = Object.freeze({
36
6
  LINE_STRIP: "LINE_STRIP",
37
7
  TRIANGLE_FAN: "TRIANGLE_FAN",
38
8
  });
39
- exports.RINGPARTIAL_ALPHA_MODE = Object.freeze({
9
+ export const RINGPARTIAL_ALPHA_MODE = Object.freeze({
40
10
  CONSTANT: 0,
41
11
  FADING: 1,
42
12
  HIDE: 2,
43
13
  });
44
- exports.PART_OFFSET_LOOPUP = Object.freeze({
14
+ export const PART_OFFSET_LOOPUP = Object.freeze({
45
15
  LONG: 0,
46
16
  LAT: 1,
47
17
  START_ANGLE: 2,
@@ -50,9 +20,8 @@ exports.PART_OFFSET_LOOPUP = Object.freeze({
50
20
  RADIUS: 8,
51
21
  RGBA_MODE: 9,
52
22
  });
53
- var default_1 = /** @class */ (function () {
54
- function default_1(id, _a) {
55
- var _b = _a === void 0 ? {} : _a, _c = _b.edgeCount, edgeCount = _c === void 0 ? 10 : _c, _d = _b.drawMode, drawMode = _d === void 0 ? exports.RINGPARTIAL_DRAW_MODE.LINE_STRIP : _d, _e = _b.startLod, startLod = _e === void 0 ? 3 : _e, _f = _b.endLod, endLod = _f === void 0 ? 13 : _f, _g = _b.alphaMultiplier, alphaMultiplier = _g === void 0 ? 1 : _g;
23
+ export default class {
24
+ constructor(id, { edgeCount = 10, drawMode = RINGPARTIAL_DRAW_MODE.LINE_STRIP, startLod = 3, endLod = 13, alphaMultiplier = 1 } = {}) {
56
25
  this.id = id;
57
26
  this.edgeCount = edgeCount;
58
27
  this.drawMode = drawMode;
@@ -60,112 +29,100 @@ var default_1 = /** @class */ (function () {
60
29
  this.endLod = endLod;
61
30
  this.alphaMultiplier = alphaMultiplier;
62
31
  }
63
- default_1.prototype.init = function (globe, gl) {
32
+ init(globe, gl) {
64
33
  this.gl = gl;
65
34
  this.globe = globe;
66
- this.program = program_1.programCache.get(globe);
67
- var _a = this.program.getVaoBuffer(), vao = _a.vao, buffer = _a.buffer;
35
+ this.program = programCache.get(globe);
36
+ const { vao, buffer } = this.program.getVaoBuffer();
68
37
  this.vao = vao;
69
38
  this.buffer = buffer;
70
- };
71
- default_1.prototype.draw3D = function () {
72
- var LOD = this.globe.api_GetCurrentLOD();
39
+ }
40
+ draw3D() {
41
+ const LOD = this.globe.api_GetCurrentLOD();
73
42
  if (LOD < this.startLod || LOD > this.endLod)
74
43
  return;
75
44
  this.program.draw(this.bufferManager.length, this.vao, this.edgeCount, this.alphaMultiplier, this.drawMode);
76
- };
45
+ }
77
46
  /**
78
47
  *
79
48
  * @param {RINGPARTIAL_DRAW_MODE} drawMode
80
49
  */
81
- default_1.prototype.setDrawMode = function (drawMode) {
50
+ setDrawMode(drawMode) {
82
51
  this.drawMode = drawMode;
83
- };
84
- default_1.prototype.setOpacity = function (opacity) {
85
- (0, typecheck_1.opacityCheck)(opacity);
52
+ }
53
+ setOpacity(opacity) {
54
+ opacityCheck(opacity);
86
55
  this.alphaMultiplier = opacity;
87
- };
88
- default_1.prototype.setStartEndLOD = function (_a) {
89
- var _b = _a === void 0 ? {} : _a, _c = _b.startLod, startLod = _c === void 0 ? null : _c, _d = _b.endLod, endLod = _d === void 0 ? null : _d;
56
+ }
57
+ setStartEndLOD({ startLod = null, endLod = null } = {}) {
90
58
  if (startLod !== null)
91
59
  this.startLod = startLod;
92
60
  if (endLod !== null)
93
61
  this.endLod = endLod;
94
- };
95
- default_1.prototype.createBufferMAnager = function (initialCapacity, bufferType) {
96
- if (initialCapacity === void 0) { initialCapacity = 10; }
97
- if (bufferType === void 0) { bufferType = 'DYNAMIC_DRAW'; }
62
+ }
63
+ createBufferMAnager(initialCapacity = 10, bufferType = 'DYNAMIC_DRAW') {
98
64
  if (!this.bufferManager) {
99
- this.bufferManager = new BufferManager(this.globe, this.gl, this.buffer, { initialCapacity: initialCapacity, bufferType: bufferType, });
65
+ this.bufferManager = new BufferManager(this.globe, this.gl, this.buffer, { initialCapacity, bufferType, });
100
66
  }
101
67
  return this.bufferManager;
102
- };
103
- default_1.prototype.free = function () {
104
- program_1.programCache.free(this.globe);
68
+ }
69
+ free() {
70
+ programCache.free(this.globe);
105
71
  this.bufferManager.free();
106
- };
107
- return default_1;
108
- }());
109
- exports.default = default_1;
110
- var BufferManager = /** @class */ (function (_super) {
111
- __extends(BufferManager, _super);
112
- function BufferManager(globe, gl, buffer, _a) {
113
- var _b = _a === void 0 ? {} : _a, _c = _b.initialCapacity, initialCapacity = _c === void 0 ? 10 : _c, bufferType = _b.bufferType;
114
- var _this = _super.call(this, 10, { capacity: initialCapacity, bufferType: bufferType, }) || this;
115
- _this.globe = globe;
116
- _this.gl = gl;
117
- _this.buffer = buffer;
118
- _this.bufferType = bufferType;
72
+ }
73
+ }
74
+ class BufferManager extends BufferOffsetManager {
75
+ constructor(globe, gl, buffer, { initialCapacity = 10, bufferType, } = {}) {
76
+ super(10, { capacity: initialCapacity, bufferType, });
77
+ this.globe = globe;
78
+ this.gl = gl;
79
+ this.buffer = buffer;
80
+ this.bufferType = bufferType;
119
81
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
120
- gl.bufferData(gl.ARRAY_BUFFER, initialCapacity * program_1.ITEM_SIZE * 4, gl[bufferType]);
82
+ gl.bufferData(gl.ARRAY_BUFFER, initialCapacity * ITEM_SIZE * 4, gl[bufferType]);
121
83
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
122
- return _this;
123
84
  }
124
85
  /**
125
86
  *
126
87
  * @param { Array<{key, long, lat, startAngle, tailAngle, radius, rgba[4], rgbaMode }>} rings
127
88
  * @returns
128
89
  */
129
- BufferManager.prototype.insertBulk = function (items) {
90
+ insertBulk(items) {
130
91
  if (items.length === 0)
131
92
  return;
132
93
  this.autoExtendBuffer(items.length);
133
- var _a = this, gl = _a.gl, buffer = _a.buffer;
94
+ const { gl, buffer } = this;
134
95
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
135
- for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
136
- var _b = items_1[_i], key = _b.key, long = _b.long, lat = _b.lat, startAngle = _b.startAngle, tailAngle = _b.tailAngle, rgba = _b.rgba, radius = _b.radius, rgbaMode = _b.rgbaMode;
137
- var offset = this.getOffset(key) | this.nextOffset();
96
+ for (let { key, long, lat, startAngle, tailAngle, rgba, radius, rgbaMode } of items) {
97
+ const offset = this.getOffset(key) | this.nextOffset();
138
98
  this.setOffset(key, offset);
139
- var block = new Float32Array(__spreadArray(__spreadArray([
140
- long, lat, startAngle, tailAngle
141
- ], rgba, true), [
142
- radius, rgbaMode
143
- ], false));
99
+ const block = new Float32Array([
100
+ long, lat, startAngle, tailAngle, ...rgba, radius, rgbaMode
101
+ ]);
144
102
  gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
145
103
  // 2 1 1 1 4 1 = 10
146
104
  }
147
105
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
148
106
  this.globe.DrawRender();
149
- };
107
+ }
150
108
  /**
151
109
  *
152
110
  * @param {Array<{key:string, payload:Float32Array}} items
153
111
  * @param {PART_OFFSET_LOOPUP} part | long, lat, START_ANGLE, ROTATION_ANGLE, RADIUS, rgba, rgba_MODE
154
112
  * @returns
155
113
  */
156
- BufferManager.prototype.updatePartial = function (items, part) {
157
- var _a = this, gl = _a.gl, buffer = _a.buffer;
114
+ updatePartial(items, part) {
115
+ const { gl, buffer } = this;
158
116
  this._updatePartial(items, part, gl, buffer);
159
117
  this.globe.DrawRender();
160
- };
161
- BufferManager.prototype.delete = function (keys) {
162
- var _a = this, gl = _a.gl, buffer = _a.buffer;
118
+ }
119
+ delete(keys) {
120
+ const { gl, buffer } = this;
163
121
  this._removefromBuffer(gl, buffer, keys, emptyBlock);
164
122
  this.globe.DrawRender();
165
- };
166
- BufferManager.prototype.free = function () {
123
+ }
124
+ free() {
167
125
  this.gl.deleteBuffer(this.buffer);
168
126
  this.buffer = null;
169
- };
170
- return BufferManager;
171
- }(bufferoffsetmanager_1.default));
127
+ }
128
+ }