@needle-tools/usd 0.0.2-next.de2e82b → 1.0.0-next.d840b4c

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +245 -28
  3. package/package.json +43 -10
  4. package/src/bindings/emHdBindings.js +5 -12227
  5. package/src/bindings/emHdBindings.wasm +0 -0
  6. package/src/bindings/index.js +130 -47
  7. package/src/bindings/openusd-build-info.json +40 -0
  8. package/src/create.three.js +365 -53
  9. package/src/hydra/ThreeJsRenderDelegate.js +1128 -75
  10. package/src/plugins/index.js +1 -2
  11. package/src/plugins/needle.js +38 -2
  12. package/src/types/bindings.d.ts +296 -3
  13. package/src/types/create.three.d.ts +87 -7
  14. package/src/types/hydra.d.ts +7 -5
  15. package/src/types/plugins.d.ts +7 -0
  16. package/src/types/usd-core-bindings.d.ts +240 -0
  17. package/src/utils.js +3 -3
  18. package/examples/index.html +0 -58
  19. package/examples/package-lock.json +0 -1548
  20. package/examples/package.json +0 -24
  21. package/examples/public/HttpReferences copy.usda +0 -46
  22. package/examples/public/HttpReferences.usda +0 -44
  23. package/examples/public/gingerbread/GingerbreadHouse.usda +0 -35
  24. package/examples/public/gingerbread/house/GingerBreadHouse.usdc +0 -0
  25. package/examples/public/gingerbread/house/textures/color.jpg +0 -0
  26. package/examples/public/gingerbread/house/textures/metallic_roughness.jpg +0 -0
  27. package/examples/public/gingerbread/house/textures/normal.jpg +0 -0
  28. package/examples/public/gingerbread/snowman/Snowman.usdc +0 -0
  29. package/examples/public/gingerbread/snowman/textures/color.jpg +0 -0
  30. package/examples/public/gingerbread/snowman/textures/metallic_roughness.jpg +0 -0
  31. package/examples/public/gingerbread/snowman/textures/normal.jpg +0 -0
  32. package/examples/public/test.usdz +0 -0
  33. package/examples/public/vite.svg +0 -1
  34. package/examples/src/fileHandling.ts +0 -256
  35. package/examples/src/main.ts +0 -167
  36. package/examples/src/three.ts +0 -140
  37. package/examples/src/vite-env.d.ts +0 -1
  38. package/examples/tsconfig.json +0 -23
  39. package/examples/vite.config.js +0 -21
  40. package/src/bindings/emHdBindings.data +0 -19331
  41. package/src/bindings/emHdBindings.worker.js +0 -124
@@ -1,2 +1 @@
1
- export { addPluginForNeedleEngine } from "./needle.js";
2
-
1
+ export { addPluginForNeedleEngine, getHydraHandleFromNeedleEngineAsset } from "./needle.js";
@@ -1,6 +1,39 @@
1
1
  import { Loader, Object3D } from "three";
2
2
  import { createThreeHydra, getUsdModule } from "../index.js";
3
3
 
4
+ const hydraHandlesByRoot = new WeakMap();
5
+
6
+ /**
7
+ * Return the Hydra handle created by the Needle Engine USD plugin for a loaded asset.
8
+ * The argument can be the value returned by `NEEDLE.loadAsset(...)` or any Object3D
9
+ * within that loaded hierarchy.
10
+ *
11
+ * @param {unknown} asset
12
+ * @returns {import("..").NeedleThreeHydraHandle | null}
13
+ */
14
+ export function getHydraHandleFromNeedleEngineAsset(asset) {
15
+ const root = findObject3D(asset);
16
+ if (!root) return null;
17
+
18
+ let handle = hydraHandlesByRoot.get(root) || null;
19
+ if (handle) return handle;
20
+
21
+ root.traverse?.((object) => {
22
+ handle ??= hydraHandlesByRoot.get(object) || null;
23
+ });
24
+ return handle;
25
+ }
26
+
27
+ /**
28
+ * @param {unknown} value
29
+ * @returns {Object3D | null}
30
+ */
31
+ function findObject3D(value) {
32
+ if (!value) return null;
33
+ if (value instanceof Object3D || value.isObject3D === true) return value;
34
+ return findObject3D(value.scene) || findObject3D(value.root);
35
+ }
36
+
4
37
 
