({
packedSplats,
extSplats,
url,
fileBytes,
fileType,
fileName,
stream,
streamLength,
onLoad,
onProgress,
onError,
lod,
nonLod,
lodAbove,
lodBase,
}: {
packedSplats?: PackedSplats;
extSplats?: ExtSplats;
url?: string;
fileBytes?: Uint8Array | ArrayBuffer;
fileType?: SplatFileType;
fileName?: string;
stream?: ReadableStream;
streamLength?: number;
onLoad?: (decoded: PackedSplats | ExtSplats) => void;
onProgress?: (event: ProgressEvent) => void;
onError?: (error: unknown) => void;
lod?: boolean | "quality";
nonLod?: boolean;
lodAbove?: number;
lodBase?: number;
})
| 58 | } |
| 59 | |
| 60 | loadInternal({ |
| 61 | packedSplats, |
| 62 | extSplats, |
| 63 | url, |
| 64 | fileBytes, |
| 65 | fileType, |
| 66 | fileName, |
| 67 | stream, |
| 68 | streamLength, |
| 69 | onLoad, |
| 70 | onProgress, |
| 71 | onError, |
| 72 | lod, |
| 73 | nonLod, |
| 74 | lodAbove, |
| 75 | lodBase, |
| 76 | }: { |
| 77 | packedSplats?: PackedSplats; |
| 78 | extSplats?: ExtSplats; |
| 79 | url?: string; |
| 80 | fileBytes?: Uint8Array | ArrayBuffer; |
| 81 | fileType?: SplatFileType; |
| 82 | fileName?: string; |
| 83 | stream?: ReadableStream; |
| 84 | streamLength?: number; |
| 85 | onLoad?: (decoded: PackedSplats | ExtSplats) => void; |
| 86 | onProgress?: (event: ProgressEvent) => void; |
| 87 | onError?: (error: unknown) => void; |
| 88 | lod?: boolean | "quality"; |
| 89 | nonLod?: boolean; |
| 90 | lodAbove?: number; |
| 91 | lodBase?: number; |
| 92 | }) { |
| 93 | if (fileBytes instanceof ArrayBuffer) { |
| 94 | fileBytes = new Uint8Array(fileBytes); |
| 95 | } |
| 96 | const resolvedURL = fileBytes |
| 97 | ? undefined |
| 98 | : this.manager.resolveURL((this.path ?? "") + (url ?? "")); |
| 99 | |
| 100 | let readStream = stream?.getReader(); |
| 101 | |
| 102 | this.manager.itemStart(resolvedURL ?? ""); |
| 103 | // let calledOnLoad = false; |
| 104 | |
| 105 | workerPool |
| 106 | .withWorker(async (worker) => { |
| 107 | // If LoD is set and not falsey |
| 108 | const splatsLod = packedSplats?.lod ?? extSplats?.lod; |
| 109 | if (splatsLod) { |
| 110 | lod = splatsLod; |
| 111 | } |
| 112 | const splatsNonLod = packedSplats?.nonLod ?? extSplats?.nonLod; |
| 113 | if (splatsNonLod !== undefined) { |
| 114 | nonLod = splatsNonLod; |
| 115 | } |
| 116 | |
| 117 | // let init: { |
no test coverage detected