three-usd-robot 0.11.0 → 0.12.0

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 (42) hide show
  1. package/README.md +48 -7
  2. package/dist/MeshBinding-DQKXuYNr.d.ts +288 -0
  3. package/dist/{ThreeUsdRobot-BxnCluuK.d.ts → ThreeUsdRobot-C3N6-XBJ.d.ts} +1 -1
  4. package/dist/{ThreeUsdRobotLoader-C-E9uwEe.d.ts → ThreeUsdRobotLoader-D2fEo9_p.d.ts} +11 -3
  5. package/dist/{buildKinematicTree-BCySuZZn.d.ts → buildKinematicTree-iFqaw0Jl.d.ts} +1 -1
  6. package/dist/bytes-CxGRGry_.d.ts +14 -0
  7. package/dist/{chunk-AXPMXEQC.js → chunk-6W4LQVEQ.js} +13 -715
  8. package/dist/chunk-6W4LQVEQ.js.map +1 -0
  9. package/dist/{chunk-5SVRTKS4.js → chunk-7GGSIA6M.js} +18 -11
  10. package/dist/chunk-7GGSIA6M.js.map +1 -0
  11. package/dist/{chunk-BCRRXGNB.js → chunk-CK5MTMYR.js} +6 -4
  12. package/dist/chunk-CK5MTMYR.js.map +1 -0
  13. package/dist/chunk-JGIVJXBU.js +54 -0
  14. package/dist/chunk-JGIVJXBU.js.map +1 -0
  15. package/dist/{chunk-ENWFOYHU.js → chunk-KYBHWDX5.js} +3 -3
  16. package/dist/{chunk-ENWFOYHU.js.map → chunk-KYBHWDX5.js.map} +1 -1
  17. package/dist/chunk-PPPRB6KE.js +963 -0
  18. package/dist/chunk-PPPRB6KE.js.map +1 -0
  19. package/dist/{chunk-LDO5FKQS.js → chunk-YGJ23CG3.js} +4 -53
  20. package/dist/chunk-YGJ23CG3.js.map +1 -0
  21. package/dist/core.d.ts +6 -63
  22. package/dist/core.js +5 -3
  23. package/dist/extras.d.ts +2 -2
  24. package/dist/helpers.d.ts +2 -2
  25. package/dist/helpers.js +3 -2
  26. package/dist/helpers.js.map +1 -1
  27. package/dist/index.d.ts +11 -262
  28. package/dist/index.js +10 -8
  29. package/dist/index.js.map +1 -1
  30. package/dist/nodes.d.ts +49 -0
  31. package/dist/nodes.js +439 -0
  32. package/dist/nodes.js.map +1 -0
  33. package/dist/parseMdl-vfzBGoMr.d.ts +87 -0
  34. package/dist/react.d.ts +6 -4
  35. package/dist/react.js +6 -4
  36. package/dist/react.js.map +1 -1
  37. package/package.json +6 -2
  38. package/dist/bytes-MOJ2oN-u.d.ts +0 -42
  39. package/dist/chunk-5SVRTKS4.js.map +0 -1
  40. package/dist/chunk-AXPMXEQC.js.map +0 -1
  41. package/dist/chunk-BCRRXGNB.js.map +0 -1
  42. package/dist/chunk-LDO5FKQS.js.map +0 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ exported back to `.usda` / `.usdz` in the browser.
27
27
  `Capsule` / `Cone`), point clouds (`Points`) and curves (`BasisCurves`:
28
28
  linear / bezier / bspline / catmullRom, periodic wrap, and an opt-in
29
29
  `curveTubes` mode that turns authored widths into tube meshes) with
30
- `UsdShade` materials (UsdPreviewSurface / Omniverse MDL) and textures; up-axis
30
+ `UsdShade` materials (UsdPreviewSurface / Omniverse MDL / MaterialX) and textures; up-axis
31
31
  and units normalized automatically. Articulation-free stages load as
32
32
  static scenes.
33
33
  - **Animation** — plays back time-sampled joint trajectories, and replays