5
38
  /** @type {import("../types").addPluginForNeedleEngine} */
6
39
  export async function addPluginForNeedleEngine(options) {
@@ -34,9 +67,10 @@ function onAddNeedlePlugin(NEEDLE, opts) {
34
67
  }
35
68
  onDestroy() {
36
69
  if (this.handle) {
37
- this.handle.dispose();
70
+ void this.handle.dispose();
38
71
  this.handle = null;
39
72
  }
73
+ hydraHandlesByRoot.delete(this.root);
40
74
  }
41
75
  }
42
76
 
@@ -95,8 +129,10 @@ function onAddNeedlePlugin(NEEDLE, opts) {
95
129
  scene: this.comp.root,
96
130
  url: url,
97
131
  files: files,
132
+ waitForMaterials: opts.waitForMaterials,
98
133
  });
99
134
  this.comp.handle = handle;
135
+ hydraHandlesByRoot.set(this.comp.root, handle);
100
136
 
101
137
  if (debug) console.debug("Loaded", this.comp);
102
138
 
@@ -155,4 +191,4 @@ function onAddNeedlePlugin(NEEDLE, opts) {
155
191
  handlers.length = 0;
156
192
  }
157
193
 
158
- }
194
+ }
@@ -11,6 +11,8 @@ declare type FSNode = {
11
11
  write: boolean,
12
12
  }
13
13
 
