@pirireis/webglobeplugins 1.2.2 → 1.2.3
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.
|
@@ -260,6 +260,14 @@ function filterEdgePointTriangles(indeces, edgePointIndices) {
|
|
|
260
260
|
}
|
|
261
261
|
return new Uint32Array(result);
|
|
262
262
|
}
|
|
263
|
+
function roundTo7(n) {
|
|
264
|
+
// Keep at most 7 digits after the decimal (degrees), then quantize to float32
|
|
265
|
+
// to match GPU attribute precision and make identity comparisons stable.
|
|
266
|
+
const rounded = Math.round(n * 1e7) / 1e7;
|
|
267
|
+
return rounded;
|
|
268
|
+
// return Math.round(rounded);
|
|
269
|
+
// return Math.fround(n);
|
|
270
|
+
}
|
|
263
271
|
// function createArcPointHarvestingMeta(): ArcPointHarvestingMeta {
|
|
264
272
|
// return {
|
|
265
273
|
// parallelCutIndices: [],
|
|
@@ -288,17 +296,17 @@ export function partialTessellation(triangleMeta, limits, innerCuts, calculateRe
|
|
|
288
296
|
*/
|
|
289
297
|
const _f32 = /*@__PURE__*/ new Float32Array(1);
|
|
290
298
|
const _u32 = /*@__PURE__*/ new Uint32Array(_f32.buffer);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
299
|
+
const float32Bits = (n) => {
|
|
300
|
+
_f32[0] = n;
|
|
301
|
+
return _u32[0];
|
|
302
|
+
};
|
|
295
303
|
const addPoint = (longLat, vec3, edgeIndex) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
|
|
304
|
+
// Triangulate and render in Mercator XY (unscaled) space.
|
|
305
|
+
// De-dupe using float32 bit patterns to exactly match GPU attribute precision.
|
|
306
|
+
const merc = radianToMercatorXY(longLat);
|
|
307
|
+
const x = Math.fround(merc[0]);
|
|
308
|
+
const y = Math.fround(merc[1]);
|
|
309
|
+
const key = `${float32Bits(x)},${float32Bits(y)}`;
|
|
302
310
|
let index = pointMap.get(key);
|
|
303
311
|
if (index !== undefined) {
|
|
304
312
|
if (edgeIndex !== undefined) {
|
package/package.json
CHANGED
|
@@ -484,6 +484,7 @@ function roundTo7(n) {
|
|
|
484
484
|
// Keep at most 7 digits after the decimal (degrees), then quantize to float32
|
|
485
485
|
// to match GPU attribute precision and make identity comparisons stable.
|
|
486
486
|
const rounded = Math.round(n * 1e7) / 1e7;
|
|
487
|
-
return
|
|
487
|
+
return rounded;
|
|
488
|
+
// return Math.round(rounded);
|
|
488
489
|
// return Math.fround(n);
|
|
489
490
|
}
|