@@ -55,7 +55,7 @@ The CDN is public and CORS-enabled, so this works in the browser too. Try
55
55
  FK check, and a re-export to one self-contained file), or open the Vite example
56
56
  and pick a robot from the preset list.
57
57
 
58
- Materials target **UsdPreviewSurface fidelity plus an Omniverse MDL mapping**:
58
+ Materials target **UsdPreviewSurface fidelity plus Omniverse MDL and MaterialX mappings**:
59
59
  constant and textured inputs, faceVarying / indexed UVs, multiple UV sets,
60
60
  per-vertex display colors, physical extensions (`ior` / `clearcoat` /
61
61
  specular workflow → `MeshPhysicalMaterial`), packed ORM maps,
@@ -74,11 +74,51 @@ wrapper arguments > declaration defaults.
74
74
  | `OmniGlass` | `MeshPhysicalMaterial` with `transmission` / `ior` (default 1.491) / `roughness` / `thickness`, glass color + texture |
75
75
  | `OmniSurface(Lite)` | constants subset: diffuse color / metalness / roughness / IOR / coat / emission / opacity |
76
76
 
77
- Executing MDL or MaterialX shader graphs is out of scope; unknown MDL
78
- materials fall back to the OmniPBR mapping with a warning. Not yet
79
- supported: collection-based material bindings, and the exotic curve schemas
80
- (`NurbsCurves`, `HermiteCurves`, `NurbsPatch`) which load with a warning and
81
- are skipped.
77
+ MaterialX networks authored natively in UsdShade (`outputs:mtlx:surface` +
78
+ `ND_*` shaders) resolve the same way by parameter mapping, without graph
79
+ execution. `ND_standard_surface_surfaceshader` maps `base × base_color` /
80
+ `metalness` / `specular_roughness` / `specular_IOR` / `coat(_roughness)` /
81
+ `transmission` / `emission (× emission_color)` / `opacity` / `normal` onto
82
+ the standard (or, when coat / transmission / IOR are authored, physical)
83
+ three material; the `ND_Usd*` compatibility nodes delegate to the
84
+ UsdPreviewSurface readers. Image and UV nodes are supported
85
+ (`ND_image_*` address modes, `ND_tiledimage_*` uvtiling/uvoffset,
86
+ `ND_texcoord_*` UV-channel index, `ND_geompropvalue_*` primvar name,
87
+ `ND_normalmap`), and constant-only `ND_multiply_* / ND_mix_* / ND_convert_*`
88
+ (plus `ND_constant_*` / `ND_dot_*`) fold into values. Anything that needs
89
+ real evaluation (noise, ramps, …) skips just that channel with a warning —
90
+ the rest of the material still renders — unless you opt into the TSL entry
91
+ below. External `.mtlx` file references (UsdMtlx) are not parsed; load them
92
+ with `loadMaterialXDocument` (a thin wrapper over three's official
93
+ `MaterialXLoader`) from `three-usd-robot/nodes`.
94
+
95
+ **Executing MaterialX graphs (optional, WebGPU)** — the separate
96
+ `three-usd-robot/nodes` entry converts `ND_*` graphs (noise, ramps, math,
97
+ images, procedural UV warps — a ~45-node practical subset) into three.js TSL
98
+ `MeshPhysicalNodeMaterial`s and plugs in through the loader's
99
+ `materialFactory` hook:
100
+
101
+ ```ts
102
+ import { ThreeUsdRobotLoader } from "three-usd-robot";
103
+ import { createMaterialXNodeFactory } from "three-usd-robot/nodes";
104
+
105
+ const loader = new ThreeUsdRobotLoader({
106
+ materialFactory: createMaterialXNodeFactory({ onWarn: console.warn }),
107
+ });
108
+ ```
109
+
110
+ Requires `WebGPURenderer` (it falls back to WebGL2 internally). Graphs with
111
+ nodes outside the conversion table fall back to the parameter mapping with a
112
+ warning, and the WebGL core bundles never import `three/webgpu` / `three/tsl`
113
+ (verified at build time). See `examples/vite-webgpu-nodes` for a procedural
114
+ marble / worley / lava demo.
115
+
116
+ Executing MDL remains out of scope (a language, not a graph — it would need
117
+ an MDL SDK-class compiler); unknown MDL materials fall back to the OmniPBR
118
+ mapping (and unknown `ND_*` surface shaders to the UsdPreviewSurface reads)
119
+ with a warning. Not yet supported: collection-based material bindings, and
120
+ the exotic curve schemas (`NurbsCurves`, `HermiteCurves`, `NurbsPatch`)
121
+ which load with a warning and are skipped.
82
122
 
