| 1337 | } |
| 1338 | |
| 1339 | private async initLodTree( |
| 1340 | worker: SplatWorker, |
| 1341 | splats: PackedSplats | ExtSplats | PagedSplats, |
| 1342 | ) { |
| 1343 | if (splats instanceof PackedSplats || splats instanceof ExtSplats) { |
| 1344 | const { lodId } = (await worker.call("initLodTree", { |
| 1345 | numSplats: splats.numSplats ?? 0, |
| 1346 | lodTree: (splats.extra.lodTree as Uint32Array).slice(), |
| 1347 | })) as { lodId: number }; |
| 1348 | this.lodIds.set(splats, { lodId, lastTouched: performance.now() }); |
| 1349 | this.lodIdToSplats.set(lodId, splats); |
| 1350 | // console.log("*** initLodTree", lodId, splats.extra.lodTree, splats); |
| 1351 | } else { |
| 1352 | const { lodId } = (await worker.call("newSharedLodTree", { |
| 1353 | lodId: this.pagerId, |
| 1354 | })) as { lodId: number }; |
| 1355 | this.lodIds.set(splats, { lodId, lastTouched: performance.now() }); |
| 1356 | this.lodIdToSplats.set(lodId, splats); |
| 1357 | // console.log("*** newSharedLodTree", lodId, this.pagerId, splats); |
| 1358 | } |
| 1359 | } |
| 1360 | |
| 1361 | private pageSizeWarning = false; |
| 1362 | |