three-usd-robot 0.9.0 → 0.10.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.
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { CollisionApproximation, ExportPhysicsMaterial, RobotGeometryProvider, ExportRobotOptions, ExportMaterial, ExportMesh } from './core.js';
2
- export { ARTICULATION_ROOT_API, COLLISION_API, ComposeOptions, CrateReader, ExtractOptions, MASS_API, MESH_COLLISION_API, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, ResolvedXform, TextureChannel, TokenizeError, UsdzPackage, VERSION, ValidateRobotOptions, ValidationIssue, ValidationSeverity, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isRenderableGprim, isScope, isSolidGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz } from './core.js';
2
+ export { ARTICULATION_ROOT_API, COLLISION_API, ComposeOptions, CrateReader, ExtractOptions, MASS_API, MESH_COLLISION_API, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, ResolvedXform, TextureChannel, TokenizeError, UsdzPackage, VERSION, ValidateRobotOptions, ValidationIssue, ValidationSeverity, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz } from './core.js';
3
3
  import * as THREE from 'three';
4
- import { A as Axis, V as Vec2, b as Vec3, S as Stage, P as Prim, R as RobotDescription, c as JointDriveDescription, d as LinkInertialDescription, K as KinematicTree, U as UsdaFile, M as Mat4 } from './buildKinematicTree-DQ4Vr4sJ.js';
5
- export { e as AssetPath, f as Attribute, g as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEFAULT_METERS_PER_UNIT, h as DEG2RAD, a as JointDescription, J as JointType, i as KinematicNode, j as Layer, L as LinkDescription, k as ListOp, l as MetadataMap, m as PrimSpec, n as PropertySpec, Q as Quat, o as RAD2DEG, p as Relationship, q as RelationshipSpec, r as SampleChannel, s as SdfPath, t as Specifier, T as TreeEdge, u as UpAxis, v as UsdDictionary, w as UsdMatrix, x as UsdValue, y as Variability, z as Vec4, E as buildKinematicTree, F as channelFromSamples, G as decomposeRigid, H as fromUsdMatrix, I as getTranslation, N as identity4, O as interpolate, W as invert, X as makeEuler, Y as makeRotationFromQuat, Z as makeRotationX, _ as makeRotationY, $ as makeRotationZ, a0 as makeScale, a1 as makeTranslation, a2 as multiply, a3 as multiplyAll, a4 as toUsdMatrix } from './buildKinematicTree-DQ4Vr4sJ.js';
6
- import { T as ThreeUsdRobot } from './ThreeUsdRobot-BAh-48DD.js';
7
- export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-BAh-48DD.js';
4
+ import { A as Axis, V as Vec2, b as Vec3, S as Stage, P as Prim, R as RobotDescription, c as JointDriveDescription, d as LinkInertialDescription, K as KinematicTree, U as UsdaFile, M as Mat4 } from './buildKinematicTree-BCySuZZn.js';
5
+ export { e as AssetPath, f as Attribute, g as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEFAULT_METERS_PER_UNIT, h as DEG2RAD, a as JointDescription, J as JointType, i as KinematicNode, j as Layer, L as LinkDescription, k as ListOp, l as MetadataMap, m as PrimSpec, n as PropertySpec, Q as Quat, o as RAD2DEG, p as Relationship, q as RelationshipSpec, r as SampleChannel, s as SdfPath, t as Specifier, T as TreeEdge, u as UpAxis, v as UsdDictionary, w as UsdMatrix, x as UsdValue, y as Variability, z as Vec4, E as buildKinematicTree, F as channelFromSamples, G as decomposeRigid, H as fromUsdMatrix, I as getTranslation, N as identity4, O as interpolate, W as invert, X as makeEuler, Y as makeRotationFromQuat, Z as makeRotationX, _ as makeRotationY, $ as makeRotationZ, a0 as makeScale, a1 as makeTranslation, a2 as multiply, a3 as multiplyAll, a4 as toUsdMatrix } from './buildKinematicTree-BCySuZZn.js';
6
+ import { T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
7
+ export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-B7Z4oORO.js';
8
8
  import { A as AssetResolver } from './bytes-MOJ2oN-u.js';
9
9
  export { B as BinarySource, D as DefaultAssetResolver, U as UsdSource, c as createMemoryResolver, j as joinPosix, t as toBytes } from './bytes-MOJ2oN-u.js';
10
- export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-DYtvelif.js';
10
+ export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-NdFAVN96.js';
11
11
 
12
12
  /** Unit vector for a USD joint axis token. Returns a fresh vector each call. */
13
13
  declare function axisVector(axis: Axis): THREE.Vector3;
@@ -47,6 +47,19 @@ type ResolvedTexture = {
47
47
  scale?: [number, number, number, number];
48
48
  /** `inputs:bias` — added to the sampled value. */
49
49
  bias?: [number, number, number, number];
50
+ /**
51
+ * UV-set (primvar) name the texture reads, resolved through the `inputs:st`
52
+ * connection to a `UsdPrimvarReader_float2.inputs:varname`. Absent ⇒ `"st"`.
53
+ */
54
+ uvSet?: string;
55
+ /** `inputs:sourceColorSpace` — overrides the per-channel colorspace default. */
56
+ sourceColorSpace?: "raw" | "sRGB" | "auto";
57
+ /**
58
+ * Which output the consuming input connects to (`outputs:r` → `"r"`, …).
59
+ * three.js samples fixed channels (roughness = G, metalness = B, ao = R);
60
+ * a mismatch is surfaced as a load warning.
61
+ */
62
+ outputChannel?: "r" | "g" | "b" | "a" | "rgb";
50
63
  };
51
64
  type ResolvedMaterial = {
52
65
  /** Name of the bound `Material` prim, for round-tripping and debugging. */
@@ -61,6 +74,16 @@ type ResolvedMaterial = {
61
74
  * clip / cutout); when `0`/absent, sub-unit opacity blends translucently.
62
75
  */
63
76
  opacityThreshold?: number;
77
+ /** `inputs:ior` — promotes the three material to `MeshPhysicalMaterial`. */
78
+ ior?: number;
79
+ /** `inputs:clearcoat` (physical promotion). */
80
+ clearcoat?: number;
81
+ /** `inputs:clearcoatRoughness` (physical promotion). */
82
+ clearcoatRoughness?: number;
83
+ /** `inputs:specularColor`, only when `inputs:useSpecularWorkflow = 1`. */
84
+ specularColor?: Vec3;
85
+ /** OmniPBR `inputs:emissive_intensity` — multiplies the emissive color. */
86
+ emissiveIntensity?: number;
64
87
  /** Diffuse/albedo texture, if any. */
65
88
  colorTexture?: ResolvedTexture;
66
89
  /** Opacity / alpha texture (may be the same image as `colorTexture`). */
@@ -103,6 +126,8 @@ type TextureOptions = {
103
126
  wrapS?: TextureWrap;
104
127
  wrapT?: TextureWrap;
105
128
  transform?: TextureTransform;
129
+ /** UV channel index (0 = `uv`, 1 = `uv1`, …) for multi-UV-set meshes. */
130
+ channel?: number;
106
131
  };
107
132
  /** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */
108
133
  type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;
@@ -119,11 +144,11 @@ declare function createTextureProvider(resolver: AssetResolver, baseUrl: string)
119
144
  * `Sphere` / `Cylinder` / `Capsule` / `Cone`) — to Three.js geometry and
120
145
  * attaches them under the robot's link objects.
121
146
  *
122
- * Meshes are triangulated with a simple fan, use authored per-vertex normals
123
- * when present (else computed smooth normals), and read `primvars:st` UVs and
124
- * `primvars:displayColor`. Solids tessellate from their schema attributes.
125
- * Geometry is left in stage units; the global `metersPerUnit` scale is applied
126
- * at the root in M9.
147
+ * Meshes are triangulated with a simple fan. Primvars (`st` UV sets, `normals`,
148
+ * `displayColor`) resolve with USD interpolation semantics `:indices`
149
+ * de-referencing, vertex vs faceVarying (de-indexed) layouts, multiple UV
150
+ * channels. Solids tessellate from their schema attributes. Geometry is left
151
+ * in stage units; the global `metersPerUnit` scale is applied at the root in M9.
127
152
  */
128
153
 
129
154
  type MeshKind = "visual" | "collision";
@@ -132,10 +157,21 @@ type BindMeshesOptions = {
132
157
  loadCollisions?: boolean;
133
158
  /** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
134
159
  textureProvider?: TextureProvider;
160
+ /** Render `BasisCurves` with authored `widths` as tube meshes (M18). */
161
+ curveTubes?: boolean;
162
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
163
+ onWarn?: (message: string) => void;
135
164
  };
136
165
  /**
137
166
  * Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points.
138
167
  *
168
+ * Primvars resolve with full interpolation semantics (M19): `:indices` arrays
169
+ * are de-referenced, vertex-interpolated `st` sets / `normals` /
170
+ * `displayColor` bind onto the shared vertices, and any faceVarying primvar
171
+ * (or per-face color) switches the mesh to a de-indexed layout where every
172
+ * face corner owns its vertex. Extra UV sets become `uv1`, `uv2`, … in
173
+ * {@link meshUvSetNames} order.
174
+ *
139
175
  * When the mesh carries `materialBind` face subsets, the triangles are ordered
140
176
  * subset by subset and a geometry group is added for each — so the mesh can be
141
177
  * drawn with one material per subset (see {@link buildMeshMaterials}). Group
@@ -150,6 +186,26 @@ declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
150
186
  * section. Returns `null` for unsupported prim types.
151
187
  */
152
188
  declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
189
+ type BuildGprimOptions = {
190
+ /** Resolves texture asset paths for mesh materials. */
191
+ textureProvider?: TextureProvider;
192
+ /**
193
+ * Render `BasisCurves` that author `widths` as tube meshes instead of
194
+ * 1-px lines (default `false`).
195
+ */
196
+ curveTubes?: boolean;
197
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
198
+ onWarn?: (message: string) => void;
199
+ };
200
+ /**
201
+ * Build a renderable `THREE.Object3D` for any supported gprim (M18):
202
+ * `Mesh` and the parametric solids become a `THREE.Mesh` (via
203
+ * {@link buildGprimGeometry} + {@link buildMeshMaterials}), `Points` a
204
+ * `THREE.Points`, and `BasisCurves` a `THREE.Group` holding one line — or,
205
+ * with {@link BuildGprimOptions.curveTubes}, one tube mesh — per curve.
206
+ * Returns `null` for unsupported prim types and degenerate geometry.
207
+ */
208
+ declare function buildGprimObject(prim: Prim, stage?: Stage, options?: BuildGprimOptions): THREE.Object3D | null;
153
209
  /**
154
210
  * Build a material for a gprim. Color priority: bound `UsdShade` material
155
211
  * (when `stage` is given) → `primvars:displayColor` → default gray. Textures
@@ -160,7 +216,9 @@ declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
160
216
  */
161
217
  declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider,
162
218
  /** Resolve the material binding from here instead (a `GeomSubset`). */
163
- bindingPrim?: Prim): THREE.Material;
219
+ bindingPrim?: Prim,
220
+ /** Receives fidelity diagnostics (channel-packing mismatches, M19). */
221
+ onWarn?: (message: string) => void): THREE.Material;
164
222
  /**
165
223
  * Attach visual (and optionally collision) meshes to every link of a built
166
224
  * {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
@@ -178,6 +236,8 @@ declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: Rob
178
236
  */
