@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
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const programs_1 = require("../programs");
4
- const util_1 = require("../util");
5
- const programs_2 = require("../programs");
6
- const programs_3 = require("../programs");
7
- const { PixelBasedMove, DrawRectangleParticles, PingPongBufferManager, WaveParticalUboManager } = programs_2.vectorfield;
8
- const MoveParticle = PixelBasedMove;
9
- const DrawParticle = DrawRectangleParticles;
3
+ var programs_1 = require("../programs");
4
+ var util_1 = require("../util");
5
+ var programs_2 = require("../programs");
6
+ var programs_3 = require("../programs");
7
+ var PixelBasedMove = programs_2.vectorfield.PixelBasedMove, DrawRectangleParticles = programs_2.vectorfield.DrawRectangleParticles, PingPongBufferManager = programs_2.vectorfield.PingPongBufferManager, WaveParticalUboManager = programs_2.vectorfield.WaveParticalUboManager;
8
+ var MoveParticle = PixelBasedMove;
9
+ var DrawParticle = DrawRectangleParticles;
10
10
  /**
11
11
  * STEPS:
12
12
  * 1. move particle | buffers: read b1 write b2 | swap buffers b1 <-> b2
@@ -15,9 +15,10 @@ const DrawParticle = DrawRectangleParticles;
15
15
  * 4. fade drawTexture1 to drawTexture2 | swap textures
16
16
  *
17
17
  */
