three-usd-robot 0.10.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 (45) hide show
  1. package/README.md +108 -8
  2. package/dist/MeshBinding-DQKXuYNr.d.ts +288 -0
  3. package/dist/ThreeUsdRobot-C3N6-XBJ.d.ts +347 -0
  4. package/dist/{ThreeUsdRobotLoader-NdFAVN96.d.ts → ThreeUsdRobotLoader-D2fEo9_p.d.ts} +17 -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-NFKK5LJK.js → chunk-6W4LQVEQ.js} +33 -307
  8. package/dist/chunk-6W4LQVEQ.js.map +1 -0
  9. package/dist/{chunk-CDQPWWMQ.js → chunk-7GGSIA6M.js} +50 -28
  10. package/dist/chunk-7GGSIA6M.js.map +1 -0
  11. package/dist/{chunk-SSSDVLUK.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-KYBHWDX5.js +701 -0
  16. package/dist/chunk-KYBHWDX5.js.map +1 -0
  17. package/dist/chunk-PPPRB6KE.js +963 -0
  18. package/dist/chunk-PPPRB6KE.js.map +1 -0
  19. package/dist/{chunk-IYKPVUZ2.js → chunk-YGJ23CG3.js} +40 -53
  20. package/dist/chunk-YGJ23CG3.js.map +1 -0
  21. package/dist/core.d.ts +74 -5
  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 +10 -237
  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/ThreeUsdRobot-B7Z4oORO.d.ts +0 -185
  39. package/dist/bytes-MOJ2oN-u.d.ts +0 -42
  40. package/dist/chunk-CDQPWWMQ.js.map +0 -1
  41. package/dist/chunk-IYKPVUZ2.js.map +0 -1
  42. package/dist/chunk-NFKK5LJK.js.map +0 -1
  43. package/dist/chunk-SSSDVLUK.js.map +0 -1
  44. package/dist/chunk-WROYLUSS.js +0 -393
  45. package/dist/chunk-WROYLUSS.js.map +0 -1
package/README.md CHANGED
@@ -27,10 +27,12 @@ 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 / OmniPBR) 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
- - **Animation** — plays back time-sampled joint trajectories.
33
+ - **Animation** — plays back time-sampled joint trajectories, and replays
34
+ baked body-transform recordings through `setLinkTransforms` with
35
+ constraint diagnostics.
34
36
  - **Export** — write robots and whole cells back to `.usda` / `.usdz`,
35
37
  simulation-ready for Isaac Sim.
36
38
  - **React** — declarative `<UsdRobot>` for React Three Fiber.
@@ -53,15 +55,70 @@ The CDN is public and CORS-enabled, so this works in the browser too. Try
53
55
  FK check, and a re-export to one self-contained file), or open the Vite example
54
56
  and pick a robot from the preset list.
55
57
 
56
- Materials target **UsdPreviewSurface fidelity plus an OmniPBR mapping**:
58
+ Materials target **UsdPreviewSurface fidelity plus Omniverse MDL and MaterialX mappings**:
57
59
  constant and textured inputs, faceVarying / indexed UVs, multiple UV sets,
58
60
  per-vertex display colors, physical extensions (`ior` / `clearcoat` /
59
61
  specular workflow → `MeshPhysicalMaterial`), packed ORM maps,