14
+ declare type MaybePromise<T> = T | Promise<T>
15
+
14
16
  declare type USD = {
15
17
  FS_createDataFile: (parent: string, filepath: string, data: Uint8Array, canRead: boolean, canWrite: boolean, canOwn: boolean) => FSNode,
16
18
  FS_createPath: (parent: string, path: string, canRead: boolean, canWrite: boolean) => FSNode,
@@ -18,6 +20,12 @@ declare type USD = {
18
20
  FS_readdir: (path: string) => string[],
19
21
  FS_rmdir: (path: string) => void,
20
22
  FS_analyzePath: (path: string) => FSNode,
23
+ CreateStage: (path: string) => USDStage,
24
+ OpenStage: (path: string) => MaybePromise<USDStage>,
25
+ ReleaseStage: (stage: USDStage) => boolean,
26
+ CreateUsdzPackage: (assetPath: string, usdzPath: string) => MaybePromise<boolean>,
27
+ GetBuildInfoJson: () => string,
28
+ ReadFile: (path: string) => Uint8Array,
21
29
  HdWebSyncDriver: new (delegate: hydraDelegate, filepath: string) => HdWebSyncDriver,
22
30
  flushPendingDeletes: () => void,
23
31
  ready: Promise<any>,
@@ -28,19 +36,292 @@ declare type USD = {
28
36
  stdout: any;
29
37
  };
30
38
 
39
+ export type OpenUsdBuildInfo = {
40
+ schema: 1,
41
+ openusd: {
42
+ version: string,
43
+ pxrVersion: number,
44
+ gitSha: string,
45
+ gitDirty: boolean,
46
+ },
47
+ toolchain: {
48
+ emscripten: string,
49
+ cxxCompiler: string,
50
+ cmakeBuildType: string,
51
+ },
52
+ modules: {
53
+ usdImaging: boolean,
54
+ hydraBridge: boolean,
55
+ materialX: boolean,
56
+ openSubdiv: boolean,
57
+ usdGltf: boolean,
58
+ },
59
+ dependencies: {
60
+ openSubdiv: {
61
+ version: string,
62
+ },
63
+ materialX: {
64
+ prefix: string,
65
+ gitSha: string,
66
+ gitDirty: boolean,
67
+ },
68
+ usdGltf: {
69
+ prefix: string,
70
+ gitSha: string,
71
+ gitDirty: boolean,
72
+ },
73
+ emsdk: {
74
+ gitSha: string,
75
+ gitDirty: boolean,
76
+ },
77
+ },
78
+ }
79
+
80
+ // Generated in OpenUSD from pxr/usdImaging/hdEmscripten/bindgen/core-bindings.json.
81
+ // Keep this core USD surface in sync with the generated usd-core-bindings.d.ts.
82
+ declare type IntVector = {
83
+ size(): number,
84
+ get(index: number): number,
85
+ delete(): void,
86
+ }
87
+
88
+ declare type DoubleVector = {
89
+ size(): number,
90
+ get(index: number): number,
91
+ delete(): void,
92
+ }
93
+
94
+ declare type StringVector = {
95
+ size(): number,
96
+ get(index: number): string,
97
+ delete(): void,
98
+ }
99
+
100
+ declare type USDPrimVector = {
101
+ size(): number,
102
+ get(index: number): USDPrim,
103
+ delete(): void,
104
+ }
105
+
106
+ declare type USDAttributeVector = {
107
+ size(): number,
108
+ get(index: number): USDAttribute,
109
+ delete(): void,
110
+ }
111
+
112
+ declare type USDRelationshipVector = {
113
+ size(): number,
114
+ get(index: number): USDRelationship,
115
+ delete(): void,
116
+ }
117
+
118
+ declare type USDLayerOffset = {
119
+ offset: number,
120
+ scale: number,
121
+ isIdentity: boolean,
122
+ }
123
+
124
+ declare type USDLayerInfo = {
125
+ identifier: string,
126
+ displayName: string,
127
+ realPath: string,
128
+ }
129
+
130
+ declare type USDSpecStackEntry = {
131
+ path: string,
132
+ layer: USDLayerInfo,
133
+ layerOffset?: USDLayerOffset,
134
+ metadata: Record<string, string>,
135
+ specifier?: string,
136
+ typeName?: string,
137
+ name?: string,
138
+ }
139
+
140
+ declare type USDSpecStack = USDSpecStackEntry[]
141
+
142
+ declare type USDResolveInfo = {
143
+ source: "None" | "Fallback" | "Default" | "TimeSamples" | "ValueClips" | "Spline" | "Unknown",
144
+ hasAuthoredValueOpinion: boolean,
145
+ hasAuthoredValue: boolean,
146
+ valueIsBlocked: boolean,
147
+ valueSourceMightBeTimeVarying: boolean,
148
+ hasNextWeakerInfo: boolean,
149
+ }
150
+
151
+ declare type USDPcpNode = {
152
+ arcType?: string,
153
+ path?: string,
154
+ pathAtIntroduction?: string,
155
+ layerStackIdentifier?: string,
156
+ children?: USDPcpNode[],
157
+ }
158
+
159
+ declare type USDPrimIndex = {
160
+ isValid: boolean,
161
+ rootNode?: USDPcpNode,
162
+ }
163
+
164
+ declare type USDCompositionArc = {
165
+ arcType: string,
166
+ targetLayer: USDLayerInfo,
167
+ targetPrimPath: string,
168
+ introducingLayer: USDLayerInfo,
169
+ introducingPrimPath: string,
170
+ isImplicit: boolean,
171
+ isAncestral: boolean,
172
+ hasSpecs: boolean,
173
+ isIntroducedInRootLayerStack: boolean,
174
+ isIntroducedInRootLayerPrimSpec: boolean,
175
+ }
176
+
177
+ declare type USDObjectsChangedNotice = {
178
+ resyncedPaths: string[],
179
+ changedInfoOnlyPaths: string[],
180
+ resolvedAssetPathsResyncedPaths: string[],
181
+ changedFields: Record<string, string[]>,
182
+ }
183
+
184
+ declare type USDLayer = {
185
+ GetIdentifier(): string,
186
+ GetDisplayName(): string,
187
+ GetRealPath(): string,
188
+ ExportToString(): string,
189
+ Export(path: string): boolean,
190
+ Save(): boolean,
191
+ }
192
+
193
+ declare type USDAttribute = {
194
+ IsValid(): boolean,
195
+ GetName(): string,
196
+ GetPath(): string,
197
+ GetTypeName(): string,
198
+ GetAllMetadata(): Record<string, string>,
199
+ GetMetadataString(key: string): string,
200
+ HasAuthoredMetadata(key: string): boolean,
201
+ GetValueString(): string,
202
+ GetValueStringAtTime(timeCode: number): string,
203
+ GetConnections(): StringVector,
204
+ GetResolveInfo(timeCode: number): USDResolveInfo,
205
+ HasAuthoredValue(): boolean,
206
+ HasAuthoredValueOpinion(): boolean,
207
+ GetNumTimeSamples(): number,
208
+ GetTimeSamples(): DoubleVector,
209
+ GetPropertyStack(timeCode: number): USDSpecStack,
210
+ GetPropertyStackWithLayerOffsets(timeCode: number): USDSpecStack,
211
+ SetBool(value: boolean, timeCode: number): boolean,
212
+ SetInt(value: number, timeCode: number): boolean,
213
+ SetFloat(value: number, timeCode: number): boolean,
214
+ SetDouble(value: number, timeCode: number): boolean,
215
+ SetString(value: string, timeCode: number): boolean,
216
+ SetToken(value: string, timeCode: number): boolean,
217
+ AddConnection(path: string): boolean,
218
+ SetColor3f(r: number, g: number, b: number, timeCode: number): boolean,
219
+ SetVec3f(x: number, y: number, z: number, timeCode: number): boolean,
220
+ SetVec3d(x: number, y: number, z: number, timeCode: number): boolean,
221
+ SetMatrix4d(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number, timeCode: number): boolean,
222
+ }
223
+
224
+ declare type USDRelationship = {
225
+ IsValid(): boolean,
226
+ GetName(): string,
227
+ GetPath(): string,
228
+ GetAllMetadata(): Record<string, string>,
229
+ GetMetadataString(key: string): string,
230
+ HasAuthoredMetadata(key: string): boolean,
231
+ GetPropertyStack(timeCode: number): USDSpecStack,
232
+ GetPropertyStackWithLayerOffsets(timeCode: number): USDSpecStack,
233
+ GetTargets(): StringVector,
234
+ AddTarget(path: string): boolean,
235
+ ClearTargets(removeSpec: boolean): boolean,
236
+ }
237
+
238
+ declare type USDPrim = {
239
+ IsValid(): boolean,
240
+ GetName(): string,
241
+ GetPath(): string,
242
+ GetTypeName(): string,
243
+ GetDisplayName(): string,
244
+ GetAllMetadata(): Record<string, string>,
245
+ GetMetadataString(key: string): string,
246
+ HasAuthoredMetadata(key: string): boolean,
247
+ GetSpecifier(): string,
248
+ IsActive(): boolean,
249
+ SetActive(active: boolean): boolean,
250
+ ApplyAPI(schemaIdentifier: string): boolean,
251
+ IsDefined(): boolean,
252
+ IsAbstract(): boolean,
253
+ IsInstance(): boolean,
254
+ IsInPrototype(): boolean,
255
+ IsPrototype(): boolean,
256
+ IsLoaded(): boolean,
257
+ HasAuthoredPayloads(): boolean,
258
+ HasAuthoredReferences(): boolean,
259
+ HasAuthoredInherits(): boolean,
260
+ HasAuthoredSpecializes(): boolean,
261
+ HasAuthoredInstanceable(): boolean,
262
+ Load(): MaybePromise<void>,
263
+ Unload(): MaybePromise<void>,
264
+ AddPayload(assetPath: string, primPath: string): boolean,
265
+ GetParent(): USDPrim,
266
+ GetChildren(): USDPrimVector,
267
+ GetAttributes(): USDAttributeVector,
268
+ GetRelationships(): USDRelationshipVector,
269
+ GetPropertyNames(): StringVector,
270
+ GetPrimStack(): USDSpecStack,
271
+ GetPrimStackWithLayerOffsets(): USDSpecStack,
272
+ GetPrimIndex(): USDPrimIndex,
273
+ GetCompositionArcs(): USDCompositionArc[],
274
+ GetAttribute(name: string): USDAttribute,
275
+ CreateAttribute(name: string, typeName: string, custom: boolean): USDAttribute,
276
+ GetRelationship(name: string): USDRelationship,
277
+ CreateRelationship(name: string, custom: boolean): USDRelationship,
278
+ AddVariant(variantSetName: string, variantName: string): boolean,
279
+ SetVariantSelection(variantSetName: string, variantName: string): MaybePromise<boolean>,
280
+ GetVariantSelection(variantSetName: string): string,
281
+ ClearVariantSelection(variantSetName: string): boolean,
282
+ BlockVariantSelection(variantSetName: string): boolean,
283
+ GetVariantSetNames(): StringVector,
284
+ GetVariantNames(variantSetName: string): StringVector,
285
+ DefinePrimInVariant(variantSetName: string, variantName: string, path: string, typeName: string): USDPrim,
286
+ }
287
+
31
288
  declare type USDStage = {
289
+ GetRootLayer(): USDLayer,
290
+ GetPseudoRoot(): USDPrim,
291
+ GetPrimAtPath(path: string): USDPrim,
292
+ DefinePrim(path: string, typeName: string): USDPrim,
293
+ Traverse(): USDPrimVector,
294
+ TraverseAll(): USDPrimVector,
295
+ GetLayerStack(includeSessionLayers: boolean): USDLayerInfo[],
296
+ GetUsedLayers(includeClipLayers: boolean): USDLayerInfo[],
297
+ GetCompositionErrors(): string[],
298
+ RegisterObjectsChanged(callback: (notice: USDObjectsChangedNotice) => void): number,
299
+ RevokeObjectsChanged(listenerId: number): boolean,
32
300
  GetStartTimeCode(): number,
33
301
  GetEndTimeCode(): number,
34
302
  GetTimeCodesPerSecond(): number,
303
+ SetStartTimeCode(timeCode: number): void,
304
+ SetEndTimeCode(timeCode: number): void,
305
+ SetTimeCodesPerSecond(timeCodesPerSecond: number): void,
35
306
  GetUpAxis(): number,
307
+ SetUpAxis(upAxis: string): boolean,
308
+ Export(path: string): boolean,
309
+ ExportToString(): string,
36
310
  }
37
311
 
38
312
  declare type HdWebSyncDriver = {
39
313
  getFile: (path: string, cb: (loadedFile: ArrayBufferLike) => void) => void,
40
- GetStage: () => USDStage,
314
+ HasStage(): boolean,
315
+ GetStage(): USDStage,
316
+ GetStageUpAxis(): number,
317
+ GetStageStartTimeCode(): number,
318
+ GetStageEndTimeCode(): number,
319
+ GetStageTimeCodesPerSecond(): number,
320
+ SetIncludedPurposes(includedPurposes: string[]): void,
41
321
  SetTime(timecode: number): void,
42
322
  GetTime(): number,
43
- Draw(): void,
323
+ Draw(): MaybePromise<void>,
324
+ Repopulate(): MaybePromise<void>,
44
325
 
45
326
  /** ??? */
46
327
  clone(): HdWebSyncDriver,
@@ -61,6 +342,16 @@ export type GetUsdModuleOptions = {
61
342
  getPreloadedPackage?: (file: string, size: number) => ArrayBuffer | null,
62
343
  setStatus?: (status: string) => void,
63
344
  onDownloadProgress?: (downloaded: number, total: number) => void,
345
+ onAssetFetchProgress?: (progress: {
346
+ url: string,
347
+ state: "start" | "progress" | "done" | "error" | string,
348
+ loaded: number,
349
+ total: number,
350
+ active: number,
351
+ loadedTotal: number,
352
+ totalBytes: number,
353
+ error?: string,
354
+ }) => void,
64
355
  /** Returns a transferable object that can be resolved to an ArrayBuffer,
65
356
  * or an URL that can be fetched to get an ArrayBuffer.
66
357
  */
@@ -78,5 +369,7 @@ export type GetUsdModuleOptions = {
78
369
  * ```
79
370
  */
80
371
  export function getUsdModule(opts?: GetUsdModuleOptions): Promise<USD>;
372
+ export function getOpenUsdBuildInfo(USD: USD): OpenUsdBuildInfo;
373
+ export function loadOpenUsdBuildInfo(opts?: GetUsdModuleOptions): Promise<OpenUsdBuildInfo>;
81
374
 
82
- export type USDRoot = {}
375
+ export type USDRoot = {}
@@ -1,8 +1,15 @@
1
- import { Scene } from "three"
2
- import { HdWebSyncDriver, USD } from ".."
1
+ import { Object3D } from "three"
2
+ import { HdWebSyncDriver, USD, USDStage } from ".."
3
3
 
4
4
  export declare type HydraFile = File & { path: string };
5
5
 
6
+ export declare type NeedleThreeHydraStageMetadata = {
7
+ upAxis: string,
8
+ startTimeCode: number,
9
+ endTimeCode: number,
10
+ timeCodesPerSecond: number,
11
+ }
12
+
6
13
  export declare type createThreeHydraConfig = {
7
14
 
8
15
  debug?: boolean,
@@ -34,7 +41,43 @@ export declare type createThreeHydraConfig = {
34
41
  * Files to be loaded into the virtual file system.
35
42
  * The first file will be loaded as the root file, others will be loaded as dependencies.
36
43
  */
37
- files: Array<HydraFile>,
44
+ files?: Array<HydraFile>,
45
+
46
+ /**
47
+ * USD geometry purposes to include in the Hydra render pass.
48
+ * Defaults to ["default", "render"].
49
+ */
50
+ includedPurposes?: Array<"default" | "render" | "proxy" | "guide" | string>,
51
+
52
+ /**
53
+ * Add Three.js helper objects for USD cameras and lights.
54
+ * The cameras and lights themselves are created through Hydra Sprim sync either way.
55
+ */
56
+ showScenePrimitiveHelpers?: boolean,
57
+
58
+ /**
59
+ * Add Three.js CameraHelper objects for USD Camera prims.
60
+ */
61
+ showCameraHelpers?: boolean,
62
+
63
+ /**
64
+ * Add Three.js light helper objects for USD light prims.
65
+ */
66
+ showLightHelpers?: boolean,
67
+
68
+ /**
69
+ * Preview scale used when applying USD Lux intensity values to Three lights.
70
+ * Defaults to 0.01. USD intensity and exposure are still authored values; this
71
+ * only controls the helper/demo Three light brightness.
72
+ */
73
+ scenePrimitiveLightIntensityScale?: number,
74
+
75
+ /**
76
+ * Include asynchronous material generation and texture assignment in ready().
77
+ * Defaults to false so stage loading and first draw are not blocked by materials.
78
+ * Call handle.materialsReady() when you need an explicit material barrier.
79
+ */
80
+ waitForMaterials?: boolean,
38
81
  }
39
82
 
40
83
  /**
@@ -48,10 +91,47 @@ export declare type NeedleThreeHydraHandle = {
48
91
  * @param dt The delta time since the last update.
49
92
  */
50
93
  update: (dt: number) => void,
51
- /** Call this to update the usd scene immediately.
52
- * @param dt The delta time since the last update.
94
+ /** Set the current USD stage time code and redraw.
95
+ */
96
+ setTime: (timeCode: number) => Promise<void>,
97
+ /** Return the current USD stage time code used by Hydra.
98
+ */
99
+ getTime: () => number,
100
+ /** Enable or disable automatic playback in update().
101
+ */
102
+ setPlaying: (playing: boolean) => void,
103
+ /** Return whether update() is currently advancing stage time.
104
+ */
105
+ isPlaying: () => boolean,
106
+ /** Redraw the current USD stage after imperative stage edits.
107
+ */
108
+ refresh: () => Promise<void>,
109
+ /** Change the visible USD geometry purposes for the current Hydra view.
110
+ */
111
+ setIncludedPurposes: (includedPurposes: Array<"default" | "render" | "proxy" | "guide" | string>) => Promise<void>,
112
+ /** Rebuild Hydra population for the current USD stage after composition edits.
113
+ */
114
+ repopulate: () => Promise<void>,
115
+ /** Run an imperative USD stage edit after the current draw settles, then repopulate and redraw.
116
+ */
117
+ editStage: <T>(callback: (stage: USDStage, driver: HdWebSyncDriver) => T | Promise<T>) => Promise<T | undefined>,
118
+ /** Resolves after the initial Hydra draw has settled.
119
+ * If createThreeHydra was called with waitForMaterials, also waits for
120
+ * asynchronous material generation and texture assignment.
121
+ */
122
+ ready: () => Promise<void>,
123
+ /** Resolves when asynchronous material generation and texture assignment have settled.
124
+ */
125
+ materialsReady: () => Promise<void>,
126
+ /** Returns lightweight delegate diagnostics for smoke tests and debugging.
127
+ */
128
+ diagnostics: () => Record<string, unknown>,
129
+ /** Returns root-stage metadata captured before the first Hydra draw.
130
+ */
131
+ stageMetadata: () => NeedleThreeHydraStageMetadata,
132
+ /** Dispose the Three Hydra delegate.
53
133
  */
54
- dispose: () => void,
134
+ dispose: () => Promise<void>,
55
135
  }
56
136
 
57
137
  export declare class USDLoadingManager {
@@ -62,4 +142,4 @@ export declare class USDLoadingManager {
62
142
  /**
63
143
  * Creates a new three.js hydra handle.
64
144
  */
65
- export function createThreeHydra(config: createThreeHydraConfig): Promise<NeedleThreeHydraHandle>
145
+ export function createThreeHydra(config: createThreeHydraConfig): Promise<NeedleThreeHydraHandle>
@@ -1,5 +1,5 @@
1
1
  import { Object3D, Texture } from 'three';
2
- import { HdWebSyncDriver } from './bindings';
2
+ import { HdWebSyncDriver, USD } from './bindings';
3
3
 
4
4
  export class hydraDelegate { }
5
5
 
@@ -17,7 +17,13 @@ export const consoleRenderDelegate: hydraDelegate = {}
17
17
 
18
18
  export type threeJsRenderDelegateConfig = {
19
19
  driver: () => HdWebSyncDriver,
20
+ USD?: USD,
20
21
  usdRoot: Object3D,
22
+ scenePrimitiveRoot?: Object3D,
23
+ showScenePrimitiveHelpers?: boolean,
24
+ showCameraHelpers?: boolean,
25
+ showLightHelpers?: boolean,
26
+ scenePrimitiveLightIntensityScale?: number,
21
27
  /** Paths for resolving textures */
22
28
  paths?: string[],
23
29
  /** @deprecated */
@@ -26,7 +32,3 @@ export type threeJsRenderDelegateConfig = {
26
32
  export class threeJsRenderDelegate extends hydraDelegate {
27
33
  constructor(path: string, config: threeJsRenderDelegateConfig)
28
34
  }
29
-
30
-
31
-
32
-
@@ -2,8 +2,15 @@
2
2
 
3
3
  export type PluginContext = {
4
4
  debug?: boolean,
5
+ /**
6
+ * Include asynchronous material generation and texture assignment in the
7
+ * Hydra handle's ready() promise. Defaults to false.
8
+ */
9
+ waitForMaterials?: boolean,
5
10
  getFiles: () => Array<import("../types").HydraFile>
6
11
  }
7
12
 
8
13
 
9
14
  export declare function addPluginForNeedleEngine(options: PluginContext): Promise<(() => void)>;
15
+
16
+ export declare function getHydraHandleFromNeedleEngineAsset(asset: unknown): import("../types").NeedleThreeHydraHandle | null;