@soonspacejs/plugin-gs3d-loader 2.13.9 → 2.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -8
- package/dist/index.esm.js +1 -1
- package/dist/types.d.ts +48 -48
- package/package.json +3 -3
- package/src/index.ts +12 -5
- package/src/types.ts +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Group, Matrix4, Object3D } from 'three';
|
|
2
|
-
export declare enum SceneFormat {
|
|
3
|
-
'Splat' = 0,
|
|
4
|
-
'KSplat' = 1,
|
|
5
|
-
'Ply' = 2,
|
|
6
|
-
'Spz' = 3
|
|
7
|
-
}
|
|
8
|
-
export declare enum LoaderStatus {
|
|
9
|
-
'Downloading' = 0,
|
|
10
|
-
'Processing' = 1,
|
|
11
|
-
'Done' = 2
|
|
12
|
-
}
|
|
13
|
-
export interface SceneOption {
|
|
14
|
-
splatAlphaRemovalThreshold?: number;
|
|
15
|
-
position?: Array<number>;
|
|
16
|
-
rotation?: Array<number>;
|
|
17
|
-
scale?: Array<number>;
|
|
18
|
-
showLoadingUI?: boolean;
|
|
19
|
-
headers?: Headers;
|
|
20
|
-
onProgress?: () => void;
|
|
21
|
-
}
|
|
22
|
-
export interface ScenesOption {
|
|
23
|
-
path: string;
|
|
24
|
-
splatAlphaRemovalThreshold?: number;
|
|
25
|
-
position?: Array<number>;
|
|
26
|
-
rotation?: Array<number>;
|
|
27
|
-
scale?: Array<number>;
|
|
28
|
-
headers?: Headers;
|
|
29
|
-
format?: SceneFormat;
|
|
30
|
-
}
|
|
31
|
-
export interface DropInViewer extends Group {
|
|
32
|
-
viewer: any;
|
|
33
|
-
updateSplatMesh: () => void;
|
|
34
|
-
addSplatScene: (path: string, options?: SceneOption) => Promise<void>;
|
|
35
|
-
addSplatScenes: (sceneOptions: ScenesOption[], showLoadingUI: boolean) => Promise<void>;
|
|
36
|
-
getSplatScene: (sceneIndex: number) => SplatScene;
|
|
37
|
-
removeSplatScene: (index: number) => Promise<void>;
|
|
38
|
-
removeSplatScenes: (indexes: number[]) => Promise<void>;
|
|
39
|
-
getSceneCount: () => number;
|
|
40
|
-
dispose: () => Promise<any>;
|
|
41
|
-
}
|
|
42
|
-
export interface SplatScene extends Object3D {
|
|
43
|
-
splatBuffer: Matrix4;
|
|
44
|
-
transform: Matrix4;
|
|
45
|
-
opacity: number;
|
|
46
|
-
copyTransformData: (otherScene: SplatScene) => void;
|
|
47
|
-
updateTransform: (dynamicMode: boolean) => void;
|
|
48
|
-
}
|
|
1
|
+
import { Group, Matrix4, Object3D } from 'three';
|
|
2
|
+
export declare enum SceneFormat {
|
|
3
|
+
'Splat' = 0,
|
|
4
|
+
'KSplat' = 1,
|
|
5
|
+
'Ply' = 2,
|
|
6
|
+
'Spz' = 3
|
|
7
|
+
}
|
|
8
|
+
export declare enum LoaderStatus {
|
|
9
|
+
'Downloading' = 0,
|
|
10
|
+
'Processing' = 1,
|
|
11
|
+
'Done' = 2
|
|
12
|
+
}
|
|
13
|
+
export interface SceneOption {
|
|
14
|
+
splatAlphaRemovalThreshold?: number;
|
|
15
|
+
position?: Array<number>;
|
|
16
|
+
rotation?: Array<number>;
|
|
17
|
+
scale?: Array<number>;
|
|
18
|
+
showLoadingUI?: boolean;
|
|
19
|
+
headers?: Headers;
|
|
20
|
+
onProgress?: (percentComplete: number, percentCompleteLabel: string, loaderStatus: LoaderStatus) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface ScenesOption {
|
|
23
|
+
path: string;
|
|
24
|
+
splatAlphaRemovalThreshold?: number;
|
|
25
|
+
position?: Array<number>;
|
|
26
|
+
rotation?: Array<number>;
|
|
27
|
+
scale?: Array<number>;
|
|
28
|
+
headers?: Headers;
|
|
29
|
+
format?: SceneFormat;
|
|
30
|
+
}
|
|
31
|
+
export interface DropInViewer extends Group {
|
|
32
|
+
viewer: any;
|
|
33
|
+
updateSplatMesh: () => void;
|
|
34
|
+
addSplatScene: (path: string, options?: SceneOption) => Promise<void>;
|
|
35
|
+
addSplatScenes: (sceneOptions: ScenesOption[], showLoadingUI: boolean, onProgress?: (percentComplete: number, percentCompleteLabel: string, loaderStatus: LoaderStatus) => void) => Promise<void>;
|
|
36
|
+
getSplatScene: (sceneIndex: number) => SplatScene;
|
|
37
|
+
removeSplatScene: (index: number) => Promise<void>;
|
|
38
|
+
removeSplatScenes: (indexes: number[]) => Promise<void>;
|
|
39
|
+
getSceneCount: () => number;
|
|
40
|
+
dispose: () => Promise<any>;
|
|
41
|
+
}
|
|
42
|
+
export interface SplatScene extends Object3D {
|
|
43
|
+
splatBuffer: Matrix4;
|
|
44
|
+
transform: Matrix4;
|
|
45
|
+
opacity: number;
|
|
46
|
+
copyTransformData: (otherScene: SplatScene) => void;
|
|
47
|
+
updateTransform: (dynamicMode: boolean) => void;
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-gs3d-loader",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.11",
|
|
4
4
|
"description": "GS3D plugin for SoonSpace.js",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
],
|
|
13
13
|
"author": "xunwei",
|
|
14
14
|
"license": "UNLICENSED",
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "08bf9efb38c291f22ca044b936fd49269c716bbb",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"soonspacejs": "2.13.
|
|
17
|
+
"soonspacejs": "2.13.11"
|
|
18
18
|
}
|
|
19
19
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as GaussianSplats3D from '@mkkellogg/gaussian-splats-3d'
|
|
2
|
-
import { ScenesOption, DropInViewer, SceneOption, } from './types'
|
|
2
|
+
import { ScenesOption, DropInViewer, SceneOption, LoaderStatus, } from './types'
|
|
3
3
|
import { Quaternion, Vector3, } from 'three'
|
|
4
|
+
import SoonSpace from 'soonspacejs/types/index'
|
|
4
5
|
|
|
5
6
|
const _quat = new Quaternion().setFromAxisAngle( new Vector3( 0, 0, 1 ), Math.PI )
|
|
6
7
|
|
|
7
8
|
class GS3DLoaderPlugin {
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
ssp?: SoonSpace
|
|
11
|
+
|
|
12
|
+
constructor ( ssp?: SoonSpace ) {
|
|
13
|
+
|
|
14
|
+
this.ssp = ssp
|
|
15
|
+
|
|
16
|
+
}
|
|
10
17
|
|
|
11
18
|
async load (
|
|
12
19
|
path: string,
|
|
@@ -32,13 +39,13 @@ class GS3DLoaderPlugin {
|
|
|
32
39
|
async loads (
|
|
33
40
|
options: ScenesOption[],
|
|
34
41
|
viewer?: DropInViewer,
|
|
35
|
-
showLoadingUI = false
|
|
36
|
-
|
|
42
|
+
showLoadingUI = false,
|
|
43
|
+
onProgress?: ( totalPercent: number, percentLabel: string, loaderStatus: LoaderStatus ) => void
|
|
37
44
|
) {
|
|
38
45
|
|
|
39
46
|
if ( !viewer ) viewer = this.createViewer()
|
|
40
47
|
|
|
41
|
-
await viewer.addSplatScenes( options, showLoadingUI )
|
|
48
|
+
await viewer.addSplatScenes( options, showLoadingUI, onProgress )
|
|
42
49
|
|
|
43
50
|
const count = viewer.getSceneCount()
|
|
44
51
|
|
package/src/types.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface SceneOption {
|
|
|
20
20
|
scale?: Array<number>;
|
|
21
21
|
showLoadingUI?: boolean;
|
|
22
22
|
headers?: Headers;
|
|
23
|
-
onProgress?: () => void;
|
|
23
|
+
onProgress?: ( percentComplete: number, percentCompleteLabel: string, loaderStatus: LoaderStatus ) => void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface ScenesOption {
|
|
@@ -37,7 +37,7 @@ export interface DropInViewer extends Group {
|
|
|
37
37
|
viewer: any;
|
|
38
38
|
updateSplatMesh: () => void;
|
|
39
39
|
addSplatScene: ( path: string, options?: SceneOption ) => Promise<void>;
|
|
40
|
-
addSplatScenes: ( sceneOptions: ScenesOption[], showLoadingUI: boolean ) => Promise<void>;
|
|
40
|
+
addSplatScenes: ( sceneOptions: ScenesOption[], showLoadingUI: boolean, onProgress?: ( percentComplete: number, percentCompleteLabel: string, loaderStatus: LoaderStatus ) => void ) => Promise<void>;
|
|
41
41
|
getSplatScene: ( sceneIndex: number ) => SplatScene;
|
|
42
42
|
removeSplatScene: ( index: number ) => Promise<void>;
|
|
43
43
|
removeSplatScenes: ( indexes: number[] ) => Promise<void>;
|