From abf01c41bfde30e36237c2bb3c3811f955cddf36 Mon Sep 17 00:00:00 2001 From: Avaer Kazmer Date: Fri, 29 Jul 2022 12:42:22 -0400 Subject: [PATCH 1/2] Rewrite hash algorithm --- lod.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lod.js b/lod.js index 2e4a511095..bc6f75f1b4 100644 --- a/lod.js +++ b/lod.js @@ -26,18 +26,24 @@ const uint16Array = new Uint16Array(1); return result; } */ const tp16 = 2 ** 16; -const tp5 = 2 ** 5; +const tp11 = 2 ** 11; const _getHashMinLod = (min, lod) => { let result; uint16Array[0] = min.x; result = uint16Array[0]; + result *= tp16; + uint16Array[0] = min.y; - result = (result * tp16) + uint16Array[0]; + result += uint16Array[0]; + result *= tp11; + uint16Array[0] = min.z; - result = (result * tp16) + uint16Array[0]; + result += uint16Array[0]; + result *= tp16; + uint16Array[0] = lod; - result = (result * tp5) + uint16Array[0]; + result += uint16Array[0]; return result; }; From 1fe713ac6b0a2328aeb8e1c292ee271cf6e130b1 Mon Sep 17 00:00:00 2001 From: Avaer Kazmer Date: Fri, 29 Jul 2022 12:43:36 -0400 Subject: [PATCH 2/2] Dead code cleanup --- lod.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lod.js b/lod.js index bc6f75f1b4..4c5744c24d 100644 --- a/lod.js +++ b/lod.js @@ -48,8 +48,8 @@ const _getHashMinLod = (min, lod) => { return result; }; const _getHashChunk = chunk => _getHashMinLod(chunk.min, chunk.lod); -const _getHashMinLodArray = (min, lodArray) => min.x + ',' + min.y + ',' + min.z + ':' + lodArray.join(','); -const _getHashChunkLodArray = chunk => _getHashMinLodArray(chunk.min, chunk.lodArray); +// const _getHashMinLodArray = (min, lodArray) => min.x + ',' + min.y + ',' + min.z + ':' + lodArray.join(','); +// const _getHashChunkLodArray = chunk => _getHashMinLodArray(chunk.min, chunk.lodArray); class Dominator extends EventTarget { constructor(base, onload) {