@pirireis/webglobeplugins 0.8.3 → 0.8.4
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/algorithms/search-binary.js +14 -0
- package/depth-locator/readme.md +26 -0
- package/package.json +1 -1
- package/point-tracks/plugin.js +63 -9
- package/programs/point-on-globe/element-draw-glow.js +0 -0
- package/programs/point-on-globe/square-pixel-point.js +9 -2
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -1
- package/wind/plugin.js +27 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const findFirstIndexInRange = (container, value) => {
|
|
2
|
+
let start = 0;
|
|
3
|
+
let end = container.length - 1;
|
|
4
|
+
let mid = 0;
|
|
5
|
+
while (start <= end) {
|
|
6
|
+
mid = Math.floor((start + end) / 2);
|
|
7
|
+
if (container[mid] <= value && value <= container[mid + 1]) return mid;
|
|
8
|
+
if (container[mid] < value) start = mid + 1;
|
|
9
|
+
else end = mid - 1;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { findFirstIndexInRange };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Programs
|
|
2
|
+
|
|
3
|
+
1) points with depth (3d/2d), draw to framebuffer and use this until projection or data changes, has picking
|
|
4
|
+
2) glow hearth-beat effect points on the target point
|
|
5
|
+
3) glow plane effect on surface projection of target point
|
|
6
|
+
4) a line from the target point to the surface
|
|
7
|
+
5) info box on the target point
|
|
8
|
+
|
|
9
|
+
all except 1 are optional
|
|
10
|
+
|
|
11
|
+
# Inputs
|
|
12
|
+
|
|
13
|
+
1) Target point ( long, lat, depth in meter)
|
|
14
|
+
2) info box content
|
|
15
|
+
|
|
16
|
+
# Derived Cases
|
|
17
|
+
|
|
18
|
+
## Time dimension
|
|
19
|
+
|
|
20
|
+
Either:
|
|
21
|
+
1) load all points at once ordered by time. Draw range of points
|
|
22
|
+
2) Select points on time window and load them. Draw them
|
|
23
|
+
|
|
24
|
+
Approach 1 is simple yet it needs time series as input.
|
|
25
|
+
Approach 2 flexible, memory efficient. Client side is complex.
|
|
26
|
+
|
package/package.json
CHANGED
package/point-tracks/plugin.js
CHANGED
|
@@ -33,6 +33,7 @@ class PointTracksPlugin {
|
|
|
33
33
|
this._opacity = opacity;
|
|
34
34
|
this.program = null
|
|
35
35
|
this._lastWH = { w: 0, h: 0 };
|
|
36
|
+
this._focusParams = { on: false, length: 0, elementBuffer: null };
|
|
36
37
|
this.pointSizes = {
|
|
37
38
|
pointSize,
|
|
38
39
|
selectionPointFilling,
|
|
@@ -47,6 +48,7 @@ class PointTracksPlugin {
|
|
|
47
48
|
this.gl = gl;
|
|
48
49
|
this._pickerDisplayer = new PickerDisplayer(globe);
|
|
49
50
|
this._pointProgram = pointOnGlobeProgramCache.get(globe);
|
|
51
|
+
this._focusParams.elementBuffer = gl.createBuffer();
|
|
50
52
|
this._initBufferManagers();
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -191,6 +193,17 @@ class PointTracksPlugin {
|
|
|
191
193
|
this.globe?.DrawRender();
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
focusTracks(trackIDs = null) {
|
|
197
|
+
if (!this.globe) return;
|
|
198
|
+
if (!trackIDs) {
|
|
199
|
+
this._focusParams.on = false;
|
|
200
|
+
this.globe?.DrawRender();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this._focusParams.on = this._fillElementBuffer(trackIDs);
|
|
205
|
+
this.globe.DrawRender();
|
|
206
|
+
}
|
|
194
207
|
|
|
195
208
|
/**
|
|
196
209
|
* @param {string} trackID
|
|
@@ -213,6 +226,7 @@ class PointTracksPlugin {
|
|
|
213
226
|
this._isFreed = true;
|
|
214
227
|
this._pickerDisplayer.free();
|
|
215
228
|
pointOnGlobeProgramCache.release(this.globe);
|
|
229
|
+
this.gl.deleteBuffer(this._focusParams.elementBuffer);
|
|
216
230
|
this._bufferManagersMap.forEach(
|
|
217
231
|
({ bufferManager, adaptor }) => bufferManager.free()
|
|
218
232
|
);
|
|
@@ -225,17 +239,28 @@ class PointTracksPlugin {
|
|
|
225
239
|
|
|
226
240
|
_pickerDisplayer.bindFBO();
|
|
227
241
|
_pickerDisplayer.clearTextures();
|
|
228
|
-
_pointProgram.draw(_vao, _bufferOrchestrator.length,
|
|
229
|
-
{
|
|
230
|
-
hoveredID: this._selectedID,
|
|
231
|
-
opacity: this._opacity,
|
|
232
|
-
pointSize: this.pointSizes.pointSize,
|
|
233
|
-
hoveredPointSize: this.pointSizes.hoveredPointSize
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
237
242
|
|
|
243
|
+
if (this._focusParams.on) {
|
|
244
|
+
_pointProgram.draw(_vao, this._focusParams.length,
|
|
245
|
+
{
|
|
246
|
+
hoveredID: this._selectedID,
|
|
247
|
+
opacity: this._opacity,
|
|
248
|
+
pointSize: this.pointSizes.pointSize,
|
|
249
|
+
hoveredPointSize: this.pointSizes.hoveredPointSize,
|
|
250
|
+
elementBuffer: this._focusParams.elementBuffer
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
_pointProgram.draw(_vao, _bufferOrchestrator.length,
|
|
254
|
+
{
|
|
255
|
+
hoveredID: this._selectedID,
|
|
256
|
+
opacity: this._opacity,
|
|
257
|
+
pointSize: this.pointSizes.pointSize,
|
|
258
|
+
hoveredPointSize: this.pointSizes.hoveredPointSize
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
238
262
|
_pickerDisplayer.drawColorTexture();
|
|
263
|
+
|
|
239
264
|
this._selfSelect();
|
|
240
265
|
}
|
|
241
266
|
|
|
@@ -286,6 +311,35 @@ class PointTracksPlugin {
|
|
|
286
311
|
});
|
|
287
312
|
|
|
288
313
|
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
_fillElementBuffer(trackIDs) {
|
|
317
|
+
|
|
318
|
+
let length = 0;
|
|
319
|
+
const indexes = [];
|
|
320
|
+
|
|
321
|
+
for (const trackID of trackIDs) {
|
|
322
|
+
const pointSet = this._tracksToPointsMap.get(trackID);
|
|
323
|
+
if (!pointSet) continue;
|
|
324
|
+
const points = Array.from(pointSet);
|
|
325
|
+
for (const pointID of points) {
|
|
326
|
+
const key = keyMethod(trackID, pointID);
|
|
327
|
+
const index = this._bufferOrchestrator.offsetMap.get(key);
|
|
328
|
+
indexes.push(index);
|
|
329
|
+
length++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
this._focusParams.length = length;
|
|
333
|
+
if (length === 0) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
const { gl } = this;
|
|
337
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._focusParams.elementBuffer);
|
|
338
|
+
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint32Array(indexes), gl.STATIC_DRAW);
|
|
339
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
|
|
289
343
|
}
|
|
290
344
|
|
|
291
345
|
|
|
File without changes
|
|
@@ -135,7 +135,7 @@ class PointOnGlobeProgram {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
|
|
138
|
-
draw(vao, length, { opacity = 1.0, hoveredID = -1, pointSize = 2.0, hoveredPointSize = 4.0 } = {}) {
|
|
138
|
+
draw(vao, length, { opacity = 1.0, hoveredID = -1, pointSize = 2.0, hoveredPointSize = 4.0, elementBuffer = null } = {}) {
|
|
139
139
|
if (length === 0 || opacity === 0) return;
|
|
140
140
|
const { gl, program, uniforms } = this;
|
|
141
141
|
gl.useProgram(program);
|
|
@@ -157,12 +157,19 @@ class PointOnGlobeProgram {
|
|
|
157
157
|
}
|
|
158
158
|
gl.bindVertexArray(vao);
|
|
159
159
|
this.cameraBlockTotem.bind(this.cameraBlockBingingPoint);
|
|
160
|
-
|
|
160
|
+
if (elementBuffer) {
|
|
161
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, elementBuffer);
|
|
162
|
+
gl.drawElements(gl.POINTS, length, gl.UNSIGNED_INT, 0);
|
|
163
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
|
|
164
|
+
} else {
|
|
165
|
+
gl.drawArrays(gl.POINTS, 0, length);
|
|
166
|
+
}
|
|
161
167
|
this.cameraBlockTotem.unbind(this.cameraBlockBingingPoint);
|
|
162
168
|
gl.bindVertexArray(null);
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
|
|
172
|
+
|
|
166
173
|
free() {
|
|
167
174
|
if (this._isFreed) return;
|
|
168
175
|
const { gl, globe } = this;
|
package/wind/plugin.js
CHANGED
|
@@ -327,6 +327,32 @@ const defaultRampColors = [
|
|
|
327
327
|
];
|
|
328
328
|
|
|
329
329
|
|
|
330
|
+
const windyLegendData = {
|
|
331
|
+
"thresholds": [0, 3, 3, 5, 5, 7, 10, 10, 13, 15, 15, 17, 20, 20, 25, 25, 30],
|
|
332
|
+
// 0 5 10 20 30 40 60
|
|
333
|
+
// "thresholds": [0, 5, 5, 10, 10, 15, 15, 20, 20, 25, 25, 30, 30, 35, 40, 60],
|
|
334
|
+
"values": [
|
|
335
|
+
"#6271B8",
|
|
336
|
+
"#6271B8",
|
|
337
|
+
"#6271B8",
|
|
338
|
+
"#6271B8",
|
|
339
|
+
"#3D6EA3",
|
|
340
|
+
"#4A94AA",
|
|
341
|
+
"#4A9294",
|
|
342
|
+
"#4D8E7C",
|
|
343
|
+
"#4CA44C",
|
|
344
|
+
"#67A436",
|
|
345
|
+
"#A28740",
|
|
346
|
+
"#A26D5C",
|
|
347
|
+
"#8D3F5C",
|
|
348
|
+
"#974B91",
|
|
349
|
+
"#5F64A0",
|
|
350
|
+
"#5B88A1",
|
|
351
|
+
"#5B88A1"
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
|
|
330
356
|
export default class WindPlugin {
|
|
331
357
|
|
|
332
358
|
/**
|
|
@@ -355,7 +381,7 @@ export default class WindPlugin {
|
|
|
355
381
|
maxSpeed = 1000.0,
|
|
356
382
|
height = 0.0,
|
|
357
383
|
numParticles = 40000,
|
|
358
|
-
legendData =
|
|
384
|
+
legendData = windyLegendData
|
|
359
385
|
} = {}) {
|
|
360
386
|
|
|
361
387
|
this.id = id;
|