three-usd-robot 0.7.0 → 0.8.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 +68 -7
- package/dist/{ThreeUsdRobot-Ljh4PDVD.d.ts → ThreeUsdRobot-CsjraHqP.d.ts} +32 -2
- package/dist/{ThreeUsdRobotLoader-BSIVFA48.d.ts → ThreeUsdRobotLoader-CxOGRLXH.d.ts} +31 -16
- package/dist/{buildKinematicTree-Ccd2DIKH.d.ts → buildKinematicTree-D4R0hEtN.d.ts} +2 -2
- package/dist/{AssetResolver-CpIJNgWZ.d.ts → bytes-MOJ2oN-u.d.ts} +14 -1
- package/dist/chunk-3CANZKP3.js +374 -0
- package/dist/chunk-3CANZKP3.js.map +1 -0
- package/dist/chunk-IYKPVUZ2.js +406 -0
- package/dist/chunk-IYKPVUZ2.js.map +1 -0
- package/dist/{chunk-O7XP5FQ4.js → chunk-P6CHTMGW.js} +4 -3
- package/dist/chunk-P6CHTMGW.js.map +1 -0
- package/dist/{chunk-4GPCBXUS.js → chunk-PHHMWMCA.js} +45 -410
- package/dist/chunk-PHHMWMCA.js.map +1 -0
- package/dist/{chunk-FL554IS5.js → chunk-YX5GIEMT.js} +114 -366
- package/dist/chunk-YX5GIEMT.js.map +1 -0
- package/dist/core.d.ts +17 -5
- package/dist/core.js +3 -2
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +73 -3
- package/dist/helpers.js +125 -13
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +28 -18
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +4 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4GPCBXUS.js.map +0 -1
- package/dist/chunk-FL554IS5.js.map +0 -1
- package/dist/chunk-O7XP5FQ4.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Stage, Prim, CollisionApproximation, ExportPhysicsMaterial, RobotGeometryProvider, ExportRobotOptions, ExportMaterial, ExportMesh } from './core.js';
|
|
2
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, ExtractOptions, Layer, MASS_API, MESH_COLLISION_API, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, Relationship, ResolvedXform, TextureChannel, TokenizeError, UpAxis, UsdzPackage, VERSION, ValidateRobotOptions, ValidationIssue, ValidationSeverity, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz } from './core.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, ExtractOptions, Layer, MASS_API, MESH_COLLISION_API, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, RIGID_BODY_API, Relationship, ResolvedXform, TextureChannel, TokenizeError, UpAxis, 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';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { A as Axis, V as Vec2, b as Vec3, 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 AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, J as JointType, g as KinematicNode, L as LinkDescription, h as ListOp, i as MetadataMap, P as PrimSpec, j as PropertySpec, Q as Quat, k as RAD2DEG, l as RelationshipSpec, S as SampleChannel, m as SdfPath, n as Specifier, T as TreeEdge, o as UsdDictionary, p as UsdMatrix, q as UsdValue, r as Variability, s as Vec4, t as buildKinematicTree, u as channelFromSamples, v as decomposeRigid, w as fromUsdMatrix, x as getTranslation, y as identity4, z as interpolate, E as invert, F as makeEuler, G as makeRotationFromQuat, H as makeRotationX, I as makeRotationY, N as makeRotationZ, O as makeScale, W as makeTranslation, X as multiply, Y as multiplyAll, Z as toUsdMatrix } from './buildKinematicTree-
|
|
6
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
7
|
-
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions } from './ThreeUsdRobot-
|
|
8
|
-
import { A as AssetResolver } from './
|
|
9
|
-
export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './
|
|
10
|
-
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-
|
|
4
|
+
import { A as Axis, V as Vec2, b as Vec3, R as RobotDescription, c as JointDriveDescription, d as LinkInertialDescription, K as KinematicTree, U as UsdaFile, M as Mat4 } from './buildKinematicTree-D4R0hEtN.js';
|
|
5
|
+
export { e as AssetPath, f as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, J as JointType, g as KinematicNode, L as LinkDescription, h as ListOp, i as MetadataMap, P as PrimSpec, j as PropertySpec, Q as Quat, k as RAD2DEG, l as RelationshipSpec, S as SampleChannel, m as SdfPath, n as Specifier, T as TreeEdge, o as UsdDictionary, p as UsdMatrix, q as UsdValue, r as Variability, s as Vec4, t as buildKinematicTree, u as channelFromSamples, v as decomposeRigid, w as fromUsdMatrix, x as getTranslation, y as identity4, z as interpolate, E as invert, F as makeEuler, G as makeRotationFromQuat, H as makeRotationX, I as makeRotationY, N as makeRotationZ, O as makeScale, W as makeTranslation, X as multiply, Y as multiplyAll, Z as toUsdMatrix } from './buildKinematicTree-D4R0hEtN.js';
|
|
6
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-CsjraHqP.js';
|
|
7
|
+
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions } from './ThreeUsdRobot-CsjraHqP.js';
|
|
8
|
+
import { A as AssetResolver } from './bytes-MOJ2oN-u.js';
|
|
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-CxOGRLXH.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;
|
|
@@ -115,13 +115,15 @@ type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Te
|
|
|
115
115
|
declare function createTextureProvider(resolver: AssetResolver, baseUrl: string): TextureProvider;
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Binds `UsdGeom.Mesh`
|
|
119
|
-
*
|
|
118
|
+
* Binds renderable gprims — `UsdGeom.Mesh` plus the parametric solids (`Cube` /
|
|
119
|
+
* `Sphere` / `Cylinder` / `Capsule` / `Cone`) — to Three.js geometry and
|
|
120
|
+
* attaches them under the robot's link objects.
|
|
120
121
|
*
|
|
121
|
-
*
|
|
122
|
-
* when present (else
|
|
123
|
-
* `primvars:displayColor`.
|
|
124
|
-
* `metersPerUnit` scale is applied
|
|
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.
|
|
125
127
|
*/
|
|
126
128
|
|
|
127
129
|
type MeshKind = "visual" | "collision";
|
|
@@ -141,7 +143,15 @@ type BindMeshesOptions = {
|
|
|
141
143
|
*/
|
|
142
144
|
declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
143
145
|
/**
|
|
144
|
-
* Build
|
|
146
|
+
* Build geometry for any renderable gprim: `Mesh` via {@link buildMeshGeometry},
|
|
147
|
+
* parametric solids from their schema attributes. Solids follow UsdGeom
|
|
148
|
+
* semantics — sizes in stage units, centered at the origin, `axis` (default
|
|
149
|
+
* `"Z"`) along the spine, and a capsule's `height` spans only its cylindrical
|
|
150
|
+
* section. Returns `null` for unsupported prim types.
|
|
151
|
+
*/
|
|
152
|
+
declare function buildGprimGeometry(prim: Prim): THREE.BufferGeometry | null;
|
|
153
|
+
/**
|
|
154
|
+
* Build a material for a gprim. Color priority: bound `UsdShade` material
|
|
145
155
|
* (when `stage` is given) → `primvars:displayColor` → default gray. Textures
|
|
146
156
|
* (via `textures`) become the matching `MeshStandardMaterial` maps — diffuse →
|
|
147
157
|
* `map` (sRGB), plus `normalMap` / `roughnessMap` / `metalnessMap` / `aoMap`
|
|
@@ -158,8 +168,8 @@ bindingPrim?: Prim): THREE.Material;
|
|
|
158
168
|
*/
|
|
159
169
|
declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: BindMeshesOptions): void;
|
|
160
170
|
/**
|
|
161
|
-
* Attach the
|
|
162
|
-
*
|
|
171
|
+
* Attach the gprims that belong to no link — the static scenery of a cell that
|
|
172
|
+
* also contains robots. They are placed by their authored stage transform
|
|
163
173
|
* under the robot root, so the loader's up-axis and unit normalization applies
|
|
164
174
|
* to them too. Collision-only and guide/proxy prims are skipped.
|
|
165
175
|
*/
|
|
@@ -300,4 +310,4 @@ type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, "geometry"> & {
|
|
|
300
310
|
/** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */
|
|
301
311
|
declare function exportThreeUsdRobot(robot: ThreeUsdRobot, options?: ExportThreeUsdRobotOptions): UsdaFile;
|
|
302
312
|
|
|
303
|
-
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, buildMeshGeometry, buildMeshMaterial, createTextureProvider, exportThreeUsdRobot, geometryToExportMesh, materialToExportMaterial, resolveBoundMaterial, threeGeometryProvider };
|
|
313
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { stageGeometryProvider, exportRobotUsda } from './chunk-
|
|
2
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
export { ARTICULATION_ROOT_API,
|
|
1
|
+
import { stageGeometryProvider, exportRobotUsda } from './chunk-P6CHTMGW.js';
|
|
2
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-P6CHTMGW.js';
|
|
3
|
+
export { ThreeUsdRobotLoader, bindRobotMeshes, bindSceneMeshes, buildGprimGeometry, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-YX5GIEMT.js';
|
|
4
|
+
import { refineJointType, buildKinematicTree } from './chunk-PHHMWMCA.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-PHHMWMCA.js';
|
|
6
|
+
export { JointObject, LinkObject, ThreeUsdRobot, axisVector } from './chunk-3CANZKP3.js';
|
|
7
|
+
import { identity4, multiply, invert } from './chunk-IYKPVUZ2.js';
|
|
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';
|
|
6
9
|
import * as THREE from 'three';
|
|
7
10
|
|
|
8
11
|
function geometryToExportMesh(geometry, options) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/three/exportThreeUsdRobot.ts","../src/three/RobotBuilder.ts"],"names":["material","exportMaterial","mesh","isIdentityMat4","THREE2"],"mappings":";;;;;;;AAyCO,SAAS,oBAAA,CACd,UACA,OAAA,EACmB;AACnB,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,YAAA,CAAa,UAAU,CAAA;AACjD,EAAA,IAAI,CAAC,QAAA,IAAY,QAAA,CAAS,KAAA,KAAU,GAAG,OAAO,IAAA;AAE9C,EAAA,MAAM,KAAA,GAAQ,SAAS,QAAA,EAAS;AAChC,EAAA,MAAM,MAAM,KAAA,GACR,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,KAA0B,CAAA,GAC3C,KAAA,CAAM,IAAA,CAAK,EAAE,QAAQ,QAAA,CAAS,KAAA,IAAS,CAAC,CAAA,EAAG,MAAM,CAAC,CAAA;AACtD,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,GAClB,GAAA,CAAI,MAAM,OAAA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S,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,EAAA,EAAI,CAAA,EAAA,EAAK;AAC3B,IAAA,IAAI,CAAA,CAAE,CAAC,CAAA,MAAO,CAAA,GAAI,MAAM,CAAA,GAAI,CAAA,GAAI,IAAI,OAAO,KAAA;AAAA,EAC7C;AACA,EAAA,OAAO,IAAA;AACT;AAGA,SAAS,aAAa,KAAA,EAAiD;AACrE,EAAA,IAAI,CAAC,OAAO,OAAO,MAAA;AACnB,EAAA,IAAK,MAAyB,UAAA,EAAY;AACxC,IAAA,MAAM,GAAA,GAAM,KAAA;AACZ,IAAA,GAAA,CAAI,iBAAA,CAAkB,MAAM,KAAK,CAAA;AACjC,IAAA,OAAO,CAAC,GAAG,GAAA,CAAI,WAAA,CAAY,QAAQ,CAAA;AAAA,EACrC;AACA,EAAA,OAAO,CAAC,GAAI,KAAA,CAAwB,QAAQ,CAAA;AAC9C","file":"index.js","sourcesContent":["/**\n * Three.js-side export (M14).\n *\n * Converts `BufferGeometry` / `MeshStandardMaterial` into the plain\n * {@link ExportMesh} data the exporter consumes, harvests the meshes attached\n * under a loaded robot's links, and re-exports a {@link ThreeUsdRobot} as a\n * USDA AST. Texture maps are not carried yet (M15) — constants only.\n */\n\nimport * as THREE from \"three\";\nimport type {\n ExportMaterial,\n ExportMesh,\n RobotGeometryProvider,\n} from \"../export/GeometryProvider.js\";\nimport { stageGeometryProvider } from \"../export/GeometryProvider.js\";\nimport { type ExportRobotOptions, exportRobotUsda } from \"../export/exportRobot.js\";\nimport type { Mat4 } from \"../kinematics/transforms.js\";\nimport type { UsdaFile, Vec2, Vec3 } from \"../parser/ast.js\";\nimport type { Stage } from \"../usd/Stage.js\";\nimport type { ThreeUsdRobot } from \"./ThreeUsdRobot.js\";\n\nexport type GeometryToExportMeshOptions = {\n name: string;\n kind?: \"visual\" | \"collision\";\n /** Transform relative to the link frame (column-major); identity when omitted. */\n transform?: Mat4;\n material?: ExportMaterial;\n doubleSided?: boolean;\n /**\n * Export only this slice of the index buffer — a `BufferGeometry` group, as\n * used by multi-material meshes. Vertices are re-indexed onto the slice.\n */\n group?: { start: number; count: number };\n};\n\n/**\n * Convert a triangle `BufferGeometry` into exportable mesh data. Non-indexed\n * geometry becomes sequential triangles; a trailing partial triangle (or the\n * absence of a position attribute) returns `null`.\n */\nexport function geometryToExportMesh(\n geometry: THREE.BufferGeometry,\n options: GeometryToExportMeshOptions,\n): ExportMesh | null {\n const position = geometry.getAttribute(\"position\");\n if (!position || position.count === 0) return null;\n\n const index = geometry.getIndex();\n const all = index\n ? Array.from(index.array as ArrayLike<number>)\n : Array.from({ length: position.count }, (_, i) => i);\n const slice = options.group\n ? all.slice(options.group.start, options.group.start + options.group.count)\n : all;\n const triangles = Math.floor(slice.length / 3);\n if (triangles === 0) return null;\n\n const normal = geometry.getAttribute(\"normal\");\n const uv = geometry.getAttribute(\"uv\");\n const hasNormals = !!normal && normal.count === position.count;\n const hasUv = !!uv && uv.count === position.count;\n\n const points: Vec3[] = [];\n const normals: Vec3[] = [];\n const st: Vec2[] = [];\n let faceVertexIndices: number[];\n\n if (options.group) {\n // Re-index onto just the vertices this group touches.\n const remap = new Map<number, number>();\n faceVertexIndices = [];\n for (const vertex of slice.slice(0, triangles * 3)) {\n let mapped = remap.get(vertex);\n if (mapped === undefined) {\n mapped = points.length;\n remap.set(vertex, mapped);\n points.push([position.getX(vertex), position.getY(vertex), position.getZ(vertex)]);\n if (hasNormals)\n normals.push([normal.getX(vertex), normal.getY(vertex), normal.getZ(vertex)]);\n if (hasUv) st.push([uv.getX(vertex), uv.getY(vertex)]);\n }\n faceVertexIndices.push(mapped);\n }\n } else {\n for (let i = 0; i < position.count; i++) {\n points.push([position.getX(i), position.getY(i), position.getZ(i)]);\n if (hasNormals) normals.push([normal.getX(i), normal.getY(i), normal.getZ(i)]);\n if (hasUv) st.push([uv.getX(i), uv.getY(i)]);\n }\n faceVertexIndices = slice.slice(0, triangles * 3);\n }\n\n const mesh: ExportMesh = {\n name: options.name,\n kind: options.kind ?? \"visual\",\n points,\n faceVertexCounts: new Array(triangles).fill(3),\n faceVertexIndices,\n };\n if (hasNormals) mesh.normals = normals;\n if (hasUv) mesh.st = st;\n\n if (options.transform && !isIdentityMat4(options.transform)) mesh.transform = options.transform;\n if (options.material) mesh.material = options.material;\n if (options.doubleSided) mesh.doubleSided = true;\n return mesh;\n}\n\n/**\n * Extract constant PBR parameters from a Three.js material. Only\n * `MeshStandardMaterial` maps onto `UsdPreviewSurface`; anything else returns\n * `undefined` (with a warning). Texture maps are reported but not carried.\n */\nexport function materialToExportMaterial(\n material: THREE.Material,\n name: string,\n onWarn?: (message: string) => void,\n): ExportMaterial | undefined {\n const std = material as THREE.MeshStandardMaterial;\n if (!std.isMeshStandardMaterial) {\n onWarn?.(`material \"${name}\": only MeshStandardMaterial exports to UsdPreviewSurface; skipped`);\n return undefined;\n }\n if (\n std.map ||\n std.normalMap ||\n std.roughnessMap ||\n std.metalnessMap ||\n std.aoMap ||\n std.emissiveMap ||\n std.alphaMap\n ) {\n onWarn?.(\n `material \"${name}\": texture maps are not carried from Three.js materials (image extraction is app-side); constants only`,\n );\n }\n\n const out: ExportMaterial = {\n name,\n diffuseColor: [std.color.r, std.color.g, std.color.b],\n metallic: std.metalness,\n roughness: std.roughness,\n };\n if (std.transparent && std.opacity < 1) out.opacity = std.opacity;\n if (std.emissive.r > 0 || std.emissive.g > 0 || std.emissive.b > 0) {\n out.emissiveColor = [std.emissive.r, std.emissive.g, std.emissive.b];\n }\n return out;\n}\n\n/**\n * Provider over the meshes `bindRobotMeshes` attached under each link of a\n * loaded robot (direct children tagged `userData.kind`), with their link-local\n * transforms and materials.\n */\nexport function threeGeometryProvider(\n robot: ThreeUsdRobot,\n onWarn?: (message: string) => void,\n): RobotGeometryProvider {\n const materialNames = new Map<THREE.Material, ExportMaterial | undefined>();\n let autoId = 0;\n const convertMaterial = (material: THREE.Material): ExportMaterial | undefined => {\n if (!materialNames.has(material)) {\n const name = material.name || `Material_${autoId++}`;\n materialNames.set(material, materialToExportMaterial(material, name, onWarn));\n }\n return materialNames.get(material);\n };\n\n return (linkKey) => {\n const linkObj = robot.getLinkObject(linkKey);\n if (!linkObj) return [];\n\n const out: ExportMesh[] = [];\n for (const childObj of linkObj.children) {\n const meshObj = childObj as THREE.Mesh;\n if (!meshObj.isMesh) continue;\n const kind = meshObj.userData.kind === \"collision\" ? \"collision\" : \"visual\";\n const transform = [...meshObj.matrix.elements];\n const baseName = meshObj.name || \"mesh\";\n const materials = Array.isArray(meshObj.material) ? meshObj.material : [meshObj.material];\n const groups = meshObj.geometry.groups;\n\n // A multi-material mesh exports one USD Mesh per geometry group, so each\n // group keeps its own material instead of collapsing to the first.\n if (materials.length > 1 && groups.length > 0) {\n for (const [i, group] of groups.entries()) {\n const material = materials[group.materialIndex ?? 0];\n const exportMaterial = material ? convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: `${baseName}_${material?.name || i}`,\n kind,\n transform,\n group: { start: group.start, count: group.count },\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) out.push(mesh);\n }\n continue;\n }\n\n const material = materials[0];\n const exportMaterial = material ? convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: baseName,\n kind,\n transform,\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) out.push(mesh);\n }\n return out;\n };\n}\n\nexport type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, \"geometry\"> & {\n /** Re-read mesh data from the source stage instead of the Three.js scene. */\n stage?: Stage;\n};\n\n/** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */\nexport function exportThreeUsdRobot(\n robot: ThreeUsdRobot,\n options: ExportThreeUsdRobotOptions = {},\n): UsdaFile {\n const { stage, ...rest } = options;\n const geometry = stage\n ? stageGeometryProvider(stage)\n : threeGeometryProvider(robot, options.onWarn);\n return exportRobotUsda(robot.robot, { ...rest, geometry });\n}\n\nfunction isIdentityMat4(m: Mat4): boolean {\n for (let i = 0; i < 16; i++) {\n if (m[i] !== (i % 5 === 0 ? 1 : 0)) return false;\n }\n return true;\n}\n","/**\n * Authoring API (M14): assemble a robot from Three.js objects and export it.\n *\n * Links and joints are declared by name. Every joint takes **one** world-space\n * frame; both body-local joint frames derive from it —\n * `frame0 = linkWorld(parent)⁻¹ · frame`, `frame1 = linkWorld(child)⁻¹ · frame`\n * — so the arrangement at build time is the robot's zero pose. Values are SI\n * (radians / stage linear units); the exporter converts to authored units on\n * write. World matrices are captured at `addLink`/`add*Joint` time.\n */\n\nimport * as THREE from \"three\";\nimport type {\n CollisionApproximation,\n ExportMaterial,\n ExportMesh,\n ExportPhysicsMaterial,\n RobotGeometryProvider,\n} from \"../export/GeometryProvider.js\";\nimport { type ExportRobotOptions, exportRobotUsda } from \"../export/exportRobot.js\";\nimport { type Mat4, identity4, invert, multiply } from \"../kinematics/transforms.js\";\nimport type { UsdaFile } from \"../parser/ast.js\";\nimport type {\n Axis,\n JointDescription,\n JointDriveDescription,\n JointType,\n LinkDescription,\n LinkInertialDescription,\n RobotDescription,\n} from \"../robot/RobotDescription.js\";\nimport { type KinematicTree, buildKinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { refineJointType } from \"../robot/normalize.js\";\nimport { geometryToExportMesh, materialToExportMaterial } from \"./exportThreeUsdRobot.js\";\n\n/** A world-space frame: a matrix, or an object whose `matrixWorld` is used. */\nexport type WorldFrame = THREE.Matrix4 | THREE.Object3D;\n\nexport type RobotBuilderOptions = {\n name: string;\n /** Stage up axis; defaults to `\"Z\"` (Isaac Sim convention). */\n upAxis?: \"Y\" | \"Z\";\n /** Stage linear unit; defaults to `1` (meters). */\n metersPerUnit?: number;\n /** Link to flag with `PhysicsArticulationRootAPI` (default: the container prim). */\n articulationRoot?: string;\n onWarn?: (message: string) => void;\n};\n\nexport type AddLinkOptions = {\n name: string;\n /** Link frame in world space at build pose (default identity). */\n frame?: WorldFrame;\n /** Objects whose `THREE.Mesh` descendants become the link's visual meshes. */\n visuals?: THREE.Object3D[];\n /** Objects whose `THREE.Mesh` descendants become collision meshes. */\n collisions?: THREE.Object3D[];\n /** Mass properties, exported as `PhysicsMassAPI` (M16). */\n inertial?: LinkInertialDescription;\n /** `physics:approximation` applied to this link's collision meshes (M16). */\n collisionApproximation?: CollisionApproximation;\n /** Physics material bound to this link's collision meshes (M16). */\n physicsMaterial?: ExportPhysicsMaterial;\n};\n\nexport type AddJointOptions = {\n name: string;\n /** Parent link name; omit to fix the child to the world. */\n parent?: string;\n child: string;\n /** Joint frame in world space (default: the child link's frame). */\n frame?: WorldFrame;\n /** Rotation / sliding axis token in the joint frame (default `\"X\"`). */\n axis?: Axis;\n /** Limits in SI: radians (revolute) or stage linear units (prismatic). */\n lower?: number;\n upper?: number;\n /** Initial joint value in SI, exported as `PhysicsJointStateAPI`. */\n initialValue?: number;\n drive?: JointDriveDescription;\n};\n\ntype PendingJoint = {\n type: JointType;\n options: AddJointOptions;\n /** Joint frame world matrix captured at add time (undefined → child frame). */\n world?: Mat4;\n};\n\nexport class RobotBuilder {\n private readonly robotName: string;\n private readonly upAxis: \"Y\" | \"Z\";\n private readonly metersPerUnit: number;\n private readonly articulationRoot?: string;\n private readonly warn: (message: string) => void;\n\n private readonly links = new Map<\n string,\n { world: Mat4; meshes: ExportMesh[]; inertial?: LinkInertialDescription }\n >();\n private readonly joints = new Map<string, PendingJoint>();\n private readonly materialCache = new Map<THREE.Material, ExportMaterial | undefined>();\n private materialAutoId = 0;\n\n constructor(options: RobotBuilderOptions) {\n this.robotName = options.name;\n this.upAxis = options.upAxis ?? \"Z\";\n this.metersPerUnit = options.metersPerUnit ?? 1;\n if (options.articulationRoot !== undefined) this.articulationRoot = options.articulationRoot;\n this.warn = options.onWarn ?? (() => {});\n }\n\n addLink(options: AddLinkOptions): this {\n if (this.links.has(options.name)) {\n throw new Error(`RobotBuilder: link \"${options.name}\" is already defined`);\n }\n const world = resolveFrame(options.frame) ?? identity4();\n const collisionExtras = {\n ...(options.collisionApproximation !== undefined\n ? { approximation: options.collisionApproximation }\n : {}),\n ...(options.physicsMaterial ? { material: options.physicsMaterial } : {}),\n };\n const meshes = [\n ...this.gatherMeshes(options.visuals ?? [], world, \"visual\"),\n ...this.gatherMeshes(options.collisions ?? [], world, \"collision\", collisionExtras),\n ];\n this.links.set(options.name, {\n world,\n meshes,\n ...(options.inertial ? { inertial: options.inertial } : {}),\n });\n return this;\n }\n\n addFixedJoint(options: Omit<AddJointOptions, \"axis\" | \"lower\" | \"upper\">): this {\n return this.addJoint(\"fixed\", options);\n }\n\n addRevoluteJoint(options: AddJointOptions): this {\n return this.addJoint(\"revolute\", options);\n }\n\n addPrismaticJoint(options: AddJointOptions): this {\n return this.addJoint(\"prismatic\", options);\n }\n\n private addJoint(type: JointType, options: AddJointOptions): this {\n if (this.joints.has(options.name)) {\n throw new Error(`RobotBuilder: joint \"${options.name}\" is already defined`);\n }\n const world = resolveFrame(options.frame);\n this.joints.set(options.name, { type, options, ...(world ? { world } : {}) });\n return this;\n }\n\n /** Assemble the IR + geometry provider (validates the kinematic graph). */\n build(): { desc: RobotDescription; geometry: RobotGeometryProvider; tree: KinematicTree } {\n const links: Record<string, LinkDescription> = {};\n for (const [name, link] of this.links) {\n links[name] = {\n name,\n primPath: `/${this.robotName}/${name}`,\n visualPrims: [],\n ...(link.inertial ? { inertial: link.inertial } : {}),\n // Authored placement, so links no joint reaches keep their build pose.\n ...(isIdentityMat4(link.world) ? {} : { worldTransform: link.world }),\n };\n }\n\n const joints: Record<string, JointDescription> = {};\n for (const [name, pending] of this.joints) {\n const { options } = pending;\n const parent = options.parent ?? \"\";\n if (parent !== \"\" && !this.links.has(parent)) {\n throw new Error(`RobotBuilder: joint \"${name}\" references unknown parent \"${parent}\"`);\n }\n const childLink = this.links.get(options.child);\n if (!childLink) {\n throw new Error(\n `RobotBuilder: joint \"${name}\" references unknown child \"${options.child}\"`,\n );\n }\n\n const jointWorld = pending.world ?? childLink.world;\n const parentWorld = parent === \"\" ? identity4() : this.links.get(parent)!.world;\n const type = refineJointType(pending.type, options.lower, options.upper);\n\n joints[name] = {\n name,\n primPath: `/${this.robotName}/${name}`,\n type,\n parent,\n child: options.child,\n axis: options.axis ?? \"X\",\n jointFrame0: multiply(invert(parentWorld), jointWorld),\n jointFrame1: multiply(invert(childLink.world), jointWorld),\n ...(options.lower !== undefined ? { lower: options.lower } : {}),\n ...(options.upper !== undefined ? { upper: options.upper } : {}),\n ...(options.initialValue !== undefined ? { initialValue: options.initialValue } : {}),\n ...(options.drive ? { drive: options.drive } : {}),\n };\n }\n\n if (this.articulationRoot !== undefined && !this.links.has(this.articulationRoot)) {\n throw new Error(`RobotBuilder: articulationRoot \"${this.articulationRoot}\" is not a link`);\n }\n\n const desc: RobotDescription = {\n name: this.robotName,\n rootLink: \"\",\n links,\n joints,\n upAxis: this.upAxis,\n metersPerUnit: this.metersPerUnit,\n ...(this.articulationRoot !== undefined\n ? { articulationRoots: [this.articulationRoot] }\n : {}),\n };\n\n const tree = buildKinematicTree(desc, { onWarn: this.warn });\n desc.rootLink = tree.root;\n if (tree.loopJoints.length > 0) desc.loopJoints = tree.loopJoints;\n if (tree.warnings.length > 0) desc.warnings = tree.warnings;\n\n const byLink = this.links;\n const geometry: RobotGeometryProvider = (linkKey) => byLink.get(linkKey)?.meshes ?? [];\n return { desc, geometry, tree };\n }\n\n /** Build and export in one step (pass the result to `serializeUsda`). */\n toUsda(options: Omit<ExportRobotOptions, \"geometry\"> = {}): UsdaFile {\n const { desc, geometry } = this.build();\n return exportRobotUsda(desc, { onWarn: this.warn, ...options, geometry });\n }\n\n /** Collect `THREE.Mesh` descendants of `roots` as link-relative export meshes. */\n private gatherMeshes(\n roots: THREE.Object3D[],\n linkWorld: Mat4,\n kind: \"visual\" | \"collision\",\n collisionExtras: {\n approximation?: CollisionApproximation;\n material?: ExportPhysicsMaterial;\n } = {},\n ): ExportMesh[] {\n const linkInverse = invert(linkWorld);\n const out: ExportMesh[] = [];\n for (const root of roots) {\n root.updateWorldMatrix(true, true);\n root.traverse((obj) => {\n const meshObj = obj as THREE.Mesh;\n if (!meshObj.isMesh) return;\n const material = Array.isArray(meshObj.material) ? meshObj.material[0] : meshObj.material;\n if (Array.isArray(meshObj.material) && meshObj.material.length > 1) {\n this.warn(\n `mesh \"${meshObj.name}\": multi-material meshes export their first material only`,\n );\n }\n const exportMaterial = material ? this.convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: meshObj.name || \"mesh\",\n kind,\n transform: multiply(linkInverse, [...meshObj.matrixWorld.elements]),\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) {\n if (kind === \"collision\") {\n if (collisionExtras.approximation !== undefined) {\n mesh.collisionApproximation = collisionExtras.approximation;\n }\n if (collisionExtras.material) mesh.physicsMaterial = collisionExtras.material;\n }\n out.push(mesh);\n } else {\n this.warn(`mesh \"${meshObj.name}\": no triangle geometry; skipped`);\n }\n });\n }\n return out;\n }\n\n private convertMaterial(material: THREE.Material): ExportMaterial | undefined {\n if (!this.materialCache.has(material)) {\n const name = material.name || `Material_${this.materialAutoId++}`;\n this.materialCache.set(material, materialToExportMaterial(material, name, this.warn));\n }\n return this.materialCache.get(material);\n }\n}\n\nfunction isIdentityMat4(m: Mat4): boolean {\n for (let i = 0; i < 16; i++) {\n if (m[i] !== (i % 5 === 0 ? 1 : 0)) return false;\n }\n return true;\n}\n\n/** World matrix of a frame argument (`matrixWorld` refreshed for objects). */\nfunction resolveFrame(frame: WorldFrame | undefined): Mat4 | undefined {\n if (!frame) return undefined;\n if ((frame as THREE.Object3D).isObject3D) {\n const obj = frame as THREE.Object3D;\n obj.updateWorldMatrix(true, false);\n return [...obj.matrixWorld.elements];\n }\n return [...(frame as THREE.Matrix4).elements];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../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eshStandardMaterial` into the plain\n * {@link ExportMesh} data the exporter consumes, harvests the meshes attached\n * under a loaded robot's links, and re-exports a {@link ThreeUsdRobot} as a\n * USDA AST. Texture maps are not carried yet (M15) — constants only.\n */\n\nimport * as THREE from \"three\";\nimport type {\n ExportMaterial,\n ExportMesh,\n RobotGeometryProvider,\n} from \"../export/GeometryProvider.js\";\nimport { stageGeometryProvider } from \"../export/GeometryProvider.js\";\nimport { type ExportRobotOptions, exportRobotUsda } from \"../export/exportRobot.js\";\nimport type { Mat4 } from \"../kinematics/transforms.js\";\nimport type { UsdaFile, Vec2, Vec3 } from \"../parser/ast.js\";\nimport type { Stage } from \"../usd/Stage.js\";\nimport type { ThreeUsdRobot } from \"./ThreeUsdRobot.js\";\n\nexport type GeometryToExportMeshOptions = {\n name: string;\n kind?: \"visual\" | \"collision\";\n /** Transform relative to the link frame (column-major); identity when omitted. */\n transform?: Mat4;\n material?: ExportMaterial;\n doubleSided?: boolean;\n /**\n * Export only this slice of the index buffer — a `BufferGeometry` group, as\n * used by multi-material meshes. Vertices are re-indexed onto the slice.\n */\n group?: { start: number; count: number };\n};\n\n/**\n * Convert a triangle `BufferGeometry` into exportable mesh data. Non-indexed\n * geometry becomes sequential triangles; a trailing partial triangle (or the\n * absence of a position attribute) returns `null`.\n */\nexport function geometryToExportMesh(\n geometry: THREE.BufferGeometry,\n options: GeometryToExportMeshOptions,\n): ExportMesh | null {\n const position = geometry.getAttribute(\"position\");\n if (!position || position.count === 0) return null;\n\n const index = geometry.getIndex();\n const all = index\n ? Array.from(index.array as ArrayLike<number>)\n : Array.from({ length: position.count }, (_, i) => i);\n const slice = options.group\n ? all.slice(options.group.start, options.group.start + options.group.count)\n : all;\n const triangles = Math.floor(slice.length / 3);\n if (triangles === 0) return null;\n\n const normal = geometry.getAttribute(\"normal\");\n const uv = geometry.getAttribute(\"uv\");\n const hasNormals = !!normal && normal.count === position.count;\n const hasUv = !!uv && uv.count === position.count;\n\n const points: Vec3[] = [];\n const normals: Vec3[] = [];\n const st: Vec2[] = [];\n let faceVertexIndices: number[];\n\n if (options.group) {\n // Re-index onto just the vertices this group touches.\n const remap = new Map<number, number>();\n faceVertexIndices = [];\n for (const vertex of slice.slice(0, triangles * 3)) {\n let mapped = remap.get(vertex);\n if (mapped === undefined) {\n mapped = points.length;\n remap.set(vertex, mapped);\n points.push([position.getX(vertex), position.getY(vertex), position.getZ(vertex)]);\n if (hasNormals)\n normals.push([normal.getX(vertex), normal.getY(vertex), normal.getZ(vertex)]);\n if (hasUv) st.push([uv.getX(vertex), uv.getY(vertex)]);\n }\n faceVertexIndices.push(mapped);\n }\n } else {\n for (let i = 0; i < position.count; i++) {\n points.push([position.getX(i), position.getY(i), position.getZ(i)]);\n if (hasNormals) normals.push([normal.getX(i), normal.getY(i), normal.getZ(i)]);\n if (hasUv) st.push([uv.getX(i), uv.getY(i)]);\n }\n faceVertexIndices = slice.slice(0, triangles * 3);\n }\n\n const mesh: ExportMesh = {\n name: options.name,\n kind: options.kind ?? \"visual\",\n points,\n faceVertexCounts: new Array(triangles).fill(3),\n faceVertexIndices,\n };\n if (hasNormals) mesh.normals = normals;\n if (hasUv) mesh.st = st;\n\n if (options.transform && !isIdentityMat4(options.transform)) mesh.transform = options.transform;\n if (options.material) mesh.material = options.material;\n if (options.doubleSided) mesh.doubleSided = true;\n return mesh;\n}\n\n/**\n * Extract constant PBR parameters from a Three.js material. Only\n * `MeshStandardMaterial` maps onto `UsdPreviewSurface`; anything else returns\n * `undefined` (with a warning). Texture maps are reported but not carried.\n */\nexport function materialToExportMaterial(\n material: THREE.Material,\n name: string,\n onWarn?: (message: string) => void,\n): ExportMaterial | undefined {\n const std = material as THREE.MeshStandardMaterial;\n if (!std.isMeshStandardMaterial) {\n onWarn?.(`material \"${name}\": only MeshStandardMaterial exports to UsdPreviewSurface; skipped`);\n return undefined;\n }\n if (\n std.map ||\n std.normalMap ||\n std.roughnessMap ||\n std.metalnessMap ||\n std.aoMap ||\n std.emissiveMap ||\n std.alphaMap\n ) {\n onWarn?.(\n `material \"${name}\": texture maps are not carried from Three.js materials (image extraction is app-side); constants only`,\n );\n }\n\n const out: ExportMaterial = {\n name,\n diffuseColor: [std.color.r, std.color.g, std.color.b],\n metallic: std.metalness,\n roughness: std.roughness,\n };\n if (std.transparent && std.opacity < 1) out.opacity = std.opacity;\n if (std.emissive.r > 0 || std.emissive.g > 0 || std.emissive.b > 0) {\n out.emissiveColor = [std.emissive.r, std.emissive.g, std.emissive.b];\n }\n return out;\n}\n\n/**\n * Provider over the meshes `bindRobotMeshes` attached under each link of a\n * loaded robot (direct children tagged `userData.kind`), with their link-local\n * transforms and materials.\n */\nexport function threeGeometryProvider(\n robot: ThreeUsdRobot,\n onWarn?: (message: string) => void,\n): RobotGeometryProvider {\n const materialNames = new Map<THREE.Material, ExportMaterial | undefined>();\n let autoId = 0;\n const convertMaterial = (material: THREE.Material): ExportMaterial | undefined => {\n if (!materialNames.has(material)) {\n const name = material.name || `Material_${autoId++}`;\n materialNames.set(material, materialToExportMaterial(material, name, onWarn));\n }\n return materialNames.get(material);\n };\n\n return (linkKey) => {\n const linkObj = robot.getLinkObject(linkKey);\n if (!linkObj) return [];\n\n const out: ExportMesh[] = [];\n for (const childObj of linkObj.children) {\n const meshObj = childObj as THREE.Mesh;\n if (!meshObj.isMesh) continue;\n const kind = meshObj.userData.kind === \"collision\" ? \"collision\" : \"visual\";\n const transform = [...meshObj.matrix.elements];\n const baseName = meshObj.name || \"mesh\";\n const materials = Array.isArray(meshObj.material) ? meshObj.material : [meshObj.material];\n const groups = meshObj.geometry.groups;\n\n // A multi-material mesh exports one USD Mesh per geometry group, so each\n // group keeps its own material instead of collapsing to the first.\n if (materials.length > 1 && groups.length > 0) {\n for (const [i, group] of groups.entries()) {\n const material = materials[group.materialIndex ?? 0];\n const exportMaterial = material ? convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: `${baseName}_${material?.name || i}`,\n kind,\n transform,\n group: { start: group.start, count: group.count },\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) out.push(mesh);\n }\n continue;\n }\n\n const material = materials[0];\n const exportMaterial = material ? convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: baseName,\n kind,\n transform,\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) out.push(mesh);\n }\n return out;\n };\n}\n\nexport type ExportThreeUsdRobotOptions = Omit<ExportRobotOptions, \"geometry\"> & {\n /** Re-read mesh data from the source stage instead of the Three.js scene. */\n stage?: Stage;\n};\n\n/** Export a loaded robot back to a USDA AST (pass the result to `serializeUsda`). */\nexport function exportThreeUsdRobot(\n robot: ThreeUsdRobot,\n options: ExportThreeUsdRobotOptions = {},\n): UsdaFile {\n const { stage, ...rest } = options;\n const geometry = stage\n ? stageGeometryProvider(stage)\n : threeGeometryProvider(robot, options.onWarn);\n return exportRobotUsda(robot.robot, { ...rest, geometry });\n}\n\nfunction isIdentityMat4(m: Mat4): boolean {\n for (let i = 0; i < 16; i++) {\n if (m[i] !== (i % 5 === 0 ? 1 : 0)) return false;\n }\n return true;\n}\n","/**\n * Authoring API (M14): assemble a robot from Three.js objects and export it.\n *\n * Links and joints are declared by name. Every joint takes **one** world-space\n * frame; both body-local joint frames derive from it —\n * `frame0 = linkWorld(parent)⁻¹ · frame`, `frame1 = linkWorld(child)⁻¹ · frame`\n * — so the arrangement at build time is the robot's zero pose. Values are SI\n * (radians / stage linear units); the exporter converts to authored units on\n * write. World matrices are captured at `addLink`/`add*Joint` time.\n */\n\nimport * as THREE from \"three\";\nimport type {\n CollisionApproximation,\n ExportMaterial,\n ExportMesh,\n ExportPhysicsMaterial,\n RobotGeometryProvider,\n} from \"../export/GeometryProvider.js\";\nimport { type ExportRobotOptions, exportRobotUsda } from \"../export/exportRobot.js\";\nimport { type Mat4, identity4, invert, multiply } from \"../kinematics/transforms.js\";\nimport type { UsdaFile } from \"../parser/ast.js\";\nimport type {\n Axis,\n JointDescription,\n JointDriveDescription,\n JointType,\n LinkDescription,\n LinkInertialDescription,\n RobotDescription,\n} from \"../robot/RobotDescription.js\";\nimport { type KinematicTree, buildKinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { refineJointType } from \"../robot/normalize.js\";\nimport { geometryToExportMesh, materialToExportMaterial } from \"./exportThreeUsdRobot.js\";\n\n/** A world-space frame: a matrix, or an object whose `matrixWorld` is used. */\nexport type WorldFrame = THREE.Matrix4 | THREE.Object3D;\n\nexport type RobotBuilderOptions = {\n name: string;\n /** Stage up axis; defaults to `\"Z\"` (Isaac Sim convention). */\n upAxis?: \"Y\" | \"Z\";\n /** Stage linear unit; defaults to `1` (meters). */\n metersPerUnit?: number;\n /** Link to flag with `PhysicsArticulationRootAPI` (default: the container prim). */\n articulationRoot?: string;\n onWarn?: (message: string) => void;\n};\n\nexport type AddLinkOptions = {\n name: string;\n /** Link frame in world space at build pose (default identity). */\n frame?: WorldFrame;\n /** Objects whose `THREE.Mesh` descendants become the link's visual meshes. */\n visuals?: THREE.Object3D[];\n /** Objects whose `THREE.Mesh` descendants become collision meshes. */\n collisions?: THREE.Object3D[];\n /** Mass properties, exported as `PhysicsMassAPI` (M16). */\n inertial?: LinkInertialDescription;\n /** `physics:approximation` applied to this link's collision meshes (M16). */\n collisionApproximation?: CollisionApproximation;\n /** Physics material bound to this link's collision meshes (M16). */\n physicsMaterial?: ExportPhysicsMaterial;\n};\n\nexport type AddJointOptions = {\n name: string;\n /** Parent link name; omit to fix the child to the world. */\n parent?: string;\n child: string;\n /** Joint frame in world space (default: the child link's frame). */\n frame?: WorldFrame;\n /** Rotation / sliding axis token in the joint frame (default `\"X\"`). */\n axis?: Axis;\n /** Limits in SI: radians (revolute) or stage linear units (prismatic). */\n lower?: number;\n upper?: number;\n /** Initial joint value in SI, exported as `PhysicsJointStateAPI`. */\n initialValue?: number;\n drive?: JointDriveDescription;\n};\n\ntype PendingJoint = {\n type: JointType;\n options: AddJointOptions;\n /** Joint frame world matrix captured at add time (undefined → child frame). */\n world?: Mat4;\n};\n\nexport class RobotBuilder {\n private readonly robotName: string;\n private readonly upAxis: \"Y\" | \"Z\";\n private readonly metersPerUnit: number;\n private readonly articulationRoot?: string;\n private readonly warn: (message: string) => void;\n\n private readonly links = new Map<\n string,\n { world: Mat4; meshes: ExportMesh[]; inertial?: LinkInertialDescription }\n >();\n private readonly joints = new Map<string, PendingJoint>();\n private readonly materialCache = new Map<THREE.Material, ExportMaterial | undefined>();\n private materialAutoId = 0;\n\n constructor(options: RobotBuilderOptions) {\n this.robotName = options.name;\n this.upAxis = options.upAxis ?? \"Z\";\n this.metersPerUnit = options.metersPerUnit ?? 1;\n if (options.articulationRoot !== undefined) this.articulationRoot = options.articulationRoot;\n this.warn = options.onWarn ?? (() => {});\n }\n\n addLink(options: AddLinkOptions): this {\n if (this.links.has(options.name)) {\n throw new Error(`RobotBuilder: link \"${options.name}\" is already defined`);\n }\n const world = resolveFrame(options.frame) ?? identity4();\n const collisionExtras = {\n ...(options.collisionApproximation !== undefined\n ? { approximation: options.collisionApproximation }\n : {}),\n ...(options.physicsMaterial ? { material: options.physicsMaterial } : {}),\n };\n const meshes = [\n ...this.gatherMeshes(options.visuals ?? [], world, \"visual\"),\n ...this.gatherMeshes(options.collisions ?? [], world, \"collision\", collisionExtras),\n ];\n this.links.set(options.name, {\n world,\n meshes,\n ...(options.inertial ? { inertial: options.inertial } : {}),\n });\n return this;\n }\n\n addFixedJoint(options: Omit<AddJointOptions, \"axis\" | \"lower\" | \"upper\">): this {\n return this.addJoint(\"fixed\", options);\n }\n\n addRevoluteJoint(options: AddJointOptions): this {\n return this.addJoint(\"revolute\", options);\n }\n\n addPrismaticJoint(options: AddJointOptions): this {\n return this.addJoint(\"prismatic\", options);\n }\n\n private addJoint(type: JointType, options: AddJointOptions): this {\n if (this.joints.has(options.name)) {\n throw new Error(`RobotBuilder: joint \"${options.name}\" is already defined`);\n }\n const world = resolveFrame(options.frame);\n this.joints.set(options.name, { type, options, ...(world ? { world } : {}) });\n return this;\n }\n\n /** Assemble the IR + geometry provider (validates the kinematic graph). */\n build(): { desc: RobotDescription; geometry: RobotGeometryProvider; tree: KinematicTree } {\n const links: Record<string, LinkDescription> = {};\n for (const [name, link] of this.links) {\n links[name] = {\n name,\n primPath: `/${this.robotName}/${name}`,\n visualPrims: [],\n ...(link.inertial ? { inertial: link.inertial } : {}),\n // Authored placement, so links no joint reaches keep their build pose.\n ...(isIdentityMat4(link.world) ? {} : { worldTransform: link.world }),\n };\n }\n\n const joints: Record<string, JointDescription> = {};\n for (const [name, pending] of this.joints) {\n const { options } = pending;\n const parent = options.parent ?? \"\";\n if (parent !== \"\" && !this.links.has(parent)) {\n throw new Error(`RobotBuilder: joint \"${name}\" references unknown parent \"${parent}\"`);\n }\n const childLink = this.links.get(options.child);\n if (!childLink) {\n throw new Error(\n `RobotBuilder: joint \"${name}\" references unknown child \"${options.child}\"`,\n );\n }\n\n const jointWorld = pending.world ?? childLink.world;\n const parentWorld = parent === \"\" ? identity4() : this.links.get(parent)!.world;\n const type = refineJointType(pending.type, options.lower, options.upper);\n\n joints[name] = {\n name,\n primPath: `/${this.robotName}/${name}`,\n type,\n parent,\n child: options.child,\n axis: options.axis ?? \"X\",\n jointFrame0: multiply(invert(parentWorld), jointWorld),\n jointFrame1: multiply(invert(childLink.world), jointWorld),\n ...(options.lower !== undefined ? { lower: options.lower } : {}),\n ...(options.upper !== undefined ? { upper: options.upper } : {}),\n ...(options.initialValue !== undefined ? { initialValue: options.initialValue } : {}),\n ...(options.drive ? { drive: options.drive } : {}),\n };\n }\n\n if (this.articulationRoot !== undefined && !this.links.has(this.articulationRoot)) {\n throw new Error(`RobotBuilder: articulationRoot \"${this.articulationRoot}\" is not a link`);\n }\n\n const desc: RobotDescription = {\n name: this.robotName,\n rootLink: \"\",\n links,\n joints,\n upAxis: this.upAxis,\n metersPerUnit: this.metersPerUnit,\n ...(this.articulationRoot !== undefined\n ? { articulationRoots: [this.articulationRoot] }\n : {}),\n };\n\n const tree = buildKinematicTree(desc, { onWarn: this.warn });\n desc.rootLink = tree.root;\n if (tree.loopJoints.length > 0) desc.loopJoints = tree.loopJoints;\n if (tree.warnings.length > 0) desc.warnings = tree.warnings;\n\n const byLink = this.links;\n const geometry: RobotGeometryProvider = (linkKey) => byLink.get(linkKey)?.meshes ?? [];\n return { desc, geometry, tree };\n }\n\n /** Build and export in one step (pass the result to `serializeUsda`). */\n toUsda(options: Omit<ExportRobotOptions, \"geometry\"> = {}): UsdaFile {\n const { desc, geometry } = this.build();\n return exportRobotUsda(desc, { onWarn: this.warn, ...options, geometry });\n }\n\n /** Collect `THREE.Mesh` descendants of `roots` as link-relative export meshes. */\n private gatherMeshes(\n roots: THREE.Object3D[],\n linkWorld: Mat4,\n kind: \"visual\" | \"collision\",\n collisionExtras: {\n approximation?: CollisionApproximation;\n material?: ExportPhysicsMaterial;\n } = {},\n ): ExportMesh[] {\n const linkInverse = invert(linkWorld);\n const out: ExportMesh[] = [];\n for (const root of roots) {\n root.updateWorldMatrix(true, true);\n root.traverse((obj) => {\n const meshObj = obj as THREE.Mesh;\n if (!meshObj.isMesh) return;\n const material = Array.isArray(meshObj.material) ? meshObj.material[0] : meshObj.material;\n if (Array.isArray(meshObj.material) && meshObj.material.length > 1) {\n this.warn(\n `mesh \"${meshObj.name}\": multi-material meshes export their first material only`,\n );\n }\n const exportMaterial = material ? this.convertMaterial(material) : undefined;\n const mesh = geometryToExportMesh(meshObj.geometry, {\n name: meshObj.name || \"mesh\",\n kind,\n transform: multiply(linkInverse, [...meshObj.matrixWorld.elements]),\n ...(exportMaterial ? { material: exportMaterial } : {}),\n doubleSided: material?.side === THREE.DoubleSide,\n });\n if (mesh) {\n if (kind === \"collision\") {\n if (collisionExtras.approximation !== undefined) {\n mesh.collisionApproximation = collisionExtras.approximation;\n }\n if (collisionExtras.material) mesh.physicsMaterial = collisionExtras.material;\n }\n out.push(mesh);\n } else {\n this.warn(`mesh \"${meshObj.name}\": no triangle geometry; skipped`);\n }\n });\n }\n return out;\n }\n\n private convertMaterial(material: THREE.Material): ExportMaterial | undefined {\n if (!this.materialCache.has(material)) {\n const name = material.name || `Material_${this.materialAutoId++}`;\n this.materialCache.set(material, materialToExportMaterial(material, name, this.warn));\n }\n return this.materialCache.get(material);\n }\n}\n\nfunction isIdentityMat4(m: Mat4): boolean {\n for (let i = 0; i < 16; i++) {\n if (m[i] !== (i % 5 === 0 ? 1 : 0)) return false;\n }\n return true;\n}\n\n/** World matrix of a frame argument (`matrixWorld` refreshed for objects). */\nfunction resolveFrame(frame: WorldFrame | undefined): Mat4 | undefined {\n if (!frame) return undefined;\n if ((frame as THREE.Object3D).isObject3D) {\n const obj = frame as THREE.Object3D;\n obj.updateWorldMatrix(true, false);\n return [...obj.matrixWorld.elements];\n }\n return [...(frame as THREE.Matrix4).elements];\n}\n"]}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-CsjraHqP.js';
|
|
5
|
+
import { T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-CxOGRLXH.js';
|
|
6
6
|
import 'three';
|
|
7
|
-
import './buildKinematicTree-
|
|
8
|
-
import './
|
|
7
|
+
import './buildKinematicTree-D4R0hEtN.js';
|
|
8
|
+
import './bytes-MOJ2oN-u.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Load a robot for use under `<Suspense>`. Throws the load promise until ready
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ThreeUsdRobotLoader } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { ThreeUsdRobotLoader } from './chunk-YX5GIEMT.js';
|
|
2
|
+
import './chunk-PHHMWMCA.js';
|
|
3
|
+
import './chunk-3CANZKP3.js';
|
|
4
|
+
import './chunk-IYKPVUZ2.js';
|
|
3
5
|
import { useFrame } from '@react-three/fiber';
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import { jsx } from 'react/jsx-runtime';
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react.tsx"],"names":["UsdRobot"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/react.tsx"],"names":["UsdRobot"],"mappings":";;;;;;;;AAwBA,IAAM,KAAA,uBAAY,GAAA,EAAwB;AAE1C,SAAS,SAAA,CAAU,KAAa,OAAA,EAAkD;AAChF,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,GAAA,CAAI,GAAG,CAAA;AAC5B,EAAA,IAAI,QAAQ,OAAO,MAAA;AAEnB,EAAA,MAAM,QAAQ,EAAC;AACf,EAAA,KAAA,CAAM,UAAU,IAAI,mBAAA,CAAoB,OAAO,CAAA,CAAE,SAAA,CAAU,GAAG,CAAA,CAAE,IAAA;AAAA,IAC9D,CAAC,KAAA,KAAU;AACT,MAAA,KAAA,CAAM,KAAA,GAAQ,KAAA;AACd,MAAA,OAAO,KAAA;AAAA,IACT,CAAA;AAAA,IACA,CAAC,KAAA,KAAU;AACT,MAAA,KAAA,CAAM,KAAA,GAAQ,KAAA;AACd,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,GACF;AACA,EAAA,KAAA,CAAM,GAAA,CAAI,KAAK,KAAK,CAAA;AACpB,EAAA,OAAO,KAAA;AACT;AAMO,SAAS,WAAA,CAAY,KAAa,OAAA,EAAqD;AAC5F,EAAA,MAAM,KAAA,GAAQ,SAAA,CAAU,GAAA,EAAK,OAAO,CAAA;AACpC,EAAA,IAAI,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,QAAA,EAAA,OAAA,mBAAU,GAAA,CAAC,aAAA,EAAA,EAAc,KAAA,EAAc,CAAA,GAAK,IAAA,EAC/C,CAAA;AAAA,EAEJ;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,KAAA,EAAM,EAAmC;AAChE,EAAA,iBAAA,CAAkB,OAAO,IAAI,CAAA;AAC7B,EAAA,OAAO,IAAA;AACT","file":"react.js","sourcesContent":["/**\n * `three-usd-robot/react`\n *\n * React Three Fiber bindings: a `<UsdRobot>` component plus hooks. `react` and\n * `@react-three/fiber` are optional peer dependencies — non-React consumers are\n * unaffected. A {@link ThreeUsdRobot} is a `THREE.Object3D`, so it mounts via\n * R3F's `<primitive>`; joint values, toggles and animation are driven through\n * effects/`useFrame` (R3F does not re-render on object mutation).\n */\n\nimport { type ThreeElements, useFrame } from \"@react-three/fiber\";\nimport * as React from \"react\";\nimport type { ThreeUsdRobot } from \"./three/ThreeUsdRobot.js\";\nimport {\n ThreeUsdRobotLoader,\n type ThreeUsdRobotLoaderOptions,\n} from \"./three/ThreeUsdRobotLoader.js\";\n\ntype CacheEntry = {\n promise: Promise<ThreeUsdRobot>;\n robot?: ThreeUsdRobot;\n error?: unknown;\n};\n\nconst cache = new Map<string, CacheEntry>();\n\nfunction loadEntry(url: string, options?: ThreeUsdRobotLoaderOptions): CacheEntry {\n const cached = cache.get(url);\n if (cached) return cached;\n\n const entry = {} as CacheEntry;\n entry.promise = new ThreeUsdRobotLoader(options).loadAsync(url).then(\n (robot) => {\n entry.robot = robot;\n return robot;\n },\n (error) => {\n entry.error = error;\n throw error;\n },\n );\n cache.set(url, entry);\n return entry;\n}\n\n/**\n * Load a robot for use under `<Suspense>`. Throws the load promise until ready\n * (suspends) and the error if it fails (for an error boundary). Cached by `url`.\n */\nexport function useUsdRobot(url: string, options?: ThreeUsdRobotLoaderOptions): ThreeUsdRobot {\n const entry = loadEntry(url, options);\n if (entry.error) throw entry.error;\n if (!entry.robot) throw entry.promise;\n return entry.robot;\n}\n\n/** Warm the cache so a later `<UsdRobot>`/`useUsdRobot` resolves instantly. */\nexport function preloadUsdRobot(url: string, options?: ThreeUsdRobotLoaderOptions): void {\n loadEntry(url, options);\n}\n\n/** Drop one cached robot (or the whole cache) so it reloads next time. */\nexport function clearUsdRobotCache(url?: string): void {\n if (url) cache.delete(url);\n else cache.clear();\n}\n\n/**\n * Advance a robot's time-sampled animation every frame while `playing`. No-op\n * for robots without an authored time range.\n */\nexport function useRobotAnimation(robot: ThreeUsdRobot | null | undefined, playing = true): void {\n const range = robot?.getTimeRange() ?? null;\n const time = React.useRef(range?.start ?? 0);\n useFrame((_, delta) => {\n if (!robot || !range || !playing) return;\n time.current += delta * robot.getTimeCodesPerSecond();\n if (time.current > range.end) time.current = range.start;\n robot.setTime(time.current);\n });\n}\n\n/**\n * Transform / event props forwarded to the underlying `<primitive>`. Picked\n * explicitly so R3F's broad element index signature doesn't widen our own props.\n */\ntype ForwardedProps = Partial<\n Pick<\n ThreeElements[\"primitive\"],\n | \"position\"\n | \"rotation\"\n | \"quaternion\"\n | \"scale\"\n | \"visible\"\n | \"renderOrder\"\n | \"name\"\n | \"userData\"\n | \"onClick\"\n | \"onPointerOver\"\n | \"onPointerOut\"\n | \"onPointerMove\"\n >\n>;\n\nexport type UsdRobotProps = ForwardedProps & {\n /** Asset URL (`.usda` / `.usdc` / binary `.usd` / `.usdz`). */\n url: string;\n /** Loader options (resolver, up-axis, textures, …). */\n loaderOptions?: ThreeUsdRobotLoaderOptions;\n /** Controlled joint values (re-applied when this object changes). */\n jointValues?: Record<string, number>;\n /** Auto-play time-sampled joint animation (default `false`). */\n animate?: boolean;\n showVisual?: boolean;\n showCollision?: boolean;\n showJointAxes?: boolean;\n showLinkFrames?: boolean;\n /** Called once the robot has loaded. */\n onLoad?: (robot: ThreeUsdRobot) => void;\n};\n\n/**\n * Declaratively mount a USD robot in an R3F `<Canvas>`. Wrap in `<Suspense>`.\n *\n * @example\n * ```tsx\n * <Suspense fallback={null}>\n * <UsdRobot url=\"/robot.usda\" jointValues={{ joint1: 0.4 }} showJointAxes />\n * </Suspense>\n * ```\n */\nexport const UsdRobot = React.forwardRef<ThreeUsdRobot, UsdRobotProps>(\n function UsdRobot(props, ref) {\n const {\n url,\n loaderOptions,\n jointValues,\n animate = false,\n showVisual,\n showCollision,\n showJointAxes,\n showLinkFrames,\n onLoad,\n ...rest\n } = props;\n\n const robot = useUsdRobot(url, loaderOptions);\n React.useImperativeHandle(ref, () => robot, [robot]);\n\n React.useEffect(() => {\n onLoad?.(robot);\n }, [robot, onLoad]);\n\n React.useEffect(() => {\n if (jointValues) robot.setJointValues(jointValues);\n }, [robot, jointValues]);\n\n React.useEffect(() => {\n if (showVisual !== undefined) robot.showVisual = showVisual;\n }, [robot, showVisual]);\n React.useEffect(() => {\n if (showCollision !== undefined) robot.showCollision = showCollision;\n }, [robot, showCollision]);\n React.useEffect(() => {\n if (showJointAxes !== undefined) robot.showJointAxes = showJointAxes;\n }, [robot, showJointAxes]);\n React.useEffect(() => {\n if (showLinkFrames !== undefined) robot.showLinkFrames = showLinkFrames;\n }, [robot, showLinkFrames]);\n\n // `useFrame` only runs inside a Canvas, so gate it behind a child component —\n // this keeps <UsdRobot> renderable (and testable) without an R3F frame loop.\n return (\n <primitive object={robot} {...rest}>\n {animate ? <RobotAnimator robot={robot} /> : null}\n </primitive>\n );\n },\n);\n\nfunction RobotAnimator({ robot }: { robot: ThreeUsdRobot }): null {\n useRobotAnimation(robot, true);\n return null;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-usd-robot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.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",
|