@onerjs/loaders 8.56.1 → 8.56.2
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/SPLAT/gaussianSplattingStream.d.ts +31 -0
- package/SPLAT/gaussianSplattingStream.js +49 -0
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/USD/index.d.ts +2 -0
- package/USD/index.js +4 -0
- package/USD/index.js.map +1 -0
- package/USD/pure.d.ts +3 -0
- package/USD/pure.js +5 -0
- package/USD/pure.js.map +1 -0
- package/USD/usdCommandProtocol.d.ts +83 -0
- package/USD/usdCommandProtocol.js +173 -0
- package/USD/usdCommandProtocol.js.map +1 -0
- package/USD/usdFileLoader.d.ts +6 -0
- package/USD/usdFileLoader.js +9 -0
- package/USD/usdFileLoader.js.map +1 -0
- package/USD/usdFileLoader.metadata.d.ts +20 -0
- package/USD/usdFileLoader.metadata.js +18 -0
- package/USD/usdFileLoader.metadata.js.map +1 -0
- package/USD/usdFileLoader.pure.d.ts +102 -0
- package/USD/usdFileLoader.pure.js +341 -0
- package/USD/usdFileLoader.pure.js.map +1 -0
- package/USD/usdFileLoader.types.d.ts +11 -0
- package/USD/usdFileLoader.types.js +2 -0
- package/USD/usdFileLoader.types.js.map +1 -0
- package/USD/usdLoadingOptions.d.ts +123 -0
- package/USD/usdLoadingOptions.js +3 -0
- package/USD/usdLoadingOptions.js.map +1 -0
- package/USD/usdSceneMaterializer.d.ts +9 -0
- package/USD/usdSceneMaterializer.js +982 -0
- package/USD/usdSceneMaterializer.js.map +1 -0
- package/USD/usdWorkerMessages.d.ts +57 -0
- package/USD/usdWorkerMessages.js +3 -0
- package/USD/usdWorkerMessages.js.map +1 -0
- package/dynamic.js +10 -0
- package/dynamic.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/pure.d.ts +1 -0
- package/pure.js +1 -0
- package/pure.js.map +1 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/** This file must only contain pure code and pure imports */
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
import { RegisterInstancedMesh } from "@onerjs/core/Meshes/instancedMesh.pure.js";
|
|
4
|
+
import { RegisterThinInstanceMesh } from "@onerjs/core/Meshes/thinInstanceMesh.pure.js";
|
|
5
|
+
import { RegisterPbrMaterial } from "@onerjs/core/Materials/PBR/pbrMaterial.pure.js";
|
|
6
|
+
import { Tools } from "@onerjs/core/Misc/tools.pure.js";
|
|
7
|
+
import { AssetContainer } from "@onerjs/core/assetContainer.js";
|
|
8
|
+
import { RegisterSceneLoaderPlugin, } from "@onerjs/core/Loading/sceneLoader.js";
|
|
9
|
+
import { USDFileLoaderMetadata } from "./usdFileLoader.metadata.js";
|
|
10
|
+
import { materializeCommandBuffers } from "./usdSceneMaterializer.js";
|
|
11
|
+
import { PROTOCOL_VERSION } from "./usdCommandProtocol.js";
|
|
12
|
+
const _DefaultAssetRootUrl = `${Tools._DefaultCdnUrl}/babylonUsdImporter/${PROTOCOL_VERSION}/`;
|
|
13
|
+
const _SupportedExtension = /\.(?:usd|usda|usdc|usdz)$/i;
|
|
14
|
+
function _toBytes(input) {
|
|
15
|
+
if (input instanceof Uint8Array) {
|
|
16
|
+
return input.slice();
|
|
17
|
+
}
|
|
18
|
+
if (input instanceof ArrayBuffer) {
|
|
19
|
+
return new Uint8Array(input.slice(0));
|
|
20
|
+
}
|
|
21
|
+
return new Uint8Array(input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength));
|
|
22
|
+
}
|
|
23
|
+
function _normalizeFiles(files) {
|
|
24
|
+
if (!files) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const normalized = {};
|
|
28
|
+
for (const [path, input] of Object.entries(files)) {
|
|
29
|
+
normalized[path] = _toBytes(input);
|
|
30
|
+
}
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
function _stagedFileName(fileName, bytes, preserveUrlCharacters) {
|
|
34
|
+
const normalizedFileName = fileName?.replace(/\\/g, "/").replace(/^\.\/+/, "");
|
|
35
|
+
const cleanFileName = preserveUrlCharacters ? normalizedFileName : normalizedFileName?.split(/[?#]/, 1)[0];
|
|
36
|
+
const pathParts = cleanFileName?.split("/").filter(Boolean);
|
|
37
|
+
if (cleanFileName && !cleanFileName.startsWith("/") && pathParts?.length && !pathParts.includes("..") && _SupportedExtension.test(cleanFileName)) {
|
|
38
|
+
return pathParts.join("/");
|
|
39
|
+
}
|
|
40
|
+
const isZip = bytes.length >= 4 && bytes[0] === 0x50 && bytes[1] === 0x4b && bytes[2] === 0x03 && bytes[3] === 0x04;
|
|
41
|
+
return isZip ? "scene.usdz" : "scene.usd";
|
|
42
|
+
}
|
|
43
|
+
function _toAsyncResult(container) {
|
|
44
|
+
return {
|
|
45
|
+
meshes: container.meshes,
|
|
46
|
+
particleSystems: container.particleSystems,
|
|
47
|
+
skeletons: container.skeletons,
|
|
48
|
+
animationGroups: container.animationGroups,
|
|
49
|
+
transformNodes: container.transformNodes,
|
|
50
|
+
geometries: container.geometries,
|
|
51
|
+
lights: container.lights,
|
|
52
|
+
spriteManagers: container.spriteManagers,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* OpenUSD scene loader backed by a WebAssembly command-buffer extractor.
|
|
57
|
+
*/
|
|
58
|
+
export class USDFileLoader {
|
|
59
|
+
/**
|
|
60
|
+
* Creates a USD loader.
|
|
61
|
+
* @param options Options controlling worker assets, supporting files, and diagnostics.
|
|
62
|
+
*/
|
|
63
|
+
constructor(options = {}) {
|
|
64
|
+
/**
|
|
65
|
+
* Defines the name of the plugin.
|
|
66
|
+
*/
|
|
67
|
+
this.name = USDFileLoaderMetadata.name;
|
|
68
|
+
/**
|
|
69
|
+
* Defines the extensions the plugin can load.
|
|
70
|
+
*/
|
|
71
|
+
this.extensions = USDFileLoaderMetadata.extensions;
|
|
72
|
+
this._nextRequestId = 1;
|
|
73
|
+
this._pending = new Map();
|
|
74
|
+
this._activeLoads = new Set();
|
|
75
|
+
this._options = {
|
|
76
|
+
...options,
|
|
77
|
+
resolveByFileName: options.resolveByFileName ?? true,
|
|
78
|
+
glueUrl: options.glueUrl ?? USDFileLoader.DefaultConfiguration.glueUrl,
|
|
79
|
+
wasmUrl: options.wasmUrl ?? USDFileLoader.DefaultConfiguration.wasmUrl,
|
|
80
|
+
dataUrl: options.dataUrl ?? USDFileLoader.DefaultConfiguration.dataUrl,
|
|
81
|
+
workerUrl: options.workerUrl ?? USDFileLoader.DefaultConfiguration.workerUrl,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Creates a configured plugin instance for a SceneLoader operation.
|
|
86
|
+
* @param options SceneLoader plugin options.
|
|
87
|
+
* @returns The configured USD loader.
|
|
88
|
+
*/
|
|
89
|
+
createPlugin(options) {
|
|
90
|
+
_RegisterUSDLoaderDependencies();
|
|
91
|
+
return new USDFileLoader(options[USDFileLoaderMetadata.name]);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Imports all objects from a USD stage into a scene.
|
|
95
|
+
* @param _meshesNames Mesh name filtering is not currently supported.
|
|
96
|
+
* @param scene The scene receiving the imported objects.
|
|
97
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
98
|
+
* @param rootUrl The source root URL.
|
|
99
|
+
* @param onProgress SceneLoader progress callback.
|
|
100
|
+
* @param fileName Name of the root USD layer.
|
|
101
|
+
* @returns The imported Babylon.js objects.
|
|
102
|
+
*/
|
|
103
|
+
async importMeshAsync(_meshesNames, scene, data, rootUrl, onProgress, fileName) {
|
|
104
|
+
const result = await this._loadAsync(scene, data, rootUrl, onProgress, fileName, true);
|
|
105
|
+
return _toAsyncResult(result.container);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Loads a USD stage into a scene.
|
|
109
|
+
* @param scene The scene receiving the imported objects.
|
|
110
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
111
|
+
* @param rootUrl The source root URL.
|
|
112
|
+
* @param onProgress SceneLoader progress callback.
|
|
113
|
+
* @param fileName Name of the root USD layer.
|
|
114
|
+
*/
|
|
115
|
+
async loadAsync(scene, data, rootUrl, onProgress, fileName) {
|
|
116
|
+
await this._loadAsync(scene, data, rootUrl, onProgress, fileName, true);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Loads a USD stage into an asset container.
|
|
120
|
+
* @param scene The scene used to create imported objects.
|
|
121
|
+
* @param data The USD, USDA, USDC, or USDZ bytes.
|
|
122
|
+
* @param rootUrl The source root URL.
|
|
123
|
+
* @param onProgress SceneLoader progress callback.
|
|
124
|
+
* @param fileName Name of the root USD layer.
|
|
125
|
+
* @returns The populated asset container.
|
|
126
|
+
*/
|
|
127
|
+
async loadAssetContainerAsync(scene, data, rootUrl, onProgress, fileName) {
|
|
128
|
+
const container = (await this._loadAsync(scene, data, rootUrl, onProgress, fileName, false)).container;
|
|
129
|
+
if (!(container instanceof AssetContainer)) {
|
|
130
|
+
throw new Error("USDFileLoader failed to create an asset container.");
|
|
131
|
+
}
|
|
132
|
+
return container;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Releases the worker and rejects pending loads.
|
|
136
|
+
*/
|
|
137
|
+
dispose() {
|
|
138
|
+
this._terminateWorker();
|
|
139
|
+
const error = new Error("USDFileLoader was disposed.");
|
|
140
|
+
for (const controller of this._activeLoads) {
|
|
141
|
+
controller.abort(error);
|
|
142
|
+
}
|
|
143
|
+
for (const request of this._pending.values()) {
|
|
144
|
+
request.reject(error);
|
|
145
|
+
}
|
|
146
|
+
this._pending.clear();
|
|
147
|
+
}
|
|
148
|
+
async _loadAsync(scene, data, _rootUrl, onProgress, fileName, addToScene) {
|
|
149
|
+
if (!(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data)) {
|
|
150
|
+
throw new Error("USDFileLoader expects binary USD data.");
|
|
151
|
+
}
|
|
152
|
+
const bytes = _toBytes(data);
|
|
153
|
+
const files = _normalizeFiles(this._options.files);
|
|
154
|
+
const requestId = this._nextRequestId++;
|
|
155
|
+
const request = {
|
|
156
|
+
type: "extract",
|
|
157
|
+
requestId,
|
|
158
|
+
asset: {
|
|
159
|
+
bytes,
|
|
160
|
+
files,
|
|
161
|
+
fileName: _stagedFileName(this._options.rootFileName ?? fileName, bytes, this._options.rootFileName !== undefined),
|
|
162
|
+
resolveByFileName: this._options.resolveByFileName ?? true,
|
|
163
|
+
glueUrl: this._options.glueUrl,
|
|
164
|
+
wasmUrl: this._options.wasmUrl,
|
|
165
|
+
dataUrl: this._options.dataUrl,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
const transfer = [...new Set([bytes.buffer, ...Object.values(files ?? {}).map((file) => file.buffer)])];
|
|
169
|
+
const controller = new AbortController();
|
|
170
|
+
const signal = controller.signal;
|
|
171
|
+
this._activeLoads.add(controller);
|
|
172
|
+
try {
|
|
173
|
+
const worker = this._getWorker(this._options.workerUrl);
|
|
174
|
+
const response = await new Promise((resolve, reject) => {
|
|
175
|
+
this._pending.set(requestId, {
|
|
176
|
+
resolve,
|
|
177
|
+
reject,
|
|
178
|
+
onProgress: (progress) => {
|
|
179
|
+
this._options.onProgress?.(progress);
|
|
180
|
+
onProgress?.({
|
|
181
|
+
lengthComputable: false,
|
|
182
|
+
loaded: _ProgressPhaseIndex[progress.phase],
|
|
183
|
+
total: 4,
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
onLog: this._options.onLog,
|
|
187
|
+
});
|
|
188
|
+
try {
|
|
189
|
+
worker.postMessage(request, transfer);
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
this._pending.delete(requestId);
|
|
193
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const materializingProgress = {
|
|
197
|
+
phase: "materializing",
|
|
198
|
+
message: "Creating Babylon.js objects...",
|
|
199
|
+
};
|
|
200
|
+
this._options.onProgress?.(materializingProgress);
|
|
201
|
+
onProgress?.({ lengthComputable: false, loaded: 4, total: 4 });
|
|
202
|
+
signal.throwIfAborted();
|
|
203
|
+
const materialized = await materializeCommandBuffers(scene, response.commands, response.data, addToScene, signal);
|
|
204
|
+
const result = {
|
|
205
|
+
container: materialized.container,
|
|
206
|
+
timings: {
|
|
207
|
+
...response.timings,
|
|
208
|
+
materializeMs: materialized.materializeMs,
|
|
209
|
+
},
|
|
210
|
+
statistics: response.statistics,
|
|
211
|
+
missingAssets: response.missingAssets,
|
|
212
|
+
};
|
|
213
|
+
try {
|
|
214
|
+
signal.throwIfAborted();
|
|
215
|
+
this._options.onComplete?.({
|
|
216
|
+
timings: result.timings,
|
|
217
|
+
statistics: result.statistics,
|
|
218
|
+
missingAssets: result.missingAssets,
|
|
219
|
+
});
|
|
220
|
+
signal.throwIfAborted();
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
materialized.container.dispose();
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
this._activeLoads.delete(controller);
|
|
230
|
+
if (this._pending.size === 0) {
|
|
231
|
+
this._terminateWorker();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
_getWorker(workerUrl) {
|
|
236
|
+
if (!workerUrl) {
|
|
237
|
+
throw new Error("The USD worker URL was not configured.");
|
|
238
|
+
}
|
|
239
|
+
const currentLocation = globalThis.location;
|
|
240
|
+
const resolvedUrl = new URL(String(workerUrl), currentLocation?.href ?? "http://localhost/").href;
|
|
241
|
+
if (this._worker && this._workerUrl !== resolvedUrl) {
|
|
242
|
+
if (this._pending.size > 0) {
|
|
243
|
+
throw new Error("Cannot change the USD worker URL while requests are pending.");
|
|
244
|
+
}
|
|
245
|
+
this._terminateWorker();
|
|
246
|
+
}
|
|
247
|
+
if (this._worker) {
|
|
248
|
+
return this._worker;
|
|
249
|
+
}
|
|
250
|
+
this._workerUrl = resolvedUrl;
|
|
251
|
+
if (!currentLocation || new URL(resolvedUrl).origin === currentLocation.origin) {
|
|
252
|
+
this._worker = new Worker(resolvedUrl, { type: "module" });
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
this._workerBlobUrl = URL.createObjectURL(new Blob([`import ${JSON.stringify(resolvedUrl)};`], { type: "application/javascript" }));
|
|
256
|
+
this._worker = new Worker(this._workerBlobUrl, { type: "module" });
|
|
257
|
+
}
|
|
258
|
+
this._worker.addEventListener("message", (event) => {
|
|
259
|
+
const response = event.data;
|
|
260
|
+
const pending = this._pending.get(response.requestId);
|
|
261
|
+
if (!pending) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (response.type === "progress") {
|
|
265
|
+
pending.onProgress?.(response.progress);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (response.type === "log") {
|
|
269
|
+
pending.onLog?.(response.level >= 2 ? "error" : response.level === 1 ? "warning" : "info", response.message);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
this._pending.delete(response.requestId);
|
|
273
|
+
if (response.type === "error") {
|
|
274
|
+
const error = new Error(response.message);
|
|
275
|
+
error.stack = response.stack;
|
|
276
|
+
pending.reject(error);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
pending.resolve(response);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
const fail = (error) => {
|
|
283
|
+
this._terminateWorker();
|
|
284
|
+
for (const request of this._pending.values()) {
|
|
285
|
+
request.reject(error);
|
|
286
|
+
}
|
|
287
|
+
this._pending.clear();
|
|
288
|
+
};
|
|
289
|
+
this._worker.addEventListener("error", (event) => {
|
|
290
|
+
fail(event.error ?? new Error(event.message || `Could not load the USD worker from '${resolvedUrl}'.`));
|
|
291
|
+
});
|
|
292
|
+
this._worker.addEventListener("messageerror", () => {
|
|
293
|
+
fail(new Error("The USD worker returned a message that could not be deserialized."));
|
|
294
|
+
});
|
|
295
|
+
return this._worker;
|
|
296
|
+
}
|
|
297
|
+
_terminateWorker() {
|
|
298
|
+
this._worker?.terminate();
|
|
299
|
+
this._worker = undefined;
|
|
300
|
+
this._workerUrl = undefined;
|
|
301
|
+
if (this._workerBlobUrl) {
|
|
302
|
+
URL.revokeObjectURL(this._workerBlobUrl);
|
|
303
|
+
this._workerBlobUrl = undefined;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Default URLs for the prebuilt OpenUSD importer assets.
|
|
309
|
+
*/
|
|
310
|
+
USDFileLoader.DefaultConfiguration = {
|
|
311
|
+
glueUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.js`,
|
|
312
|
+
wasmUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.wasm`,
|
|
313
|
+
dataUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.data`,
|
|
314
|
+
workerUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.worker.js`,
|
|
315
|
+
};
|
|
316
|
+
const _ProgressPhaseIndex = {
|
|
317
|
+
initializing: 1,
|
|
318
|
+
staging: 2,
|
|
319
|
+
extracting: 3,
|
|
320
|
+
materializing: 4,
|
|
321
|
+
};
|
|
322
|
+
let _Registered = false;
|
|
323
|
+
/** @internal */
|
|
324
|
+
export function _RegisterUSDLoaderDependencies() {
|
|
325
|
+
RegisterPbrMaterial();
|
|
326
|
+
RegisterInstancedMesh();
|
|
327
|
+
RegisterThinInstanceMesh();
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Registers the USD scene loader plugin and its Babylon.js runtime dependencies.
|
|
331
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
332
|
+
*/
|
|
333
|
+
export function RegisterUSDFileLoader() {
|
|
334
|
+
if (_Registered) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
_Registered = true;
|
|
338
|
+
_RegisterUSDLoaderDependencies();
|
|
339
|
+
RegisterSceneLoaderPlugin(new USDFileLoader());
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=usdFileLoader.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdFileLoader.pure.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdFileLoader.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,yDAAyD;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAA+B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAMH,yBAAyB,GAC5B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAUjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAiBxD,MAAM,oBAAoB,GAAG,GAAG,KAAK,CAAC,cAAc,uBAAuB,gBAAgB,GAAG,CAAC;AAC/F,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AAEzD,SAAS,QAAQ,CAAC,KAAqB;IACnC,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;QAC/B,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,K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,EAAE,CAAC;YACtB,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACzC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QACpC,CAAC;IACL,CAAC;;AA/RD;;GAEG;AACW,kCAAoB,GAAG;IACjC,OAAO,EAAE,GAAG,oBAAoB,yBAAyB;IACzD,OAAO,EAAE,GAAG,oBAAoB,2BAA2B;IAC3D,OAAO,EAAE,GAAG,oBAAoB,2BAA2B;IAC3D,SAAS,EAAE,GAAG,oBAAoB,gCAAgC;CACrE,AALiC,CAKhC;AA0RN,MAAM,mBAAmB,GAA6C;IAClE,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;CACnB,CAAC;AAEF,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,gBAAgB;AAChB,MAAM,UAAU,8BAA8B;IAC1C,mBAAmB,EAAE,CAAC;IACtB,qBAAqB,EAAE,CAAC;IACxB,wBAAwB,EAAE,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACjC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IACnB,8BAA8B,EAAE,CAAC;IACjC,yBAAyB,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { RegisterInstancedMesh } from \"core/Meshes/instancedMesh.pure\";\nimport { RegisterThinInstanceMesh } from \"core/Meshes/thinInstanceMesh.pure\";\nimport { RegisterPbrMaterial } from \"core/Materials/PBR/pbrMaterial.pure\";\nimport { Tools } from \"core/Misc/tools.pure\";\nimport { type AbstractAssetContainer, AssetContainer } from \"core/assetContainer\";\nimport {\n type ISceneLoaderAsyncResult,\n type ISceneLoaderPluginAsync,\n type ISceneLoaderPluginFactory,\n type ISceneLoaderProgressEvent,\n type SceneLoaderPluginOptions,\n RegisterSceneLoaderPlugin,\n} from \"core/Loading/sceneLoader\";\nimport { type Scene } from \"core/scene.pure\";\n\nimport { USDFileLoaderMetadata } from \"./usdFileLoader.metadata\";\nimport {\n type USDBinaryInput,\n type USDFileLoaderOptions,\n type USDImportDiagnostics,\n type USDImportStatistics,\n type USDImportTimings,\n type USDLoadProgress,\n type USDVirtualFiles,\n} from \"./usdLoadingOptions\";\nimport { materializeCommandBuffers } from \"./usdSceneMaterializer\";\nimport { PROTOCOL_VERSION } from \"./usdCommandProtocol\";\nimport { type ExtractRequest, type WorkerResponse } from \"./usdWorkerMessages\";\n\ninterface PendingRequest {\n resolve: (response: Extract<WorkerResponse, { type: \"result\" }>) => void;\n reject: (error: Error) => void;\n onProgress?: (progress: USDLoadProgress) => void;\n onLog?: USDFileLoaderOptions[\"onLog\"];\n}\n\ninterface USDLoadResult {\n container: AbstractAssetContainer;\n timings: USDImportTimings;\n statistics: USDImportStatistics;\n missingAssets: string[];\n}\n\nconst _DefaultAssetRootUrl = `${Tools._DefaultCdnUrl}/babylonUsdImporter/${PROTOCOL_VERSION}/`;\nconst _SupportedExtension = /\\.(?:usd|usda|usdc|usdz)$/i;\n\nfunction _toBytes(input: USDBinaryInput): Uint8Array {\n if (input instanceof Uint8Array) {\n return input.slice();\n }\n if (input instanceof ArrayBuffer) {\n return new Uint8Array(input.slice(0));\n }\n return new Uint8Array(input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength));\n}\n\nfunction _normalizeFiles(files?: USDVirtualFiles): Record<string, Uint8Array> | undefined {\n if (!files) {\n return undefined;\n }\n const normalized: Record<string, Uint8Array> = {};\n for (const [path, input] of Object.entries(files)) {\n normalized[path] = _toBytes(input);\n }\n return normalized;\n}\n\nfunction _stagedFileName(fileName: string | undefined, bytes: Uint8Array, preserveUrlCharacters: boolean): string {\n const normalizedFileName = fileName?.replace(/\\\\/g, \"/\").replace(/^\\.\\/+/, \"\");\n const cleanFileName = preserveUrlCharacters ? normalizedFileName : normalizedFileName?.split(/[?#]/, 1)[0];\n const pathParts = cleanFileName?.split(\"/\").filter(Boolean);\n if (cleanFileName && !cleanFileName.startsWith(\"/\") && pathParts?.length && !pathParts.includes(\"..\") && _SupportedExtension.test(cleanFileName)) {\n return pathParts.join(\"/\");\n }\n const isZip = bytes.length >= 4 && bytes[0] === 0x50 && bytes[1] === 0x4b && bytes[2] === 0x03 && bytes[3] === 0x04;\n return isZip ? \"scene.usdz\" : \"scene.usd\";\n}\n\nfunction _toAsyncResult(container: AbstractAssetContainer): ISceneLoaderAsyncResult {\n return {\n meshes: container.meshes,\n particleSystems: container.particleSystems,\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: container.transformNodes,\n geometries: container.geometries,\n lights: container.lights,\n spriteManagers: container.spriteManagers,\n };\n}\n\n/**\n * OpenUSD scene loader backed by a WebAssembly command-buffer extractor.\n */\nexport class USDFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPluginFactory {\n /**\n * Default URLs for the prebuilt OpenUSD importer assets.\n */\n public static DefaultConfiguration = {\n glueUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.js`,\n wasmUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.wasm`,\n dataUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.data`,\n workerUrl: `${_DefaultAssetRootUrl}babylon-usd-importer.worker.js`,\n };\n\n /**\n * Defines the name of the plugin.\n */\n public readonly name = USDFileLoaderMetadata.name;\n\n /**\n * Defines the extensions the plugin can load.\n */\n public readonly extensions = USDFileLoaderMetadata.extensions;\n\n private readonly _options: USDFileLoaderOptions;\n private _worker: Worker | undefined;\n private _workerUrl: string | undefined;\n private _workerBlobUrl: string | undefined;\n private _nextRequestId = 1;\n private readonly _pending = new Map<number, PendingRequest>();\n private readonly _activeLoads = new Set<AbortController>();\n\n /**\n * Creates a USD loader.\n * @param options Options controlling worker assets, supporting files, and diagnostics.\n */\n public constructor(options: Partial<USDFileLoaderOptions> = {}) {\n this._options = {\n ...options,\n resolveByFileName: options.resolveByFileName ?? true,\n glueUrl: options.glueUrl ?? USDFileLoader.DefaultConfiguration.glueUrl,\n wasmUrl: options.wasmUrl ?? USDFileLoader.DefaultConfiguration.wasmUrl,\n dataUrl: options.dataUrl ?? USDFileLoader.DefaultConfiguration.dataUrl,\n workerUrl: options.workerUrl ?? USDFileLoader.DefaultConfiguration.workerUrl,\n };\n }\n\n /**\n * Creates a configured plugin instance for a SceneLoader operation.\n * @param options SceneLoader plugin options.\n * @returns The configured USD loader.\n */\n public createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPluginAsync {\n _RegisterUSDLoaderDependencies();\n return new USDFileLoader(options[USDFileLoaderMetadata.name]);\n }\n\n /**\n * Imports all objects from a USD stage into a scene.\n * @param _meshesNames Mesh name filtering is not currently supported.\n * @param scene The scene receiving the imported objects.\n * @param data The USD, USDA, USDC, or USDZ bytes.\n * @param rootUrl The source root URL.\n * @param onProgress SceneLoader progress callback.\n * @param fileName Name of the root USD layer.\n * @returns The imported Babylon.js objects.\n */\n public async importMeshAsync(\n _meshesNames: string | readonly string[] | null | undefined,\n scene: Scene,\n data: unknown,\n rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<ISceneLoaderAsyncResult> {\n const result = await this._loadAsync(scene, data, rootUrl, onProgress, fileName, true);\n return _toAsyncResult(result.container);\n }\n\n /**\n * Loads a USD stage into a scene.\n * @param scene The scene receiving the imported objects.\n * @param data The USD, USDA, USDC, or USDZ bytes.\n * @param rootUrl The source root URL.\n * @param onProgress SceneLoader progress callback.\n * @param fileName Name of the root USD layer.\n */\n public async loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n await this._loadAsync(scene, data, rootUrl, onProgress, fileName, true);\n }\n\n /**\n * Loads a USD stage into an asset container.\n * @param scene The scene used to create imported objects.\n * @param data The USD, USDA, USDC, or USDZ bytes.\n * @param rootUrl The source root URL.\n * @param onProgress SceneLoader progress callback.\n * @param fileName Name of the root USD layer.\n * @returns The populated asset container.\n */\n public async loadAssetContainerAsync(\n scene: Scene,\n data: unknown,\n rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<AssetContainer> {\n const container = (await this._loadAsync(scene, data, rootUrl, onProgress, fileName, false)).container;\n if (!(container instanceof AssetContainer)) {\n throw new Error(\"USDFileLoader failed to create an asset container.\");\n }\n return container;\n }\n\n /**\n * Releases the worker and rejects pending loads.\n */\n public dispose(): void {\n this._terminateWorker();\n const error = new Error(\"USDFileLoader was disposed.\");\n for (const controller of this._activeLoads) {\n controller.abort(error);\n }\n for (const request of this._pending.values()) {\n request.reject(error);\n }\n this._pending.clear();\n }\n\n private async _loadAsync(\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\n fileName: string | undefined,\n addToScene: boolean\n ): Promise<USDLoadResult> {\n if (!(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data)) {\n throw new Error(\"USDFileLoader expects binary USD data.\");\n }\n const bytes = _toBytes(data);\n const files = _normalizeFiles(this._options.files);\n const requestId = this._nextRequestId++;\n const request: ExtractRequest = {\n type: \"extract\",\n requestId,\n asset: {\n bytes,\n files,\n fileName: _stagedFileName(this._options.rootFileName ?? fileName, bytes, this._options.rootFileName !== undefined),\n resolveByFileName: this._options.resolveByFileName ?? true,\n glueUrl: this._options.glueUrl,\n wasmUrl: this._options.wasmUrl,\n dataUrl: this._options.dataUrl,\n },\n };\n const transfer = [...new Set([bytes.buffer, ...Object.values(files ?? {}).map((file) => file.buffer)])];\n const controller = new AbortController();\n const signal = controller.signal;\n this._activeLoads.add(controller);\n try {\n const worker = this._getWorker(this._options.workerUrl);\n const response = await new Promise<Extract<WorkerResponse, { type: \"result\" }>>((resolve, reject) => {\n this._pending.set(requestId, {\n resolve,\n reject,\n onProgress: (progress) => {\n this._options.onProgress?.(progress);\n onProgress?.({\n lengthComputable: false,\n loaded: _ProgressPhaseIndex[progress.phase],\n total: 4,\n });\n },\n onLog: this._options.onLog,\n });\n try {\n worker.postMessage(request, transfer);\n } catch (error) {\n this._pending.delete(requestId);\n reject(error instanceof Error ? error : new Error(String(error)));\n }\n });\n\n const materializingProgress = {\n phase: \"materializing\",\n message: \"Creating Babylon.js objects...\",\n } as const;\n this._options.onProgress?.(materializingProgress);\n onProgress?.({ lengthComputable: false, loaded: 4, total: 4 });\n signal.throwIfAborted();\n const materialized = await materializeCommandBuffers(scene, response.commands, response.data, addToScene, signal);\n const result = {\n container: materialized.container,\n timings: {\n ...response.timings,\n materializeMs: materialized.materializeMs,\n },\n statistics: response.statistics,\n missingAssets: response.missingAssets,\n };\n try {\n signal.throwIfAborted();\n this._options.onComplete?.({\n timings: result.timings,\n statistics: result.statistics,\n missingAssets: result.missingAssets,\n } satisfies USDImportDiagnostics);\n signal.throwIfAborted();\n } catch (error) {\n materialized.container.dispose();\n throw error;\n }\n return result;\n } finally {\n this._activeLoads.delete(controller);\n if (this._pending.size === 0) {\n this._terminateWorker();\n }\n }\n }\n\n private _getWorker(workerUrl?: string | URL): Worker {\n if (!workerUrl) {\n throw new Error(\"The USD worker URL was not configured.\");\n }\n const currentLocation = globalThis.location;\n const resolvedUrl = new URL(String(workerUrl), currentLocation?.href ?? \"http://localhost/\").href;\n if (this._worker && this._workerUrl !== resolvedUrl) {\n if (this._pending.size > 0) {\n throw new Error(\"Cannot change the USD worker URL while requests are pending.\");\n }\n this._terminateWorker();\n }\n if (this._worker) {\n return this._worker;\n }\n this._workerUrl = resolvedUrl;\n if (!currentLocation || new URL(resolvedUrl).origin === currentLocation.origin) {\n this._worker = new Worker(resolvedUrl, { type: \"module\" });\n } else {\n this._workerBlobUrl = URL.createObjectURL(new Blob([`import ${JSON.stringify(resolvedUrl)};`], { type: \"application/javascript\" }));\n this._worker = new Worker(this._workerBlobUrl, { type: \"module\" });\n }\n this._worker.addEventListener(\"message\", (event: MessageEvent<WorkerResponse>) => {\n const response = event.data;\n const pending = this._pending.get(response.requestId);\n if (!pending) {\n return;\n }\n if (response.type === \"progress\") {\n pending.onProgress?.(response.progress);\n return;\n }\n if (response.type === \"log\") {\n pending.onLog?.(response.level >= 2 ? \"error\" : response.level === 1 ? \"warning\" : \"info\", response.message);\n return;\n }\n this._pending.delete(response.requestId);\n if (response.type === \"error\") {\n const error = new Error(response.message);\n error.stack = response.stack;\n pending.reject(error);\n } else {\n pending.resolve(response);\n }\n });\n const fail = (error: Error) => {\n this._terminateWorker();\n for (const request of this._pending.values()) {\n request.reject(error);\n }\n this._pending.clear();\n };\n this._worker.addEventListener(\"error\", (event) => {\n fail(event.error ?? new Error(event.message || `Could not load the USD worker from '${resolvedUrl}'.`));\n });\n this._worker.addEventListener(\"messageerror\", () => {\n fail(new Error(\"The USD worker returned a message that could not be deserialized.\"));\n });\n return this._worker;\n }\n\n private _terminateWorker(): void {\n this._worker?.terminate();\n this._worker = undefined;\n this._workerUrl = undefined;\n if (this._workerBlobUrl) {\n URL.revokeObjectURL(this._workerBlobUrl);\n this._workerBlobUrl = undefined;\n }\n }\n}\n\nconst _ProgressPhaseIndex: Record<USDLoadProgress[\"phase\"], number> = {\n initializing: 1,\n staging: 2,\n extracting: 3,\n materializing: 4,\n};\n\nlet _Registered = false;\n\n/** @internal */\nexport function _RegisterUSDLoaderDependencies(): void {\n RegisterPbrMaterial();\n RegisterInstancedMesh();\n RegisterThinInstanceMesh();\n}\n\n/**\n * Registers the USD scene loader plugin and its Babylon.js runtime dependencies.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterUSDFileLoader(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n _RegisterUSDLoaderDependencies();\n RegisterSceneLoaderPlugin(new USDFileLoader());\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
import { type USDFileLoaderMetadata } from "./usdFileLoader.metadata.js";
|
|
3
|
+
import { type USDFileLoaderOptions } from "./usdLoadingOptions.js";
|
|
4
|
+
declare module "@onerjs/core/Loading/sceneLoader.js" {
|
|
5
|
+
interface SceneLoaderPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Defines options for the USD loader.
|
|
8
|
+
*/
|
|
9
|
+
[USDFileLoaderMetadata.name]: Partial<USDFileLoaderOptions>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdFileLoader.types.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdFileLoader.types.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n\nimport { type USDFileLoaderMetadata } from \"./usdFileLoader.metadata\";\nimport { type USDFileLoaderOptions } from \"./usdLoadingOptions\";\n\ndeclare module \"core/Loading/sceneLoader\" {\n // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention\n export interface SceneLoaderPluginOptions {\n /**\n * Defines options for the USD loader.\n */\n [USDFileLoaderMetadata.name]: Partial<USDFileLoaderOptions>;\n }\n}\n"]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary input accepted for supporting USD layers and assets.
|
|
3
|
+
*/
|
|
4
|
+
export type USDBinaryInput = ArrayBuffer | ArrayBufferView;
|
|
5
|
+
/**
|
|
6
|
+
* Virtual files supplied alongside the root USD layer, keyed by their path relative to the
|
|
7
|
+
* root layer.
|
|
8
|
+
*/
|
|
9
|
+
export type USDVirtualFiles = Readonly<Record<string, USDBinaryInput>>;
|
|
10
|
+
/**
|
|
11
|
+
* Progress phases reported by the USD worker and Babylon materializer.
|
|
12
|
+
*/
|
|
13
|
+
export interface USDLoadProgress {
|
|
14
|
+
/**
|
|
15
|
+
* Current importer phase.
|
|
16
|
+
*/
|
|
17
|
+
phase: "initializing" | "staging" | "extracting" | "materializing";
|
|
18
|
+
/**
|
|
19
|
+
* Human-readable phase description.
|
|
20
|
+
*/
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options for the OpenUSD scene loader.
|
|
25
|
+
*/
|
|
26
|
+
export interface USDFileLoaderOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Virtual path used to stage the root layer. Set this when supporting files need
|
|
29
|
+
* to resolve relative to a directory hierarchy.
|
|
30
|
+
*/
|
|
31
|
+
rootFileName?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Supporting layers, payloads, and textures keyed by virtual path in the same
|
|
34
|
+
* virtual file system as `rootFileName`.
|
|
35
|
+
*/
|
|
36
|
+
files?: USDVirtualFiles;
|
|
37
|
+
/**
|
|
38
|
+
* Enables conservative file-name fallback for unresolved absolute references.
|
|
39
|
+
* Defaults to true.
|
|
40
|
+
*/
|
|
41
|
+
resolveByFileName?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* URL of the module worker. Defaults to the protocol-versioned worker hosted on the Babylon.js CDN.
|
|
44
|
+
*/
|
|
45
|
+
workerUrl?: string | URL;
|
|
46
|
+
/**
|
|
47
|
+
* URL of the generated Emscripten JavaScript module.
|
|
48
|
+
*/
|
|
49
|
+
glueUrl?: string;
|
|
50
|
+
/**
|
|
51
|
+
* URL of the OpenUSD WebAssembly binary.
|
|
52
|
+
*/
|
|
53
|
+
wasmUrl?: string;
|
|
54
|
+
/**
|
|
55
|
+
* URL of the OpenUSD preloaded resource bundle.
|
|
56
|
+
*/
|
|
57
|
+
dataUrl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Called when the importer moves to a new processing phase.
|
|
60
|
+
*/
|
|
61
|
+
onProgress?: (progress: USDLoadProgress) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Called for OpenUSD diagnostic messages.
|
|
64
|
+
*/
|
|
65
|
+
onLog?: (level: "info" | "warning" | "error", message: string) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Called after extraction and Babylon.js object creation complete.
|
|
68
|
+
*/
|
|
69
|
+
onComplete?: (diagnostics: USDImportDiagnostics) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Timing data measured by the OpenUSD worker and Babylon materializer.
|
|
73
|
+
*/
|
|
74
|
+
export interface USDImportTimings {
|
|
75
|
+
/** Total extraction time, including the final Wasm heap copy. */
|
|
76
|
+
totalMs: number;
|
|
77
|
+
/** Time spent opening and composing the USD stage. */
|
|
78
|
+
stageOpenMs: number;
|
|
79
|
+
/** Time spent traversing the composed stage. */
|
|
80
|
+
stageReadMs: number;
|
|
81
|
+
/** Time spent preparing renderable vertex streams. */
|
|
82
|
+
preparationMs: number;
|
|
83
|
+
/** Time spent packing the command and raw-data buffers. */
|
|
84
|
+
packingMs: number;
|
|
85
|
+
/** Time spent copying command and data buffers from the Wasm heap. */
|
|
86
|
+
heapCopyMs: number;
|
|
87
|
+
/** Time spent creating Babylon.js objects. */
|
|
88
|
+
materializeMs: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Statistics reported for an imported USD stage.
|
|
92
|
+
*/
|
|
93
|
+
export interface USDImportStatistics {
|
|
94
|
+
/** Number of transform nodes extracted from the composed stage. */
|
|
95
|
+
nodes: number;
|
|
96
|
+
/** Number of polygonal `UsdGeomMesh` sources. */
|
|
97
|
+
meshes: number;
|
|
98
|
+
/** Number of analytic cube, sphere, cylinder, and cone sources. */
|
|
99
|
+
analyticPrimitives: number;
|
|
100
|
+
/** Number of native Babylon instances created from shared USD geometry. */
|
|
101
|
+
instances: number;
|
|
102
|
+
/** Number of authored USD materials translated. */
|
|
103
|
+
materials: number;
|
|
104
|
+
/** Number of unique vertices in polygonal source meshes. */
|
|
105
|
+
vertices: number;
|
|
106
|
+
/** Number of unique triangles in polygonal source meshes. */
|
|
107
|
+
triangles: number;
|
|
108
|
+
/** Size of the command buffer in bytes. */
|
|
109
|
+
commandBytes: number;
|
|
110
|
+
/** Size of the raw-data buffer in bytes. */
|
|
111
|
+
dataBytes: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Diagnostics reported after a USD import completes.
|
|
115
|
+
*/
|
|
116
|
+
export interface USDImportDiagnostics {
|
|
117
|
+
/** Timing data for extraction and Babylon.js object creation. */
|
|
118
|
+
timings: USDImportTimings;
|
|
119
|
+
/** Counts and buffer sizes reported by the OpenUSD extractor. */
|
|
120
|
+
statistics: USDImportStatistics;
|
|
121
|
+
/** Asset references OpenUSD could not resolve from the supplied virtual files. */
|
|
122
|
+
missingAssets: readonly string[];
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usdLoadingOptions.js","sourceRoot":"","sources":["../../../../dev/loaders/src/USD/usdLoadingOptions.ts"],"names":[],"mappings":"AAAA,yDAAyD","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Binary input accepted for supporting USD layers and assets.\n */\nexport type USDBinaryInput = ArrayBuffer | ArrayBufferView;\n\n/**\n * Virtual files supplied alongside the root USD layer, keyed by their path relative to the\n * root layer.\n */\nexport type USDVirtualFiles = Readonly<Record<string, USDBinaryInput>>;\n\n/**\n * Progress phases reported by the USD worker and Babylon materializer.\n */\nexport interface USDLoadProgress {\n /**\n * Current importer phase.\n */\n phase: \"initializing\" | \"staging\" | \"extracting\" | \"materializing\";\n\n /**\n * Human-readable phase description.\n */\n message: string;\n}\n\n/**\n * Options for the OpenUSD scene loader.\n */\nexport interface USDFileLoaderOptions {\n /**\n * Virtual path used to stage the root layer. Set this when supporting files need\n * to resolve relative to a directory hierarchy.\n */\n rootFileName?: string;\n\n /**\n * Supporting layers, payloads, and textures keyed by virtual path in the same\n * virtual file system as `rootFileName`.\n */\n files?: USDVirtualFiles;\n\n /**\n * Enables conservative file-name fallback for unresolved absolute references.\n * Defaults to true.\n */\n resolveByFileName?: boolean;\n\n /**\n * URL of the module worker. Defaults to the protocol-versioned worker hosted on the Babylon.js CDN.\n */\n workerUrl?: string | URL;\n\n /**\n * URL of the generated Emscripten JavaScript module.\n */\n glueUrl?: string;\n\n /**\n * URL of the OpenUSD WebAssembly binary.\n */\n wasmUrl?: string;\n\n /**\n * URL of the OpenUSD preloaded resource bundle.\n */\n dataUrl?: string;\n\n /**\n * Called when the importer moves to a new processing phase.\n */\n onProgress?: (progress: USDLoadProgress) => void;\n\n /**\n * Called for OpenUSD diagnostic messages.\n */\n onLog?: (level: \"info\" | \"warning\" | \"error\", message: string) => void;\n\n /**\n * Called after extraction and Babylon.js object creation complete.\n */\n onComplete?: (diagnostics: USDImportDiagnostics) => void;\n}\n\n/**\n * Timing data measured by the OpenUSD worker and Babylon materializer.\n */\nexport interface USDImportTimings {\n /** Total extraction time, including the final Wasm heap copy. */\n totalMs: number;\n /** Time spent opening and composing the USD stage. */\n stageOpenMs: number;\n /** Time spent traversing the composed stage. */\n stageReadMs: number;\n /** Time spent preparing renderable vertex streams. */\n preparationMs: number;\n /** Time spent packing the command and raw-data buffers. */\n packingMs: number;\n /** Time spent copying command and data buffers from the Wasm heap. */\n heapCopyMs: number;\n /** Time spent creating Babylon.js objects. */\n materializeMs: number;\n}\n\n/**\n * Statistics reported for an imported USD stage.\n */\nexport interface USDImportStatistics {\n /** Number of transform nodes extracted from the composed stage. */\n nodes: number;\n /** Number of polygonal `UsdGeomMesh` sources. */\n meshes: number;\n /** Number of analytic cube, sphere, cylinder, and cone sources. */\n analyticPrimitives: number;\n /** Number of native Babylon instances created from shared USD geometry. */\n instances: number;\n /** Number of authored USD materials translated. */\n materials: number;\n /** Number of unique vertices in polygonal source meshes. */\n vertices: number;\n /** Number of unique triangles in polygonal source meshes. */\n triangles: number;\n /** Size of the command buffer in bytes. */\n commandBytes: number;\n /** Size of the raw-data buffer in bytes. */\n dataBytes: number;\n}\n\n/**\n * Diagnostics reported after a USD import completes.\n */\nexport interface USDImportDiagnostics {\n /** Timing data for extraction and Babylon.js object creation. */\n timings: USDImportTimings;\n /** Counts and buffer sizes reported by the OpenUSD extractor. */\n statistics: USDImportStatistics;\n /** Asset references OpenUSD could not resolve from the supplied virtual files. */\n missingAssets: readonly string[];\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AbstractAssetContainer } from "@onerjs/core/assetContainer.js";
|
|
2
|
+
import { type Scene } from "@onerjs/core/scene.pure.js";
|
|
3
|
+
export interface MaterializationResult {
|
|
4
|
+
container: AbstractAssetContainer & {
|
|
5
|
+
dispose(): void;
|
|
6
|
+
};
|
|
7
|
+
materializeMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function materializeCommandBuffers(scene: Scene, commandBuffer: ArrayBuffer, dataBuffer: ArrayBuffer, addToScene: boolean, signal?: AbortSignal): Promise<MaterializationResult>;
|