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

Method asyncInitialize

src/SplatMesh.ts:447–512  ·  view source on GitHub ↗
(options: SplatMeshOptions)

Source from the content-addressed store, hash-verified

445 }
446
447 async asyncInitialize(options: SplatMeshOptions) {
448 const {
449 url,
450 fileBytes,
451 fileType,
452 fileName,
453 stream,
454 streamLength,
455 maxSplats,
456 constructSplats,
457 onProgress,
458 splatEncoding,
459 lod,
460 nonLod,
461 lodAbove,
462 } = options;
463 if (this.packedSplats) {
464 if (url || fileBytes || stream || constructSplats) {
465 const packedSplatsOptions = {
466 url,
467 fileBytes,
468 fileType,
469 fileName,
470 stream,
471 streamLength,
472 maxSplats,
473 construct: constructSplats,
474 onProgress,
475 splatEncoding,
476 lod,
477 nonLod,
478 lodAbove,
479 };
480 this.packedSplats.reinitialize(packedSplatsOptions);
481 }
482 await this.packedSplats.initialized;
483 this.splats = this.packedSplats;
484 } else if (this.extSplats) {
485 if (url || fileBytes || stream || constructSplats) {
486 const construct = constructSplats as
487 | ((splats: ExtSplats) => Promise<void>)
488 | undefined;
489 this.extSplats.reinitialize({
490 url,
491 fileBytes,
492 fileType,
493 fileName,
494 stream,
495 streamLength,
496 maxSplats,
497 construct,
498 onProgress,
499 lod,
500 nonLod,
501 lodAbove,
502 });
503 await this.extSplats.initialized;
504 this.splats = this.extSplats;

Callers 1

constructorMethod · 0.95

Calls 3

updateGeneratorMethod · 0.95
getNumSplatsMethod · 0.65
reinitializeMethod · 0.45

Tested by

no test coverage detected