@pirireis/webglobeplugins 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +78 -80
  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 +14 -16
  9. package/Math/methods.js +65 -70
  10. package/Math/plane.js +16 -18
  11. package/Math/quaternion.js +45 -49
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +42 -45
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +7 -8
  16. package/altitude-locator/plugin.js +98 -114
  17. package/arrowfield/adaptor.js +3 -4
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +62 -65
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +200 -226
  22. package/circle-line-chain/chain-list-map.js +82 -88
  23. package/circle-line-chain/plugin.js +134 -165
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +108 -133
  26. package/compass-rose/compass-text-writer.js +62 -70
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +46 -50
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +44 -48
  32. package/heatwave/isobar/plugin.js +104 -123
  33. package/heatwave/isobar/quadtreecontours.js +76 -92
  34. package/heatwave/plugins/heatwaveglobeshell.js +69 -87
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +32 -64
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +48 -84
  40. package/partialrings/program.js +136 -47
  41. package/pin/pin-object-array.js +83 -86
  42. package/pin/pin-point-totem.js +21 -22
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +40 -45
  45. package/point-heat-map/point-to-heat-map-flow.js +40 -42
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +137 -162
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +170 -62
  50. package/programs/arrowfield/object.js +33 -35
  51. package/programs/data2legend/density-to-legend.js +45 -21
  52. package/programs/data2legend/point-to-density-texture.js +52 -27
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +88 -42
  55. package/programs/float2legendwithratio/object.js +43 -46
  56. package/programs/globe-util/is-globe-moved.js +10 -11
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +191 -98
  60. package/programs/globeshell/wiggle/object.js +33 -35
  61. package/programs/helpers/blender/program.js +36 -19
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +35 -13
  64. package/programs/helpers/fadeaway/object.js +9 -10
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +91 -32
  68. package/programs/line-on-globe/circle-accurate-3d.js +82 -32
  69. package/programs/line-on-globe/circle-accurate-flat.js +108 -50
  70. package/programs/line-on-globe/circle-accurate.js +103 -33
  71. package/programs/line-on-globe/circle.js +97 -32
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +83 -33
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +79 -34
  74. package/programs/line-on-globe/linestrip.js +111 -45
  75. package/programs/line-on-globe/naive-accurate-flexible.js +120 -50
  76. package/programs/line-on-globe/to-the-surface.js +58 -29
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +117 -33
  79. package/programs/point-on-globe/element-globe-surface-glow.js +78 -38
  80. package/programs/point-on-globe/element-point-glow.js +103 -35
  81. package/programs/point-on-globe/square-pixel-point.js +76 -27
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +63 -21
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +156 -145
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -197
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +73 -20
  88. package/programs/rings/distancering/paddyflatprogram2d.js +75 -22
  89. package/programs/rings/distancering/paddyflatprogram3d.js +73 -20
  90. package/programs/rings/partial-ring/piece-of-pie.js +137 -35
  91. package/programs/totems/camerauniformblock.js +64 -51
  92. package/programs/totems/canvas-webglobe-info.js +48 -40
  93. package/programs/totems/gpu-selection-uniform-block.js +44 -40
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +90 -29
  96. package/programs/util.js +6 -7
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +70 -29
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +91 -35
  101. package/programs/vectorfields/logics/ubo.js +31 -25
  102. package/programs/vectorfields/pingpongbuffermanager.js +30 -34
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +202 -258
  105. package/rangerings/rangeringangletext.js +108 -120
  106. package/rangerings/ring-account.js +52 -69
  107. package/shaders/fragment-toy/firework.js +55 -1
  108. package/shaders/fragment-toy/singularity.js +55 -1
  109. package/timetracks/adaptors-line-strip.js +26 -37
  110. package/timetracks/adaptors.js +47 -61
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -71
  113. package/timetracks/plugin.js +69 -77
  114. package/timetracks/program-line-strip.js +296 -103
  115. package/timetracks/program.js +419 -113
  116. package/timetracks/programpoint-line-strip.js +97 -44
  117. package/timetracks/programpoint.js +90 -44
  118. package/util/account/bufferoffsetmanager.js +72 -95
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -44
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -94
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +29 -30
  124. package/util/account/util.js +2 -4
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +13 -15
  128. package/util/geometry/index.js +9 -11
  129. package/util/gl-util/buffer/attribute-loader.js +8 -20
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +8 -9
  132. package/util/gl-util/uniform-block/manager.js +67 -67
  133. package/util/heatwavedatamanager/datamanager.js +56 -116
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +37 -40
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -10
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +27 -29
  140. package/util/interpolation/timetrack/web-worker-str.js +179 -1
  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 +46 -52
  146. package/util/programs/draw-texture-on-canvas.js +39 -21
  147. package/util/programs/shapesonglobe.js +104 -64
  148. package/util/programs/supersampletotextures.js +45 -39
  149. package/util/programs/texturetoglobe.js +98 -48
  150. package/util/shaderfunctions/geometrytransformations.js +322 -27
  151. package/util/shaderfunctions/nodata.js +7 -1
  152. package/util/shaderfunctions/noisefunctions.js +39 -9
  153. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  154. package/util/webglobe/rasteroverlay.js +35 -37
  155. package/util/webglobjectbuilders.js +55 -60
  156. package/util/webglobjectbuilders1.js +48 -49
  157. package/waveparticles/adaptor.js +6 -7
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +79 -84
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +453 -251
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +46 -48
  165. package/write-text/context-text.js +51 -58
  166. package/write-text/context-text3.js +69 -74
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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;
10
10
  /**
11
11
  * STEPS:
12
12
  * 1. move particle | buffers: read b1 write b2 | swap buffers b1 <-> b2
@@ -15,10 +15,9 @@ var DrawParticle = DrawRectangleParticles;
15
15
  * 4. fade drawTexture1 to drawTexture2 | swap textures
16
16
  *
17
17
  */
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;
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 } = {}) {
22
21
  this.id = id;
23
22
  this.globe = null;
24
23
  this.gl = null;
@@ -38,23 +37,23 @@ var Plugin = /** @class */ (function () {
38
37
  this._dataHeight = dataHeight;
39
38
  this._drawTextureMaxPixelOnDimension = drawTextureMaxPixelOnDimension;
40
39
  this._globeshellparameters = {
41
- minLon: minLon,
42
- maxLon: maxLon,
43
- minLat: minLat,
44
- maxLat: maxLat,
40
+ minLon,
41
+ maxLon,
42
+ minLat,
43
+ maxLat,
45
44
  };
46
45
  this._stepIndex = 0;
47
46
  this._fullCycleStepCount = 3;
48
47
  this._isFreed = false;
49
48
  }
50
- Plugin.prototype.init = function (globe, gl) {
49
+ init(globe, gl) {
51
50
  this.globe = globe;
52
51
  this.gl = gl;
53
52
  this.moveParticle = new MoveParticle(gl);
54
53
  this.drawParticle = new DrawParticle(gl);
55
54
  this.fadeAway = new programs_3.FadeAway(gl);
56
55
  this.globeShellWiggle = new programs_1.GlobeShellWiggle(gl, globe, this._globeshellparameters);
57
- var inPositionLocation = this.moveParticle.getInPositionLocation();
56
+ const inPositionLocation = this.moveParticle.getInPositionLocation();
58
57
  this.bufferManager = new PingPongBufferManager(gl, this._particleCount, inPositionLocation);
59
58
  this._rgVectorFieldTexture = this._createRGTexture();
60
59
  this.waveUbo = new WaveParticalUboManager(gl, 0);
@@ -63,10 +62,10 @@ var Plugin = /** @class */ (function () {
63
62
  this.setBBox(this._globeshellparameters);
64
63
  this.setOpacity(this._opacity);
65
64
  this.____drawIndex = 0;
66
- };
67
- Plugin.prototype._createDrawTexture = function () {
68
- var gl = this.gl;
69
- var texture = gl.createTexture();
65
+ }
66
+ _createDrawTexture() {
67
+ const gl = this.gl;
68
+ const texture = gl.createTexture();
70
69
  gl.bindTexture(gl.TEXTURE_2D, texture);
71
70
  // gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2200, 2200, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
72
71
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this._drawTextureResolution.width, this._drawTextureResolution.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
@@ -76,14 +75,14 @@ var Plugin = /** @class */ (function () {
76
75
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
77
76
  gl.bindTexture(gl.TEXTURE_2D, null);
78
77
  return texture;
79
- };
80
- Plugin.prototype._step = function () {
78
+ }
79
+ _step() {
81
80
  this._stepIndex = (this._stepIndex + 1) % this._fullCycleStepCount;
82
- };
83
- Plugin.prototype.draw3D = function () {
81
+ }
82
+ draw3D() {
84
83
  if (this._isFreed)
85
84
  return;
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;
85
+ const { gl, moveParticle, drawParticle, bufferManager, globeShellWiggle, waveUbo, fadeAway, _rgVectorFieldTexture } = this;
87
86
  gl.disable(gl.DEPTH_TEST);
88
87
  if (this._stepIndex === 0) {
89
88
  waveUbo.update({ random_seed: Math.random() });
@@ -93,8 +92,8 @@ var Plugin = /** @class */ (function () {
93
92
  }
94
93
  else if (this._stepIndex === 1) {
95
94
  this.____drawIndex = 1 - this.____drawIndex;
96
- var canvasWidth = gl.canvas.width;
97
- var canvasHeight = gl.canvas.height;
95
+ const canvasWidth = gl.canvas.width;
96
+ const canvasHeight = gl.canvas.height;
98
97
  // gl.viewport(0, 0, 2200, 2200);
99
98
  gl.viewport(0, 0, this._drawTextureResolution.width, this._drawTextureResolution.height);
100
99
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
@@ -105,8 +104,8 @@ var Plugin = /** @class */ (function () {
105
104
  gl.viewport(0, 0, canvasWidth, canvasHeight);
106
105
  }
107
106
  else {
108
- var canvasWidth = gl.canvas.width;
109
- var canvasHeight = gl.canvas.height;
107
+ const canvasWidth = gl.canvas.width;
108
+ const canvasHeight = gl.canvas.height;
110
109
  // gl.viewport(0, 0, 2200, 2200);
111
110
  gl.viewport(0, 0, this._drawTextureResolution.width, this._drawTextureResolution.height);
112
111
  gl.bindFramebuffer(gl.FRAMEBUFFER, this._frameBuffer);
@@ -123,16 +122,16 @@ var Plugin = /** @class */ (function () {
123
122
  globeShellWiggle.draw();
124
123
  this._step();
125
124
  gl.enable(gl.DEPTH_TEST);
126
- };
127
- Plugin.prototype.setCycleStepCount = function (value) {
125
+ }
126
+ setCycleStepCount(value) {
128
127
  if (value < 3) {
129
128
  this._fullCycleStepCount = 3;
130
129
  }
131
130
  this._fullCycleStepCount = value;
132
- };
133
- Plugin.prototype._createRGTexture = function () {
134
- var _a = this, gl = _a.gl, _dataWidth = _a._dataWidth, _dataHeight = _a._dataHeight;
135
- var texture = gl.createTexture();
131
+ }
132
+ _createRGTexture() {
133
+ const { gl, _dataWidth, _dataHeight, } = this;
134
+ const texture = gl.createTexture();
136
135
  // R32F
137
136
  gl.bindTexture(gl.TEXTURE_2D, texture);
138
137
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, null);
@@ -142,10 +141,10 @@ var Plugin = /** @class */ (function () {
142
141
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
143
142
  gl.bindTexture(gl.TEXTURE_2D, null);
144
143
  return texture;
145
- };
144
+ }
146
145
  // TODO: free all resources
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;
146
+ free() {
147
+ const { gl, fadeAway, globeShellWiggle, _rgVectorFieldTexture, bufferManager, waveUbo, _drawTextures, _frameBuffer } = this;
149
148
  this._isFreed = true;
150
149
  fadeAway.free();
151
150
  globeShellWiggle.free();
@@ -158,16 +157,15 @@ var Plugin = /** @class */ (function () {
158
157
  this.drawParticle = null;
159
158
  bufferManager.free();
160
159
  waveUbo.free();
161
- _drawTextures.forEach(function (texture) { return gl.deleteTexture(texture); });
160
+ _drawTextures.forEach(texture => gl.deleteTexture(texture));
162
161
  gl.deleteFramebuffer(_frameBuffer);
163
- };
162
+ }
164
163
  // setters
165
- Plugin.prototype.setParticleCount = function (value) {
164
+ setParticleCount(value) {
166
165
  this._particleCount = value;
167
166
  this.bufferManager.setParticleCount(value);
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;
167
+ }
168
+ setVectorFieldData(data, { dataWidth = null, dataHeight = null, flipY } = {}) {
171
169
  if (dataWidth !== null && dataHeight !== null) {
172
170
  this._dataWidth = dataWidth;
173
171
  this._dataHeight = dataHeight;
@@ -176,25 +174,25 @@ var Plugin = /** @class */ (function () {
176
174
  this._flipY = flipY;
177
175
  }
178
176
  this.__data = data;
179
- var _e = this, gl = _e.gl, _dataWidth = _e._dataWidth, _dataHeight = _e._dataHeight;
177
+ const { gl, _dataWidth, _dataHeight } = this;
180
178
  gl.bindTexture(gl.TEXTURE_2D, this._rgVectorFieldTexture);
181
179
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this._flipY);
182
180
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, data);
183
181
  gl.bindTexture(gl.TEXTURE_2D, null);
184
182
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
185
- };
186
- Plugin.prototype.setHeight = function (value) {
183
+ }
184
+ setHeight(value) {
187
185
  this.globeShellWiggle.setHeight(value);
188
- };
189
- Plugin.prototype.setDropRate = function (value) {
186
+ }
187
+ setDropRate(value) {
190
188
  this.waveUbo.update({ drop_rate: value });
191
- };
192
- Plugin.prototype.__readAndWriteTextureData = function () {
193
- var _a = this, gl = _a.gl, _rgVectorFieldTexture = _a._rgVectorFieldTexture, _dataWidth = _a._dataWidth, _dataHeight = _a._dataHeight;
189
+ }
190
+ __readAndWriteTextureData() {
191
+ const { gl, _rgVectorFieldTexture, _dataWidth, _dataHeight } = this;
194
192
  // Step 1: Bind the texture to a framebuffer
195
193
  // Step 2: Read the texture data into a Float32Array
196
194
  gl.bindTexture(gl.TEXTURE_2D, _rgVectorFieldTexture);
197
- var textureData = new Float32Array(_dataWidth * _dataHeight * 2); // RG32F has 2 components per pixel
195
+ const textureData = new Float32Array(_dataWidth * _dataHeight * 2); // RG32F has 2 components per pixel
198
196
  gl.readPixels(0, 0, _dataWidth, _dataHeight, gl.RG, gl.FLOAT, textureData);
199
197
  gl.bindTexture(gl.TEXTURE_2D, null);
200
198
  // Step 3: Create a new texture and write the data back
@@ -203,18 +201,17 @@ var Plugin = /** @class */ (function () {
203
201
  // Replace the old texture with the new one
204
202
  this._rgVectorFieldTexture = this._createRGTexture();
205
203
  this.setVectorFieldData(textureData);
206
- };
207
- Plugin.prototype._drawTextureSizeFromBbox = function (_a) {
208
- var minLon = _a.minLon, minLat = _a.minLat, maxLon = _a.maxLon, maxLat = _a.maxLat;
209
- var horizon;
204
+ }
205
+ _drawTextureSizeFromBbox({ minLon, minLat, maxLon, maxLat }) {
206
+ let horizon;
210
207
  if (minLon > 0 && maxLon < 0) {
211
208
  horizon = 360 - minLon + maxLon;
212
209
  }
213
210
  else {
214
211
  horizon = maxLon - minLon;
215
212
  }
216
- var vertical = maxLat - minLat;
217
- var width, height;
213
+ const vertical = maxLat - minLat;
214
+ let width, height;
218
215
  if (horizon > vertical) {
219
216
  width = this._drawTextureMaxPixelOnDimension;
220
217
  height = Math.floor(this._drawTextureMaxPixelOnDimension * vertical / horizon);
@@ -224,48 +221,46 @@ var Plugin = /** @class */ (function () {
224
221
  width = Math.floor(this._drawTextureMaxPixelOnDimension * horizon / vertical);
225
222
  }
226
223
  return {
227
- width: width,
228
- height: height
224
+ width,
225
+ height
229
226
  };
230
- };
231
- Plugin.prototype.setDrawTextureMaxPixelOnDimension = function (value) {
227
+ }
228
+ setDrawTextureMaxPixelOnDimension(value) {
232
229
  this._drawTextureMaxPixelOnDimension = value;
233
230
  this._drawTextureResolution = this._drawTextureSizeFromBbox(this._globeshellparameters);
234
231
  this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
235
232
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
236
- };
237
- Plugin.prototype.setParticleSpeed = function (value) {
233
+ }
234
+ setParticleSpeed(value) {
238
235
  this.waveUbo.update({ range: value });
239
- };
240
- Plugin.prototype.setFadeOpacity = function (value) {
236
+ }
237
+ setFadeOpacity(value) {
241
238
  this._fadeOpacity = value;
242
- };
243
- Plugin.prototype.setOpacity = function (value) {
239
+ }
240
+ setOpacity(value) {
244
241
  this.globeShellWiggle.setOpacity(value);
245
- };
246
- Plugin.prototype.setParticleDimensions = function (tail, wing) {
242
+ }
243
+ setParticleDimensions(tail, wing) {
247
244
  if (0 < tail || 0 < wing) {
248
245
  this.waveUbo.update({ tail_wing_base_limp: [tail, wing] });
249
246
  }
250
247
  else {
251
248
  console.error("tail and wing must be greater than 0");
252
249
  }
253
- };
254
- Plugin.prototype.setParticleColor = function (color) {
250
+ }
251
+ setParticleColor(color) {
255
252
  if (color.length !== 3) {
256
253
  console.error("color must be an array of rgb elements");
257
254
  return;
258
255
  }
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 });
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 });
266
262
  this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
267
263
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
268
- };
269
- return Plugin;
270
- }());
264
+ }
265
+ }
271
266
  exports.default = Plugin;
@@ -11,24 +11,24 @@ exports.default = imageToMagnitude;
11
11
  * @returns {Float32Array}
12
12
  */
13
13
  function imageToMagnitude(imageData) {
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');
14
+ const { image, uMax, vMax, uMin, vMin, height, width } = imageData;
15
+ const canvas = document.createElement('canvas');
16
+ const ctx = canvas.getContext('2d');
17
17
  canvas.width = width;
18
18
  canvas.height = height;
19
19
  ctx.drawImage(image, 0, 0, width, height);
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;
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;
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
- var plugin_1 = __importDefault(require("./plugin"));
7
+ const plugin_1 = __importDefault(require("./plugin"));
8
8
  exports.WindPlugin = plugin_1.default;
9
- var vectorfieldimage_1 = __importDefault(require("./vectorfieldimage"));
9
+ const vectorfieldimage_1 = __importDefault(require("./vectorfieldimage"));
10
10
  exports.createVectorFieldImage = vectorfieldimage_1.default;
11
- var imagetovectorfieldandmagnitude_1 = __importDefault(require("./imagetovectorfieldandmagnitude"));
11
+ const imagetovectorfieldandmagnitude_1 = __importDefault(require("./imagetovectorfieldandmagnitude"));
12
12
  exports.imageToMagnitude = imagetovectorfieldandmagnitude_1.default;
13
- var webglobjectbuilders_1 = require("../util/webglobjectbuilders");
13
+ const webglobjectbuilders_1 = require("../util/webglobjectbuilders");
14
14
  Object.defineProperty(exports, "createImageFromBase64", { enumerable: true, get: function () { return webglobjectbuilders_1.createImageFromBase64; } });