@pirireis/webglobeplugins 1.2.22 → 1.2.24
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
|
@@ -178,7 +178,6 @@ function sendToSubWorker(wrapper) {
|
|
|
178
178
|
wrapper.lastBBOXData === null &&
|
|
179
179
|
!_stateChanged)
|
|
180
180
|
return false;
|
|
181
|
-
_stateChanged = false;
|
|
182
181
|
wrapper.inProgress = true;
|
|
183
182
|
wrapper.worker.postMessage({
|
|
184
183
|
pickableState: _pickableState,
|
|
@@ -195,11 +194,16 @@ function triggerAllWorkers() {
|
|
|
195
194
|
// If a batch is already running, do not start another one.
|
|
196
195
|
if (_batchInFlight)
|
|
197
196
|
return;
|
|
197
|
+
const shouldClearStateChanged = _stateChanged;
|
|
198
198
|
let dispatched = 0;
|
|
199
199
|
for (const w of _workers) {
|
|
200
200
|
if (sendToSubWorker(w))
|
|
201
201
|
dispatched++;
|
|
202
202
|
}
|
|
203
|
+
// Only clear after we've attempted dispatching to all workers,
|
|
204
|
+
// so every worker can observe the new state.
|
|
205
|
+
if (shouldClearStateChanged)
|
|
206
|
+
_stateChanged = false;
|
|
203
207
|
// Start barrier only if we actually dispatched work.
|
|
204
208
|
if (dispatched > 0) {
|
|
205
209
|
_batchInFlight = true;
|
|
@@ -6,6 +6,9 @@ const cache = new Cache();
|
|
|
6
6
|
let _pickableState = false;
|
|
7
7
|
let _arcState = false;
|
|
8
8
|
let _variativeColorsOnState = false;
|
|
9
|
+
// Keep the last bboxes so inserts/deletes can tessellate immediately
|
|
10
|
+
// without requiring a new camera move / tile update message.
|
|
11
|
+
let _lastBboxes = null;
|
|
9
12
|
let showThreshold = 0;
|
|
10
13
|
const NO_COLOR_ALPHA = 255;
|
|
11
14
|
const MAX_ALPHA_VALUE = 254;
|
|
@@ -54,23 +57,24 @@ self.onmessage = (event) => {
|
|
|
54
57
|
// Update bboxes if provided
|
|
55
58
|
if (bboxes) {
|
|
56
59
|
cache.setBBOXes(bboxes);
|
|
60
|
+
_lastBboxes = bboxes;
|
|
57
61
|
if (bboxes.length > 0) {
|
|
58
62
|
showThreshold = zoomLevelShowThreshold(bboxes[0].zoom, 0.05);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
const trianglesInView = cache.search();
|
|
62
66
|
const results = [];
|
|
63
|
-
// Convert bbox to BBoxZoom format for partialTessellation
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
// Convert bbox to BBoxZoom format for partialTessellation.
|
|
68
|
+
// IMPORTANT: inserts/deletes may arrive without `bboxes`, but we still
|
|
69
|
+
// want to tessellate against the last-known visible tiles.
|
|
70
|
+
const bboxesForTessellation = bboxes ?? _lastBboxes ?? [];
|
|
71
|
+
const bboxZooms = bboxesForTessellation.map((b) => ({
|
|
72
|
+
bbox: {
|
|
73
|
+
min: [b.minX, b.minY],
|
|
74
|
+
max: [b.maxX, b.maxY],
|
|
75
|
+
},
|
|
76
|
+
zoom: b.zoom,
|
|
77
|
+
}));
|
|
74
78
|
let counter = 0;
|
|
75
79
|
let indexCounter = 0;
|
|
76
80
|
let arcCounter = 0;
|
|
@@ -15,6 +15,7 @@ export class TerrainPolygonSemiPlugin {
|
|
|
15
15
|
pickable: false,
|
|
16
16
|
pickablePause: false,
|
|
17
17
|
variativeColorsOn: false,
|
|
18
|
+
useDepthTestOnExceedingTiltThresholdAngle: false,
|
|
18
19
|
polygonStyle: {
|
|
19
20
|
defaultColor: [0.5, 0.5, 1, 1],
|
|
20
21
|
changeColorOnHover: true,
|
|
@@ -249,6 +250,13 @@ export class TerrainPolygonSemiPlugin {
|
|
|
249
250
|
this._uboForRealEdgeArcs?.updateSingle("opacity", this._effectiveOpacity("edgeArc"));
|
|
250
251
|
this.globe.DrawRender();
|
|
251
252
|
}
|
|
253
|
+
setUseDepthTestOnExceedingTiltThresholdAngle(state) {
|
|
254
|
+
const oldState = this._options.useDepthTestOnExceedingTiltThresholdAngle;
|
|
255
|
+
if (oldState === state)
|
|
256
|
+
return;
|
|
257
|
+
this._options.useDepthTestOnExceedingTiltThresholdAngle = state;
|
|
258
|
+
this.globe.DrawRender();
|
|
259
|
+
}
|
|
252
260
|
setChangeColorOnHoverState(state, target = "polygon") {
|
|
253
261
|
const oldState = this._options[`${target}Style`].changeHoverColor;
|
|
254
262
|
if (oldState === state)
|
|
@@ -375,6 +383,9 @@ export class TerrainPolygonSemiPlugin {
|
|
|
375
383
|
}
|
|
376
384
|
}
|
|
377
385
|
_useDepth() {
|
|
386
|
+
if (!this._options.useDepthTestOnExceedingTiltThresholdAngle) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
378
389
|
const { Tilt } = this.globe.api_GetCurrentLookInfo();
|
|
379
390
|
const useDepth = Tilt > DEPTH_START_ANGLE;
|
|
380
391
|
if (this._lastPickedPolygon !== null && useDepth) {
|
|
@@ -384,10 +395,14 @@ export class TerrainPolygonSemiPlugin {
|
|
|
384
395
|
}
|
|
385
396
|
return useDepth;
|
|
386
397
|
}
|
|
387
|
-
|
|
398
|
+
getExceedingTiltThresholdAngle() {
|
|
388
399
|
return DEPTH_START_ANGLE;
|
|
389
400
|
}
|
|
390
401
|
draw3D() {
|
|
402
|
+
if (!this.globe) {
|
|
403
|
+
console.warn("TerrainPolygonSemiPlugin.draw3D called before init");
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
391
406
|
const gl = this.globe.gl;
|
|
392
407
|
const useDepth = this._useDepth();
|
|
393
408
|
gl.enable(gl.BLEND);
|
|
@@ -472,28 +487,6 @@ export class TerrainPolygonSemiPlugin {
|
|
|
472
487
|
}
|
|
473
488
|
return targetUBO;
|
|
474
489
|
}
|
|
475
|
-
// setPickableState(state: boolean): void {
|
|
476
|
-
// throw new Error("setPickableState is buggy. use setPausePickableState instead.");
|
|
477
|
-
// const oldState = this._options.pickable;
|
|
478
|
-
// if (oldState === state) return;
|
|
479
|
-
// if (oldState === false && state === true) {
|
|
480
|
-
// this._pickIndexBuffer = this.globe.gl.createBuffer();
|
|
481
|
-
// this._uboHandler.updateSingle("private_isPickedOn", new Float32Array([1.0]));
|
|
482
|
-
// this._uboHandler.updateSingle("hoverColor", new Float32Array(this._options.polygonStyle.hoverColor));
|
|
483
|
-
// this._pickerDisplayer = new PickerDisplayer(this.globe, "R32I");
|
|
484
|
-
// } else if (oldState === true && state === false) {
|
|
485
|
-
// this.globe.gl.deleteBuffer(this._pickIndexBuffer!);
|
|
486
|
-
// this._pickIndexBuffer = null;
|
|
487
|
-
// this._uboHandler.updateSingle("private_isPickedOn", new Float32Array([0.0]));
|
|
488
|
-
// this._uboHandler.updateSingle("private_pickedIndex", new Float32Array([-1]));
|
|
489
|
-
// this._pickerDisplayer?.free();
|
|
490
|
-
// this._pickerDisplayer = null;
|
|
491
|
-
// this._lastPickedPolygon = null;
|
|
492
|
-
// }
|
|
493
|
-
// this._options.pickable = state;
|
|
494
|
-
// this._workerContact.setPickableState(state);
|
|
495
|
-
// this.globe.DrawRender();
|
|
496
|
-
// }
|
|
497
490
|
sagUst4W(long, lat, rowSize, colSize, cellWidth = 100, cellHeight = 100, rotationAngle = 0) {
|
|
498
491
|
const globe = this.globe;
|
|
499
492
|
const data = calculateAndSetCoordinates(globe, "sol_ust", rowSize, colSize, 0, 0, 0, 0, cellWidth, cellHeight, [0.75, 0, 0, 1], rotationAngle, { long, lat });
|