83
123
  ## Install
84
124
 
@@ -390,6 +430,7 @@ and builds the deployable site.
390
430
  | `three-usd-robot/core` | Three.js-independent USD parser & writer, robot IR, forward-kinematics math |
391
431
  | `three-usd-robot/helpers` | Viewer helpers (joint axes, link frames, joint limits) |
392
432
  | `three-usd-robot/extras` | Joint slider panel (bring your own `lil-gui`) |
433
+ | `three-usd-robot/nodes` | Optional MaterialX → TSL execution (`three/webgpu`) — `createMaterialXNodeFactory`, `loadMaterialXDocument` |
393
434
  | `three-usd-robot/react` | React Three Fiber `<UsdRobot>` component + hooks |
394
435
 
395
436
  ## Development
@@ -0,0 +1,288 @@
1
+ import * as THREE from 'three';
2
+ import { x as Vec2, y as Vec3, S as Stage, P as Prim, R as RobotDescription } from './buildKinematicTree-iFqaw0Jl.js';
3
+ import { b as MdlModuleProvider, A as AssetResolver } from './parseMdl-vfzBGoMr.js';
4
+ import { T as ThreeUsdRobot } from './ThreeUsdRobot-C3N6-XBJ.js';
5
+
6
+ /**
7
+ * Resolves `UsdShade` material bindings to flat PBR parameters.
8
+ *
9
+ * Follows a prim's (or an ancestor's) `material:binding` to a `Material`, finds
10
+ * its surface `Shader`, and reads constant color/metalness/roughness/opacity/
11
+ * emissive inputs plus the **texture** asset paths for the diffuse, normal,
12
+ * roughness, metallic, occlusion and emissive channels. Handles both
13
+ * `UsdPreviewSurface` (constant inputs or a connected `UsdUVTexture` network)
14
+ * and the Omniverse MDL material families (M20): `OmniPBR` (and derivatives
15
+ * such as `OmniPBR_Opacity`), `OmniPBR_ClearCoat`, `OmniGlass`, and an
16
+ * `OmniSurface(Lite)` constants subset. MDL shaders are identified by
17
+ * `info:mdl:sourceAsset` / `:subIdentifier`; when the referenced `.mdl` module
18
+ * text is available (see `loadMdlModules`), parameter values fall back from
19
+ * authored USD inputs to the module's wrapper arguments and declaration
20
+ * defaults. Executing MDL remains out of scope.
21
+ *
22
+ * MaterialX networks authored natively in UsdShade (M21) resolve here too:
23
+ * `ND_standard_surface_surfaceshader` has a dedicated reader (see
24
+ * `MaterialXBinding.ts`), while the `ND_Usd*` compatibility nodes share
25
+ * `UsdPreviewSurface` input names and reuse the generic reads.
26
+ */
27
+
28
+ /** `UsdUVTexture` wrap mode for one axis (`black` ≈ clamp; three has no border). */
29
+ type TextureWrap = "repeat" | "clamp" | "mirror" | "black";
30
+ /** `UsdTransform2d` applied to the `st` coords feeding a texture. */
31
+ type TextureTransform = {
32
+ /** `inputs:translation` (UV offset). */
33
+ translation?: Vec2;
34
+ /** `inputs:rotation` in degrees (CCW about the origin). */
35
+ rotation?: number;
36
+ /** `inputs:scale` (UV tiling). */
37
+ scale?: Vec2;
38
+ };
39
+ /** A resolved texture reference plus its `UsdUVTexture` sampler/transform state. */
40
+ type ResolvedTexture = {
41
+ /** Authored asset path of the image. */
42
+ path: string;
43
+ wrapS?: TextureWrap;
44
+ wrapT?: TextureWrap;
45
+ /** `UsdTransform2d` on the `st` input, if any. */
46
+ transform?: TextureTransform;
47
+ /** `inputs:scale` — multiplies the sampled value (folded into material factors). */
48
+ scale?: [number, number, number, number];
49
+ /** `inputs:bias` — added to the sampled value. */
50
+ bias?: [number, number, number, number];
51
+ /**
52
+ * UV-set (primvar) name the texture reads, resolved through the `inputs:st`
53
+ * connection to a `UsdPrimvarReader_float2.inputs:varname`. Absent ⇒ `"st"`.
54
+ */
55
+ uvSet?: string;
56
+ /**
57
+ * Direct UV channel index (MaterialX `ND_texcoord_*.inputs:index`, M21).
58
+ * Beats `uvSet`; channel N is the mesh's N-th UV set in `meshUvSetNames`
59
+ * order (`st` first, extras sorted).
60
+ */
61
+ uvChannel?: number;
62
+ /** `inputs:sourceColorSpace` — overrides the per-channel colorspace default. */
63
+ sourceColorSpace?: "raw" | "sRGB" | "auto";
64
+ /**
65
+ * Which output the consuming input connects to (`outputs:r` → `"r"`, …).
66
+ * three.js samples fixed channels (roughness = G, metalness = B, ao = R);
67
+ * a mismatch is surfaced as a load warning.
68
+ */
69
+ outputChannel?: "r" | "g" | "b" | "a" | "rgb";
70
+ };
71
+ type ResolvedMaterial = {
72
+ /** Name of the bound `Material` prim, for round-tripping and debugging. */
73
+ name?: string;
74
+ color?: Vec3;
75
+ opacity?: number;
76
+ metalness?: number;
77
+ roughness?: number;
78
+ emissiveColor?: Vec3;
79
+ /**
80
+ * `inputs:opacityThreshold`. When `> 0`, opacity is a binary mask (alpha
81
+ * clip / cutout); when `0`/absent, sub-unit opacity blends translucently.
82
+ */
83
+ opacityThreshold?: number;
84
+ /** `inputs:ior` — promotes the three material to `MeshPhysicalMaterial`. */
85
+ ior?: number;
86
+ /** `inputs:clearcoat` (physical promotion). */
87
+ clearcoat?: number;
88
+ /** `inputs:clearcoatRoughness` (physical promotion). */
89
+ clearcoatRoughness?: number;
90
+ /** `inputs:specularColor`, only when `inputs:useSpecularWorkflow = 1`. */
91
+ specularColor?: Vec3;
92
+ /** OmniPBR `inputs:emissive_intensity` — multiplies the emissive color. */
93
+ emissiveIntensity?: number;
94
+ /** OmniGlass — `1` marks a transmissive dielectric (physical promotion, M20). */
95
+ transmission?: number;
96
+ /** OmniGlass `inputs:depth` — refraction volume thickness (scene units, M20). */
97
+ thickness?: number;
98
+ /** Diffuse/albedo texture, if any. */
99
+ colorTexture?: ResolvedTexture;
100
+ /** Opacity / alpha texture (may be the same image as `colorTexture`). */
101
+ opacityTexture?: ResolvedTexture;
102
+ /** Tangent-space normal map, if any. */
103
+ normalTexture?: ResolvedTexture;
104
+ /** Roughness map, if any. */
105
+ roughnessTexture?: ResolvedTexture;
106
+ /** Metallic map, if any. */
107
+ metalnessTexture?: ResolvedTexture;
108
+ /** Ambient-occlusion map, if any. */
109
+ occlusionTexture?: ResolvedTexture;
110
+ /** Emissive map, if any. */
111
+ emissiveTexture?: ResolvedTexture;
112
+ /** OmniPBR_ClearCoat `clearcoat_normalmap_texture` (physical promotion, M20). */
113
+ clearcoatNormalTexture?: ResolvedTexture;
114
+ };
115
+ type ResolveMaterialOptions = {
116
+ /** Parsed `.mdl` modules for MDL family detection and value fallback (M20). */
117
+ mdl?: MdlModuleProvider;
118
+ /** Receives diagnostics (unknown MDL material families). */
119
+ onWarn?: (message: string) => void;
120
+ };
121
+ /** Resolve the bound material's flat parameters for `prim`, or `undefined`. */
122
+ declare function resolveBoundMaterial(stage: Stage, prim: Prim, options?: ResolveMaterialOptions): ResolvedMaterial | undefined;
123
+ /**
124
+ * The `Shader` prim driving `prim`'s bound material surface, or `undefined`.
125
+ * Follows the same binding/surface-output resolution as
126
+ * {@link resolveBoundMaterial} — exposed for custom material factories (M22)
127
+ * that need the raw shader network rather than the flattened parameters.
128
+ */
129
+ declare function findBoundSurfaceShader(stage: Stage, prim: Prim): Prim | undefined;
130
+
131
+ /**
132
+ * Loads texture image assets referenced by `UsdShade` materials.
133
+ *
134
+ * A {@link TextureProvider} maps an authored asset path (plus sampler/transform
135
+ * options) to a `THREE.Texture`. The default provider fetches the image **bytes**
136
+ * through the {@link AssetResolver} and decodes them via a blob URL — so it works
137
+ * uniformly for textures served over HTTP and for images embedded inside a
138
+ * `.usdz` package (whose resolver serves zip entries, not real URLs). Decoded
139
+ * images are cached per resolved URL and shared across every texture that uses
140
+ * them; each `THREE.Texture` carries its own color space / wrap / transform.
141
+ */
142
+
143
+ /**
144
+ * Color space to interpret a texture in. Color/albedo and emissive maps are
145
+ * `"srgb"`; data maps (normal, roughness, metalness, occlusion) are `"linear"`.
146
+ */
147
+ type TextureColorSpace = "srgb" | "linear";
148
+ /** Per-use sampler state applied to the returned `THREE.Texture`. */
149
+ type TextureOptions = {
150
+ /** Defaults to `"srgb"`. */
151
+ colorSpace?: TextureColorSpace;
152
+ wrapS?: TextureWrap;
153
+ wrapT?: TextureWrap;
154
+ transform?: TextureTransform;
155
+ /** UV channel index (0 = `uv`, 1 = `uv1`, …) for multi-UV-set meshes. */
156
+ channel?: number;
157
+ };
158
+ /** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */
159
+ type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;
160
+ /**
161
+ * A {@link TextureProvider} backed by the {@link AssetResolver}, resolving paths
162
+ * against `baseUrl`. Image bytes are fetched once per URL (works for HTTP and
163
+ * `.usdz` entries alike) and the decoded image is shared; each call returns a
164
+ * distinct `THREE.Texture` carrying the requested color space / wrap / transform.
165
+ */
166
+ declare function createTextureProvider(resolver: AssetResolver, baseUrl: string): TextureProvider;
167
+
168
+ /**
169
+ * Binds renderable gprims — `UsdGeom.Mesh` plus the parametric solids (`Cube` /
170
+ * `Sphere` / `Cylinder` / `Capsule` / `Cone`) — to Three.js geometry and
171
+ * attaches them under the robot's link objects.
172
+ *
173
+ * Meshes are triangulated with a simple fan. Primvars (`st` UV sets, `normals`,
174
+ * `displayColor`) resolve with USD interpolation semantics — `:indices`
175
+ * de-referencing, vertex vs faceVarying (de-indexed) layouts, multiple UV
176
+ * channels. Solids tessellate from their schema attributes. Geometry is left
177
+ * in stage units; the global `metersPerUnit` scale is applied at the root in M9.
178
+ */
179
+
180
+ type MeshKind = "visual" | "collision";
181
+ /**
182
+ * Replaces material creation for mesh-like gprims (`Mesh` and the parametric
183
+ * solids). Return `null` to fall back to the default `UsdShade` resolution —
184
+ * the hook that lets the optional `three-usd-robot/nodes` entry build TSL
185
+ * `NodeMaterial`s without the core depending on `three/webgpu` (M22).
186
+ */
187
+ type MaterialFactory = (prim: Prim, stage: Stage) => THREE.Material | null;
188
+ type BindMeshesOptions = {
189
+ loadVisuals?: boolean;
190
+ loadCollisions?: boolean;
191
+ /** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
192
+ textureProvider?: TextureProvider;
193
+ /** Render `BasisCurves` with authored `widths` as tube meshes (M18). */
194
+ curveTubes?: boolean;
195
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
196
+ onWarn?: (message: string) => void;
197
+ /** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
198
+ mdl?: MdlModuleProvider;
199
+ /** Overrides material creation for mesh-like gprims (M22). */
200
+ materialFactory?: MaterialFactory;
201
+ };
202
+ /**
203
+ * Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points.
204
+ *
205
+ * Primvars resolve with full interpolation semantics (M19): `:indices` arrays
206
+ * are de-referenced, vertex-interpolated `st` sets / `normals` /
207
+ * `displayColor` bind onto the shared vertices, and any faceVarying primvar
208
+ * (or per-face color) switches the mesh to a de-indexed layout where every
209
+ * face corner owns its vertex. Extra UV sets become `uv1`, `uv2`, … in
210
+ * {@link meshUvSetNames} order.
211
+ *
212
+ * When the mesh carries `materialBind` face subsets, the triangles are ordered
213
+ * subset by subset and a geometry group is added for each — so the mesh can be
214
+ * drawn with one material per subset (see {@link buildMeshMaterials}). Group
215
+ * order matches {@link getMaterialSubsets}, with any unassigned faces last.
216
+ */
217
+ declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
218
+ /**
219
+ * Build geometry for any renderable gprim: `Mesh` via {@link buildMeshGeometry},
220
+ * parametric solids from their schema attributes. Solids follow UsdGeom
221
+ * semantics — sizes in stage units, centered at the origin, `axis` (default
222
+ * `"Z"`) along the spine, and a capsule's `height` spans only its cylindrical
223
+ * section. Returns `null` for unsupported prim types.
224
+ */
225
+ declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
226
+ type BuildGprimOptions = {
227
+ /** Resolves texture asset paths for mesh materials. */
228
+ textureProvider?: TextureProvider;
229
+ /**
230
+ * Render `BasisCurves` that author `widths` as tube meshes instead of
231
+ * 1-px lines (default `false`).
232
+ */
233
+ curveTubes?: boolean;
234
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
235
+ onWarn?: (message: string) => void;
236
+ /** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
237
+ mdl?: MdlModuleProvider;
238
+ /** Overrides material creation for mesh-like gprims (M22). */
239
+ materialFactory?: MaterialFactory;
240
+ };
241
+ /**
242
+ * Build a renderable `THREE.Object3D` for any supported gprim (M18):
243
+ * `Mesh` and the parametric solids become a `THREE.Mesh` (via
244
+ * {@link buildGprimGeometry} + {@link buildMeshMaterials}), `Points` a
245
+ * `THREE.Points`, and `BasisCurves` a `THREE.Group` holding one line — or,
246
+ * with {@link BuildGprimOptions.curveTubes}, one tube mesh — per curve.
247
+ * Returns `null` for unsupported prim types and degenerate geometry.
248
+ */
249
+ declare function buildGprimObject(prim: Prim, stage?: Stage, options?: BuildGprimOptions): THREE.Object3D | null;
250
+ /**
251
+ * Build a material for a gprim. Color priority: bound `UsdShade` material
252
+ * (when `stage` is given) → `primvars:displayColor` → default gray. Textures
253
+ * (via `textures`) become the matching `MeshStandardMaterial` maps — diffuse →
254
+ * `map` (sRGB), plus `normalMap` / `roughnessMap` / `metalnessMap` / `aoMap`
255
+ * (linear data) and emissive `emissiveMap`. Metalness / roughness / opacity /
256
+ * emissive constants come from the bound material when present.
257
+ */
258
+ declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider,
259
+ /** Resolve the material binding from here instead (a `GeomSubset`). */
260
+ bindingPrim?: Prim,
261
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
262
+ onWarn?: (message: string) => void,
263
+ /** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
264
+ mdl?: MdlModuleProvider): THREE.Material;
265
+ /**
266
+ * Attach visual (and optionally collision) meshes to every link of a built
267
+ * {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
268
+ * the owning link prim.
269
+ */
270
+ declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: BindMeshesOptions): void;
271
+ /**
272
+ * Attach the gprims that belong to no link — the static scenery of a cell that
273
+ * also contains robots. The authored prim hierarchy is mirrored with
274
+ * `THREE.Group` nodes (each carrying `userData.primPath` and its prim's local
275
+ * transform), so grouped scenery — a pallet and its cartons, a fence and its
276
+ * wires — stays one movable subtree. World placements are unchanged, and the
277
+ * loader's up-axis and unit normalization still applies at the robot root.
278
+ * Collision-only and guide/proxy prims are skipped.
279
+ */
280
+ declare function bindSceneMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: {
281
+ textureProvider?: TextureProvider;
282
+ curveTubes?: boolean;
283
+ onWarn?: (message: string) => void;
284
+ mdl?: MdlModuleProvider;
285
+ materialFactory?: MaterialFactory;
286
+ }): number;
287
+
288
+ export { type BindMeshesOptions as B, type MaterialFactory as M, type ResolveMaterialOptions as R, type TextureProvider as T, type BuildGprimOptions as a, type MeshKind as b, type ResolvedMaterial as c, type ResolvedTexture as d, type TextureColorSpace as e, type TextureOptions as f, type TextureTransform as g, type TextureWrap as h, bindRobotMeshes as i, bindSceneMeshes as j, buildGprimGeometry as k, buildGprimObject as l, buildMeshGeometry as m, buildMeshMaterial as n, createTextureProvider as o, findBoundSurfaceShader as p, resolveBoundMaterial as r };
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { J as JointType, A as Axis, a as JointDescription, L as LinkDescription, R as RobotDescription, K as KinematicTree, S as Stage } from './buildKinematicTree-BCySuZZn.js';
2
+ import { f as JointType, A as Axis, e as JointDescription, i as LinkDescription, R as RobotDescription, K as KinematicTree, S as Stage } from './buildKinematicTree-iFqaw0Jl.js';
3
3
 
