@openusd-wasm/three-loader 0.0.1 → 0.0.3
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 +12 -0
- package/dist/openusd_three_loader.d.ts +6 -14
- package/dist/openusd_three_loader.js +386 -786
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -74,6 +74,18 @@ When the entry layer references a known asset root, such as `resource/` or
|
|
|
74
74
|
pass `files` to `parseAsync` for explicit virtual filesystem entries, or set
|
|
75
75
|
`autoResolveAssets: false` to disable this behavior.
|
|
76
76
|
|
|
77
|
+
When generating USDA files that reference assets written next to the layer, use
|
|
78
|
+
`toLayerRelativeAssetPath` before authoring the reference. OpenUSD treats
|
|
79
|
+
`@assets/model.usdz@` as a search-path asset, while `@./assets/model.usdz@`
|
|
80
|
+
is anchored to the current layer directory and packages without transient
|
|
81
|
+
`0/model.usdz` remap warnings.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { toLayerRelativeAssetPath } from '@openusd-wasm/utils'
|
|
85
|
+
|
|
86
|
+
refs.AddReference(toLayerRelativeAssetPath('assets/gearbox.usdz'), '')
|
|
87
|
+
```
|
|
88
|
+
|
|
77
89
|
## Textures
|
|
78
90
|
|
|
79
91
|
USD asset paths do not always map directly to browser URLs. The loader creates
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Pxr } from "@openusd-wasm/pxr";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { Loader, LoadingManager } from "three";
|
|
4
|
+
import { USDAssetValue, USDTextureResolver as USDTextureResolver$1, USDTextureResolverContext as USDTextureResolverContext$1 } from "@openusd-wasm/utils";
|
|
4
5
|
|
|
5
6
|
//#region src/types.d.ts
|
|
6
7
|
type USDSourceInput = string | ArrayBuffer | ArrayBufferView | Blob;
|
|
@@ -13,9 +14,9 @@ interface USDStageInfo {
|
|
|
13
14
|
rootLayerIdentifier: string;
|
|
14
15
|
defaultPrim: string | null;
|
|
15
16
|
upAxis: string;
|
|
16
|
-
startTimeCode
|
|
17
|
-
endTimeCode
|
|
18
|
-
timeCodesPerSecond
|
|
17
|
+
startTimeCode: number;
|
|
18
|
+
endTimeCode: number;
|
|
19
|
+
timeCodesPerSecond: number;
|
|
19
20
|
}
|
|
20
21
|
interface USDViewPrim {
|
|
21
22
|
path: string;
|
|
@@ -110,17 +111,8 @@ interface ExtractUSDModelDataOptions {
|
|
|
110
111
|
sourcePath?: string;
|
|
111
112
|
rootLayerIdentifier?: string;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
material?: USDMaterialInfo;
|
|
116
|
-
shader?: USDShaderInfo;
|
|
117
|
-
}
|
|
118
|
-
interface USDAssetValue {
|
|
119
|
-
path?: string;
|
|
120
|
-
resolvedPath?: string;
|
|
121
|
-
url?: string;
|
|
122
|
-
}
|
|
123
|
-
type USDTextureResolver = (asset: USDAssetValue, context: USDTextureResolverContext) => string | null | undefined;
|
|
114
|
+
type USDTextureResolverContext = USDTextureResolverContext$1<USDMaterialInfo, USDShaderInfo>;
|
|
115
|
+
type USDTextureResolver = USDTextureResolver$1<USDMaterialInfo, USDShaderInfo>;
|
|
124
116
|
interface BuildUSDObjectOptions {
|
|
125
117
|
sourcePath?: string;
|
|
126
118
|
convertZUp?: boolean;
|