@pirireis/webglobeplugins 0.15.24 → 0.15.26
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
package/point-tracks/plugin.js
CHANGED
|
@@ -168,6 +168,11 @@ class PointTracksPlugin {
|
|
|
168
168
|
*/
|
|
169
169
|
deleteTrack(trackID) {
|
|
170
170
|
const pointList = this._tracksToPointsMap.get(trackID);
|
|
171
|
+
if (!pointList) {
|
|
172
|
+
console.warn(`Track with ID ${trackID} does not exist.`);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
;
|
|
171
176
|
const points = Array.from(pointList);
|
|
172
177
|
const { _bufferOrchestrator, _bufferManagersMap } = this;
|
|
173
178
|
_bufferOrchestrator.deleteBulk(points.map((pointID) => keyMethod(trackID, pointID)), _bufferManagersMap);
|
|
@@ -47,9 +47,10 @@ export function imageToRadianAngle(imageData) {
|
|
|
47
47
|
const g = data[i + 1];
|
|
48
48
|
const u = uMin + (uDiff * r) / 255;
|
|
49
49
|
const v = vMin + (vDiff * g) / 255;
|
|
50
|
-
|
|
50
|
+
// North-oriented angle: 0 = North, π/2 = East, π = South, 3π/2 = West
|
|
51
|
+
const angle = Math.atan2(u, v);
|
|
51
52
|
const index = i / 4;
|
|
52
|
-
angleArray[index] = angle;
|
|
53
|
+
angleArray[index] = angle < 0 ? (angle + 2 * Math.PI) : angle;
|
|
53
54
|
}
|
|
54
55
|
return angleArray;
|
|
55
56
|
}
|
package/wind/plugin.js
CHANGED
|
@@ -54,6 +54,9 @@ varying vec2 v_tex_pos;
|
|
|
54
54
|
void main() {
|
|
55
55
|
vec4 color = texture2D(u_screen, 1.0 - v_tex_pos);
|
|
56
56
|
// a hack to guarantee opacity fade out even with a value close to 1.0
|
|
57
|
+
if ( color.a < 0.005) {
|
|
58
|
+
discard;
|
|
59
|
+
}
|
|
57
60
|
gl_FragColor = vec4( floor(255.0 * color * u_opacity) / 255.0);
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -82,15 +85,15 @@ float rand(const vec2 co) {
|
|
|
82
85
|
|
|
83
86
|
// wind speed lookup; use manual bilinear filtering based on 4 adjacent pixels for smooth interpolation
|
|
84
87
|
vec2 lookup_wind(const vec2 uv) {
|
|
85
|
-
|
|
86
|
-
vec2 px = 1.0 / u_wind_res;
|
|
87
|
-
vec2 vc = (floor(uv * u_wind_res)) * px;
|
|
88
|
-
vec2 f = fract(uv * u_wind_res);
|
|
89
|
-
vec2 tl = texture2D(u_wind, vc).rg;
|
|
90
|
-
vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;
|
|
91
|
-
vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;
|
|
92
|
-
vec2 br = texture2D(u_wind, vc + px).rg;
|
|
93
|
-
return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
88
|
+
return texture2D(u_wind, uv).rg; // lower-res hardware filtering
|
|
89
|
+
// vec2 px = 1.0 / u_wind_res;
|
|
90
|
+
// vec2 vc = (floor(uv * u_wind_res)) * px;
|
|
91
|
+
// vec2 f = fract(uv * u_wind_res);
|
|
92
|
+
// vec2 tl = texture2D(u_wind, vc).rg;
|
|
93
|
+
// vec2 tr = texture2D(u_wind, vc + vec2(px.x, 0)).rg;
|
|
94
|
+
// vec2 bl = texture2D(u_wind, vc + vec2(0, px.y)).rg;
|
|
95
|
+
// vec2 br = texture2D(u_wind, vc + px).rg;
|
|
96
|
+
// return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
void main() {
|
|
@@ -218,13 +221,16 @@ void main() {
|
|
|
218
221
|
color.r / 255.0 + color.b,
|
|
219
222
|
color.g / 255.0 + color.a);
|
|
220
223
|
|
|
221
|
-
|
|
222
|
-
if ( v_particle_pos.y < 0.0265 || v_particle_pos.y > 0.9735 ) {
|
|
224
|
+
|
|
225
|
+
// if ( v_particle_pos.y < 0.0265 || v_particle_pos.y > 0.9735 ) {
|
|
226
|
+
float y = v_particle_pos.y - 0.0055;//a
|
|
227
|
+
if ( y > 0.9735 || y < 0.0265 ) {
|
|
223
228
|
gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);
|
|
224
229
|
return;
|
|
225
230
|
}
|
|
226
|
-
vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x, v_particle_pos.y, 1.0);
|
|
227
|
-
|
|
231
|
+
// vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x, v_particle_pos.y, 1.0);
|
|
232
|
+
vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x, y, 1.0);
|
|
233
|
+
|
|
228
234
|
|
|
229
235
|
float xRad = PI * (2.0 * pos.x - 1.0);
|
|
230
236
|
float yRad = pos.y * PI;
|
|
@@ -267,12 +273,12 @@ void main() {
|
|
|
267
273
|
v_particle_pos = vec2(
|
|
268
274
|
color.r / 255.0 + color.b,
|
|
269
275
|
color.g / 255.0 + color.a);
|
|
270
|
-
|
|
271
|
-
if (
|
|
276
|
+
float y = v_particle_pos.y - 0.0055;//a
|
|
277
|
+
if ( y < 0.0265 || y > 0.9735 ) {
|
|
272
278
|
gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);
|
|
273
279
|
return;
|
|
274
280
|
}
|
|
275
|
-
vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x,
|
|
281
|
+
vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x, y, 1.0);
|
|
276
282
|
|
|
277
283
|
float x = (2.0 * pos.x - 1.0);
|
|
278
284
|
float mercator_x = x * POLE;
|
|
@@ -505,6 +511,7 @@ export default class WindPlugin {
|
|
|
505
511
|
gl.uniform2f(this.updateProgram.u_wind_min, this.windData.uMin, this.windData.vMin);
|
|
506
512
|
gl.uniform2f(this.updateProgram.u_wind_max, this.windData.uMax, this.windData.vMax);
|
|
507
513
|
this.setGeometry();
|
|
514
|
+
console.log("windData bbox", windData.bbox);
|
|
508
515
|
const minXY = this._latLongToPixelXY(windDataMeta.bbox[1], windDataMeta.bbox[0]);
|
|
509
516
|
const maxXY = this._latLongToPixelXY(windDataMeta.bbox[3], windDataMeta.bbox[2]);
|
|
510
517
|
this._loadBoundingBoxData(minXY.x, minXY.y, maxXY.x, maxXY.y);
|
|
@@ -537,16 +544,22 @@ export default class WindPlugin {
|
|
|
537
544
|
*/
|
|
538
545
|
getTexturePointSampler(type = `magnitude`) {
|
|
539
546
|
if (type == `magnitude`) {
|
|
540
|
-
if (!this.texturePointSampler)
|
|
547
|
+
if (!this.texturePointSampler) {
|
|
541
548
|
this._createTexturePointSampler();
|
|
549
|
+
this._setCoorcinatesDataCalculatorData();
|
|
550
|
+
}
|
|
542
551
|
return this.texturePointSampler;
|
|
543
552
|
}
|
|
544
553
|
else if (type == `angle`) {
|
|
545
|
-
if (!this.texturePointSamplerAngle)
|
|
554
|
+
if (!this.texturePointSamplerAngle) {
|
|
546
555
|
this._createTexturePointSamplerAngle();
|
|
556
|
+
this._setCoorcinatesDataCalculatorData();
|
|
557
|
+
}
|
|
547
558
|
return this.texturePointSamplerAngle;
|
|
548
559
|
}
|
|
549
|
-
|
|
560
|
+
else {
|
|
561
|
+
throw new Error(`WindPlugin.getTexturePointSampler: type must be either 'magnitude' or 'angle'.`);
|
|
562
|
+
}
|
|
550
563
|
}
|
|
551
564
|
_createTexturePointSamplerAngle() {
|
|
552
565
|
const { bbox, width, height } = this._windDataMeta;
|