4
4
  /**
5
5
  * The articulated "motion" node of a joint, inserted between the joint's two
@@ -1,6 +1,8 @@
1
- import { R as RobotDescription } from './buildKinematicTree-BCySuZZn.js';
2
- import { A as AssetResolver, U as UsdSource, B as BinarySource } from './bytes-MOJ2oN-u.js';
3
- import { W as WorldUpAxis, a as ThreeUsdRobotOptions, T as ThreeUsdRobot } from './ThreeUsdRobot-BxnCluuK.js';
1
+ import { R as RobotDescription } from './buildKinematicTree-iFqaw0Jl.js';
2
+ import { A as AssetResolver } from './parseMdl-vfzBGoMr.js';
3
+ import { U as UsdSource, B as BinarySource } from './bytes-CxGRGry_.js';
4
+ import { M as MaterialFactory } from './MeshBinding-DQKXuYNr.js';
5
+ import { W as WorldUpAxis, a as ThreeUsdRobotOptions, T as ThreeUsdRobot } from './ThreeUsdRobot-C3N6-XBJ.js';
4
6
 
5
7
  type ThreeUsdRobotLoaderOptions = {
6
8
  /** Resolver for references / payloads / sublayers (default {@link DefaultAssetResolver}). */
@@ -51,6 +53,12 @@ type ThreeUsdRobotLoaderOptions = {
51
53
  robotName?: string;
52
54
  /** Receives non-fatal load diagnostics. */
53
55
  onWarn?: (message: string) => void;
56
+ /**
57
+ * Overrides material creation for mesh-like gprims (M22) — e.g. the TSL
58
+ * MaterialX factory from `three-usd-robot/nodes`. Return `null` per prim to
59
+ * keep the default `UsdShade` resolution.
60
+ */
61
+ materialFactory?: MaterialFactory;
54
62
  };
