Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/splat-painter/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@

// Now export the PackedSplats to SPZ
console.log("Writing splats to SPZ...");
const { fileBytes: spzBytes } = writeSpz(newPackedSplats, ioOptions.maxSh, ioOptions.fractionalBits);
const { fileBytes: spzBytes } = await writeSpz(newPackedSplats, ioOptions.maxSh, ioOptions.fractionalBits);

console.log("Creating download...");
const blob = new Blob([spzBytes], { type: "application/octet-stream" });
Expand Down
8 changes: 5 additions & 3 deletions src/spz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,18 @@ export function writeSpz(
splats: PackedSplats | ExtSplats,
maxSh?: number,
fractionalBits?: number,
): { fileBytes: Uint8Array };
): Promise<{ fileBytes: Uint8Array }>;
export function writeSpz(
splats: PackedSplats | ExtSplats,
options?: WriteSpzOptions,
): { fileBytes: Uint8Array };
export function writeSpz(
): Promise<{ fileBytes: Uint8Array }>;
export async function writeSpz(
splats: PackedSplats | ExtSplats,
maxShOrOptions?: number | WriteSpzOptions,
fractionalBits?: number,
) {
await wasm.initialization;

const options: WriteSpzOptions =
typeof maxShOrOptions === "number"
? { maxSh: maxShOrOptions, fractionalBits }
Expand Down
Loading