60
- `sourceColorSpace`, and purpose/strength-aware bindings. Executing MDL or
61
- MaterialX shader graphs is out of scope. Not yet supported:
62
- collection-based material bindings, and the exotic curve schemas
63
- (`NurbsCurves`, `HermiteCurves`, `NurbsPatch`) which load with a warning and
64
- are skipped.
62
+ `sourceColorSpace`, and purpose/strength-aware bindings. MDL shaders are
63
+ identified by `info:mdl:sourceAsset` and mapped **by family** no shader
64
+ execution and referenced `.mdl` modules are fetched and parsed for their
65
+ declaration values, so wrapper materials
66
+ (`export material X(*) = OmniPBR(…)`) render correctly even when the USD
67
+ shader authors no inputs at all. Value priority: authored USD inputs >
68
+ wrapper arguments > declaration defaults.
69
+
70
+ | MDL family | three.js mapping |
71
+ | --- | --- |
72
+ | `OmniPBR` (and derivatives, e.g. `OmniPBR_Opacity`) | color / metalness / roughness / emissive (`emissive_intensity`), per-channel texture maps and packed `ORM_texture`, opacity, normal map, `texture_translate/rotate/scale` |
73
+ | `OmniPBR_ClearCoat` | the OmniPBR mapping plus `clearcoat` / `clearcoatRoughness` / `clearcoatNormalMap` |
74
+ | `OmniGlass` | `MeshPhysicalMaterial` with `transmission` / `ior` (default 1.491) / `roughness` / `thickness`, glass color + texture |
75
+ | `OmniSurface(Lite)` | constants subset: diffuse color / metalness / roughness / IOR / coat / emission / opacity |
76
+
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.
65
122
 
66
123
  ## Install
67
124
 
@@ -212,6 +269,48 @@ if (range) {
212
269
  }
213
270
  ```
214
271
 
272
+ ### Baked link transforms (recorded playback)
273
+
274
+ Recordings baked as **body transforms** (Isaac Sim stage-recorder output,
275
+ maximal-coordinate solver playback) can drive link poses directly, bypassing
276
+ the joints — usdview-style display semantics:
277
+
278
+ ```ts
279
+ // A world-pose track keyed by prim path (or link key), quaternion in [x, y, z, w]:
280
+ robot.setLinkTransforms({
281
+ "/World/link1": { position: [0, 0, 1], quaternion: [0, 0, 0, 1] },
282
+ "/World/link2": { position: [0.3, 0, 2], quaternion: [0, 0, 0, 1] },
283
+ }); // batched — one matrix update; unlisted links keep their current world pose
284
+
285
+ robot.displayMode; // "baked": joint values are untouched and no longer place links
286
+ robot.setJointValues(liveValues); // recompute all links from joint values → "fk"
287
+ ```
288
+
289
+ Poses are read in the **three.js scene world after `worldUp` normalization** —
290
+ pair a Z-up meter track (Isaac / ROS convention) with `worldUp: "Z"`; feeding
291
+ it into the default Y-up normalization lays the robot on its side. Transforms
292
+ on the `robot` object itself (placement, uniform scaling) are accounted for,
293
+ and `{ space: "stage" }` reads authored stage coordinates instead.
294
+
295
+ Constraint deviations — a recording from a different model version, solver
296
+ drift, a coordinate-convention bug — are shown, never silently corrected.
297
+ Measure them, or project onto the joints instead:
298
+
299
+ ```ts
300
+ robot.validateLinkTransforms(poses);
301
+ // { "/World/joint1": { anchorError /* m */, axisError /* rad */, q, limitExceeded }, … }
302
+ // covers every joint: fixed joints, loop joints dropped from the FK tree,
303
+ // and the world-fixed root attachment
304
+
305
+ const { values, residuals } = robot.jointValuesFromLinkTransforms(poses, {
306
+ previous: lastValues, // ±π branch continuity, frame to frame
307
+ });
308
+ robot.setJointValues(values); // constraint-respecting playback of the same track
309
+ ```
310
+
311
+ `new ThreeUsdRobotLoader({ debugBakedTransforms: true })` warns once per baked
312
+ session when poses deviate beyond 1 mm / 0.01 rad.
313
+
215
314
  ### React Three Fiber
216
315
 
217
316
  `three-usd-robot/react` provides a declarative `<UsdRobot>` (`react` and
@@ -331,6 +430,7 @@ and builds the deployable site.
331
430
  | `three-usd-robot/core` | Three.js-independent USD parser & writer, robot IR, forward-kinematics math |
332
431
  | `three-usd-robot/helpers` | Viewer helpers (joint axes, link frames, joint limits) |
333
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` |
334
434
  | `three-usd-robot/react` | React Three Fiber `<UsdRobot>` component + hooks |
335
435
 
336
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 };