18
- const MAX_PIXELS_ON_DIMENSION = 2200;
19
- class Plugin {
20
- constructor(id, { dataWidth, dataHeight, fadeOpacity = 0.83, opacity = 0.75, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, patricleCount = 8000, flipY = true, drawTextureMaxPixelOnDimension = MAX_PIXELS_ON_DIMENSION } = {}) {
18
+ var MAX_PIXELS_ON_DIMENSION = 2200;
19
+ var Plugin = /** @class */ (function () {
20
+ function Plugin(id, _a) {
21
+ var _b = _a === void 0 ? {} : _a, dataWidth = _b.dataWidth, dataHeight = _b.dataHeight, _c = _b.fadeOpacity, fadeOpacity = _c === void 0 ? 0.83 : _c, _d = _b.opacity, opacity = _d === void 0 ? 0.75 : _d, _e = _b.minLon, minLon = _e === void 0 ? -180 : _e, _f = _b.minLat, minLat = _f === void 0 ? -90 : _f, _g = _b.maxLon, maxLon = _g === void 0 ? 180 : _g, _h = _b.maxLat, maxLat = _h === void 0 ? 90 : _h, _j = _b.patricleCount, patricleCount = _j === void 0 ? 8000 : _j, _k = _b.flipY, flipY = _k === void 0 ? true : _k, _l = _b.drawTextureMaxPixelOnDimension, drawTextureMaxPixelOnDimension = _l === void 0 ? MAX_PIXELS_ON_DIMENSION : _l;
21
22
  this.id = id;
22
23
  this.globe = null;
23
24
  this.gl = null;
@@ -37,23 +38,23 @@ class Plugin {
37
38
  this._dataHeight = dataHeight;
38
39
  this._drawTextureMaxPixelOnDimension = drawTextureMaxPixelOnDimension;
39
40
  this._globeshellparameters = {
40
- minLon,
41
- maxLon,
42
- minLat,
43
- maxLat,
41
+ minLon: minLon,
42
+ maxLon: maxLon,
43
+ minLat: minLat,
44
+ maxLat: maxLat,
44
45
  };
45
46
  this._stepIndex = 0;
46
47
  this._fullCycleStepCount = 3;
47
48
  this._isFreed = false;
48
49
  }
49
- init(globe, gl) {
50
+ Plugin.prototype.init = function (globe, gl) {
50
51
  this.globe = globe;
51
52
  this.gl = gl;
52
53
  this.moveParticle = new MoveParticle(gl);
53
54
  this.drawParticle = new DrawParticle(gl);
54
55
  this.fadeAway = new programs_3.FadeAway(gl);
55
56
  this.globeShellWiggle = new programs_1.GlobeShellWiggle(gl, globe, this._globeshellparameters);
56
- const inPositionLocation = this.moveParticle.getInPositionLocation();
57
+ var inPositionLocation = this.moveParticle.getInPositionLocation();
57
58
  this.bufferManager = new PingPongBufferManager(gl, this._particleCount, inPositionLocation);
58
59
  this._rgVectorFieldTexture = this._createRGTexture();
59
60
  this.waveUbo = new WaveParticalUboManager(gl, 0);
@@ -62,10 +63,10 @@ class Plugin {
62
63
  this.setBBox(this._globeshellparameters);
63
64
  this.setOpacity(this._opacity);
64
65
  this.____drawIndex = 0;
65
- }
66
- _createDrawTexture() {
67
- const gl = this.gl;
68
- const texture = gl.createTexture();
66
+ };
67
+ Plugin.prototype._createDrawTexture = function () {
68
+ var gl = this.gl;
69
+ var texture = gl.createTexture();
69
70
  gl.bindTexture(gl.TEXTURE_2D, texture);
70
71
  // gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2200, 2200, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
71
72
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this._drawTextureResolution.width, this._drawTextureResolution.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
@@ -75,14 +76,14 @@ class Plugin {
75
76
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
76
77
  gl.bindTexture(gl.TEXTURE_2D, null);
77
78
  return texture;
78
- }
79
- _step() {
79
+ };
80
+ Plugin.prototype._step = function () {
80
81
  this._stepIndex = (this._stepIndex + 1) % this._fullCycleStepCount;
81
- }
82
- draw3D() {
82
+ };
83
+ Plugin.prototype.draw3D = function () {
83
84
  if (this._isFreed)
84
85
  return;
85
- const { gl, moveParticle, drawParticle, bufferManager, globeShellWiggle, waveUbo, fadeAway, _rgVectorFieldTexture } = this;
86
+ var _a = this, gl = _a.gl, moveParticle = _a.moveParticle, drawParticle = _a.drawParticle, bufferManager = _a.bufferManager, globeShellWiggle = _a.globeShellWiggle, waveUbo = _a.waveUbo, fadeAway = _a.fadeAway, _rgVectorFieldTexture = _a._rgVectorFieldTexture;
86
87
  gl.disable(gl.DEPTH_TEST);
87
88
  if (this._stepIndex === 0) {
88
89
  waveUbo.update({ random_seed: Math.random() });
@@ -92,8 +93,8 @@ class Plugin {
92
93
  }
93
94
  else if (this._stepIndex === 1) {
94
95
  this.____drawIndex = 1 - this.____drawIndex;
95
- const canvasWidth = gl.canvas.width;
96
- const canvasHeight = gl.canvas.height;
96
+ var canvasWidth = gl.canvas.width;
97
+ var canvasHeight = gl.canvas.height;
97
98
  // gl.viewport(0, 0, 2200, 2200);
98
99
  gl.viewport(0, 0, this._drawTextureResolution.width, this._drawTextureResolution.height);
99
100
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
@@ -104,8 +105,8 @@ class Plugin {
104
105
  gl.viewport(0, 0, canvasWidth, canvasHeight);
105
106
  }
106
107
  else {
107
- const canvasWidth = gl.canvas.width;
108
- const canvasHeight = gl.canvas.height;
108
+ var canvasWidth = gl.canvas.width;
109
+ var canvasHeight = gl.canvas.height;
109
110
  // gl.viewport(0, 0, 2200, 2200);
110
111
  gl.viewport(0, 0, this._drawTextureResolution.width, this._drawTextureResolution.height);
111
112
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
@@ -122,16 +123,16 @@ class Plugin {
122
123
  globeShellWiggle.draw();
123
124
  this._step();
124
125
  gl.enable(gl.DEPTH_TEST);
125
- }
126
- setCycleStepCount(value) {
126
+ };
127
+ Plugin.prototype.setCycleStepCount = function (value) {
127
128
  if (value < 3) {
128
129
  this._fullCycleStepCount = 3;
129
130
  }
130
131
  this._fullCycleStepCount = value;
131
- }
132
- _createRGTexture() {
133
- const { gl, _dataWidth, _dataHeight, } = this;
134
- const texture = gl.createTexture();
132
+ };
133
+ Plugin.prototype._createRGTexture = function () {
134
+ var _a = this, gl = _a.gl, _dataWidth = _a._dataWidth, _dataHeight = _a._dataHeight;
135
+ var texture = gl.createTexture();
135
136
  // R32F
136
137
  gl.bindTexture(gl.TEXTURE_2D, texture);
137
138
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, null);
@@ -141,10 +142,10 @@ class Plugin {
141
142
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
142
143
  gl.bindTexture(gl.TEXTURE_2D, null);
143
144
  return texture;
144
- }
145
+ };
145
146
  // TODO: free all resources
146
- free() {
147
- const { gl, fadeAway, globeShellWiggle, _rgVectorFieldTexture, bufferManager, waveUbo, _drawTextures, _frameBuffer } = this;
147
+ Plugin.prototype.free = function () {
148
+ var _a = this, gl = _a.gl, fadeAway = _a.fadeAway, globeShellWiggle = _a.globeShellWiggle, _rgVectorFieldTexture = _a._rgVectorFieldTexture, bufferManager = _a.bufferManager, waveUbo = _a.waveUbo, _drawTextures = _a._drawTextures, _frameBuffer = _a._frameBuffer;
148
149
  this._isFreed = true;
149
150
  fadeAway.free();
150
151
  globeShellWiggle.free();
@@ -157,15 +158,16 @@ class Plugin {
157
158
  this.drawParticle = null;
158
159
  bufferManager.free();
159
160
  waveUbo.free();
160
- _drawTextures.forEach(texture => gl.deleteTexture(texture));
161
+ _drawTextures.forEach(function (texture) { return gl.deleteTexture(texture); });
161
162
  gl.deleteFramebuffer(_frameBuffer);
162
- }
163
+ };
163
164
  // setters
164
- setParticleCount(value) {
165
+ Plugin.prototype.setParticleCount = function (value) {
165
166
  this._particleCount = value;
166
167
  this.bufferManager.setParticleCount(value);
167
- }
168
- setVectorFieldData(data, { dataWidth = null, dataHeight = null, flipY } = {}) {
168
+ };
169
+ Plugin.prototype.setVectorFieldData = function (data, _a) {
170
+ var _b = _a === void 0 ? {} : _a, _c = _b.dataWidth, dataWidth = _c === void 0 ? null : _c, _d = _b.dataHeight, dataHeight = _d === void 0 ? null : _d, flipY = _b.flipY;
169
171
  if (dataWidth !== null && dataHeight !== null) {
170
172
  this._dataWidth = dataWidth;
171
173
  this._dataHeight = dataHeight;
@@ -174,25 +176,25 @@ class Plugin {
174
176
  this._flipY = flipY;
175
177
  }
176
178
  this.__data = data;
177
- const { gl, _dataWidth, _dataHeight } = this;
179
+ var _e = this, gl = _e.gl, _dataWidth = _e._dataWidth, _dataHeight = _e._dataHeight;
178
180
  gl.bindTexture(gl.TEXTURE_2D, this._rgVectorFieldTexture);
179
181
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this._flipY);
180
182
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, data);
181
183
  gl.bindTexture(gl.TEXTURE_2D, null);
182
184
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
183
- }
184
- setHeight(value) {
185
+ };
186
+ Plugin.prototype.setHeight = function (value) {
185
187
  this.globeShellWiggle.setHeight(value);
186
- }
187
- setDropRate(value) {
188
+ };
189
+ Plugin.prototype.setDropRate = function (value) {
188
190
  this.waveUbo.update({ drop_rate: value });
189
- }
190
- __readAndWriteTextureData() {
191
- const { gl, _rgVectorFieldTexture, _dataWidth, _dataHeight } = this;
191
+ };
192
+ Plugin.prototype.__readAndWriteTextureData = function () {
193
+ var _a = this, gl = _a.gl, _rgVectorFieldTexture = _a._rgVectorFieldTexture, _dataWidth = _a._dataWidth, _dataHeight = _a._dataHeight;
192
194
  // Step 1: Bind the texture to a framebuffer
193
195
  // Step 2: Read the texture data into a Float32Array
194
196
  gl.bindTexture(gl.TEXTURE_2D, _rgVectorFieldTexture);
195
- const textureData = new Float32Array(_dataWidth * _dataHeight * 2); // RG32F has 2 components per pixel
197
+ var textureData = new Float32Array(_dataWidth * _dataHeight * 2); // RG32F has 2 components per pixel
196
198
  gl.readPixels(0, 0, _dataWidth, _dataHeight, gl.RG, gl.FLOAT, textureData);
197
199
  gl.bindTexture(gl.TEXTURE_2D, null);
198
200
  // Step 3: Create a new texture and write the data back
@@ -201,17 +203,18 @@ class Plugin {
201
203
  // Replace the old texture with the new one
202
204
  this._rgVectorFieldTexture = this._createRGTexture();
203
205
  this.setVectorFieldData(textureData);
204
- }
205
- _drawTextureSizeFromBbox({ minLon, minLat, maxLon, maxLat }) {
206
- let horizon;
206
+ };
207
+ Plugin.prototype._drawTextureSizeFromBbox = function (_a) {
208
+ var minLon = _a.minLon, minLat = _a.minLat, maxLon = _a.maxLon, maxLat = _a.maxLat;
209
+ var horizon;
207
210
  if (minLon > 0 && maxLon < 0) {
208
211
  horizon = 360 - minLon + maxLon;
209
212
  }
210
213
  else {
211
214
  horizon = maxLon - minLon;
212
215
  }
213
- const vertical = maxLat - minLat;
214
- let width, height;
216
+ var vertical = maxLat - minLat;
217
+ var width, height;
215
218
  if (horizon > vertical) {
216
219
  width = this._drawTextureMaxPixelOnDimension;
217
220
  height = Math.floor(this._drawTextureMaxPixelOnDimension * vertical / horizon);
@@ -221,46 +224,48 @@ class Plugin {
221
224
  width = Math.floor(this._drawTextureMaxPixelOnDimension * horizon / vertical);
222
225
  }
223
226
  return {
224
- width,
225
- height
227
+ width: width,
228
+ height: height
226
229
  };
227
- }
228
- setDrawTextureMaxPixelOnDimension(value) {
230
+ };
231
+ Plugin.prototype.setDrawTextureMaxPixelOnDimension = function (value) {
229
232
  this._drawTextureMaxPixelOnDimension = value;
230
233
  this._drawTextureResolution = this._drawTextureSizeFromBbox(this._globeshellparameters);
231
234
  this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
232
235
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
233
- }
234
- setParticleSpeed(value) {
236
+ };
237
+ Plugin.prototype.setParticleSpeed = function (value) {
235
238
  this.waveUbo.update({ range: value });
236
- }
237
- setFadeOpacity(value) {
239
+ };
240
+ Plugin.prototype.setFadeOpacity = function (value) {
238
241
  this._fadeOpacity = value;
239
- }
240
- setOpacity(value) {
242
+ };
243
+ Plugin.prototype.setOpacity = function (value) {
241
244
  this.globeShellWiggle.setOpacity(value);
242
- }
243
- setParticleDimensions(tail, wing) {
245
+ };
246
+ Plugin.prototype.setParticleDimensions = function (tail, wing) {
244
247
  if (0 < tail || 0 < wing) {
245
248
  this.waveUbo.update({ tail_wing_base_limp: [tail, wing] });
246
249
  }
247
250
  else {
248
251
  console.error("tail and wing must be greater than 0");
249
252
  }
250
- }
251
- setParticleColor(color) {
253
+ };
254
+ Plugin.prototype.setParticleColor = function (color) {
252
255
  if (color.length !== 3) {
253
256
  console.error("color must be an array of rgb elements");
254
257
  return;
255
258
  }
256
- this.waveUbo.update({ color });
257
- }
258
- setBBox({ minLon, minLat, maxLon, maxLat }) {
259
- this._globeshellparameters = { minLon, minLat, maxLon, maxLat };
260
- this.globeShellWiggle.setBBox({ minLon, minLat, maxLon, maxLat });
261
- this._drawTextureResolution = this._drawTextureSizeFromBbox({ minLon, minLat, maxLon, maxLat });
259
+ this.waveUbo.update({ color: color });
260
+ };
261
+ Plugin.prototype.setBBox = function (_a) {
262
+ var minLon = _a.minLon, minLat = _a.minLat, maxLon = _a.maxLon, maxLat = _a.maxLat;
263
+ this._globeshellparameters = { minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat };
264
+ this.globeShellWiggle.setBBox({ minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat });
265
+ this._drawTextureResolution = this._drawTextureSizeFromBbox({ minLon: minLon, minLat: minLat, maxLon: maxLon, maxLat: maxLat });
262
266
  this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
263
267
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
264
- }
265
- }
268
+ };
269
+ return Plugin;
270
+ }());
266
271
  exports.default = Plugin;
@@ -11,24 +11,24 @@ exports.default = imageToMagnitude;
11
11
  * @returns {Float32Array}
12
12
  */
13
13
  function imageToMagnitude(imageData) {
14
- const { image, uMax, vMax, uMin, vMin, height, width } = imageData;
15
- const canvas = document.createElement('canvas');
16
- const ctx = canvas.getContext('2d');
14
+ var image = imageData.image, uMax = imageData.uMax, vMax = imageData.vMax, uMin = imageData.uMin, vMin = imageData.vMin, height = imageData.height, width = imageData.width;
15
+ var canvas = document.createElement('canvas');
16
+ var ctx = canvas.getContext('2d');
17
17
  canvas.width = width;
18
18
  canvas.height = height;
19
19
  ctx.drawImage(image, 0, 0, width, height);
20
- const img = ctx.getImageData(0, 0, width, height);
21
- const data = img.data;
22
- const magnitudeArray = new Float32Array(height * width);
23
- const uDiff = uMax - uMin;
24
- const vDiff = vMax - vMin;
25
- for (let i = 0; i < data.length; i += 4) {
26
- const r = data[i];
27
- const g = data[i + 1];
28
- const u = uMin + (uDiff * r) / 255;
29
- const v = vMin + (vDiff * g) / 255;
30
- const magnitude = Math.sqrt(u * u + v * v);
31
- const index = i / 4;
20
+ var img = ctx.getImageData(0, 0, width, height);
21
+ var data = img.data;
22
+ var magnitudeArray = new Float32Array(height * width);
23
+ var uDiff = uMax - uMin;
24
+ var vDiff = vMax - vMin;
25
+ for (var i = 0; i < data.length; i += 4) {
26
+ var r = data[i];
27
+ var g = data[i + 1];
28
+ var u = uMin + (uDiff * r) / 255;
29
+ var v = vMin + (vDiff * g) / 255;
30
+ var magnitude = Math.sqrt(u * u + v * v);
31
+ var index = i / 4;
32
32
  magnitudeArray[index] = magnitude;
33
33
  }
34
34
  return magnitudeArray;
package/wind/index.js CHANGED
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createImageFromBase64 = exports.WindPlugin = exports.imageToMagnitude = exports.createVectorFieldImage = void 0;
7
- const plugin_1 = __importDefault(require("./plugin"));
7
+ var plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.WindPlugin = plugin_1.default;
9
- const vectorfieldimage_1 = __importDefault(require("./vectorfieldimage"));
9
+ var vectorfieldimage_1 = __importDefault(require("./vectorfieldimage"));
10
10
  exports.createVectorFieldImage = vectorfieldimage_1.default;
11
- const imagetovectorfieldandmagnitude_1 = __importDefault(require("./imagetovectorfieldandmagnitude"));
11
+ var imagetovectorfieldandmagnitude_1 = __importDefault(require("./imagetovectorfieldandmagnitude"));
12
12
  exports.imageToMagnitude = imagetovectorfieldandmagnitude_1.default;
13
- const webglobjectbuilders_1 = require("../util/webglobjectbuilders");
13
+ var webglobjectbuilders_1 = require("../util/webglobjectbuilders");
14
14
  Object.defineProperty(exports, "createImageFromBase64", { enumerable: true, get: function () { return webglobjectbuilders_1.createImageFromBase64; } });