three-usd-robot 0.9.0 → 0.11.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/README.md +76 -7
- package/dist/ThreeUsdRobot-BxnCluuK.d.ts +347 -0
- package/dist/{ThreeUsdRobotLoader-DYtvelif.d.ts → ThreeUsdRobotLoader-C-E9uwEe.d.ts} +15 -2
- package/dist/{buildKinematicTree-DQ4Vr4sJ.d.ts → buildKinematicTree-BCySuZZn.d.ts} +4 -0
- package/dist/chunk-5SVRTKS4.js +966 -0
- package/dist/chunk-5SVRTKS4.js.map +1 -0
- package/dist/{chunk-2UD32EGU.js → chunk-AXPMXEQC.js} +1005 -175
- package/dist/chunk-AXPMXEQC.js.map +1 -0
- package/dist/{chunk-TE4MPP5Q.js → chunk-BCRRXGNB.js} +4 -4
- package/dist/{chunk-TE4MPP5Q.js.map → chunk-BCRRXGNB.js.map} +1 -1
- package/dist/chunk-ENWFOYHU.js +701 -0
- package/dist/chunk-ENWFOYHU.js.map +1 -0
- package/dist/{chunk-IYKPVUZ2.js → chunk-LDO5FKQS.js} +39 -3
- package/dist/chunk-LDO5FKQS.js.map +1 -0
- package/dist/core.d.ts +173 -5
- package/dist/core.js +3 -3
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +2 -2
- package/dist/index.d.ts +101 -17
- package/dist/index.js +8 -8
- package/dist/react.d.ts +3 -3
- package/dist/react.js +4 -4
- package/package.json +1 -1
- package/dist/ThreeUsdRobot-BAh-48DD.d.ts +0 -185
- package/dist/chunk-2UD32EGU.js.map +0 -1
- package/dist/chunk-IYKPVUZ2.js.map +0 -1
- package/dist/chunk-WROYLUSS.js +0 -393
- package/dist/chunk-WROYLUSS.js.map +0 -1
- package/dist/chunk-XEXFGL7R.js +0 -529
- package/dist/chunk-XEXFGL7R.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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';
|
|
1
|
+
import { MdlModuleProvider, CollisionApproximation, ExportPhysicsMaterial, RobotGeometryProvider, ExportRobotOptions, ExportMaterial, ExportMesh } from './core.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, COLLISION_API, ComposeOptions, CrateReader, ExtractOptions, JointDofInput, JointRelativeDecomposition, MASS_API, MESH_COLLISION_API, MdlMaterialDecl, MdlModule, MdlTextureValue, MdlValue, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, ResolvedXform, TextureChannel, TokenizeError, UsdzPackage, VERSION, ValidateRobotOptions, ValidationIssue, ValidationSeverity, collectMdlAssetPaths, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, decomposeJointRelative, driveKindFor, exportRobotUsda, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMdlTexture, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, loadMdlModules, nearestAngleBranch, normalizeJointLimits, openUsdz, parseMdl, parseMdlLiteral, 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-
|
|
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-
|
|
6
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
7
|
-
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-
|
|
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-BxnCluuK.js';
|
|
7
|
+
export { J as JointObject, b as JointResidual, c as JointValuesFromLinkTransformsOptions, L as LinkObject, d as LinkPose, e as LinkPoseSpace, f as LinkPosesOptions, a as ThreeUsdRobotOptions, W as WorldUpAxis } from './ThreeUsdRobot-BxnCluuK.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-
|
|
10
|
+
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-C-E9uwEe.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;
|
|
@@ -20,8 +20,13 @@ declare function axisVector(axis: Axis): THREE.Vector3;
|
|
|
20
20
|
* emissive inputs plus the **texture** asset paths for the diffuse, normal,
|
|
21
21
|
* roughness, metallic, occlusion and emissive channels. Handles both
|
|
22
22
|
* `UsdPreviewSurface` (constant inputs or a connected `UsdUVTexture` network)
|
|
23
|
-
* and Omniverse
|
|
24
|
-
* `
|
|
23
|
+
* and the Omniverse MDL material families (M20): `OmniPBR` (and derivatives
|
|
24
|
+
* such as `OmniPBR_Opacity`), `OmniPBR_ClearCoat`, `OmniGlass`, and an
|
|
25
|
+
* `OmniSurface(Lite)` constants subset. MDL shaders are identified by
|
|
26
|
+
* `info:mdl:sourceAsset` / `:subIdentifier`; when the referenced `.mdl` module
|
|
27
|
+
* text is available (see `loadMdlModules`), parameter values fall back from
|
|
28
|
+
* authored USD inputs to the module's wrapper arguments and declaration
|
|
29
|
+
* defaults. Executing MDL remains out of scope.
|
|
25
30
|
*/
|
|
26
31
|
|
|
27
32
|
/** `UsdUVTexture` wrap mode for one axis (`black` ≈ clamp; three has no border). */
|
|
@@ -47,6 +52,19 @@ type ResolvedTexture = {
|
|
|
47
52
|
scale?: [number, number, number, number];
|
|
48
53
|
/** `inputs:bias` — added to the sampled value. */
|
|
49
54
|
bias?: [number, number, number, number];
|
|
55
|
+
/**
|
|
56
|
+
* UV-set (primvar) name the texture reads, resolved through the `inputs:st`
|
|
57
|
+
* connection to a `UsdPrimvarReader_float2.inputs:varname`. Absent ⇒ `"st"`.
|
|
58
|
+
*/
|
|
59
|
+
uvSet?: string;
|
|
60
|
+
/** `inputs:sourceColorSpace` — overrides the per-channel colorspace default. */
|
|
61
|
+
sourceColorSpace?: "raw" | "sRGB" | "auto";
|
|
62
|
+
/**
|
|
63
|
+
* Which output the consuming input connects to (`outputs:r` → `"r"`, …).
|
|
64
|
+
* three.js samples fixed channels (roughness = G, metalness = B, ao = R);
|
|
65
|
+
* a mismatch is surfaced as a load warning.
|
|
66
|
+
*/
|
|
67
|
+
outputChannel?: "r" | "g" | "b" | "a" | "rgb";
|
|
50
68
|
};
|
|
51
69
|
type ResolvedMaterial = {
|
|
52
70
|
/** Name of the bound `Material` prim, for round-tripping and debugging. */
|
|
@@ -61,6 +79,20 @@ type ResolvedMaterial = {
|
|
|
61
79
|
* clip / cutout); when `0`/absent, sub-unit opacity blends translucently.
|
|
62
80
|
*/
|
|
63
81
|
opacityThreshold?: number;
|
|
82
|
+
/** `inputs:ior` — promotes the three material to `MeshPhysicalMaterial`. */
|
|
83
|
+
ior?: number;
|
|
84
|
+
/** `inputs:clearcoat` (physical promotion). */
|
|
85
|
+
clearcoat?: number;
|
|
86
|
+
/** `inputs:clearcoatRoughness` (physical promotion). */
|
|
87
|
+
clearcoatRoughness?: number;
|
|
88
|
+
/** `inputs:specularColor`, only when `inputs:useSpecularWorkflow = 1`. */
|
|
89
|
+
specularColor?: Vec3;
|
|
90
|
+
/** OmniPBR `inputs:emissive_intensity` — multiplies the emissive color. */
|
|
91
|
+
emissiveIntensity?: number;
|
|
92
|
+
/** OmniGlass — `1` marks a transmissive dielectric (physical promotion, M20). */
|
|
93
|
+
transmission?: number;
|
|
94
|
+
/** OmniGlass `inputs:depth` — refraction volume thickness (scene units, M20). */
|
|
95
|
+
thickness?: number;
|
|
64
96
|
/** Diffuse/albedo texture, if any. */
|
|
65
97
|
colorTexture?: ResolvedTexture;
|
|
66
98
|
/** Opacity / alpha texture (may be the same image as `colorTexture`). */
|
|
@@ -75,9 +107,17 @@ type ResolvedMaterial = {
|
|
|
75
107
|
occlusionTexture?: ResolvedTexture;
|
|
76
108
|
/** Emissive map, if any. */
|
|
77
109
|
emissiveTexture?: ResolvedTexture;
|
|
110
|
+
/** OmniPBR_ClearCoat `clearcoat_normalmap_texture` (physical promotion, M20). */
|
|
111
|
+
clearcoatNormalTexture?: ResolvedTexture;
|
|
112
|
+
};
|
|
113
|
+
type ResolveMaterialOptions = {
|
|
114
|
+
/** Parsed `.mdl` modules for MDL family detection and value fallback (M20). */
|
|
115
|
+
mdl?: MdlModuleProvider;
|
|
116
|
+
/** Receives diagnostics (unknown MDL material families). */
|
|
117
|
+
onWarn?: (message: string) => void;
|
|
78
118
|
};
|
|
79
119
|
/** Resolve the bound material's flat parameters for `prim`, or `undefined`. */
|
|
80
|
-
declare function resolveBoundMaterial(stage: Stage, prim: Prim): ResolvedMaterial | undefined;
|
|
120
|
+
declare function resolveBoundMaterial(stage: Stage, prim: Prim, options?: ResolveMaterialOptions): ResolvedMaterial | undefined;
|
|
81
121
|
|
|
82
122
|
/**
|
|
83
123
|
* Loads texture image assets referenced by `UsdShade` materials.
|
|
@@ -103,6 +143,8 @@ type TextureOptions = {
|
|
|
103
143
|
wrapS?: TextureWrap;
|
|
104
144
|
wrapT?: TextureWrap;
|
|
105
145
|
transform?: TextureTransform;
|
|
146
|
+
/** UV channel index (0 = `uv`, 1 = `uv1`, …) for multi-UV-set meshes. */
|
|
147
|
+
channel?: number;
|
|
106
148
|
};
|
|
107
149
|
/** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */
|
|
108
150
|
type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;
|
|
@@ -119,11 +161,11 @@ declare function createTextureProvider(resolver: AssetResolver, baseUrl: string)
|
|
|
119
161
|
* `Sphere` / `Cylinder` / `Capsule` / `Cone`) — to Three.js geometry and
|
|
120
162
|
* attaches them under the robot's link objects.
|
|
121
163
|
*
|
|
122
|
-
* Meshes are triangulated with a simple fan
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* at the root in M9.
|
|
164
|
+
* Meshes are triangulated with a simple fan. Primvars (`st` UV sets, `normals`,
|
|
165
|
+
* `displayColor`) resolve with USD interpolation semantics — `:indices`
|
|
166
|
+
* de-referencing, vertex vs faceVarying (de-indexed) layouts, multiple UV
|
|
167
|
+
* channels. Solids tessellate from their schema attributes. Geometry is left
|
|
168
|
+
* in stage units; the global `metersPerUnit` scale is applied at the root in M9.
|
|
127
169
|
*/
|
|
128
170
|
|
|
129
171
|
type MeshKind = "visual" | "collision";
|
|
@@ -132,10 +174,23 @@ type BindMeshesOptions = {
|
|
|
132
174
|
loadCollisions?: boolean;
|
|
133
175
|
/** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
|
|
134
176
|
textureProvider?: TextureProvider;
|
|
177
|
+
/** Render `BasisCurves` with authored `widths` as tube meshes (M18). */
|
|
178
|
+
curveTubes?: boolean;
|
|
179
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
180
|
+
onWarn?: (message: string) => void;
|
|
181
|
+
/** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
|
|
182
|
+
mdl?: MdlModuleProvider;
|
|
135
183
|
};
|
|
136
184
|
/**
|
|
137
185
|
* Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points.
|
|
138
186
|
*
|
|
187
|
+
* Primvars resolve with full interpolation semantics (M19): `:indices` arrays
|
|
188
|
+
* are de-referenced, vertex-interpolated `st` sets / `normals` /
|
|
189
|
+
* `displayColor` bind onto the shared vertices, and any faceVarying primvar
|
|
190
|
+
* (or per-face color) switches the mesh to a de-indexed layout where every
|
|
191
|
+
* face corner owns its vertex. Extra UV sets become `uv1`, `uv2`, … in
|
|
192
|
+
* {@link meshUvSetNames} order.
|
|
193
|
+
*
|
|
139
194
|
* When the mesh carries `materialBind` face subsets, the triangles are ordered
|
|
140
195
|
* subset by subset and a geometry group is added for each — so the mesh can be
|
|
141
196
|
* drawn with one material per subset (see {@link buildMeshMaterials}). Group
|
|
@@ -150,6 +205,28 @@ declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
|
150
205
|
* section. Returns `null` for unsupported prim types.
|
|
151
206
|
*/
|
|
152
207
|
declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
|
|
208
|
+
type BuildGprimOptions = {
|
|
209
|
+
/** Resolves texture asset paths for mesh materials. */
|
|
210
|
+
textureProvider?: TextureProvider;
|
|
211
|
+
/**
|
|
212
|
+
* Render `BasisCurves` that author `widths` as tube meshes instead of
|
|
213
|
+
* 1-px lines (default `false`).
|
|
214
|
+
*/
|
|
215
|
+
curveTubes?: boolean;
|
|
216
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
217
|
+
onWarn?: (message: string) => void;
|
|
218
|
+
/** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
|
|
219
|
+
mdl?: MdlModuleProvider;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Build a renderable `THREE.Object3D` for any supported gprim (M18):
|
|
223
|
+
* `Mesh` and the parametric solids become a `THREE.Mesh` (via
|
|
224
|
+
* {@link buildGprimGeometry} + {@link buildMeshMaterials}), `Points` a
|
|
225
|
+
* `THREE.Points`, and `BasisCurves` a `THREE.Group` holding one line — or,
|
|
226
|
+
* with {@link BuildGprimOptions.curveTubes}, one tube mesh — per curve.
|
|
227
|
+
* Returns `null` for unsupported prim types and degenerate geometry.
|
|
228
|
+
*/
|
|
229
|
+
declare function buildGprimObject(prim: Prim, stage?: Stage, options?: BuildGprimOptions): THREE.Object3D | null;
|
|
153
230
|
/**
|
|
154
231
|
* Build a material for a gprim. Color priority: bound `UsdShade` material
|
|
155
232
|
* (when `stage` is given) → `primvars:displayColor` → default gray. Textures
|
|
@@ -160,7 +237,11 @@ declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
|
|
|
160
237
|
*/
|
|
161
238
|
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider,
|
|
162
239
|
/** Resolve the material binding from here instead (a `GeomSubset`). */
|
|
163
|
-
bindingPrim?: Prim
|
|
240
|
+
bindingPrim?: Prim,
|
|
241
|
+
/** Receives fidelity diagnostics (channel-packing mismatches, M19). */
|
|
242
|
+
onWarn?: (message: string) => void,
|
|
243
|
+
/** Parsed `.mdl` modules for MDL material family/value resolution (M20). */
|
|
244
|
+
mdl?: MdlModuleProvider): THREE.Material;
|
|
164
245
|
/**
|
|
165
246
|
* Attach visual (and optionally collision) meshes to every link of a built
|
|
166
247
|
* {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
|
|
@@ -178,6 +259,9 @@ declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: Rob
|
|
|
178
259
|
*/
|
|
179
260
|
declare function bindSceneMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: {
|
|
180
261
|
textureProvider?: TextureProvider;
|
|
262
|
+
curveTubes?: boolean;
|
|
263
|
+
onWarn?: (message: string) => void;
|
|
264
|
+
mdl?: MdlModuleProvider;
|
|
181
265
|
}): number;
|
|
182
266
|
|
|
183
267
|
/**
|
|
@@ -313,4 +397,4 @@ type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, "geometry"> & {
|
|
|
313
397
|
/** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */
|
|
314
398
|
declare function exportThreeUsdRobot(robot: ThreeUsdRobot, options?: ExportThreeUsdRobotOptions): UsdaFile;
|
|
315
399
|
|
|
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 };
|
|
400
|
+
export { type AddJointOptions, type AddLinkOptions, AssetResolver, Axis, type BindMeshesOptions, type BuildGprimOptions, CollisionApproximation, ExportMaterial, ExportMesh, ExportPhysicsMaterial, ExportRobotOptions, type ExportThreeUsdRobotOptions, type GeometryToExportMeshOptions, JointDriveDescription, KinematicTree, LinkInertialDescription, Mat4, MdlModuleProvider, type MeshKind, Prim, type ResolveMaterialOptions, 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,11 +1,11 @@
|
|
|
1
|
-
import { stageGeometryProvider, exportRobotUsda } from './chunk-
|
|
2
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
3
|
-
export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-
|
|
4
|
-
import { refineJointType, buildKinematicTree } from './chunk-
|
|
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-
|
|
6
|
-
export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-
|
|
7
|
-
import { identity4, multiply, invert } from './chunk-
|
|
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-
|
|
1
|
+
import { stageGeometryProvider, exportRobotUsda } from './chunk-BCRRXGNB.js';
|
|
2
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-BCRRXGNB.js';
|
|
3
|
+
export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildGprimObject, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-5SVRTKS4.js';
|
|
4
|
+
import { refineJointType, buildKinematicTree } from './chunk-AXPMXEQC.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, collectMdlAssetPaths, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMdlTexture, isMesh, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, loadMdlModules, normalizeJointLimits, openUsdz, parseMdl, parseMdlLiteral, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize } from './chunk-AXPMXEQC.js';
|
|
6
|
+
export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-ENWFOYHU.js';
|
|
7
|
+
import { identity4, multiply, invert } from './chunk-LDO5FKQS.js';
|
|
8
|
+
export { AssetPath, DEG2RAD, Quat, RAD2DEG, UsdMatrix, channelFromSamples, decomposeJointRelative, decomposeRigid, fromUsdMatrix, getTranslation, identity4, interpolate, invert, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, nearestAngleBranch, toUsdMatrix } from './chunk-LDO5FKQS.js';
|
|
9
9
|
import * as THREE from 'three';
|
|
10
10
|
|
|
11
11
|
function geometryToExportMesh(geometry, options) {
|
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-
|
|
5
|
-
import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-
|
|
4
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-BxnCluuK.js';
|
|
5
|
+
import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-C-E9uwEe.js';
|
|
6
6
|
import 'three';
|
|
7
|
-
import './buildKinematicTree-
|
|
7
|
+
import './buildKinematicTree-BCySuZZn.js';
|
|
8
8
|
import './bytes-MOJ2oN-u.js';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ThreeUsdRobotLoader } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import { ThreeUsdRobotLoader } from './chunk-5SVRTKS4.js';
|
|
2
|
+
import './chunk-AXPMXEQC.js';
|
|
3
|
+
import './chunk-ENWFOYHU.js';
|
|
4
|
+
import './chunk-LDO5FKQS.js';
|
|
5
5
|
import { useFrame } from '@react-three/fiber';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-usd-robot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|
|
@@ -1,185 +0,0 @@
|
|
|
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-DQ4Vr4sJ.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The articulated "motion" node of a joint, inserted between the joint's two
|
|
6
|
-
* fixed frames (`jointFrame0` and `inverse(jointFrame1)`). {@link setValue}
|
|
7
|
-
* rotates it about the axis (revolute/continuous) or slides it along the axis
|
|
8
|
-
* (prismatic); fixed joints are inert.
|
|
9
|
-
*/
|
|
10
|
-
declare class JointObject extends THREE.Object3D {
|
|
11
|
-
readonly isJointObject = true;
|
|
12
|
-
readonly jointName: string;
|
|
13
|
-
/** Full USD prim path of the joint — the collision-proof address. */
|
|
14
|
-
readonly primPath: string;
|
|
15
|
-
readonly jointType: JointType;
|
|
16
|
-
readonly axisToken: Axis;
|
|
17
|
-
readonly axis: THREE.Vector3;
|
|
18
|
-
readonly lower: number | undefined;
|
|
19
|
-
readonly upper: number | undefined;
|
|
20
|
-
private _value;
|
|
21
|
-
constructor(joint: JointDescription);
|
|
22
|
-
get value(): number;
|
|
23
|
-
get articulated(): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Set the joint value (radians for revolute/continuous, length for prismatic).
|
|
26
|
-
* Optionally clamps to authored limits. Returns the value actually applied.
|
|
27
|
-
*/
|
|
28
|
-
setValue(value: number, clampToLimits?: boolean): number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Three.js node for a robot link. Its frame is the USD link prim's frame;
|
|
33
|
-
* visual/collision meshes (M6) attach as children relative to it. Placement
|
|
34
|
-
* relative to the parent is supplied by the joint chain, so a link's own local
|
|
35
|
-
* matrix is identity (except the root, which carries the world-fixed placement).
|
|
36
|
-
*/
|
|
37
|
-
declare class LinkObject extends THREE.Object3D {
|
|
38
|
-
readonly isLinkObject = true;
|
|
39
|
-
readonly linkName: string;
|
|
40
|
-
readonly primPath: string;
|
|
41
|
-
constructor(link: LinkDescription);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Target world up-axis: normalize to Y-up / Z-up, or keep the authored orientation. */
|
|
45
|
-
type WorldUpAxis = "Y" | "Z" | "keep";
|
|
46
|
-
type ThreeUsdRobotOptions = {
|
|
47
|
-
/** Clamp `setJointValue` to authored limits (default `true`). */
|
|
48
|
-
clampJointLimits?: boolean;
|
|
49
|
-
/** Size of the built-in joint-axis / link-frame helpers (stage units, default `0.15`). */
|
|
50
|
-
helperSize?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Target world up-axis. The root is rotated so the stage's authored `upAxis`
|
|
53
|
-
* lands in that convention: `"Y"` for a standard three.js scene, `"Z"` for a
|
|
54
|
-
* robotics-style Z-up world, `"keep"` for no correction. Takes precedence
|
|
55
|
-
* over the deprecated {@link ThreeUsdRobotOptions.upAxisConversion}.
|
|
56
|
-
*/
|
|
57
|
-
worldUp?: WorldUpAxis;
|
|
58
|
-
/**
|
|
59
|
-
* Legacy up-axis correction: `"auto"` ≡ `worldUp: "Y"`, `"Y"` / `"none"` ≡
|
|
60
|
-
* `worldUp: "keep"`, and `"Z"` forces the Z-up→Y-up rotation regardless of
|
|
61
|
-
* stage metadata. Default `"none"` (the loader defaults to `"auto"`).
|
|
62
|
-
* @deprecated Use {@link ThreeUsdRobotOptions.worldUp}.
|
|
63
|
-
*/
|
|
64
|
-
upAxisConversion?: "auto" | "Y" | "Z" | "none";
|
|
65
|
-
/** Extra uniform scale multiplied with the stage `metersPerUnit` (default `1`). */
|
|
66
|
-
unitScale?: number;
|
|
67
|
-
/** Seed joints from their authored initial value (drive target / joint state). Default `true`. */
|
|
68
|
-
applyInitialPose?: boolean;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* A Three.js `Object3D` that realizes a {@link RobotDescription} as a kinematic
|
|
72
|
-
* hierarchy and drives forward kinematics via {@link setJointValue}.
|
|
73
|
-
*
|
|
74
|
-
* Per joint the hierarchy is
|
|
75
|
-
* `parentLink → jointFrame0 → jointMotion → jointFrame1⁻¹ → childLink`,
|
|
76
|
-
* where only `jointMotion` (a {@link JointObject}) changes with the joint value;
|
|
77
|
-
* world poses then fall out of Three.js's `updateMatrixWorld`.
|
|
78
|
-
*
|
|
79
|
-
* **Naming contract** — a link/joint's key is its prim's leaf name when that
|
|
80
|
-
* is unique across the robot, else its full prim path (deterministic; see the
|
|
81
|
-
* extractor). Every accessor taking a name equally accepts the full prim path,
|
|
82
|
-
* which is stable regardless of collisions; {@link getLinkObjectsByPath} /
|
|
83
|
-
* {@link getJointObjectsByPath} enumerate the path-keyed tables.
|
|
84
|
-
*/
|
|
85
|
-
declare class ThreeUsdRobot extends THREE.Object3D {
|
|
86
|
-
readonly isThreeUsdRobot = true;
|
|
87
|
-
readonly robot: RobotDescription;
|
|
88
|
-
readonly tree: KinematicTree;
|
|
89
|
-
readonly clampJointLimits: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* The composed USD stage this robot was built from — the full prim tree, for
|
|
92
|
-
* inspection tooling (structure panels, attribute browsers). Attached by
|
|
93
|
-
* {@link ThreeUsdRobotLoader}; `undefined` for programmatically-built robots.
|
|
94
|
-
*/
|
|
95
|
-
stage?: Stage;
|
|
96
|
-
private readonly linkObjects;
|
|
97
|
-
private readonly jointObjects;
|
|
98
|
-
private readonly linkKeyByPath;
|
|
99
|
-
private readonly jointKeyByPath;
|
|
100
|
-
private dirty;
|
|
101
|
-
private readonly helperSize;
|
|
102
|
-
private _showVisual;
|
|
103
|
-
private _showCollision;
|
|
104
|
-
private _showJointAxes;
|
|
105
|
-
private _showLinkFrames;
|
|
106
|
-
private jointAxesHelpers;
|
|
107
|
-
private linkFrameHelpers;
|
|
108
|
-
constructor(robot: RobotDescription, tree: KinematicTree, options?: ThreeUsdRobotOptions);
|
|
109
|
-
/** Orient (authored upAxis → target world up) and scale (metersPerUnit × unitScale) the root. */
|
|
110
|
-
private applyStageNormalization;
|
|
111
|
-
/** Apply each joint's authored initial value, if any. */
|
|
112
|
-
private applyInitialPose;
|
|
113
|
-
private attachRoot;
|
|
114
|
-
private attachTreeEdges;
|
|
115
|
-
/** Build `parent → frame0 → motion → frame1⁻¹ → child` for one joint. */
|
|
116
|
-
private attachJointChain;
|
|
117
|
-
private attachIsolatedLinks;
|
|
118
|
-
/** Resolve a link reference — key or full prim path — to the extractor key. */
|
|
119
|
-
private linkKey;
|
|
120
|
-
/** Resolve a joint reference — key or full prim path — to the extractor key. */
|
|
121
|
-
private jointKey;
|
|
122
|
-
/**
|
|
123
|
-
* Set one joint value, addressed by key or full prim path. Unknown joints
|
|
124
|
-
* are ignored. Returns whether it applied.
|
|
125
|
-
*/
|
|
126
|
-
setJointValue(name: string, value: number): boolean;
|
|
127
|
-
/** Set several joint values at once (matrix update is coalesced). */
|
|
128
|
-
setJointValues(values: Record<string, number>): void;
|
|
129
|
-
getJointValue(name: string): number | undefined;
|
|
130
|
-
/** Recompute world matrices. Called lazily by the getters; safe to call directly. */
|
|
131
|
-
updateKinematics(): void;
|
|
132
|
-
private ensureUpdated;
|
|
133
|
-
/** World matrix of a link, addressed by key or full prim path. */
|
|
134
|
-
getLinkWorldMatrix(name: string): THREE.Matrix4;
|
|
135
|
-
getLinkWorldPosition(name: string): THREE.Vector3;
|
|
136
|
-
/** Link object by key or full prim path. */
|
|
137
|
-
getLinkObject(name: string): LinkObject | undefined;
|
|
138
|
-
/** Joint object by key or full prim path. */
|
|
139
|
-
getJointObject(name: string): JointObject | undefined;
|
|
140
|
-
/**
|
|
141
|
-
* Table of link prim path → {@link LinkObject}. Prim paths are the
|
|
142
|
-
* collision-proof way to pin a link (e.g. to attach tools or gizmos).
|
|
143
|
-
*/
|
|
144
|
-
getLinkObjectsByPath(): Map<string, LinkObject>;
|
|
145
|
-
/**
|
|
146
|
-
* Table of joint prim path → {@link JointObject}, covering the joints
|
|
147
|
-
* realized in the kinematic tree (loop joints have no motion node).
|
|
148
|
-
*/
|
|
149
|
-
getJointObjectsByPath(): Map<string, JointObject>;
|
|
150
|
-
getJoints(): JointDescription[];
|
|
151
|
-
getLinks(): LinkDescription[];
|
|
152
|
-
/** Names of the articulated (controllable) joints. */
|
|
153
|
-
getJointNames(): string[];
|
|
154
|
-
getLinkNames(): string[];
|
|
155
|
-
getKinematicTree(): KinematicTree;
|
|
156
|
-
/** Authored stage up-axis (`"Y"` or `"Z"`) — unaffected by `worldUp` normalization. */
|
|
157
|
-
get upAxis(): "Y" | "Z";
|
|
158
|
-
/** Authored stage scale in meters per unit (already applied to the root). */
|
|
159
|
-
get metersPerUnit(): number;
|
|
160
|
-
/** Playback rate in time codes per second (from the stage; default 24). */
|
|
161
|
-
getTimeCodesPerSecond(): number;
|
|
162
|
-
/** Whether any joint has a time-sampled trajectory. */
|
|
163
|
-
hasAnimation(): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Animation range in time codes: the union of authored joint sample ranges,
|
|
166
|
-
* falling back to the stage `startTimeCode`/`endTimeCode`. `null` if neither.
|
|
167
|
-
*/
|
|
168
|
-
getTimeRange(): {
|
|
169
|
-
start: number;
|
|
170
|
-
end: number;
|
|
171
|
-
} | null;
|
|
172
|
-
/** Sample every animated joint at time code `t` and apply the values. */
|
|
173
|
-
setTime(t: number): void;
|
|
174
|
-
get showVisual(): boolean;
|
|
175
|
-
set showVisual(v: boolean);
|
|
176
|
-
get showCollision(): boolean;
|
|
177
|
-
set showCollision(v: boolean);
|
|
178
|
-
get showJointAxes(): boolean;
|
|
179
|
-
set showJointAxes(v: boolean);
|
|
180
|
-
get showLinkFrames(): boolean;
|
|
181
|
-
set showLinkFrames(v: boolean);
|
|
182
|
-
private setKindVisibility;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export { JointObject as J, LinkObject as L, ThreeUsdRobot as T, type WorldUpAxis as W, type ThreeUsdRobotOptions as a };
|