@pirireis/webglobeplugins 0.10.2-alpha → 0.10.4-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.
@@ -206,7 +206,6 @@ export class IsobarRasterToVector {
206
206
  }
207
207
  }
208
208
  _isobarsCheckAndComplete(isobars) {
209
- window.isobars = isobars;
210
209
  if (!Array.isArray(isobars))
211
210
  throw new Error("isobars must be an array");
212
211
  if (isobars.length === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.10.2-alpha",
3
+ "version": "0.10.4-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -2,7 +2,6 @@ import { createProgram } from "../../util";
2
2
  export default class {
3
3
  constructor(gl) {
4
4
  this.gl = gl;
5
- // console.log("Float2LegendWithRatioProgram gl:", gl);
6
5
  this._width = 1;
7
6
  this._height = 1;
8
7
  this._blendRatio = 0.0;
@@ -88,9 +88,6 @@ void main() {
88
88
  outColor = vec4( v_color.rgb, v_color.a * opacity );
89
89
  }
90
90
  }`;
91
- console.log("LineStripProgram");
92
- console.log(vertexShaderSource);
93
- console.log(fragmentShaderSource);
94
91
  class Logic {
95
92
  _vaosPublished = [];
96
93
  _ubosPublished = [];
@@ -104,7 +101,6 @@ class Logic {
104
101
  location: null
105
102
  };
106
103
  constructor(globe) {
107
- console.log("LineStripProgram globe", globe);
108
104
  this.gl = globe.gl;
109
105
  this.globe = globe;
110
106
  this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
package/programs/util.js CHANGED
@@ -9,7 +9,6 @@ function longlatbbox2normalbbox({ minLon = -180, maxLon = 180, minLat = -90, max
9
9
  bboxOffsetRad: new Float32Array([horOffset, vertOffset]),
10
10
  bboxSizeRad: new Float32Array([horSize, vertSize])
11
11
  };
12
- console.log("longlatbbox2normalbbox", result);
13
12
  return result;
14
13
  }
15
14
  export { longlatbbox2normalbbox };
@@ -0,0 +1,4 @@
1
+ const UBO_BINDING_POINTS = {
2
+ SEAWAVE: 0,
3
+ };
4
+ export { UBO_BINDING_POINTS };
@@ -1,32 +1,49 @@
1
1
  import { createProgram } from "../../../util";
2
2
  import { UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
3
3
  import { glProgramCache } from "../../programcache";
4
+ import { SeaWaveUbo } from "./ubo-new";
4
5
  /**
5
6
  * [+] ubo
6
7
  */
7
8
  const vertexShaderSource = `#version 300 es
8
9
  precision highp float;
9
- ` + shaderUboSource + `
10
+ ` + SeaWaveUbo.glslCode() + `
10
11
  uniform sampler2D u_vector_field;
11
12
  in vec2 in_position;
12
13
  out vec3 base_color;
14
+
15
+
16
+ vec2 read_value(const vec2 uv) {
17
+ vec2 value = texture(u_vector_field, uv).rg;
18
+ if ( value.x == escape_value || value.y == escape_value) {
19
+ return vec2(0.0);
20
+ }
21
+ return value;
22
+ }
23
+
24
+
13
25
  vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
14
26
  // return texture(u_vector_field, uv).rg; // lower-res hardware filtering
15
27
  vec2 res = vec2(textureSize(u_vector_field, 0));
16
28
  vec2 px = 1.0 / res;
17
29
  vec2 vc = (floor(uv * res)) * px;
18
30
  vec2 f = fract(uv * res);
19
- vec2 tl = texture(u_vector_field, vc).rg;
20
- vec2 tr = texture(u_vector_field, vc + vec2(px.x, 0)).rg;
21
- vec2 bl = texture(u_vector_field, vc + vec2(0, px.y)).rg;
22
- vec2 br = texture(u_vector_field, vc + px).rg;
31
+ vec2 tl = read_value(vc).rg;
32
+ vec2 tr = read_value(vc + vec2(px.x, 0)).rg;
33
+ vec2 bl = read_value(vc + vec2(0, px.y)).rg;
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);}
23
39
  return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
24
40
  }
