Skip to content

Commit 1bd33d3

Browse files
authored
add support for SPZ version 4 in SPZLoader and add new SPZ v4 example. (#34222) (#2347)
* Update three.js * Add examples * Update patch and delete examples
1 parent b80e917 commit 1bd33d3

4 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎examples-testing/changes.patch‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15948,7 +15948,7 @@ index 4afa5d2d0..715c323a2 100644
1594815948

1594915949
render();
1595015950
diff --git a/examples-testing/examples/webgpu_gaussian_splatting.ts b/examples-testing/examples/webgpu_gaussian_splatting.ts
15951-
index 0b2d62a18..f1a2179e6 100644
15951+
index 59f413c2f..947a60694 100644
1595215952
--- a/examples-testing/examples/webgpu_gaussian_splatting.ts
1595315953
+++ b/examples-testing/examples/webgpu_gaussian_splatting.ts
1595415954
@@ -6,12 +6,35 @@ import { SPZLoader } from 'three/addons/loaders/SPZLoader.js';
@@ -15989,7 +15989,7 @@ index 0b2d62a18..f1a2179e6 100644
1598915989
millipede: {
1599015990
name: 'Millipede (SPLAT)',
1599115991
url: './models/splat/millipede.splat',
15992-
@@ -71,7 +94,7 @@ async function init() {
15992+
@@ -84,7 +107,7 @@ async function init() {
1599315993
controls.target.set(0, 0, 0);
1599415994
controls.update();
1599515995

@@ -15998,7 +15998,7 @@ index 0b2d62a18..f1a2179e6 100644
1599815998
gui.add(params, 'source', sourceNames)
1599915999
.name('Splat')
1600016000
.onChange(async value => {
16001-
@@ -83,7 +106,7 @@ async function init() {
16001+
@@ -96,7 +119,7 @@ async function init() {
1600216002
window.addEventListener('resize', onWindowResize);
1600316003
}
1600416004

@@ -16007,7 +16007,7 @@ index 0b2d62a18..f1a2179e6 100644
1600716007
const source = sources[sourceKey];
1600816008
const splatData = await new source.loader().loadAsync(source.url);
1600916009

16010-
@@ -101,8 +124,8 @@ async function loadSplatSource(sourceKey) {
16010+
@@ -114,8 +137,8 @@ async function loadSplatSource(sourceKey) {
1601116011
updateLicenseInfo(source);
1601216012
}
1601316013

@@ -16018,7 +16018,7 @@ index 0b2d62a18..f1a2179e6 100644
1601816018
const credit = source.credit;
1601916019

1602016020
if (credit === undefined) {
16021-
@@ -126,24 +149,24 @@ function updateLicenseInfo(source) {
16021+
@@ -139,24 +162,24 @@ function updateLicenseInfo(source) {
1602216022
'</a>.';
1602316023
}
1602416024

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class ZSTDDecoder {
2+
init(): Promise<void>;
3+
4+
decode(array: Uint8Array, uncompressedSize?: number): Uint8Array;
5+
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { BufferGeometry, Loader, LoadingManager } from "three";
2+
import { ZSTDDecoder } from "../libs/zstddec.module.js";
23

34
declare class SPZLoader extends Loader<BufferGeometry> {
45
constructor(manager?: LoadingManager);
56

6-
parse(buffer: ArrayBuffer): BufferGeometry;
7+
parse(
8+
buffer: ArrayBuffer,
9+
onLoad?: (geometry: BufferGeometry) => void,
10+
onError?: (err: unknown) => void,
11+
): BufferGeometry | Promise<BufferGeometry> | undefined;
712

813
parseRawSPZ(bytes: Uint8Array): BufferGeometry;
14+
15+
parseRawSPZV4(bytes: Uint8Array, zstd: ZSTDDecoder): BufferGeometry;
916
}
1017

1118
export { SPZLoader };

0 commit comments

Comments
 (0)