179
237
  declare function bindSceneMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: {
180
238
  textureProvider?: TextureProvider;
239
+ curveTubes?: boolean;
240
+ onWarn?: (message: string) => void;
181
241
  }): number;
182
242
 
183
243
  /**
@@ -313,4 +373,4 @@ type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, "geometry"> & {
313
373
  /** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */
314
374
  declare function exportThreeUsdRobot(robot: ThreeUsdRobot, options?: ExportThreeUsdRobotOptions): UsdaFile;
315
375
 
316
- export { type AddJointOptions, type AddLinkOptions, AssetResolver, Axis, type BindMeshesOptions, CollisionApproximation, ExportMaterial, ExportMesh, ExportPhysicsMaterial, ExportRobotOptions, type ExportThreeUsdRobotOptions, type GeometryToExportMeshOptions, JointDriveDescription, KinematicTree, LinkInertialDescription, Mat4, type MeshKind, Prim, type ResolvedMaterial, type ResolvedTexture, RobotBuilder, type RobotBuilderOptions, RobotDescription, RobotGeometryProvider, Stage, type TextureColorSpace, type TextureOptions, type TextureProvider, type TextureTransform, type TextureWrap, ThreeUsdRobot, UsdaFile, Vec2, Vec3, type WorldFrame, axisVector, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider, exportThreeUsdRobot, geometryToExportMesh, materialToExportMaterial, resolveBoundMaterial, threeGeometryProvider };
376
+ export { type AddJointOptions, type AddLinkOptions, AssetResolver, Axis, type BindMeshesOptions, type BuildGprimOptions, CollisionApproximation, ExportMaterial, ExportMesh, ExportPhysicsMaterial, ExportRobotOptions, type ExportThreeUsdRobotOptions, type GeometryToExportMeshOptions, JointDriveDescription, KinematicTree, LinkInertialDescription, Mat4, type MeshKind, Prim, type ResolvedMaterial, type ResolvedTexture, RobotBuilder, type RobotBuilderOptions, RobotDescription, RobotGeometryProvider, Stage, type TextureColorSpace, type TextureOptions, type TextureProvider, type TextureTransform, type TextureWrap, ThreeUsdRobot, UsdaFile, Vec2, Vec3, type WorldFrame, axisVector, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildGprimObject, buildMeshGeometry, buildMeshMaterial, createTextureProvider, exportThreeUsdRobot, geometryToExportMesh, materialToExportMaterial, resolveBoundMaterial, threeGeometryProvider };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { stageGeometryProvider, exportRobotUsda } from './chunk-TE4MPP5Q.js';
2
- export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-TE4MPP5Q.js';
3
- export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-XEXFGL7R.js';
4
- import { refineJointType, buildKinematicTree } from './chunk-2UD32EGU.js';
5
- export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isRenderableGprim, isScope, isSolidGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize } from './chunk-2UD32EGU.js';
1
+ import { stageGeometryProvider, exportRobotUsda } from './chunk-SSSDVLUK.js';
2
+ export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-SSSDVLUK.js';
3
+ export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildGprimObject, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-CDQPWWMQ.js';
4
+ import { refineJointType, buildKinematicTree } from './chunk-NFKK5LJK.js';
5
+ export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize } from './chunk-NFKK5LJK.js';
6
6
  export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-WROYLUSS.js';