25
41
 
26
42
 
27
43
  void main(){
28
44
  vec2 direction_vector = lookup_wind(in_position);
29
- if (direction_vector.r == 0.0 && direction_vector.g == 0.0){ return;}
45
+ if (direction_vector.r == 0.0 && direction_vector.g == 0.0) return;
46
+
30
47
 
31
48
  vec2 limp;
32
49
  if ( 0 == gl_VertexID) { limp = -tail_wing_base_limp; }
@@ -60,8 +77,9 @@ class Logic {
60
77
  const gl = this.gl;
61
78
  const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
62
79
  // ubo point
63
- const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
64
- gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
80
+ // const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
81
+ // gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
82
+ SeaWaveUbo.assignBindingPoint(gl, program, 0);
65
83
  return [program, gl.getUniformLocation(program, 'u_vector_field')];
66
84
  }
67
85
  /**
@@ -1,12 +1,13 @@
1
1
  import { createShader } from "../../../util";
2
2
  import { UBO_SIZE, UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
3
3
  import { glProgramCache } from "../../programcache";
4
+ import { SeaWaveUbo } from "./ubo-new";
4
5
  // program output is buffer
5
6
  // TODO: Mechanism for randomness
6
7
  // drop out mechanism
7
8
  // random particle position mechanism
8
9
  const vertexShaderSource = `#version 300 es
9
- ` + shaderUboSource + `
10
+ ` + SeaWaveUbo.glslCode() + `
10
11
 
11
12
  uniform sampler2D vector_field;
12
13
  in vec2 in_position;
@@ -24,10 +25,37 @@ float random(const vec2 co) {
24
25
  return fract(sin(t) * (rand_constants.z + t));
25
26
  }
26
27
 
28
+
29
+ vec2 read_value(const vec2 uv) {
30
+ vec2 value = texture(vector_field, uv).rg;
31
+ if ( value.x == escape_value || value.y == escape_value) {
32
+ return vec2(0.0);
33
+ }
34
+ return value;
35
+ }
36
+
27
37
  vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
28
38
  // return texture(vector_field, uv).rg; // lower-res hardware filtering
29
39
  vec2 res = vec2(textureSize(vector_field, 0));
30
- if (res.x == 0.0 || res.y == 0.0){ return vec2(0.0);}
40
+ vec2 px = 1.0 / res;
41
+ vec2 vc = (floor(uv * res)) * px;
42
+ vec2 f = fract(uv * res);
43
+ vec2 tl = texture(vector_field, vc).rg;
44
+ vec2 tr = texture(vector_field, vc + vec2(px.x, 0)).rg;
45
+ vec2 bl = texture(vector_field, vc + vec2(0, px.y)).rg;
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);}
51
+ return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
52
+ }
53
+
54
+
55
+ vec2 lookup_wind2(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
56
+ // return texture(vector_field, uv).rg; // lower-res hardware filtering
57
+ vec2 res = vec2(textureSize(vector_field, 0));
58
+ if (res.x == escape_value || res.y == escape_value){ return vec2(0.0);}
31
59
  vec2 px = 1.0 / res;
32
60
  vec2 vc = (floor(uv * res)) * px;
33
61
  vec2 f = fract(uv * res);
@@ -107,8 +135,9 @@ class Logic {
107
135
  if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
108
136
  throw new Error(gl.getProgramParameter(program));
109
137
  }
110
- const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
111
- gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
138
+ // const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
139
+ // gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
140
+ SeaWaveUbo.assignBindingPoint(gl, program, 0);
112
141
  return [program, gl.getUniformLocation(program, 'vector_field')];
113
142
  ;
114
143
  }
@@ -0,0 +1,25 @@
1
+ import { UBO_BINDING_POINTS } from "./constants";
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]);
4
+ //0.7297389507293701, 0.20000000298023224, 1, 7, 1, 1, 1, 0, 0.05000000074505806, 0, 2200, 656, -9999,
5
+ // {float random_seed;float range;vec2 tail_wing_base_limp;vec3 color;float drop_rate;vec2 draw_texture_size;float escape_value; }
6
+ export const SeaWaveUbo = /*@__PURE__*/ new UniformBlockManager("Seawave_UBO", [
7
+ { name: "tail_wing_base_limp", type: "vec2", value: INITIAL_UBO_DATA.slice(2, 4) },
8
+ { name: "draw_texture_size", type: "vec2", value: INITIAL_UBO_DATA.slice(8, 10) },
9
+ { name: "random_seed", type: "float", value: INITIAL_UBO_DATA.slice(0, 1) },
10
+ { name: "range", type: "float", value: INITIAL_UBO_DATA.slice(1, 2) },
11
+ { name: "escape_value", type: "float", value: INITIAL_UBO_DATA.slice(10, 11) },
12
+ { name: "drop_rate", type: "float", value: INITIAL_UBO_DATA.slice(7, 8) },
13
+ { name: "color", type: "vec3", value: INITIAL_UBO_DATA.slice(4, 7) },
14
+ ], UBO_BINDING_POINTS.SEAWAVE);
15
+ // window add properties
16
+ // const shaderUboSource = `
17
+ // layout(std140) uniform UBO {
18
+ // float random_seed;
19
+ // float range;
20
+ // vec2 tail_wing_base_limp;
21
+ // vec3 color;
22
+ // float drop_rate;
23
+ // vec2 draw_texture_size;
24
+ // float escape_value;
25
+ // };`;
@@ -1,22 +1,23 @@
1
1
  const UBO_BINDING_POINT = 0;
2
- const INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000]);
2
+ const INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000, -9999]);
3
3
  const shaderUboSource = `
4
4
  layout(std140) uniform UBO {
5
- float random_seed;
5
+ float random_seed;
6
6
  float range;
7
- vec2 tail_wing_base_limp;
8
- vec3 color;
9
- float drop_rate;
10
- vec2 draw_texture_size;
7
+ vec2 tail_wing_base_limp;
8
+ vec3 color;
9
+ float drop_rate;
10
+ vec2 draw_texture_size;
11
+ float escape_value;
11
12
  };`;
