@pirireis/webglobeplugins 1.2.12 → 1.2.14
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/Math/tessellation/triangle-tessellation.js +14 -6
- package/package.json +1 -1
- package/programs/totems/attachments/dem-textures-manager.js +2 -1
- package/semiplugins/shape-on-terrain/terrain-polygon/data/worker-contact.js +26 -0
- package/semiplugins/shape-on-terrain/terrain-polygon/data/worker.js +3 -15
|
@@ -388,13 +388,16 @@ export function partialTessellation(triangleMeta, limits, innerCuts, calculateRe
|
|
|
388
388
|
// If this clipped segment is valid, generate points
|
|
389
389
|
if (segMinLon < segMaxLon - 1e-9) {
|
|
390
390
|
// Add the exact start and end points of the clipped segment
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
if (inBBOX(p0.longLat, workBBox))
|
|
392
|
+
addPoint(p0.longLat, p0.vec, p0.arcIndex);
|
|
393
|
+
if (inBBOX(p1.longLat, workBBox))
|
|
394
|
+
addPoint(p1.longLat, p1.vec, p1.arcIndex);
|
|
393
395
|
// Add fill points *between* them
|
|
394
|
-
let currentLon = Math.ceil(segMinLon / lonStep) * lonStep;
|
|
395
|
-
if (currentLon < segMinLon - 1e-9)
|
|
396
|
-
currentLon += lonStep;
|
|
396
|
+
let currentLon = Math.max(Math.ceil(segMinLon / lonStep) * lonStep, segMinLon);
|
|
397
|
+
// if (currentLon < segMinLon - 1e-9) currentLon += lonStep;
|
|
397
398
|
while (currentLon < segMaxLon - 1e-9) {
|
|
399
|
+
const longLat = [currentLon, lat];
|
|
400
|
+
addPoint(longLat, undefined, undefined);
|
|
398
401
|
addPoint([currentLon, lat], undefined, undefined);
|
|
399
402
|
currentLon += lonStep;
|
|
400
403
|
}
|
|
@@ -420,7 +423,8 @@ export function partialTessellation(triangleMeta, limits, innerCuts, calculateRe
|
|
|
420
423
|
// Check if this point is inside the *workBBox*
|
|
421
424
|
if (pLongLat[1] >= workBBox.min[1] - 1e-9 &&
|
|
422
425
|
pLongLat[1] <= workBBox.max[1] + 1e-9) {
|
|
423
|
-
|
|
426
|
+
if (inBBOX(pLongLat, workBBox))
|
|
427
|
+
addPoint(pLongLat, p.vec, p.arcIndex);
|
|
424
428
|
}
|
|
425
429
|
}
|
|
426
430
|
currentLon += lonStep;
|
|
@@ -484,3 +488,7 @@ function orderIndcecesAlongArc(triangleMeta, edgePointIndexSets, allLongLats) {
|
|
|
484
488
|
}
|
|
485
489
|
return finalResult;
|
|
486
490
|
}
|
|
491
|
+
function inBBOX(longlat, bbox) {
|
|
492
|
+
return longlat[0] >= bbox.min[0] && longlat[0] <= bbox.max[0] &&
|
|
493
|
+
longlat[1] >= bbox.min[1] && longlat[1] <= bbox.max[1];
|
|
494
|
+
}
|
package/package.json
CHANGED
|
@@ -143,7 +143,8 @@ export class DemTextureManager {
|
|
|
143
143
|
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
144
144
|
// turn off premultiply alpha
|
|
145
145
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
146
|
-
|
|
146
|
+
const length = Math.min(this.mergedData.length, MAXLAYERS);
|
|
147
|
+
for (let i = 0; i < length; i++) {
|
|
147
148
|
const { mesh, bbox, coverRatio } = this.mergedData[i];
|
|
148
149
|
gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, // mip level
|
|
149
150
|
0, // xoffset
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DemTextureManagerCache } from "../../../../programs/totems/attachments/dem-textures-manager";
|
|
2
2
|
import { RADIAN } from "../../../../Math/methods";
|
|
3
3
|
export class WorkerContact {
|
|
4
|
+
globe;
|
|
4
5
|
_masterWorker;
|
|
5
6
|
_options;
|
|
6
7
|
onResult;
|
|
7
8
|
demTextureManager = null;
|
|
8
9
|
constructor(globe, options, onResult) {
|
|
10
|
+
this.globe = globe;
|
|
9
11
|
this._options = options;
|
|
10
12
|
this.onResult = onResult;
|
|
11
13
|
// Initialize the Master Worker
|
|
@@ -37,6 +39,8 @@ export class WorkerContact {
|
|
|
37
39
|
maxY: bbox.ur.y * RADIAN,
|
|
38
40
|
};
|
|
39
41
|
}
|
|
42
|
+
const { Tilt } = this.globe.api_GetCurrentLookInfo();
|
|
43
|
+
fineTuneBboxZooms(bboxesData, Tilt);
|
|
40
44
|
// Send BBOX updates to Master Worker
|
|
41
45
|
this._masterWorker.postMessage({
|
|
42
46
|
bboxes: bboxesData
|
|
@@ -74,3 +78,25 @@ export class WorkerContact {
|
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
}
|
|
81
|
+
function fineTuneBboxZooms(bboxZooms, tilt) {
|
|
82
|
+
return;
|
|
83
|
+
if (bboxZooms.length < 3)
|
|
84
|
+
return;
|
|
85
|
+
if (tilt > 45) {
|
|
86
|
+
bboxZooms[1].zoom = bboxZooms[0].zoom;
|
|
87
|
+
bboxZooms[2].zoom = bboxZooms[0].zoom;
|
|
88
|
+
if (tilt > 65 && bboxZooms.length >= 4) {
|
|
89
|
+
bboxZooms[3].zoom = bboxZooms[0].zoom;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (bboxZooms[0].zoom > 12) {
|
|
93
|
+
bboxZooms[1].zoom = bboxZooms[0].zoom;
|
|
94
|
+
}
|
|
95
|
+
else if (bboxZooms[0].zoom > 8 && bboxZooms[0].zoom <= 12) {
|
|
96
|
+
bboxZooms[2].zoom = bboxZooms[1].zoom;
|
|
97
|
+
bboxZooms[0].zoom = bboxZooms[1].zoom;
|
|
98
|
+
}
|
|
99
|
+
while (bboxZooms.length > 6) {
|
|
100
|
+
bboxZooms.pop();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -7,17 +7,6 @@ let _pickableState = false;
|
|
|
7
7
|
let _arcState = false;
|
|
8
8
|
let _variativeColorsOnState = false;
|
|
9
9
|
let showThreshold = 0;
|
|
10
|
-
function fineTuneBboxZooms(bboxZooms) {
|
|
11
|
-
if (bboxZooms.length >= 3 && bboxZooms[0].zoom > 12) {
|
|
12
|
-
const first = bboxZooms.shift();
|
|
13
|
-
bboxZooms[0].zoom = first.zoom;
|
|
14
|
-
bboxZooms[0].minX = Math.min(first.minX, bboxZooms[0].minX);
|
|
15
|
-
bboxZooms[0].minY = Math.min(first.minY, bboxZooms[0].minY);
|
|
16
|
-
bboxZooms[0].maxX = Math.max(first.maxX, bboxZooms[0].maxX);
|
|
17
|
-
bboxZooms[0].maxY = Math.max(first.maxY, bboxZooms[0].maxY);
|
|
18
|
-
}
|
|
19
|
-
return bboxZooms;
|
|
20
|
-
}
|
|
21
10
|
const NO_COLOR_ALPHA = 255;
|
|
22
11
|
const MAX_ALPHA_VALUE = 254;
|
|
23
12
|
function clamp01(value) {
|
|
@@ -64,10 +53,9 @@ self.onmessage = (event) => {
|
|
|
64
53
|
}
|
|
65
54
|
// Update bboxes if provided
|
|
66
55
|
if (bboxes) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
showThreshold = zoomLevelShowThreshold(fineTunedBboxes[0].zoom, 0.05);
|
|
56
|
+
cache.setBBOXes(bboxes);
|
|
57
|
+
if (bboxes.length > 0) {
|
|
58
|
+
showThreshold = zoomLevelShowThreshold(bboxes[0].zoom, 0.05);
|
|
71
59
|
}
|
|
72
60
|
}
|
|
73
61
|
const trianglesInView = cache.search();
|