@stowkit/three-loader 0.1.9 → 0.1.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/README.md +25 -28
- package/dist/StowKitLoader.d.ts +23 -198
- package/dist/StowKitLoader.d.ts.map +1 -1
- package/dist/StowKitPack.d.ts +132 -0
- package/dist/StowKitPack.d.ts.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/stowkit-three-loader.esm.js +308 -550
- package/dist/stowkit-three-loader.esm.js.map +1 -1
- package/dist/stowkit-three-loader.js +308 -550
- package/dist/stowkit-three-loader.js.map +1 -1
- package/package.json +3 -2
- package/scripts/postinstall.js +18 -0
package/README.md
CHANGED
|
@@ -11,24 +11,20 @@ npm install @stowkit/three-loader three
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import * as THREE from 'three';
|
|
15
14
|
import { StowKitLoader } from '@stowkit/three-loader';
|
|
16
15
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// Draco decoder: /stowkit/draco/ (auto-included)
|
|
20
|
-
const loader = new StowKitLoader();
|
|
21
|
-
|
|
22
|
-
// Optional: Override paths only if you have custom locations
|
|
23
|
-
// loader.setTranscoderPath('/custom-basis-path/');
|
|
24
|
-
// loader.setDracoDecoderPath('/custom-draco-path/');
|
|
16
|
+
// Load a pack (auto-initializes with defaults)
|
|
17
|
+
const pack = await StowKitLoader.load('assets.stow');
|
|
25
18
|
|
|
26
|
-
//
|
|
27
|
-
await
|
|
19
|
+
// Load assets by name - simple and clean!
|
|
20
|
+
const mesh = await pack.loadMesh('models/character');
|
|
21
|
+
const texture = await pack.loadTexture('textures/wood');
|
|
22
|
+
const audio = await pack.loadAudio('sounds/bgm', audioListener);
|
|
28
23
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
// Use in Three.js
|
|
25
|
+
scene.add(mesh);
|
|
26
|
+
material.map = texture;
|
|
27
|
+
audio.play();
|
|
32
28
|
```
|
|
33
29
|
|
|
34
30
|
## Features
|
|
@@ -45,29 +41,30 @@ threeScene.add(scene);
|
|
|
45
41
|
|
|
46
42
|
## API Reference
|
|
47
43
|
|
|
48
|
-
###
|
|
44
|
+
### Loading Packs
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
new StowKitLoader(manager?: THREE.LoadingManager, parameters?: StowKitLoaderParameters)
|
|
52
|
-
```
|
|
46
|
+
#### `StowKitLoader.load(url: string, options?: StowKitLoaderOptions): Promise<StowKitPack>`
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
Load a .stow pack file. Returns a `StowKitPack` instance for loading assets.
|
|
49
|
+
|
|
50
|
+
**Options (all optional):**
|
|
55
51
|
```typescript
|
|
56
|
-
interface
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
interface StowKitLoaderOptions {
|
|
53
|
+
basisPath?: string; // Path to Basis Universal transcoder (default: '/stowkit/basis/')
|
|
54
|
+
dracoPath?: string; // Path to Draco decoder (default: '/stowkit/draco/')
|
|
55
|
+
wasmPath?: string; // Path to WASM reader module (default: '/stowkit_reader.wasm')
|
|
60
56
|
}
|
|
61
57
|
```
|
|
62
58
|
|
|
63
|
-
**
|
|
59
|
+
**Examples:**
|
|
64
60
|
```typescript
|
|
65
|
-
// Default
|
|
66
|
-
const
|
|
61
|
+
// Default paths (recommended)
|
|
62
|
+
const pack = await StowKitLoader.load('assets.stow');
|
|
67
63
|
|
|
68
64
|
// Custom paths
|
|
69
|
-
const
|
|
70
|
-
|
|
65
|
+
const pack = await StowKitLoader.load('game.stow', {
|
|
66
|
+
basisPath: '/custom/basis/',
|
|
67
|
+
dracoPath: '/custom/draco/',
|
|
71
68
|
wasmPath: '/custom/stowkit_reader.wasm'
|
|
72
69
|
});
|
|
73
70
|
```
|
package/dist/StowKitLoader.d.ts
CHANGED
|
@@ -1,219 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export interface StowKitLoaderParameters {
|
|
1
|
+
import { StowKitPack } from './StowKitPack';
|
|
2
|
+
export interface StowKitLoaderOptions {
|
|
4
3
|
/**
|
|
5
4
|
* Path to basis transcoder for KTX2 texture loading
|
|
6
|
-
* @default '/basis/'
|
|
5
|
+
* @default '/stowkit/basis/'
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
basisPath?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Path to Draco decoder for mesh decompression
|
|
10
|
+
* @default '/stowkit/draco/'
|
|
11
|
+
*/
|
|
12
|
+
dracoPath?: string;
|
|
9
13
|
/**
|
|
10
14
|
* Path to WASM reader module
|
|
11
15
|
* @default '/stowkit_reader.wasm'
|
|
12
16
|
*/
|
|
13
17
|
wasmPath?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Custom StowKitReader instance (optional)
|
|
16
|
-
*/
|
|
17
|
-
reader?: StowKitReader;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Three.js loader for StowKit asset packs
|
|
20
|
+
* Three.js loader for StowKit asset packs
|
|
21
21
|
*
|
|
22
22
|
* Usage:
|
|
23
23
|
* ```typescript
|
|
24
|
-
* const
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* loader.loadMesh('assets.stow', 'path/to/mesh', (scene) => {
|
|
29
|
-
* threeScene.add(scene);
|
|
30
|
-
* });
|
|
24
|
+
* const pack = await StowKitLoader.load('assets.stow');
|
|
25
|
+
* const mesh = await pack.loadMesh('models/character');
|
|
26
|
+
* const texture = await pack.loadTexture('textures/diffuse');
|
|
27
|
+
* const audio = await pack.loadAudio('sounds/bgm', listener);
|
|
31
28
|
* ```
|
|
32
29
|
*/
|
|
33
|
-
export declare class StowKitLoader
|
|
34
|
-
private reader;
|
|
35
|
-
private ktx2Loader;
|
|
36
|
-
private dracoLoader;
|
|
37
|
-
private
|
|
38
|
-
constructor(manager?: THREE.LoadingManager, parameters?: StowKitLoaderParameters);
|
|
39
|
-
/**
|
|
40
|
-
* Set the path to the Draco decoder
|
|
41
|
-
*/
|
|
42
|
-
setDracoDecoderPath(path: string): this;
|
|
43
|
-
/**
|
|
44
|
-
* Set the path to the Basis Universal transcoder
|
|
45
|
-
*/
|
|
46
|
-
setTranscoderPath(path: string): this;
|
|
47
|
-
/**
|
|
48
|
-
* Detect WebGL support for compressed textures
|
|
49
|
-
*/
|
|
50
|
-
detectSupport(renderer: THREE.WebGLRenderer): this;
|
|
51
|
-
/**
|
|
52
|
-
* Open a .stow pack file (call this first if loading multiple assets)
|
|
53
|
-
* @param url - URL to the .stow file
|
|
54
|
-
*/
|
|
55
|
-
openPack(url: string): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Load and parse a mesh asset by its index
|
|
58
|
-
* @param index - Asset index
|
|
59
|
-
* @param onLoad - Callback when loading completes
|
|
60
|
-
* @param onProgress - Progress callback
|
|
61
|
-
* @param onError - Error callback
|
|
62
|
-
*/
|
|
63
|
-
loadMeshByIndex(index: number, onLoad?: (scene: THREE.Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: Error) => void): Promise<THREE.Group>;
|
|
64
|
-
/**
|
|
65
|
-
* Load and parse a mesh asset from a StowKit pack
|
|
66
|
-
* @param url - URL to the .stow file (or omit if already opened with openPack)
|
|
67
|
-
* @param assetPath - Path to the mesh asset within the pack
|
|
68
|
-
* @param onLoad - Callback when loading completes
|
|
69
|
-
* @param onProgress - Progress callback
|
|
70
|
-
* @param onError - Error callback
|
|
71
|
-
*/
|
|
72
|
-
loadMesh(url: string, assetPath: string, onLoad?: (scene: THREE.Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: Error) => void): Promise<THREE.Group>;
|
|
73
|
-
/**
|
|
74
|
-
* Load textures for materials
|
|
75
|
-
*/
|
|
76
|
-
private loadMaterialTextures;
|
|
77
|
-
/**
|
|
78
|
-
* Load a KTX2 texture from binary data
|
|
79
|
-
*/
|
|
80
|
-
private loadKTX2Texture;
|
|
81
|
-
/**
|
|
82
|
-
* Apply texture to appropriate material property
|
|
83
|
-
*/
|
|
84
|
-
private applyTextureToMaterial;
|
|
85
|
-
/**
|
|
86
|
-
* Load a texture asset from a StowKit pack
|
|
87
|
-
* @param url - URL to the .stow file (or omit if already opened with openPack)
|
|
88
|
-
* @param assetPath - Path to the texture asset within the pack
|
|
89
|
-
* @param onLoad - Callback when loading completes
|
|
90
|
-
* @param onProgress - Progress callback
|
|
91
|
-
* @param onError - Error callback
|
|
92
|
-
*/
|
|
93
|
-
loadTexture(url: string, assetPath: string, onLoad?: (texture: THREE.CompressedTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: Error) => void): Promise<THREE.CompressedTexture>;
|
|
94
|
-
/**
|
|
95
|
-
* Load a texture asset by its index in the pack
|
|
96
|
-
* @param index - Asset index
|
|
97
|
-
* @param onLoad - Callback when loading completes
|
|
98
|
-
* @param onProgress - Progress callback
|
|
99
|
-
* @param onError - Error callback
|
|
100
|
-
*/
|
|
101
|
-
loadTextureByIndex(index: number, onLoad?: (texture: THREE.CompressedTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: Error) => void): Promise<THREE.CompressedTexture>;
|
|
102
|
-
/**
|
|
103
|
-
* Load an audio asset from a StowKit pack
|
|
104
|
-
* @param url - URL to the .stow file (or omit if already opened with openPack)
|
|
105
|
-
* @param assetPath - Path to the audio asset within the pack
|
|
106
|
-
* @param listener - THREE.AudioListener to attach to
|
|
107
|
-
* @param onLoad - Callback when loading completes
|
|
108
|
-
* @param onProgress - Progress callback
|
|
109
|
-
* @param onError - Error callback
|
|
110
|
-
*/
|
|
111
|
-
loadAudio(url: string, assetPath: string, listener: THREE.AudioListener, onLoad?: (audio: THREE.Audio) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: Error) => void): Promise<THREE.Audio>;
|
|
112
|
-
/**
|
|
113
|
-
* Get metadata for an audio asset
|
|
114
|
-
* @param assetPath - Path to the audio asset within the pack
|
|
115
|
-
*/
|
|
116
|
-
getAudioMetadata(assetPath: string): {
|
|
117
|
-
stringId: string;
|
|
118
|
-
sampleRate: number;
|
|
119
|
-
channels: number;
|
|
120
|
-
durationMs: number;
|
|
121
|
-
} | null;
|
|
122
|
-
/**
|
|
123
|
-
* Get metadata for a texture asset
|
|
124
|
-
* @param assetPath - Path to the texture asset within the pack
|
|
125
|
-
*/
|
|
126
|
-
getTextureMetadata(assetPath: string): {
|
|
127
|
-
width: number;
|
|
128
|
-
height: number;
|
|
129
|
-
channels: number;
|
|
130
|
-
isKtx2: boolean;
|
|
131
|
-
channelFormat: number;
|
|
132
|
-
stringId: string;
|
|
133
|
-
} | null;
|
|
134
|
-
/**
|
|
135
|
-
* Load material schema information by index
|
|
136
|
-
* @param index - Asset index
|
|
137
|
-
*/
|
|
138
|
-
loadMaterialSchemaByIndex(index: number): {
|
|
139
|
-
stringId: string;
|
|
140
|
-
schemaName: string;
|
|
141
|
-
fields: Array<{
|
|
142
|
-
name: string;
|
|
143
|
-
type: 'Texture' | 'Color' | 'Float' | 'Vec2' | 'Vec3' | 'Vec4' | 'Int';
|
|
144
|
-
previewFlag: 'None' | 'MainTex' | 'Tint';
|
|
145
|
-
defaultValue: [number, number, number, number];
|
|
146
|
-
}>;
|
|
147
|
-
} | null;
|
|
148
|
-
/**
|
|
149
|
-
* Load material schema information by path
|
|
150
|
-
* @param assetPath - Path to the material schema asset
|
|
151
|
-
*/
|
|
152
|
-
loadMaterialSchema(assetPath: string): {
|
|
153
|
-
stringId: string;
|
|
154
|
-
schemaName: string;
|
|
155
|
-
fields: Array<{
|
|
156
|
-
name: string;
|
|
157
|
-
type: 'Texture' | 'Color' | 'Float' | 'Vec2' | 'Vec3' | 'Vec4' | 'Int';
|
|
158
|
-
previewFlag: 'None' | 'MainTex' | 'Tint';
|
|
159
|
-
defaultValue: [number, number, number, number];
|
|
160
|
-
}>;
|
|
161
|
-
} | null;
|
|
162
|
-
/**
|
|
163
|
-
* Get material information from a loaded mesh
|
|
164
|
-
* Returns material data including properties and texture references
|
|
165
|
-
*/
|
|
166
|
-
getMeshMaterials(assetPath: string): Array<{
|
|
167
|
-
name: string;
|
|
168
|
-
schemaId: string;
|
|
169
|
-
properties: Array<{
|
|
170
|
-
fieldName: string;
|
|
171
|
-
value: [number, number, number, number];
|
|
172
|
-
textureId: string;
|
|
173
|
-
}>;
|
|
174
|
-
}> | null;
|
|
175
|
-
/**
|
|
176
|
-
* Open a .stow file from a File or ArrayBuffer
|
|
177
|
-
*/
|
|
178
|
-
open(fileOrBuffer: ArrayBuffer | File): Promise<boolean>;
|
|
179
|
-
/**
|
|
180
|
-
* Get the total number of assets
|
|
181
|
-
*/
|
|
182
|
-
getAssetCount(): number;
|
|
183
|
-
/**
|
|
184
|
-
* Get info about a specific asset
|
|
185
|
-
*/
|
|
186
|
-
getAssetInfo(index: number): any;
|
|
187
|
-
/**
|
|
188
|
-
* Read asset data by index
|
|
189
|
-
*/
|
|
190
|
-
readAssetData(index: number): Uint8Array | null;
|
|
191
|
-
/**
|
|
192
|
-
* Read asset metadata by index
|
|
193
|
-
*/
|
|
194
|
-
readAssetMetadata(index: number): Uint8Array | null;
|
|
195
|
-
/**
|
|
196
|
-
* Parse texture metadata
|
|
197
|
-
*/
|
|
198
|
-
parseTextureMetadata(metadataBytes: Uint8Array): any;
|
|
199
|
-
/**
|
|
200
|
-
* Create an HTML audio element for preview
|
|
201
|
-
* @param index - Asset index
|
|
202
|
-
*/
|
|
203
|
-
createAudioPreview(index: number): Promise<HTMLAudioElement>;
|
|
30
|
+
export declare class StowKitLoader {
|
|
31
|
+
private static reader;
|
|
32
|
+
private static ktx2Loader;
|
|
33
|
+
private static dracoLoader;
|
|
34
|
+
private static initialized;
|
|
204
35
|
/**
|
|
205
|
-
*
|
|
36
|
+
* Load a .stow pack file
|
|
206
37
|
*/
|
|
207
|
-
|
|
208
|
-
index: number;
|
|
209
|
-
name?: string;
|
|
210
|
-
type: number;
|
|
211
|
-
dataSize: number;
|
|
212
|
-
metadataSize: number;
|
|
213
|
-
}>;
|
|
38
|
+
static load(url: string, options?: StowKitLoaderOptions): Promise<StowKitPack>;
|
|
214
39
|
/**
|
|
215
|
-
*
|
|
40
|
+
* Initialize the loader (called automatically on first load)
|
|
216
41
|
*/
|
|
217
|
-
|
|
42
|
+
private static initialize;
|
|
218
43
|
}
|
|
219
44
|
//# sourceMappingURL=StowKitLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StowKitLoader.d.ts","sourceRoot":"","sources":["../src/StowKitLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StowKitLoader.d.ts","sourceRoot":"","sources":["../src/StowKitLoader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAC,MAAM,CAA8B;IACnD,OAAO,CAAC,MAAM,CAAC,UAAU,CAA2B;IACpD,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4B;IACtD,OAAO,CAAC,MAAM,CAAC,WAAW,CAAS;IAEnC;;OAEG;WACU,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBpF;;OAEG;mBACkB,UAAU;CAwBlC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
3
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
4
|
+
import { StowKitReader } from '@stowkit/reader';
|
|
5
|
+
/**
|
|
6
|
+
* Represents an opened StowKit pack with methods to load assets by name
|
|
7
|
+
*/
|
|
8
|
+
export declare class StowKitPack {
|
|
9
|
+
private reader;
|
|
10
|
+
private ktx2Loader;
|
|
11
|
+
private dracoLoader;
|
|
12
|
+
constructor(reader: StowKitReader, ktx2Loader: KTX2Loader, dracoLoader: DRACOLoader);
|
|
13
|
+
/**
|
|
14
|
+
* Load a mesh by its canonical path/name
|
|
15
|
+
*/
|
|
16
|
+
loadMesh(assetPath: string): Promise<THREE.Group>;
|
|
17
|
+
/**
|
|
18
|
+
* Load a texture by its canonical path/name
|
|
19
|
+
*/
|
|
20
|
+
loadTexture(assetPath: string): Promise<THREE.CompressedTexture>;
|
|
21
|
+
/**
|
|
22
|
+
* Load audio by its canonical path/name
|
|
23
|
+
*/
|
|
24
|
+
loadAudio(assetPath: string, listener: THREE.AudioListener): Promise<THREE.Audio>;
|
|
25
|
+
/**
|
|
26
|
+
* Get list of all assets in pack
|
|
27
|
+
*/
|
|
28
|
+
listAssets(): import("@stowkit/reader").AssetListItem[];
|
|
29
|
+
/**
|
|
30
|
+
* Get asset count
|
|
31
|
+
*/
|
|
32
|
+
getAssetCount(): number;
|
|
33
|
+
/**
|
|
34
|
+
* Get asset info by index
|
|
35
|
+
*/
|
|
36
|
+
getAssetInfo(index: number): any;
|
|
37
|
+
/**
|
|
38
|
+
* Read asset data by index
|
|
39
|
+
*/
|
|
40
|
+
readAssetData(index: number): Uint8Array | null;
|
|
41
|
+
/**
|
|
42
|
+
* Read asset metadata by index
|
|
43
|
+
*/
|
|
44
|
+
readAssetMetadata(index: number): Uint8Array | null;
|
|
45
|
+
/**
|
|
46
|
+
* Parse texture metadata
|
|
47
|
+
*/
|
|
48
|
+
parseTextureMetadata(metadataBytes: Uint8Array): any;
|
|
49
|
+
/**
|
|
50
|
+
* Load mesh by index
|
|
51
|
+
*/
|
|
52
|
+
loadMeshByIndex(index: number): Promise<THREE.Group>;
|
|
53
|
+
/**
|
|
54
|
+
* Load texture by index
|
|
55
|
+
*/
|
|
56
|
+
loadTextureByIndex(index: number): Promise<THREE.CompressedTexture>;
|
|
57
|
+
/**
|
|
58
|
+
* Create HTML audio preview element
|
|
59
|
+
*/
|
|
60
|
+
createAudioPreview(index: number): Promise<HTMLAudioElement>;
|
|
61
|
+
/**
|
|
62
|
+
* Get audio metadata by path
|
|
63
|
+
*/
|
|
64
|
+
getAudioMetadata(assetPath: string): {
|
|
65
|
+
stringId: string;
|
|
66
|
+
sampleRate: number;
|
|
67
|
+
channels: number;
|
|
68
|
+
durationMs: number;
|
|
69
|
+
} | null;
|
|
70
|
+
/**
|
|
71
|
+
* Load material schema by index
|
|
72
|
+
*/
|
|
73
|
+
loadMaterialSchemaByIndex(index: number): {
|
|
74
|
+
stringId: string;
|
|
75
|
+
schemaName: string;
|
|
76
|
+
fields: {
|
|
77
|
+
name: string;
|
|
78
|
+
type: "Texture" | "Color" | "Float" | "Vec2" | "Vec3" | "Vec4" | "Int";
|
|
79
|
+
previewFlag: "None" | "MainTex" | "Tint";
|
|
80
|
+
defaultValue: [number, number, number, number];
|
|
81
|
+
}[];
|
|
82
|
+
} | null;
|
|
83
|
+
/**
|
|
84
|
+
* Get mesh materials by index
|
|
85
|
+
*/
|
|
86
|
+
getMeshMaterialsByIndex(index: number): {
|
|
87
|
+
name: string;
|
|
88
|
+
schemaId: string;
|
|
89
|
+
propertyCount: number;
|
|
90
|
+
properties: Array<{
|
|
91
|
+
fieldName: string;
|
|
92
|
+
value: [number, number, number, number];
|
|
93
|
+
textureId: string;
|
|
94
|
+
}>;
|
|
95
|
+
}[] | null;
|
|
96
|
+
/**
|
|
97
|
+
* Get material schema information
|
|
98
|
+
*/
|
|
99
|
+
getMaterialSchema(assetPath: string): {
|
|
100
|
+
stringId: string;
|
|
101
|
+
schemaName: string;
|
|
102
|
+
fields: {
|
|
103
|
+
name: string;
|
|
104
|
+
type: "Texture" | "Color" | "Float" | "Vec2" | "Vec3" | "Vec4" | "Int";
|
|
105
|
+
previewFlag: "None" | "MainTex" | "Tint";
|
|
106
|
+
defaultValue: [number, number, number, number];
|
|
107
|
+
}[];
|
|
108
|
+
} | null;
|
|
109
|
+
/**
|
|
110
|
+
* Get mesh materials information
|
|
111
|
+
*/
|
|
112
|
+
getMeshMaterials(assetPath: string): {
|
|
113
|
+
name: string;
|
|
114
|
+
schemaId: string;
|
|
115
|
+
propertyCount: number;
|
|
116
|
+
properties: Array<{
|
|
117
|
+
fieldName: string;
|
|
118
|
+
value: [number, number, number, number];
|
|
119
|
+
textureId: string;
|
|
120
|
+
}>;
|
|
121
|
+
}[] | null;
|
|
122
|
+
/**
|
|
123
|
+
* Close the pack and free resources
|
|
124
|
+
*/
|
|
125
|
+
dispose(): void;
|
|
126
|
+
private loadMaterialTextures;
|
|
127
|
+
private loadKTX2Texture;
|
|
128
|
+
private applyTextureToMaterial;
|
|
129
|
+
private loadMaterialSchemaByIndex_internal;
|
|
130
|
+
private getMeshMaterialsByIndex_internal;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=StowKitPack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StowKitPack.d.ts","sourceRoot":"","sources":["../src/StowKitPack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW;IAMnF;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;IA+BvD;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAiBtE;;OAEG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;IA0BvF;;OAEG;IACH,UAAU;IAIV;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG;IAIhC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAI/C;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAInD;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,UAAU,GAAG,GAAG;IAIpD;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;IAY1D;;OAEG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAMzE;;OAEG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiBlE;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM;;;;;;IAsBlC;;OAEG;IACH,yBAAyB,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;IAIvC;;OAEG;IACH,uBAAuB,CAAC,KAAK,EAAE,MAAM;cA6KvB,MAAM;kBACF,MAAM;uBACD,MAAM;oBACT,KAAK,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACxC,SAAS,EAAE,MAAM,CAAC;SACrB,CAAC;;IAhLV;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;IAOnC;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM;cA4JpB,MAAM;kBACF,MAAM;uBACD,MAAM;oBACT,KAAK,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACxC,SAAS,EAAE,MAAM,CAAC;SACrB,CAAC;;IA5JV;;OAEG;IACH,OAAO,IAAI,IAAI;YAKD,oBAAoB;YA8BpB,eAAe;IA2B7B,OAAO,CAAC,sBAAsB;IAuB9B,OAAO,CAAC,kCAAkC;IA8C1C,OAAO,CAAC,gCAAgC;CA+D3C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Three.js loader for StowKit asset packs
|
|
4
4
|
*/
|
|
5
5
|
export { StowKitLoader } from './StowKitLoader';
|
|
6
|
-
export {
|
|
6
|
+
export { StowKitPack } from './StowKitPack';
|
|
7
|
+
export type { StowKitLoaderOptions } from './StowKitLoader';
|
|
7
8
|
export type { MeshGeometryInfo, MaterialPropertyValue, MaterialData, Node, MeshMetadata } from './MeshParser';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACR,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,IAAI,EACJ,YAAY,EACf,MAAM,cAAc,CAAC"}
|