12
- const UBO_SIZE = 40;
13
+ const UBO_SIZE = 44;
13
14
  class WaveParticalUboManager {
14
15
  constructor(gl) {
15
16
  this.gl = gl;
16
17
  this.ubo = this._createBuffer();
17
18
  this._data = null;
18
19
  }
19
- update({ range, random_seed, tail_wing_base_limp, draw_texture_size, drop_rate, color }) {
20
+ update({ range, random_seed, tail_wing_base_limp, draw_texture_size, drop_rate, color, escape_value }) {
20
21
  const { gl, ubo } = this;
21
22
  gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
22
23
  if (random_seed !== undefined)
@@ -31,6 +32,8 @@ class WaveParticalUboManager {
31
32
  gl.bufferSubData(gl.UNIFORM_BUFFER, 28, new Float32Array([drop_rate]));
32
33
  if (draw_texture_size !== undefined)
33
34
  gl.bufferSubData(gl.UNIFORM_BUFFER, 32, new Float32Array(draw_texture_size));
35
+ if (escape_value !== undefined)
36
+ gl.bufferSubData(gl.UNIFORM_BUFFER, 40, new Float32Array([escape_value]));
34
37
  gl.bindBuffer(gl.UNIFORM_BUFFER, null);
35
38
  }
36
39
  _createBuffer() {
@@ -41,7 +41,7 @@ const typeArrayConstructors = {
41
41
  'ivec4': Int32Array,
42
42
  'bool': Float32Array
43
43
  };
44
- class UniformBlockManager {
44
+ export class UniformBlockManager {
45
45
  /**
46
46
  *
47
47
  * @param {UniformBlockName} blockName
@@ -93,11 +93,39 @@ class UniformBlockManager {
93
93
  return {
94
94
  ubo,
95
95
  update: (nameValueMap) => this.updateUBO(gl, ubo, nameValueMap),
96
+ updateSingle: (key, value) => this.updateUboSingle(gl, ubo, key, value),
96
97
  bind: () => this.bind(gl, ubo),
97
98
  unbind: () => this.unbind(gl),
98
99
  free: () => gl.deleteBuffer(ubo),
99
100
  };
100
101
  }
102
+ updateUboSingle(gl, ubo, key, value) {
103
+ gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
104
+ const offset = this.offsetMap.get(key);
105
+ if (offset === undefined) {
106
+ throw new Error(`Uniform block member ${key} not found in offset map.`);
107
+ }
108
+ // @ts-ignore
109
+ const type = this.blockMembers.find(member => member.name === key).type;
110
+ let data;
111
+ if (Array.isArray(value)) {
112
+ data = new typeArrayConstructors[type](value);
113
+ }
114
+ else if (typeof value === 'number') {
115
+ data = new typeArrayConstructors[type]([value]);
116
+ }
117
+ else if (value instanceof ArrayBuffer) {
118
+ data = new typeArrayConstructors[type](value);
119
+ }
120
+ else if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
121
+ data = (typeof value === 'number') ? new typeArrayConstructors[type]([value]) : new typeArrayConstructors[type](value);
122
+ }
123
+ else {
124
+ throw new Error(`Unsupported value type for ${key}: ${typeof value}`);
125
+ }
126
+ gl.bufferSubData(gl.UNIFORM_BUFFER, offset, data);
127
+ gl.bindBuffer(gl.UNIFORM_BUFFER, null);
128
+ }
101
129
  updateUBO(gl, ubo, nameValueMap) {
102
130
  gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
103
131
  for (const [name, value] of nameValueMap.entries()) {
@@ -122,7 +150,6 @@ class UniformBlockManager {
122
150
  else {
123
151
  throw new Error(`Unsupported value type for ${name}: ${typeof value}`);
124
152
  }
125
- console.log("Data to be uploaded:", data);
126
153
  gl.bufferSubData(gl.UNIFORM_BUFFER, offset, data);
127
154
  }
128
155
  gl.bindBuffer(gl.UNIFORM_BUFFER, null);
@@ -162,4 +189,3 @@ class UniformBlockManager {
162
189
  return lastOffset + lastItemAlignment;
163
190
  }
164
191
  }
165
- export { UniformBlockManager };
@@ -98,7 +98,7 @@ export default class PointCoordinatesDataCalculator {
98
98
  }
99
99
  }
100
100
  // function test() {
101
- // const cp = window.plugin.getPointCoordinatesDataCalculator();
101
+ // const cp = window.plugin.getTexturePointSampler();
102
102
  // const bbox = [-15, 25, 70, 60];
103
103
  // cp.registerPoint("left up", -15, 60, (data0, data1, interpolated) => {
104
104
  // console.log("left up", data0, data1, interpolated);
@@ -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([0, 0], i * 2);
5
+ vectorArray.set([noDataValue, noDataValue], i * 2);
6
6
  continue;
7
7
  }
8
8
  const rad = (centigradeArray[i] + 90.0) * Math.PI / 180;
@@ -4,6 +4,7 @@ import { vectorfield } from "../programs/index";
4
4
  import { pixelBasedMoveProgramCache } from "../programs/vectorfields/logics/pixelbased";
5
5
  import { drawRectangleParticlesProgramCache } from "../programs/vectorfields/logics/drawrectangleparticles";
6
6
  import { FadeAway } from "../programs";
7
+ import { SeaWaveUbo } from "../programs/vectorfields/logics/ubo-new";
7
8
  const { PingPongBufferManager, WaveParticalUboManager } = vectorfield;
8
9
  /**
9
10
  * STEPS:
@@ -15,7 +16,7 @@ const { PingPongBufferManager, WaveParticalUboManager } = vectorfield;
15
16
  */
16
17
  const MAX_PIXELS_ON_DIMENSION = 2200;
17
18
  export default class Plugin {
18
- 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 } = {}) {
19
+ constructor(id, { dataWidth, dataHeight, fadeOpacity = 0.83, opacity = 0.75, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, escapeValue = -9999, patricleCount = 8000, flipY = true, drawTextureMaxPixelOnDimension = MAX_PIXELS_ON_DIMENSION } = {}) {
19
20
  this.id = id;
20
21
  this.globe = null;
21
22
  this.gl = null;
@@ -33,6 +34,7 @@ export default class Plugin {
33
34
  this._particleCount = patricleCount;
34
35
  this._dataWidth = dataWidth;
35
36
  this._dataHeight = dataHeight;
37
+ this._escapeValue = escapeValue;
36
38
  this._drawTextureMaxPixelOnDimension = drawTextureMaxPixelOnDimension;
37
39
  this._globeshellparameters = {
38
40
  minLon,
@@ -54,11 +56,12 @@ export default class Plugin {
54
56
  const inPositionLocation = this.moveParticle.getInPositionLocation();
55
57
  this.bufferManager = new PingPongBufferManager(gl, this._particleCount, inPositionLocation);
56
58
  this._rgVectorFieldTexture = this._createRGTexture();
57
- this.waveUbo = new WaveParticalUboManager(gl, 0);
59
+ this.waveUbo = SeaWaveUbo.createUBO(gl);
58
60
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
59
61
  this._frameBuffer = gl.createFramebuffer();
60
62
  this.setBBox(this._globeshellparameters);
61
63
  this.setOpacity(this._opacity);
64
+ this.setEscapeValue(this._escapeValue);
62
65
  this.____drawIndex = 0;
63
66
  }
64
67
  _createDrawTexture() {
@@ -83,7 +86,9 @@ export default class Plugin {
83
86
  const { gl, moveParticle, drawParticle, bufferManager, globeShellWiggle, waveUbo, fadeAway, _rgVectorFieldTexture } = this;
84
87
  gl.disable(gl.DEPTH_TEST);
85
88
  if (this._stepIndex === 0) {
86
- waveUbo.update({ random_seed: Math.random() });
89
+ // waveUbo.update({ random_seed: Math.random() });
90
+ this.waveUbo.updateSingle("random_seed", new Float32Array([Math.random()]));
91
+ ;
87
92
  moveParticle.move(bufferManager, _rgVectorFieldTexture, waveUbo);
88
93
  // 1s swap buffer b1 <-> b2
89
94
  bufferManager.swap();
@@ -188,7 +193,16 @@ export default class Plugin {
188
193
  this.globeShellWiggle.setHeight(value);
189
194
  }
190
195
  setDropRate(value) {
191
- this.waveUbo.update({ drop_rate: value });
196
+ this.waveUbo.updateSingle("drop_rate", new Float32Array([value]));
197
+ ;
198
+ }
199
+ setEscapeValue(value) {
200
+ if (typeof value !== 'number') {
201
+ console.error("escape value must be a number");
202
+ return;
203
+ }
204
+ this._escapeValue = value;
205
+ this.waveUbo.updateSingle("escape_value", value);
192
206
  }
193
207
  __readAndWriteTextureData() {
194
208
  const { gl, _rgVectorFieldTexture, _dataWidth, _dataHeight } = this;
@@ -231,24 +245,40 @@ export default class Plugin {
231
245
  setDrawTextureMaxPixelOnDimension(value) {
232
246
  this._drawTextureMaxPixelOnDimension = value;
233
247
  this._drawTextureResolution = this._drawTextureSizeFromBbox(this._globeshellparameters);
234
- this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
248
+ this.waveUbo.updateSingle("draw_texture_size", new Float32Array([this._drawTextureResolution.width, this._drawTextureResolution.height]));
235
249
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
236
250
  }
237
251
  setParticleSpeed(value) {
238
- this.waveUbo.update({ range: value });
252
+ if (typeof value !== 'number' || value <= 0) {
253
+ console.error("Particle speed must be a positive number");
254
+ return;
255
+ }
256
+ if (value > 100) {
257
+ console.warn("Particle speed is too high, it may cause performance issues");
258
+ }
259
+ this.waveUbo.updateSingle("range", new Float32Array([value]));
239
260
  }
240
261
  setFadeOpacity(value) {
262
+ if (typeof value !== 'number' || value < 0 || value > 1) {
263
+ console.error("Fade opacity must be a number between 0 and 1");
264
+ return;
265
+ }
241
266
  this._fadeOpacity = value;
242
267
  }
243
268
  setOpacity(value) {
269
+ if (typeof value !== 'number' || value < 0 || value > 1) {
270
+ console.error("Opacity must be a number between 0 and 1");
271
+ return;
272
+ }
244
273
  this.globeShellWiggle.setOpacity(value);
245
274
  }
246
275
  setParticleDimensions(tail, wing) {
247
276
  if (0 < tail || 0 < wing) {
248
- this.waveUbo.update({ tail_wing_base_limp: [tail, wing] });
277
+ console.error("tail and wing must be greater than 0");
249
278
  }
250
279
  else {
251
- console.error("tail and wing must be greater than 0");
280
+ this.waveUbo.updateSingle("tail_wing_base_limp", new Float32Array([tail, wing]));
281
+ ;
252
282
  }
253
283
  }
254
284
  setParticleColor(color) {
@@ -256,13 +286,14 @@ export default class Plugin {
256
286
  console.error("color must be an array of rgb elements");
257
287
  return;
258
288
  }
259
- this.waveUbo.update({ color });
289
+ this.waveUbo.updateSingle("color", new Float32Array(color));
290
+ ;
260
291
  }
261
292
  setBBox({ minLon, minLat, maxLon, maxLat }) {
262
293
  this._globeshellparameters = { minLon, minLat, maxLon, maxLat };
263
294
  this.globeShellWiggle.setBBox({ minLon, minLat, maxLon, maxLat });
264
295
  this._drawTextureResolution = this._drawTextureSizeFromBbox({ minLon, minLat, maxLon, maxLat });
265
- this.waveUbo.update({ draw_texture_size: [this._drawTextureResolution.width, this._drawTextureResolution.height] });
296
+ this.waveUbo.updateSingle("draw_texture_size", new Float32Array([this._drawTextureResolution.width, this._drawTextureResolution.height]));
266
297
  this._drawTextures = [this._createDrawTexture(), this._createDrawTexture()];
267
298
  }
268
299
  }
package/wind/plugin.js CHANGED
@@ -531,22 +531,22 @@ export default class WindPlugin {
531
531
  this.setWind(windData);
532
532
  };
533
533
  }
534
- getPointCoordinatesDataCalculator() {
535
- if (!this.coordinatesDataCalculator)
536
- this._createPointCoordinatesDataCalculator();
537
- return this.coordinatesDataCalculator;
534
+ getTexturePointSampler() {
535
+ if (!this.texturePointSampler)
536
+ this._createTexturePointSampler();
537
+ return this.texturePointSampler;
538
538
  }
539
- _createPointCoordinatesDataCalculator() {
539
+ _createTexturePointSampler() {
540
540
  const { bbox, width, height } = this._windDataMeta;
541
- this.coordinatesDataCalculator = new TexturePointSampler(bbox, width, height);
541
+ this.texturePointSampler = new TexturePointSampler(bbox, width, height);
542
542
  this._setCoorcinatesDataCalculatorData();
543
543
  }
544
544
  _setCoorcinatesDataCalculatorData() {
545
- if (!this.windData || !this.coordinatesDataCalculator) {
545
+ if (!this.windData || !this.texturePointSampler) {
546
546
  return;
547
547
  }
548
548
  const magnitude = imageToMagnitude(this.windData);
549
- this.coordinatesDataCalculator.updateTextureData(0, magnitude, magnitude);
549
+ this.texturePointSampler.updateTextureData(0, magnitude, magnitude);
550
550
  }
551
551
  // -----------------------------------------------
552
552
  // --- inner methods ---