7
7
  import { identity4, multiply, invert } from './chunk-IYKPVUZ2.js';
8
8
  export { AssetPath, DEG2RAD, Quat, RAD2DEG, UsdMatrix, channelFromSamples, decomposeRigid, fromUsdMatrix, getTranslation, identity4, interpolate, invert, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, toUsdMatrix } from './chunk-IYKPVUZ2.js';
package/dist/react.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as _react_three_fiber from '@react-three/fiber';
2
2
  import { ThreeElements } from '@react-three/fiber';
3
3
  import * as React from 'react';
4
- import { T as ThreeUsdRobot } from './ThreeUsdRobot-BAh-48DD.js';
5
- import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-DYtvelif.js';
4
+ import { T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
5
+ import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-NdFAVN96.js';
6
6
  import 'three';
7
- import './buildKinematicTree-DQ4Vr4sJ.js';
7
+ import './buildKinematicTree-BCySuZZn.js';
8
8
  import './bytes-MOJ2oN-u.js';
9
9
 
10
10
  /**
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import { ThreeUsdRobotLoader } from './chunk-XEXFGL7R.js';
2
- import './chunk-2UD32EGU.js';
1
+ import { ThreeUsdRobotLoader } from './chunk-CDQPWWMQ.js';
2
+ import './chunk-NFKK5LJK.js';
3
3
  import './chunk-WROYLUSS.js';
4
4
  import './chunk-IYKPVUZ2.js';
5
5
  import { useFrame } from '@react-three/fiber';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-usd-robot",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Kinematic OpenUSD robot loader for Three.js — load Isaac Sim / OpenUSD robot assets, extract joints and links, and control articulations in the browser.",
5
5
  "type": "module",
6
6
  "license": "MIT",