MCPcopy
hub / github.com/sparkjsdev/spark / initLodTree

Method initLodTree

src/SparkRenderer.ts:1339–1359  ·  view source on GitHub ↗
(
    worker: SplatWorker,
    splats: PackedSplats | ExtSplats | PagedSplats,
  )

Source from the content-addressed store, hash-verified

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

Callers 1

driveLodMethod · 0.95

Calls 1

callMethod · 0.45

Tested by

no test coverage detected