55
63
  /**
56
64
  * Loads Isaac Sim / OpenUSD robot assets into a controllable {@link ThreeUsdRobot}.
@@ -528,4 +528,4 @@ type BuildTreeOptions = {
528
528
  };
529
529
  declare function buildKinematicTree(robot: RobotDescription, options?: BuildTreeOptions): KinematicTree;
530
530
 
531
- export { makeRotationZ as $, type Axis as A, type BuildTreeOptions as B, type CompositionArc as C, DEFAULT_METERS_PER_UNIT as D, buildKinematicTree as E, channelFromSamples as F, decomposeRigid as G, fromUsdMatrix as H, getTranslation as I, type JointType as J, type KinematicTree as K, type LinkDescription as L, type Mat4 as M, identity4 as N, interpolate as O, Prim as P, Quat as Q, type RobotDescription as R, Stage as S, type TreeEdge as T, type UsdaFile as U, type Vec2 as V, invert as W, makeEuler as X, makeRotationFromQuat as Y, makeRotationX as Z, makeRotationY as _, type JointDescription as a, makeScale as a0, makeTranslation as a1, multiply as a2, multiplyAll as a3, toUsdMatrix as a4, type Vec3 as b, type JointDriveDescription as c, type LinkInertialDescription as d, AssetPath as e, Attribute as f, type AttributeSpec as g, DEG2RAD as h, type KinematicNode as i, Layer as j, type ListOp as k, type MetadataMap as l, type PrimSpec as m, type PropertySpec as n, RAD2DEG as o, Relationship as p, type RelationshipSpec as q, type SampleChannel as r, type SdfPath as s, type Specifier as t, type UpAxis as u, type UsdDictionary as v, UsdMatrix as w, type UsdValue as x, type Variability as y, type Vec4 as z };
531
+ export { makeRotationZ as $, type Axis as A, type BuildTreeOptions as B, type CompositionArc as C, DEFAULT_METERS_PER_UNIT as D, buildKinematicTree as E, channelFromSamples as F, decomposeRigid as G, fromUsdMatrix as H, getTranslation as I, type JointDriveDescription as J, type KinematicTree as K, type LinkInertialDescription as L, type Mat4 as M, identity4 as N, interpolate as O, Prim as P, Quat as Q, type RobotDescription as R, Stage as S, type TreeEdge as T, type UsdaFile as U, type Variability as V, invert as W, makeEuler as X, makeRotationFromQuat as Y, makeRotationX as Z, makeRotationY as _, AssetPath as a, makeScale as a0, makeTranslation as a1, multiply as a2, multiplyAll as a3, toUsdMatrix as a4, Attribute as b, type AttributeSpec as c, DEG2RAD as d, type JointDescription as e, type JointType as f, type KinematicNode as g, Layer as h, type LinkDescription as i, type ListOp as j, type MetadataMap as k, type PrimSpec as l, type PropertySpec as m, RAD2DEG as n, Relationship as o, type RelationshipSpec as p, type SampleChannel as q, type SdfPath as r, type Specifier as s, type UpAxis as t, type UsdDictionary as u, UsdMatrix as v, type UsdValue as w, type Vec2 as x, type Vec3 as y, type Vec4 as z };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * In-memory input normalization for the loader entry points. Callers hold USD
3
+ * content in many shapes — a `fetch` response's `ArrayBuffer`, a `Uint8Array`
4
+ * (or any typed-array view), a dropped `File` / `Blob` — and every byte-eating
5
+ * API here funnels through {@link toBytes} so all of them are accepted.
6
+ */
7
+ /** Binary USD content: an `ArrayBuffer`, any typed-array view, or a `Blob`/`File`. */
8
+ type BinarySource = ArrayBuffer | ArrayBufferView | Blob;
9
+ /** In-memory USD content: USDA source text, or {@link BinarySource} bytes. */
10
+ type UsdSource = string | BinarySource;
11
+ /** Normalize a {@link BinarySource} to bytes, honoring a view's offset/length. */
12
+ declare function toBytes(data: BinarySource): Promise<Uint8Array>;
13
+
14
+ export { type BinarySource as B, type UsdSource as U, toBytes as t };