@pirireis/webglobeplugins 0.8.23 → 0.8.25

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.
@@ -18,6 +18,7 @@ export default class HeatWaveGlobeShellPlugin {
18
18
  minMaxEdges = { min: -99999, max: 99999 },
19
19
  escapeValue = 99999,
20
20
  resolution = [2056, 2056],
21
+ yFlip = true,
21
22
  } = {}) {
22
23
  this.id = id;
23
24
  this.dataManager = dataManager;
@@ -30,7 +31,7 @@ export default class HeatWaveGlobeShellPlugin {
30
31
  this._resolution = resolution;
31
32
 
32
33
  this._colorRampData = colorRampData; // holds until init
33
-
34
+ this._yFlip = yFlip;
34
35
  this._lastTexture0data = null;
35
36
  this._lastTexture1data = null;
36
37
 
@@ -155,7 +156,7 @@ export default class HeatWaveGlobeShellPlugin {
155
156
  this._disCarded = false;
156
157
  this._lastTexture0data = textureData0;
157
158
  this._lastTexture1data = textureData1;
158
- this.heatProgram.setFloatTextureData(textureData0, textureData1, this._dataWidthHeight.width, this._dataWidthHeight.height);
159
+ this.heatProgram.setFloatTextureData(textureData0, textureData1, this._dataWidthHeight.width, this._dataWidthHeight.height, this._yFlip);
159
160
  }
160
161
  this.drawHeat();
161
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.8.23",
3
+ "version": "0.8.25",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -87,12 +87,15 @@ export default class DataObject {
87
87
  }
88
88
 
89
89
 
90
- setFloatTextureData(data0, data1, width, height) {
90
+ setFloatTextureData(data0, data1, width, height, yFlip = false) {
91
91
  const { texture0, texture1, gl } = this;
92
+
92
93
  gl.bindTexture(gl.TEXTURE_2D, texture0);
94
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, yFlip);
93
95
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data0);
94
96
  gl.bindTexture(gl.TEXTURE_2D, texture1);
95
97
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data1);
98
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
96
99
  }
97
100
 
98
101
 
package/wind/plugin.js CHANGED
@@ -605,11 +605,8 @@ export default class WindPlugin {
605
605
 
606
606
  gl.useProgram(currentProgram);
607
607
 
608
- if (this.coordinatesDataCalculator) {
609
- const magnitude = imageToMagnitude(windData);
610
- this.coordinatesDataCalculator.updateData(0, magnitude, magnitude);
611
608
 
612
- }
609
+ this._setCoorcinatesDataCalculatorData();
613
610
  this.resize();
614
611
  }
615
612
 
@@ -640,10 +637,15 @@ export default class WindPlugin {
640
637
 
641
638
 
642
639
  _createPointCoordinatesDataCalculator() {
643
- if (!this.windData) {
644
- throw new Error("wind plugin. _createPointCoordinatesDataCalculator is called before wind data is set.");
645
- }
646
640
  this.coordinatesDataCalculator = new PointCoordinatesDataCalculator(this.windData.bbox, this.windData.width, this.windData.height);
641
+ this._setCoorcinatesDataCalculatorData();
642
+ }
643
+
644
+
645
+ _setCoorcinatesDataCalculatorData() {
646
+ if (!this.windData || !this.coordinatesDataCalculator) {
647
+ return;
648
+ }
647
649
  const magnitude = imageToMagnitude(this.windData);
648
650
  this.coordinatesDataCalculator.updateData(0, magnitude, magnitude);
649
651
  }