@pirireis/webglobeplugins 0.10.5-alpha → 0.10.7-alpha

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.10.5-alpha",
3
+ "version": "0.10.7-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -32,10 +32,7 @@ vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu
32
32
  vec2 tr = read_value(vc + vec2(px.x, 0)).rg;
33
33
  vec2 bl = read_value(vc + vec2(0, px.y)).rg;
34
34
  vec2 br = read_value(vc + px).rg;
35
- if (tl.x == 0.0 && tl.y == 0.0){ return vec2(0.0);}
36
- if (tr.x == 0.0 && tr.y == 0.0){ return vec2(0.0);}
37
- if (bl.x == 0.0 && bl.y == 0.0){ return vec2(0.0);}
38
- if (br.x == 0.0 && br.y == 0.0){ return vec2(0.0);}
35
+
39
36
  return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
40
37
  }
41
38
 
@@ -44,10 +44,7 @@ vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu
44
44
  vec2 tr = texture(vector_field, vc + vec2(px.x, 0)).rg;
45
45
  vec2 bl = texture(vector_field, vc + vec2(0, px.y)).rg;
46
46
  vec2 br = texture(vector_field, vc + px).rg;
47
- if (tl.x == 0.0 && tl.y == 0.0){ return vec2(0.0);}
48
- if (tr.x == 0.0 && tr.y == 0.0){ return vec2(0.0);}
49
- if (bl.x == 0.0 && bl.y == 0.0){ return vec2(0.0);}
50
- if (br.x == 0.0 && br.y == 0.0){ return vec2(0.0);}
47
+
51
48
  return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
52
49
  }
53
50
 
@@ -1,6 +1,6 @@
1
1
  import { UBO_BINDING_POINTS } from "./constants";
2
2
  import { UniformBlockManager } from "../../../util/gl-util/uniform-block/manager";
3
- const INITIAL_UBO_DATA = /*@__PURE__*/ new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000, -9999]);
3
+ const INITIAL_UBO_DATA = /*@__PURE__*/ new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000, 0]);
4
4
  //0.7297389507293701, 0.20000000298023224, 1, 7, 1, 1, 1, 0, 0.05000000074505806, 0, 2200, 656, -9999,
5
5
  // {float random_seed;float range;vec2 tail_wing_base_limp;vec3 color;float drop_rate;vec2 draw_texture_size;float escape_value; }
6
6
  export const SeaWaveUbo = /*@__PURE__*/ new UniformBlockManager("Seawave_UBO", [
@@ -28,7 +28,7 @@ export class TexturePointSampler {
28
28
  throw new Error("Texture count must be 1 or 2");
29
29
  }
30
30
  this._textureCount = textureCount;
31
- this._isReady = false; // Reset readiness when changing texture count
31
+ this._pushPointCallbackAll();
32
32
  }
33
33
  registerPoint(key, long, lat, callback) {
34
34
  if (key in this._pointObjects) {
@@ -37,15 +37,14 @@ export class TexturePointSampler {
37
37
  }
38
38
  if (!this._isInBBox(long, lat)) {
39
39
  this._pointObjects.set(key, pointObject(long, lat, -1, callback));
40
+ this._findAndSend(key);
40
41
  return false;
41
42
  }
42
43
  else {
43
44
  const index = this._metaCalculater.getFlooredIndex(long, lat);
44
45
  this._pointObjects.set(key, pointObject(long, lat, index, callback));
45
46
  }
46
- if (this._isReady) {
47
- this._findAndSend(key);
48
- }
47
+ this._findAndSend(key);
49
48
  return true;
50
49
  }
51
50
  unregisterPoint(key) {
@@ -97,9 +96,8 @@ export class TexturePointSampler {
97
96
  this.updateRatio(ratio);
98
97
  }
99
98
  updateRatio(ratio) {
100
- if (ratio < 0 || ratio > 1) {
101
- console.warn("Ratio must be between 0 and 1");
102
- ratio = Math.max(0, Math.min(1, ratio)); // Clamp the ratio
99
+ if (typeof ratio !== "number") {
100
+ throw new Error("Ratio must be a number");
103
101
  }
104
102
  this._ratio = ratio;
105
103
  this._pushPointCallbackAll();
@@ -137,7 +135,7 @@ export class TexturePointSampler {
137
135
  }
138
136
  }
139
137
  _pushPointCallbackAll() {
140
- if (this._isReady) {
138
+ if (this._isReady && this._ratio >= 0 && this._ratio <= 1) {
141
139
  for (const key of this._pointObjects.keys()) {
142
140
  this._findAndSend(key);
143
141
  }
@@ -2,7 +2,7 @@ function centigradePlus90ToVectorArray(centigradeArray, noDataValue = -9999) {
2
2
  const vectorArray = new Float32Array(centigradeArray.length * 2);
3
3
  for (let i = 0; i < centigradeArray.length; i++) {
4
4
  if (centigradeArray[i] === noDataValue) {
5
- vectorArray.set([noDataValue, noDataValue], i * 2);
5
+ vectorArray.set([0, 0], i * 2);
6
6
  continue;
7
7
  }
8
8
  const rad = (centigradeArray[i] + 90.0) * Math.PI / 180;