three-usd-robot 0.6.0 → 0.7.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 +35 -5
- package/dist/{ThreeUsdRobot-CajXJqYU.d.ts → ThreeUsdRobot-Ljh4PDVD.d.ts} +1 -1
- package/dist/{ThreeUsdRobotLoader-DrMMLzo-.d.ts → ThreeUsdRobotLoader-BSIVFA48.d.ts} +2 -2
- package/dist/{buildKinematicTree-wtZPzy0B.d.ts → buildKinematicTree-Ccd2DIKH.d.ts} +5 -0
- package/dist/{chunk-4MEZM763.js → chunk-4GPCBXUS.js} +160 -41
- package/dist/chunk-4GPCBXUS.js.map +1 -0
- package/dist/{chunk-YVWSO27W.js → chunk-FL554IS5.js} +61 -10
- package/dist/chunk-FL554IS5.js.map +1 -0
- package/dist/{chunk-JZMCABQO.js → chunk-O7XP5FQ4.js} +102 -31
- package/dist/chunk-O7XP5FQ4.js.map +1 -0
- package/dist/core.d.ts +16 -4
- package/dist/core.js +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.d.ts +26 -7
- package/dist/index.js +65 -32
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/react.js +2 -2
- package/package.json +6 -2
- package/dist/chunk-4MEZM763.js.map +0 -1
- package/dist/chunk-JZMCABQO.js.map +0 -1
- package/dist/chunk-YVWSO27W.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../src/export/exportRobot.ts","../src/export/GeometryProvider.ts","../src/export/writeUsdz.ts","../src/robot/RobotValidator.ts"],"names":["attr"],"mappings":";;;;AACO,IAAM,YAAA,GAAe;AAGrB,IAAM,OAAA,GAAU;;;ACqDvB,IAAM,sBAAA,GAAyB,sBAAA;AAsB/B,IAAM,oBAAA,GAAkD;AAAA,EACtD,KAAA,EAAO,mBAAA;AAAA,EACP,QAAA,EAAU,sBAAA;AAA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O,IAAA,CAAK,CAAC,CAAA,EAAG,MAAO,CAAA,CAAE,QAAA,KAAa,CAAA,CAAE,QAAA,GAAW,CAAA,GAAI,CAAA,CAAE,QAAA,KAAa,OAAA,GAAU,KAAK,CAAE,CAAA;AAChG","file":"chunk-O7XP5FQ4.js","sourcesContent":["/** Package identity. Kept in one place so every entry point can re-export it. */\nexport const PACKAGE_NAME = \"three-usd-robot\";\n\n/** Library version. Replaced by the release tooling at publish time. */\nexport const VERSION = \"0.0.0\";\n","/**\n * Robot IR → USDA layer (M13).\n *\n * Builds a self-contained UsdPhysics robot layer from a {@link RobotDescription}:\n * one `Xform` prim per link placed at its **zero-pose** world transform\n * (folding joint frames root-down, `T_child = T_parent · frame0 · frame1⁻¹` —\n * see docs/export-design.md §4), one `Physics*Joint` prim per joint, and the\n * link meshes supplied by a {@link RobotGeometryProvider}. Initial joint values\n * author as `PhysicsJointStateAPI` opinions rather than being baked into link\n * transforms, so a re-import applies them exactly once. Values convert back\n * from SI to authored units (angular radians → degrees).\n */\n\nimport {\n type Mat4,\n decomposeRigid,\n identity4,\n invert,\n multiply,\n toUsdMatrix,\n} from \"../kinematics/transforms.js\";\nimport type {\n AttributeSpec,\n MetadataMap,\n PrimSpec,\n PropertySpec,\n RelationshipSpec,\n UsdValue,\n UsdaFile,\n} from \"../parser/ast.js\";\nimport { AssetPath, Quat } from \"../parser/ast.js\";\nimport type {\n JointDescription,\n JointType,\n LinkInertialDescription,\n RobotDescription,\n} from \"../robot/RobotDescription.js\";\nimport { buildKinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { jointValueFromSI } from \"../robot/normalize.js\";\nimport {\n ARTICULATION_ROOT_API,\n COLLISION_API,\n MASS_API,\n MESH_COLLISION_API,\n PHYSICS_MATERIAL_API,\n RIGID_BODY_API,\n driveKindFor,\n} from \"../schemas/usdPhysics.js\";\nimport type {\n ExportMaterial,\n ExportMesh,\n ExportPhysicsMaterial,\n RobotGeometryProvider,\n TextureChannel,\n} from \"./GeometryProvider.js\";\n\n/** PhysX articulation tuning API (Isaac / Omniverse). */\nconst PHYSX_ARTICULATION_API = \"PhysxArticulationAPI\";\n\nexport type ExportRobotOptions = {\n /** Supplies each link's meshes; omit for a kinematics-only layer. */\n geometry?: RobotGeometryProvider;\n /** Root prim name; defaults to the (sanitized) robot name. */\n robotName?: string;\n /**\n * Author `physxArticulation:enabledSelfCollisions` on the articulation root\n * (M16). `false` is the common Isaac stabilizer for adjacent-link contact.\n */\n enabledSelfCollisions?: boolean;\n /**\n * Apply the Isaac Sim Robot Schema (M16): `IsaacRobotAPI` on the root with\n * ordered `isaac:physics:robotLinks` / `robotJoints` relationships,\n * `IsaacLinkAPI` per link, and `IsaacJointAPI` (+ DOF order) per joint.\n */\n isaacRobotSchema?: boolean;\n /** Receives non-fatal export diagnostics. */\n onWarn?: (message: string) => void;\n};\n\nconst JOINT_SCHEMA_BY_TYPE: Record<JointType, string> = {\n fixed: \"PhysicsFixedJoint\",\n revolute: \"PhysicsRevoluteJoint\",\n continuous: \"PhysicsRevoluteJoint\",\n prismatic: \"PhysicsPrismaticJoint\",\n};\n\n/** Serialize a robot IR into a single-layer USDA AST (pass to `serializeUsda`). */\nexport function exportRobotUsda(\n desc: RobotDescription,\n options: ExportRobotOptions = {},\n): UsdaFile {\n const warn = (m: string) => options.onWarn?.(m);\n const tree = buildKinematicTree(desc, { onWarn: warn });\n\n const robotName = sanitizeName(options.robotName ?? desc.name ?? \"robot\");\n\n // One flat sibling namespace under the root prim for links and joints.\n const alloc = nameAllocator(warn);\n const linkNames = new Map<string, string>();\n for (const key of Object.keys(desc.links)) linkNames.set(key, alloc(key, `link \"${key}\"`));\n const jointNames = new Map<string, string>();\n for (const key of Object.keys(desc.joints)) jointNames.set(key, alloc(key, `joint \"${key}\"`));\n const linkPath = (key: string) => `/${robotName}/${linkNames.get(key)}`;\n\n // Zero-pose world placement per link, folded root-down along the tree.\n // Links no joint chain reaches (floating root / isolated) keep their\n // authored stage placement when the IR carries one.\n const authoredWorld = (key: string) => desc.links[key]?.worldTransform ?? identity4();\n const worldByLink = new Map<string, Mat4>();\n for (const key of tree.order) {\n const node = tree.nodes[key]!;\n if (node.parent === null || node.jointToParent === null) {\n const rootJoint = tree.rootJoint ? desc.joints[tree.rootJoint] : undefined;\n worldByLink.set(\n key,\n rootJoint\n ? multiply(rootJoint.jointFrame0, invert(rootJoint.jointFrame1))\n : authoredWorld(key),\n );\n continue;\n }\n const joint = desc.joints[node.jointToParent]!;\n const parentWorld = worldByLink.get(node.parent) ?? identity4();\n worldByLink.set(\n key,\n multiply(multiply(parentWorld, joint.jointFrame0), invert(joint.jointFrame1)),\n );\n }\n for (const key of tree.isolatedLinks) worldByLink.set(key, authoredWorld(key));\n\n // Articulation root: preserve link-level APIs from the IR; otherwise apply it\n // on the container prim (never both — nested articulation roots are invalid).\n const articulationLinks = new Set(desc.articulationRoots ?? []);\n\n // Gather meshes once, then dedupe their (physics) materials by name.\n const meshesByLink = new Map<string, ExportMesh[]>();\n const materials = new Map<string, ExportMaterial>();\n const physicsMaterials = new Map<string, ExportPhysicsMaterial>();\n for (const [key, link] of Object.entries(desc.links)) {\n const meshes = options.geometry?.(key, link) ?? [];\n meshesByLink.set(key, meshes);\n for (const mesh of meshes) {\n if (mesh.material && !materials.has(mesh.material.name)) {\n materials.set(mesh.material.name, mesh.material);\n }\n if (mesh.physicsMaterial && !physicsMaterials.has(mesh.physicsMaterial.name)) {\n physicsMaterials.set(mesh.physicsMaterial.name, mesh.physicsMaterial);\n }\n }\n }\n const looksName = materials.size > 0 ? alloc(\"Looks\") : undefined;\n const materialAlloc = nameAllocator();\n const materialNames = new Map<string, string>();\n for (const name of materials.keys()) materialNames.set(name, materialAlloc(name));\n const materialPath = (name: string) =>\n looksName ? `/${robotName}/${looksName}/${materialNames.get(name)}` : undefined;\n\n const physicsScopeName = physicsMaterials.size > 0 ? alloc(\"PhysicsMaterials\") : undefined;\n const physicsMaterialAlloc = nameAllocator();\n const physicsMaterialNames = new Map<string, string>();\n for (const name of physicsMaterials.keys()) {\n physicsMaterialNames.set(name, physicsMaterialAlloc(name));\n }\n const physicsMaterialPath = (name: string) =>\n physicsScopeName\n ? `/${robotName}/${physicsScopeName}/${physicsMaterialNames.get(name)}`\n : undefined;\n\n const isaac = options.isaacRobotSchema === true;\n const children: PrimSpec[] = [];\n for (const [key, link] of Object.entries(desc.links)) {\n const apiSchemas = [RIGID_BODY_API];\n if (articulationLinks.has(key)) apiSchemas.push(ARTICULATION_ROOT_API);\n if (link.inertial) apiSchemas.push(MASS_API);\n if (isaac) apiSchemas.push(\"IsaacLinkAPI\");\n const selfCollision = articulationLinks.has(key) ? options.enabledSelfCollisions : undefined;\n if (selfCollision !== undefined) apiSchemas.push(PHYSX_ARTICULATION_API);\n children.push(\n buildLinkPrim({\n name: linkNames.get(key)!,\n world: worldByLink.get(key) ?? identity4(),\n apiSchemas,\n meshes: meshesByLink.get(key) ?? [],\n materialPath,\n physicsMaterialPath,\n warn,\n ...(link.inertial ? { inertial: link.inertial } : {}),\n ...(selfCollision !== undefined ? { selfCollision } : {}),\n }),\n );\n }\n const emittedJoints = new Set<string>();\n for (const [key, joint] of Object.entries(desc.joints)) {\n if (!desc.links[joint.child] || (joint.parent !== \"\" && !desc.links[joint.parent])) {\n warn(`joint \"${key}\" references an unknown link; skipped`);\n continue;\n }\n emittedJoints.add(key);\n children.push(buildJointPrim(jointNames.get(key)!, key, joint, linkPath, isaac, warn));\n }\n if (looksName) {\n children.push(buildLooksPrim(looksName, materials, materialNames, materialPath));\n }\n if (physicsScopeName) {\n children.push(\n buildPhysicsMaterialsPrim(physicsScopeName, physicsMaterials, physicsMaterialNames),\n );\n }\n\n const rootApiSchemas: string[] = [];\n const rootProperties: PropertySpec[] = [];\n if (articulationLinks.size === 0) {\n rootApiSchemas.push(ARTICULATION_ROOT_API);\n if (options.enabledSelfCollisions !== undefined) {\n rootApiSchemas.push(PHYSX_ARTICULATION_API);\n rootProperties.push(\n attr(\"physxArticulation:enabledSelfCollisions\", \"bool\", options.enabledSelfCollisions),\n );\n }\n }\n if (isaac) {\n rootApiSchemas.push(\"IsaacRobotAPI\");\n const orderedLinks = [...tree.order, ...tree.isolatedLinks];\n const orderedJoints: string[] = [];\n const pushJoint = (key: string | null | undefined) => {\n if (key && emittedJoints.has(key) && !orderedJoints.includes(key)) orderedJoints.push(key);\n };\n pushJoint(tree.rootJoint);\n for (const linkKey of tree.order) pushJoint(tree.nodes[linkKey]?.jointToParent);\n for (const jointKey of tree.loopJoints) pushJoint(jointKey);\n for (const jointKey of Object.keys(desc.joints)) pushJoint(jointKey);\n\n rootProperties.push(rel(\"isaac:physics:robotLinks\", orderedLinks.map(linkPath)));\n rootProperties.push(\n rel(\n \"isaac:physics:robotJoints\",\n orderedJoints.map((key) => `/${robotName}/${jointNames.get(key)}`),\n ),\n );\n }\n\n const root: PrimSpec = {\n specifier: \"def\",\n typeName: \"Xform\",\n name: robotName,\n metadata: rootApiSchemas.length > 0 ? { apiSchemas: rootApiSchemas } : {},\n properties: rootProperties,\n children,\n line: 0,\n };\n\n const metadata: MetadataMap = {\n defaultPrim: robotName,\n metersPerUnit: desc.metersPerUnit,\n upAxis: desc.upAxis,\n ...(desc.timeCodesPerSecond !== undefined\n ? { timeCodesPerSecond: desc.timeCodesPerSecond }\n : {}),\n ...(desc.startTimeCode !== undefined ? { startTimeCode: desc.startTimeCode } : {}),\n ...(desc.endTimeCode !== undefined ? { endTimeCode: desc.endTimeCode } : {}),\n };\n\n return { version: \"1.0\", metadata, prims: [root] };\n}\n\n// ---------------------------------------------------------------------------\n// Links & meshes\n// ---------------------------------------------------------------------------\n\ntype LinkPrimArgs = {\n name: string;\n world: Mat4;\n apiSchemas: string[];\n meshes: ExportMesh[];\n inertial?: LinkInertialDescription;\n /** `physxArticulation:enabledSelfCollisions` for link-level articulation roots. */\n selfCollision?: boolean;\n materialPath: (name: string) => string | undefined;\n physicsMaterialPath: (name: string) => string | undefined;\n warn: (message: string) => void;\n};\n\nfunction buildLinkPrim(args: LinkPrimArgs): PrimSpec {\n const meshAlloc = nameAllocator();\n const properties: PropertySpec[] = transformProps(args.world);\n if (args.inertial) properties.push(...massProps(args.inertial, args.name, args.warn));\n if (args.selfCollision !== undefined) {\n properties.push(attr(\"physxArticulation:enabledSelfCollisions\", \"bool\", args.selfCollision));\n }\n return {\n specifier: \"def\",\n typeName: \"Xform\",\n name: args.name,\n metadata: { apiSchemas: args.apiSchemas },\n properties,\n children: args.meshes.map((mesh) =>\n buildMeshPrim(mesh, meshAlloc(mesh.name), args.materialPath, args.physicsMaterialPath),\n ),\n line: 0,\n };\n}\n\n/**\n * `UsdPhysicsMassAPI` attributes for a link's mass properties. UsdPhysics\n * requires `diagonalInertia` and `principalAxes` to be authored together, so a\n * missing principal-axes frame is completed with the identity quaternion\n * (equivalent — the diagonal is then in the body frame) and axes without a\n * diagonal are dropped (meaningless alone).\n */\nfunction massProps(\n inertial: LinkInertialDescription,\n linkName: string,\n warn: (message: string) => void,\n): PropertySpec[] {\n const out: PropertySpec[] = [];\n if (inertial.mass !== undefined) out.push(attr(\"physics:mass\", \"float\", inertial.mass));\n if (inertial.density !== undefined) out.push(attr(\"physics:density\", \"float\", inertial.density));\n if (inertial.centerOfMass) {\n out.push(attr(\"physics:centerOfMass\", \"point3f\", inertial.centerOfMass));\n }\n if (inertial.diagonalInertia) {\n out.push(attr(\"physics:diagonalInertia\", \"float3\", inertial.diagonalInertia));\n out.push(attr(\"physics:principalAxes\", \"quatf\", inertial.principalAxes ?? Quat.identity()));\n } else if (inertial.principalAxes) {\n warn(`link \"${linkName}\": principalAxes without diagonalInertia is meaningless; dropped`);\n }\n return out;\n}\n\nfunction buildMeshPrim(\n mesh: ExportMesh,\n name: string,\n materialPath: (name: string) => string | undefined,\n physicsMaterialPath: (name: string) => string | undefined,\n): PrimSpec {\n const properties: PropertySpec[] = [];\n if (mesh.transform) properties.push(...transformProps(mesh.transform));\n properties.push(\n arrayAttr(\"faceVertexCounts\", \"int\", mesh.faceVertexCounts),\n arrayAttr(\"faceVertexIndices\", \"int\", mesh.faceVertexIndices),\n arrayAttr(\"points\", \"point3f\", mesh.points),\n );\n if (mesh.normals) properties.push(arrayAttr(\"normals\", \"normal3f\", mesh.normals));\n if (mesh.st) {\n properties.push(arrayAttr(\"primvars:st\", \"texCoord2f\", mesh.st, { interpolation: \"vertex\" }));\n }\n if (mesh.displayColor) {\n properties.push(arrayAttr(\"primvars:displayColor\", \"color3f\", [mesh.displayColor]));\n }\n if (mesh.doubleSided) properties.push(attr(\"doubleSided\", \"bool\", true));\n properties.push(uniformToken(\"subdivisionScheme\", \"none\"));\n\n const apiSchemas: string[] = [];\n if (mesh.kind === \"collision\") {\n apiSchemas.push(COLLISION_API);\n // `guide` keeps collision shapes out of the render pass (usdview, Isaac Sim,\n // and this package's own loader) while PhysX still collides with them.\n properties.push(uniformToken(\"purpose\", \"guide\"));\n if (mesh.collisionApproximation) {\n apiSchemas.push(MESH_COLLISION_API);\n properties.push(uniformToken(\"physics:approximation\", mesh.collisionApproximation));\n }\n }\n const binding = mesh.material ? materialPath(mesh.material.name) : undefined;\n if (binding) properties.push(rel(\"material:binding\", [binding]));\n const physicsBinding =\n mesh.kind === \"collision\" && mesh.physicsMaterial\n ? physicsMaterialPath(mesh.physicsMaterial.name)\n : undefined;\n if (physicsBinding) properties.push(rel(\"material:binding:physics\", [physicsBinding]));\n if (binding || physicsBinding) apiSchemas.push(\"MaterialBindingAPI\");\n\n return {\n specifier: \"def\",\n typeName: \"Mesh\",\n name,\n metadata: apiSchemas.length > 0 ? { apiSchemas } : {},\n properties,\n children: [],\n line: 0,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Physics materials\n// ---------------------------------------------------------------------------\n\n/** `Scope` holding one `PhysicsMaterialAPI` material per unique name. */\nfunction buildPhysicsMaterialsPrim(\n scopeName: string,\n materials: Map<string, ExportPhysicsMaterial>,\n names: Map<string, string>,\n): PrimSpec {\n const children: PrimSpec[] = [];\n for (const [key, material] of materials) {\n children.push(buildPhysicsMaterialPrim(names.get(key)!, material));\n }\n return {\n specifier: \"def\",\n typeName: \"Scope\",\n name: scopeName,\n metadata: {},\n properties: [],\n children,\n line: 0,\n };\n}\n\nfunction buildPhysicsMaterialPrim(name: string, material: ExportPhysicsMaterial): PrimSpec {\n const properties: PropertySpec[] = [];\n if (material.staticFriction !== undefined) {\n properties.push(attr(\"physics:staticFriction\", \"float\", material.staticFriction));\n }\n if (material.dynamicFriction !== undefined) {\n properties.push(attr(\"physics:dynamicFriction\", \"float\", material.dynamicFriction));\n }\n if (material.restitution !== undefined) {\n properties.push(attr(\"physics:restitution\", \"float\", material.restitution));\n }\n if (material.density !== undefined) {\n properties.push(attr(\"physics:density\", \"float\", material.density));\n }\n return {\n specifier: \"def\",\n typeName: \"Material\",\n name,\n metadata: { apiSchemas: [PHYSICS_MATERIAL_API] },\n properties,\n children: [],\n line: 0,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Materials\n// ---------------------------------------------------------------------------\n\n/** `Scope` holding one `Material` + `UsdPreviewSurface` shader per material. */\nfunction buildLooksPrim(\n looksName: string,\n materials: Map<string, ExportMaterial>,\n materialNames: Map<string, string>,\n materialPath: (name: string) => string | undefined,\n): PrimSpec {\n const children: PrimSpec[] = [];\n for (const [key, material] of materials) {\n children.push(buildMaterialPrim(materialNames.get(key)!, material, materialPath(key)!));\n }\n return {\n specifier: \"def\",\n typeName: \"Scope\",\n name: looksName,\n metadata: {},\n properties: [],\n children,\n line: 0,\n };\n}\n\n/** How each texture channel wires into `UsdPreviewSurface`. */\nconst TEXTURE_WIRING: Record<\n TextureChannel,\n { input: string; inputType: string; output: string; outputType: string; colorSpace: string }\n> = {\n color: {\n input: \"inputs:diffuseColor\",\n inputType: \"color3f\",\n output: \"outputs:rgb\",\n outputType: \"float3\",\n colorSpace: \"sRGB\",\n },\n emissive: {\n input: \"inputs:emissiveColor\",\n inputType: \"color3f\",\n output: \"outputs:rgb\",\n outputType: \"float3\",\n colorSpace: \"sRGB\",\n },\n normal: {\n input: \"inputs:normal\",\n inputType: \"normal3f\",\n output: \"outputs:rgb\",\n outputType: \"float3\",\n colorSpace: \"raw\",\n },\n opacity: {\n input: \"inputs:opacity\",\n inputType: \"float\",\n output: \"outputs:a\",\n outputType: \"float\",\n colorSpace: \"raw\",\n },\n roughness: {\n input: \"inputs:roughness\",\n inputType: \"float\",\n output: \"outputs:r\",\n outputType: \"float\",\n colorSpace: \"raw\",\n },\n metalness: {\n input: \"inputs:metallic\",\n inputType: \"float\",\n output: \"outputs:r\",\n outputType: \"float\",\n colorSpace: \"raw\",\n },\n occlusion: {\n input: \"inputs:occlusion\",\n inputType: \"float\",\n output: \"outputs:r\",\n outputType: \"float\",\n colorSpace: \"raw\",\n },\n};\n\nfunction buildMaterialPrim(name: string, material: ExportMaterial, selfPath: string): PrimSpec {\n const textures = material.textures ?? {};\n const shaderProps: PropertySpec[] = [uniformToken(\"info:id\", \"UsdPreviewSurface\")];\n\n // A surface input: constant value, texture connection, or both (the\n // connection wins per UsdShade; the constant stays for flat consumers).\n const input = (channel: TextureChannel, value?: UsdValue) => {\n const wiring = TEXTURE_WIRING[channel];\n const texturePath = textures[channel];\n if (value === undefined && texturePath === undefined) return;\n const spec = attr(wiring.input, wiring.inputType, value);\n if (texturePath !== undefined) {\n spec.connections = [`${selfPath}/${channel}Texture.${wiring.output}`];\n }\n shaderProps.push(spec);\n };\n input(\"color\", material.diffuseColor);\n input(\"metalness\", material.metallic);\n input(\"roughness\", material.roughness);\n input(\"opacity\", material.opacity);\n input(\"emissive\", material.emissiveColor);\n input(\"normal\");\n input(\"occlusion\");\n shaderProps.push(attr(\"outputs:surface\", \"token\", undefined));\n\n const children: PrimSpec[] = [shaderPrim(\"PreviewSurface\", shaderProps)];\n const textureEntries = Object.entries(textures) as [TextureChannel, string][];\n if (textureEntries.length > 0) {\n children.push(\n shaderPrim(\"stReader\", [\n uniformToken(\"info:id\", \"UsdPrimvarReader_float2\"),\n attr(\"inputs:varname\", \"string\", \"st\"),\n attr(\"outputs:result\", \"float2\", undefined),\n ]),\n );\n for (const [channel, path] of textureEntries) {\n children.push(buildUvTexturePrim(channel, path, selfPath));\n }\n }\n\n const surfaceConnect = attr(\"outputs:surface\", \"token\", undefined);\n surfaceConnect.connections = [`${selfPath}/PreviewSurface.outputs:surface`];\n\n return {\n specifier: \"def\",\n typeName: \"Material\",\n name,\n metadata: {},\n properties: [surfaceConnect],\n children,\n line: 0,\n };\n}\n\n/** `UsdUVTexture` node for one channel, fed by the material's `stReader`. */\nfunction buildUvTexturePrim(channel: TextureChannel, path: string, selfPath: string): PrimSpec {\n const wiring = TEXTURE_WIRING[channel];\n const st = attr(\"inputs:st\", \"float2\", undefined);\n st.connections = [`${selfPath}/stReader.outputs:result`];\n return shaderPrim(`${channel}Texture`, [\n uniformToken(\"info:id\", \"UsdUVTexture\"),\n attr(\"inputs:file\", \"asset\", new AssetPath(path)),\n uniformToken(\"inputs:sourceColorSpace\", wiring.colorSpace),\n st,\n attr(wiring.output, wiring.outputType, undefined),\n ]);\n}\n\nfunction shaderPrim(name: string, properties: PropertySpec[]): PrimSpec {\n return {\n specifier: \"def\",\n typeName: \"Shader\",\n name,\n metadata: {},\n properties,\n children: [],\n line: 0,\n };\n}\n\n/** `xformOp:transform` + `xformOpOrder` for an explicit matrix placement. */\nfunction transformProps(m: Mat4): PropertySpec[] {\n return [\n attr(\"xformOp:transform\", \"matrix4d\", toUsdMatrix(m)),\n arrayAttr(\"xformOpOrder\", \"token\", [\"xformOp:transform\"], undefined, \"uniform\"),\n ];\n}\n\n// ---------------------------------------------------------------------------\n// Joints\n// ---------------------------------------------------------------------------\n\nfunction buildJointPrim(\n name: string,\n key: string,\n joint: JointDescription,\n linkPath: (key: string) => string,\n isaac: boolean,\n warn: (m: string) => void,\n): PrimSpec {\n const kind = driveKindFor(joint.type);\n const angular = kind === \"angular\";\n const properties: PropertySpec[] = [];\n const apiSchemas: string[] = [];\n\n if (joint.parent !== \"\") properties.push(rel(\"physics:body0\", [linkPath(joint.parent)]));\n properties.push(rel(\"physics:body1\", [linkPath(joint.child)]));\n if (joint.type !== \"fixed\") properties.push(uniformToken(\"physics:axis\", joint.axis));\n if (joint.lower !== undefined) {\n properties.push(attr(\"physics:lowerLimit\", \"float\", jointValueFromSI(angular, joint.lower)));\n }\n if (joint.upper !== undefined) {\n properties.push(attr(\"physics:upperLimit\", \"float\", jointValueFromSI(angular, joint.upper)));\n }\n\n for (const index of [0, 1] as const) {\n const frame = index === 0 ? joint.jointFrame0 : joint.jointFrame1;\n const { position, orientation, rigid } = decomposeRigid(frame);\n if (!rigid) {\n warn(`joint \"${key}\": jointFrame${index} is not rigid; scale/shear was discarded`);\n }\n properties.push(attr(`physics:localPos${index}`, \"point3f\", position));\n properties.push(attr(`physics:localRot${index}`, \"quatf\", orientation));\n }\n\n // Joint state: the initial value and/or the sampled trajectory (SI → authored).\n if (joint.initialValue !== undefined || joint.valueSamples) {\n const state = attr(\n `state:${kind}:physics:position`,\n \"float\",\n joint.initialValue !== undefined ? jointValueFromSI(angular, joint.initialValue) : undefined,\n );\n if (joint.valueSamples) {\n state.timeSamples = new Map(\n joint.valueSamples.times.map((t, i) => [\n t,\n jointValueFromSI(angular, joint.valueSamples!.values[i] ?? 0),\n ]),\n );\n }\n properties.push(state);\n apiSchemas.push(`PhysicsJointStateAPI:${kind}`);\n }\n\n if (joint.drive) {\n const d = joint.drive;\n if (d.targetPosition !== undefined) {\n properties.push(\n attr(\n `drive:${kind}:physics:targetPosition`,\n \"float\",\n jointValueFromSI(angular, d.targetPosition),\n ),\n );\n }\n if (d.stiffness !== undefined) {\n properties.push(attr(`drive:${kind}:physics:stiffness`, \"float\", d.stiffness));\n }\n if (d.damping !== undefined) {\n properties.push(attr(`drive:${kind}:physics:damping`, \"float\", d.damping));\n }\n if (d.maxForce !== undefined) {\n properties.push(attr(`drive:${kind}:physics:maxForce`, \"float\", d.maxForce));\n }\n apiSchemas.push(`PhysicsDriveAPI:${kind}`);\n }\n\n if (isaac) {\n apiSchemas.push(\"IsaacJointAPI\");\n if (joint.type !== \"fixed\") {\n const prefix = joint.type === \"prismatic\" ? \"Trans\" : \"Rot\";\n properties.push(\n arrayAttr(\"isaac:physics:DofOffsetOpOrder\", \"token\", [`${prefix}${joint.axis}`]),\n );\n }\n }\n\n return {\n specifier: \"def\",\n typeName: JOINT_SCHEMA_BY_TYPE[joint.type],\n name,\n metadata: apiSchemas.length > 0 ? { apiSchemas } : {},\n properties,\n children: [],\n line: 0,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Naming & spec helpers\n// ---------------------------------------------------------------------------\n\n/** Make a valid USD identifier out of an arbitrary key (`/a/b c` → `_a_b_c`). */\nfunction sanitizeName(raw: string): string {\n const cleaned = raw.replace(/[^A-Za-z0-9_]/g, \"_\");\n const named = cleaned.length > 0 ? cleaned : \"_\";\n return /^[0-9]/.test(named) ? `_${named}` : named;\n}\n\n/** Allocates unique sanitized sibling names, warning when a name changes. */\nfunction nameAllocator(warn?: (m: string) => void): (raw: string, label?: string) => string {\n const used = new Set<string>();\n return (raw, label) => {\n let name = sanitizeName(raw);\n for (let i = 2; used.has(name); i++) name = `${sanitizeName(raw)}_${i}`;\n used.add(name);\n if (name !== raw && label && warn) warn(`${label} exported as prim \"${name}\"`);\n return name;\n };\n}\n\nfunction attr(\n name: string,\n typeName: string,\n value: UsdValue | undefined,\n metadata: MetadataMap = {},\n): AttributeSpec {\n return {\n kind: \"attribute\",\n name,\n typeName,\n isArray: false,\n variability: \"varying\",\n custom: false,\n ...(value !== undefined ? { value } : {}),\n metadata,\n line: 0,\n };\n}\n\nfunction arrayAttr(\n name: string,\n typeName: string,\n value: UsdValue[],\n metadata: MetadataMap = {},\n variability: \"varying\" | \"uniform\" = \"varying\",\n): AttributeSpec {\n return {\n kind: \"attribute\",\n name,\n typeName,\n isArray: true,\n variability,\n custom: false,\n value,\n metadata,\n line: 0,\n };\n}\n\nfunction uniformToken(name: string, value: string): AttributeSpec {\n return {\n kind: \"attribute\",\n name,\n typeName: \"token\",\n isArray: false,\n variability: \"uniform\",\n custom: false,\n value,\n metadata: {},\n line: 0,\n };\n}\n\nfunction rel(name: string, targets: string[]): RelationshipSpec {\n return {\n kind: \"relationship\",\n name,\n custom: false,\n listOp: \"explicit\",\n targets,\n metadata: {},\n line: 0,\n };\n}\n","/**\n * Geometry access for the robot exporter (M13).\n *\n * `exportRobotUsda` is geometry-agnostic: a {@link RobotGeometryProvider}\n * supplies each link's meshes as plain data. {@link stageGeometryProvider}\n * reads them back off a loaded {@link Stage} for round-trip export; the\n * Three.js authoring side (M14) supplies one backed by `BufferGeometry`.\n */\n\nimport { type Mat4, identity4, multiply } from \"../kinematics/transforms.js\";\nimport type { Vec2, Vec3 } from \"../parser/ast.js\";\nimport type { LinkDescription } from \"../robot/RobotDescription.js\";\nimport { getMaterialSubsets } from \"../schemas/usdGeom.js\";\nimport { resolveBoundMaterial } from \"../three/MaterialBinding.js\";\nimport type { Prim } from \"../usd/Prim.js\";\nimport type { Stage } from \"../usd/Stage.js\";\nimport { computeLocalTransform } from \"../usd/xformOps.js\";\n\n/** Texture channels a `UsdPreviewSurface` network can reference (M15). */\nexport type TextureChannel =\n | \"color\"\n | \"opacity\"\n | \"normal\"\n | \"roughness\"\n | \"metalness\"\n | \"occlusion\"\n | \"emissive\";\n\n/**\n * PBR parameters for a mesh, written as a `UsdPreviewSurface` material (M14).\n * `textures` holds per-channel image **asset paths** (M15) — emitted as a\n * `UsdUVTexture` + `UsdPrimvarReader_float2` network; sampler details\n * (wrap/scale/bias/transform) are not carried. Bundle the image bytes\n * themselves with `writeUsdz` under the same paths.\n */\nexport type ExportMaterial = {\n /** Material identity: meshes sharing a name share one Material prim. */\n name: string;\n diffuseColor?: Vec3;\n metallic?: number;\n roughness?: number;\n /** Sub-unit opacity renders as a translucent blend. */\n opacity?: number;\n emissiveColor?: Vec3;\n /** Per-channel texture asset paths. */\n textures?: Partial<Record<TextureChannel, string>>;\n};\n\n/** `UsdPhysicsMaterialAPI` parameters, bound via `material:binding:physics` (M16). */\nexport type ExportPhysicsMaterial = {\n /** Identity: meshes sharing a name share one physics-material prim. */\n name: string;\n staticFriction?: number;\n dynamicFriction?: number;\n restitution?: number;\n density?: number;\n};\n\n/** `physics:approximation` tokens of `UsdPhysicsMeshCollisionAPI`. */\nexport type CollisionApproximation =\n | \"none\"\n | \"convexHull\"\n | \"convexDecomposition\"\n | \"boundingSphere\"\n | \"boundingCube\"\n | \"meshSimplification\";\n\n/** One mesh of a link, as plain exportable data (stage units, link-relative). */\nexport type ExportMesh = {\n /** Prim-name hint; the exporter sanitizes and uniquifies it. */\n name: string;\n kind: \"visual\" | \"collision\";\n points: Vec3[];\n /** Authored polygon topology (not re-triangulated). */\n faceVertexCounts: number[];\n faceVertexIndices: number[];\n /** Per-vertex normals (only written when one per point). */\n normals?: Vec3[];\n /** `primvars:st` UVs, vertex interpolation (one per point). */\n st?: Vec2[];\n displayColor?: Vec3;\n doubleSided?: boolean;\n /** Transform relative to the link frame (column-major); identity when omitted. */\n transform?: Mat4;\n /** Bound material constants, if any. */\n material?: ExportMaterial;\n /** Collision approximation token (collision meshes only, M16). */\n collisionApproximation?: CollisionApproximation;\n /** Bound physics material (collision meshes only, M16). */\n physicsMaterial?: ExportPhysicsMaterial;\n};\n\n/** Supplies the meshes of a link for export. */\nexport type RobotGeometryProvider = (linkKey: string, link: LinkDescription) => ExportMesh[];\n\n/** Provider that reads each link's visual/collision Mesh prims from a stage. */\nexport function stageGeometryProvider(stage: Stage): RobotGeometryProvider {\n return (_linkKey, link) => {\n const linkPrim = stage.GetPrimAtPath(link.primPath);\n if (!linkPrim) return [];\n\n // Meshes that are both visual and collision export once, as visual.\n const visualSet = new Set(link.visualPrims);\n const out: ExportMesh[] = [];\n for (const path of link.visualPrims) {\n out.push(...readMeshes(stage, linkPrim, path, \"visual\"));\n }\n for (const path of link.collisionPrims ?? []) {\n if (visualSet.has(path)) continue;\n out.push(...readMeshes(stage, linkPrim, path, \"collision\"));\n }\n return out;\n };\n}\n\n/**\n * Read a Mesh prim as exportable data. A mesh painted by `materialBind` face\n * subsets becomes one {@link ExportMesh} per subset (points re-indexed to the\n * faces each one covers), so the export keeps its materials instead of\n * collapsing to a single colour.\n */\nfunction readMeshes(\n stage: Stage,\n linkPrim: Prim,\n meshPath: string,\n kind: \"visual\" | \"collision\",\n): ExportMesh[] {\n const prim = stage.GetPrimAtPath(meshPath);\n if (!prim) return [];\n\n const points = prim.GetAttribute(\"points\").Get();\n if (!isVec3Array(points) || points.length === 0) return [];\n\n const countsValue = prim.GetAttribute(\"faceVertexCounts\").Get();\n const indicesValue = prim.GetAttribute(\"faceVertexIndices\").Get();\n const counts = isNumberArray(countsValue) ? countsValue : [];\n const indices = isNumberArray(indicesValue) ? indicesValue : [];\n const normalsValue = prim.GetAttribute(\"normals\").Get();\n const stValue = prim.GetAttribute(\"primvars:st\").Get();\n const displayColor = prim.GetAttribute(\"primvars:displayColor\").Get();\n const normals =\n isVec3Array(normalsValue) && normalsValue.length === points.length ? normalsValue : undefined;\n const st = isVec2Array(stValue) && stValue.length === points.length ? stValue : undefined;\n\n // Attributes shared by every piece of this mesh.\n const transform = relativeTransform(linkPrim, prim);\n const common = {\n kind,\n ...(isVec3Array(displayColor) && displayColor[0] ? { displayColor: displayColor[0] } : {}),\n ...(prim.GetAttribute(\"doubleSided\").Get() === true ? { doubleSided: true } : {}),\n ...(isIdentity(transform) ? {} : { transform }),\n } satisfies Partial<ExportMesh>;\n\n const withPhysics = (mesh: ExportMesh): ExportMesh => {\n if (kind !== \"collision\") return mesh;\n const approximation = prim.GetAttribute(\"physics:approximation\").Get();\n if (typeof approximation === \"string\" && APPROXIMATIONS.has(approximation)) {\n mesh.collisionApproximation = approximation as CollisionApproximation;\n }\n const physicsMaterial = readBoundPhysicsMaterial(stage, prim);\n if (physicsMaterial) mesh.physicsMaterial = physicsMaterial;\n return mesh;\n };\n\n const subsets = getMaterialSubsets(prim);\n if (subsets.length === 0) {\n const material = readBoundMaterial(stage, prim);\n return [\n withPhysics({\n ...common,\n name: prim.GetName(),\n points: points.slice(),\n faceVertexCounts: counts.slice(),\n faceVertexIndices: indices.slice(),\n ...(normals ? { normals: normals.slice() } : {}),\n ...(st ? { st: st.slice() } : {}),\n ...(material ? { material } : {}),\n }),\n ];\n }\n\n const faceStart: number[] = [];\n let offset = 0;\n for (const count of counts) {\n faceStart.push(offset);\n offset += count;\n }\n\n /** Re-index the given faces onto their own point list. */\n const piece = (faces: number[], name: string, material?: ExportMaterial): ExportMesh | null => {\n const remap = new Map<number, number>();\n const outPoints: Vec3[] = [];\n const outNormals: Vec3[] = [];\n const outSt: Vec2[] = [];\n const outCounts: number[] = [];\n const outIndices: number[] = [];\n\n for (const face of faces) {\n const start = faceStart[face];\n const count = counts[face];\n if (start === undefined || count === undefined) continue;\n outCounts.push(count);\n for (let k = 0; k < count; k++) {\n const vertex = indices[start + k];\n if (vertex === undefined || !points[vertex]) continue;\n let mapped = remap.get(vertex);\n if (mapped === undefined) {\n mapped = outPoints.length;\n remap.set(vertex, mapped);\n outPoints.push(points[vertex]!);\n if (normals) outNormals.push(normals[vertex]!);\n if (st) outSt.push(st[vertex]!);\n }\n outIndices.push(mapped);\n }\n }\n if (outPoints.length === 0) return null;\n\n return withPhysics({\n ...common,\n name,\n points: outPoints,\n faceVertexCounts: outCounts,\n faceVertexIndices: outIndices,\n ...(normals ? { normals: outNormals } : {}),\n ...(st ? { st: outSt } : {}),\n ...(material ? { material } : {}),\n });\n };\n\n const out: ExportMesh[] = [];\n const claimed = new Set<number>();\n subsets.forEach((subset, index) => {\n const faces = subset.faces.filter((f) => f >= 0 && f < counts.length && !claimed.has(f));\n for (const f of faces) claimed.add(f);\n const material = readBoundMaterial(stage, subset.prim);\n const mesh = piece(faces, `${prim.GetName()}_${material?.name ?? index}`, material);\n if (mesh) out.push(mesh);\n });\n\n const leftover = counts.map((_, f) => f).filter((f) => !claimed.has(f));\n if (leftover.length > 0) {\n const material = readBoundMaterial(stage, prim);\n const mesh = piece(leftover, prim.GetName(), material);\n if (mesh) out.push(mesh);\n }\n return out;\n}\n\nconst APPROXIMATIONS: ReadonlySet<string> = new Set([\n \"none\",\n \"convexHull\",\n \"convexDecomposition\",\n \"boundingSphere\",\n \"boundingCube\",\n \"meshSimplification\",\n]);\n\n/** `UsdPhysicsMaterialAPI` parameters bound via `material:binding:physics`. */\nfunction readBoundPhysicsMaterial(stage: Stage, prim: Prim): ExportPhysicsMaterial | undefined {\n const target = firstBindingTarget(prim, \"material:binding:physics\");\n if (!target) return undefined;\n const materialPrim = stage.GetPrimAtPath(target);\n if (!materialPrim) return undefined;\n\n const out: ExportPhysicsMaterial = {\n name: target.split(\"/\").filter(Boolean).pop() ?? \"PhysicsMaterial\",\n };\n const read = (attr: string): number | undefined => {\n const v = materialPrim.GetAttribute(attr).Get();\n return typeof v === \"number\" ? v : undefined;\n };\n const staticFriction = read(\"physics:staticFriction\");\n if (staticFriction !== undefined) out.staticFriction = staticFriction;\n const dynamicFriction = read(\"physics:dynamicFriction\");\n if (dynamicFriction !== undefined) out.dynamicFriction = dynamicFriction;\n const restitution = read(\"physics:restitution\");\n if (restitution !== undefined) out.restitution = restitution;\n const density = read(\"physics:density\");\n if (density !== undefined) out.density = density;\n return Object.keys(out).length > 1 ? out : undefined;\n}\n\n/** First target of `relName` on the prim or an ancestor. */\nfunction firstBindingTarget(prim: Prim, relName: string): string | undefined {\n let p: Prim | null = prim;\n while (p) {\n const targets = p.GetRelationship(relName).GetTargets();\n if (targets.length > 0) return targets[0];\n p = p.GetParent();\n }\n return undefined;\n}\n\n/** PBR constants + texture asset paths of the bound material. */\nfunction readBoundMaterial(stage: Stage, prim: Prim): ExportMaterial | undefined {\n const bound = resolveBoundMaterial(stage, prim);\n if (!bound) return undefined;\n const material: ExportMaterial = { name: boundMaterialName(prim) ?? \"Material\" };\n if (bound.color) material.diffuseColor = bound.color;\n if (bound.metalness !== undefined) material.metallic = bound.metalness;\n if (bound.roughness !== undefined) material.roughness = bound.roughness;\n if (bound.opacity !== undefined) material.opacity = bound.opacity;\n if (bound.emissiveColor) material.emissiveColor = bound.emissiveColor;\n\n const textures: Partial<Record<TextureChannel, string>> = {};\n if (bound.colorTexture) textures.color = bound.colorTexture.path;\n if (bound.opacityTexture) textures.opacity = bound.opacityTexture.path;\n if (bound.normalTexture) textures.normal = bound.normalTexture.path;\n if (bound.roughnessTexture) textures.roughness = bound.roughnessTexture.path;\n if (bound.metalnessTexture) textures.metalness = bound.metalnessTexture.path;\n if (bound.occlusionTexture) textures.occlusion = bound.occlusionTexture.path;\n if (bound.emissiveTexture) textures.emissive = bound.emissiveTexture.path;\n if (Object.keys(textures).length > 0) material.textures = textures;\n\n return Object.keys(material).length > 1 ? material : undefined;\n}\n\n/** Leaf name of the first `material:binding` target on the prim or an ancestor. */\nfunction boundMaterialName(prim: Prim): string | undefined {\n let p: Prim | null = prim;\n while (p) {\n const targets = p.GetRelationship(\"material:binding\").GetTargets();\n if (targets.length > 0) return targets[0]!.split(\"/\").filter(Boolean).pop();\n p = p.GetParent();\n }\n return undefined;\n}\n\n/** Accumulated local transform from `linkPrim` (exclusive) down to `meshPrim` (inclusive). */\nfunction relativeTransform(linkPrim: Prim, meshPrim: Prim): Mat4 {\n const chain: Prim[] = [];\n let p: Prim | null = meshPrim;\n const stop = linkPrim.GetPath();\n while (p && p.GetPath() !== stop) {\n chain.push(p);\n p = p.GetParent();\n }\n chain.reverse();\n\n let m = identity4();\n for (const prim of chain) {\n m = multiply(m, computeLocalTransform(prim).matrix);\n }\n return m;\n}\n\nfunction isIdentity(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\nfunction isNumberArray(v: unknown): v is number[] {\n return Array.isArray(v) && v.every((n) => typeof n === \"number\");\n}\n\nfunction isVec3Array(v: unknown): v is Vec3[] {\n return Array.isArray(v) && v.every((e) => Array.isArray(e) && e.length === 3);\n}\n\nfunction isVec2Array(v: unknown): v is Vec2[] {\n return Array.isArray(v) && v.every((e) => Array.isArray(e) && e.length === 2);\n}\n","/**\n * USDZ package writer (M15) — the write-direction counterpart of `openUsdz`.\n *\n * A `.usdz` is a **stored** (uncompressed) zip whose entries' file data must\n * start on 64-byte boundaries; alignment is achieved with padding placed in a\n * local-header extra field (the fflate-sanctioned trick, as used by Three.js's\n * USDZExporter). The first entry is the package's root USD layer — `openUsdz`\n * and other USDZ readers open that one.\n */\n\nimport { type Zippable, strToU8, zipSync } from \"fflate\";\n\nconst USD_ENTRY = /\\.(usda|usdc|usd)$/i;\n/** Private extra-field id used purely as alignment padding. */\nconst PAD_EXTRA_ID = 12345;\n/** Bytes of a zip local file header before the name/extra fields. */\nconst LOCAL_HEADER_SIZE = 30;\n/** An extra field costs 4 header bytes (id + size) plus its data. */\nconst EXTRA_HEADER_SIZE = 4;\n\n/**\n * Pack entries into USDZ bytes. `entries` maps archive paths to file contents\n * (strings are UTF-8 encoded — pass the `serializeUsda` output directly). One\n * entry must be a USD layer (`.usda`/`.usdc`/`.usd`); the first such entry\n * becomes the package root and is moved to the front of the archive.\n */\nexport function writeUsdz(entries: Record<string, Uint8Array | string>): Uint8Array {\n const names = Object.keys(entries);\n const root = names.find((n) => USD_ENTRY.test(n));\n if (!root) {\n throw new Error(\"writeUsdz: entries must include a root USD layer (.usda/.usdc/.usd)\");\n }\n const ordered = [root, ...names.filter((n) => n !== root)];\n\n const files: Zippable = {};\n let offset = 0;\n for (const name of ordered) {\n const raw = entries[name]!;\n const data = typeof raw === \"string\" ? strToU8(raw) : raw;\n const nameLength = strToU8(name).length;\n\n // Where this entry's data would start without an extra field.\n const dataStart = offset + LOCAL_HEADER_SIZE + nameLength;\n if ((dataStart & 63) === 0) {\n files[name] = data;\n offset = dataStart + data.length;\n } else {\n // Pad so the data starts on the next 64-byte boundary past the 4-byte\n // extra-field header.\n const padLength = (64 - ((dataStart + EXTRA_HEADER_SIZE) & 63)) & 63;\n files[name] = [data, { extra: { [PAD_EXTRA_ID]: new Uint8Array(padLength) } }];\n offset = dataStart + EXTRA_HEADER_SIZE + padLength + data.length;\n }\n }\n\n return zipSync(files, { level: 0 });\n}\n","/**\n * Simulation-readiness checks for a {@link RobotDescription} (M16).\n *\n * Validates what Isaac Sim's Asset Validator cares about that is visible from\n * the IR (plus, optionally, the export geometry): graph connectivity, limit\n * sanity, mass properties, and collision setup. `error` issues break\n * simulation; `warning` issues are quality gaps a physics engine tolerates\n * but misbehaves on.\n */\n\nimport type { RobotGeometryProvider } from \"../export/GeometryProvider.js\";\nimport { decomposeRigid } from \"../kinematics/transforms.js\";\nimport type { RobotDescription } from \"./RobotDescription.js\";\nimport { buildKinematicTree } from \"./buildKinematicTree.js\";\n\nexport type ValidationSeverity = \"error\" | \"warning\";\n\nexport type ValidationIssue = {\n severity: ValidationSeverity;\n /** Stable machine-readable code (e.g. `unknown-link`, `no-collision`). */\n code: string;\n message: string;\n /** Link or joint key the issue refers to, when applicable. */\n subject?: string;\n};\n\nexport type ValidateRobotOptions = {\n /** Enables mesh-level checks (collision presence / approximation). */\n geometry?: RobotGeometryProvider;\n};\n\n/** Check a robot IR for simulation-readiness; returns errors first. */\nexport function validateRobotDescription(\n desc: RobotDescription,\n options: ValidateRobotOptions = {},\n): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const add = (severity: ValidationSeverity, code: string, message: string, subject?: string) =>\n issues.push({ severity, code, message, ...(subject !== undefined ? { subject } : {}) });\n\n if (Object.keys(desc.links).length === 0) {\n add(\"error\", \"no-links\", \"robot has no links\");\n }\n\n for (const [key, joint] of Object.entries(desc.joints)) {\n if (joint.parent !== \"\" && !desc.links[joint.parent]) {\n add(\n \"error\",\n \"unknown-link\",\n `joint \"${key}\" references unknown parent \"${joint.parent}\"`,\n key,\n );\n }\n if (!desc.links[joint.child]) {\n add(\"error\", \"unknown-link\", `joint \"${key}\" references unknown child \"${joint.child}\"`, key);\n }\n if (joint.lower !== undefined && joint.upper !== undefined && joint.lower > joint.upper) {\n add(\n \"error\",\n \"invalid-limits\",\n `joint \"${key}\" lower limit ${joint.lower} exceeds upper ${joint.upper}`,\n key,\n );\n }\n if (\n joint.initialValue !== undefined &&\n ((joint.lower !== undefined && joint.initialValue < joint.lower) ||\n (joint.upper !== undefined && joint.initialValue > joint.upper))\n ) {\n add(\n \"warning\",\n \"initial-out-of-limits\",\n `joint \"${key}\" initial value ${joint.initialValue} is outside its limits`,\n key,\n );\n }\n const frames = [\n [\"jointFrame0\", joint.jointFrame0],\n [\"jointFrame1\", joint.jointFrame1],\n ] as const;\n for (const [label, frame] of frames) {\n if (!decomposeRigid(frame).rigid) {\n add(\n \"warning\",\n \"non-rigid-frame\",\n `joint \"${key}\" ${label} carries scale/shear/reflection (discarded on export)`,\n key,\n );\n }\n }\n }\n\n const tree = buildKinematicTree(desc);\n for (const jointKey of tree.loopJoints) {\n add(\n \"warning\",\n \"closed-loop\",\n `joint \"${jointKey}\" closes a kinematic loop (dropped from the spanning tree)`,\n jointKey,\n );\n }\n for (const linkKey of tree.isolatedLinks) {\n add(\n \"warning\",\n \"isolated-link\",\n `link \"${linkKey}\" is unreachable from root \"${tree.root}\"`,\n linkKey,\n );\n }\n if ((desc.articulationRoots ?? []).length === 0 && !tree.rootJoint) {\n add(\n \"warning\",\n \"no-articulation-root\",\n \"no ArticulationRootAPI link and no world-fixed joint — the base will float\",\n );\n }\n\n for (const [key, link] of Object.entries(desc.links)) {\n const inertial = link.inertial;\n if (!inertial || (inertial.mass === undefined && inertial.density === undefined)) {\n add(\"warning\", \"no-inertial\", `link \"${key}\" has no mass or density (PhysicsMassAPI)`, key);\n }\n if (inertial?.mass !== undefined && inertial.mass <= 0) {\n add(\"error\", \"bad-mass\", `link \"${key}\" has non-positive mass ${inertial.mass}`, key);\n }\n if (inertial?.diagonalInertia?.some((v) => v < 0)) {\n add(\"error\", \"bad-inertia\", `link \"${key}\" has a negative diagonal-inertia component`, key);\n }\n if (inertial?.principalAxes && !inertial.diagonalInertia) {\n add(\n \"warning\",\n \"inertia-pairing\",\n `link \"${key}\" authors principalAxes without diagonalInertia (dropped on export)`,\n key,\n );\n }\n\n if (options.geometry) {\n const meshes = options.geometry(key, link);\n const collisions = meshes.filter((mesh) => mesh.kind === \"collision\");\n if (collisions.length === 0) {\n add(\"warning\", \"no-collision\", `link \"${key}\" has no collision geometry`, key);\n }\n for (const mesh of collisions) {\n if (!mesh.collisionApproximation) {\n add(\n \"warning\",\n \"collision-approximation\",\n `link \"${key}\" collision mesh \"${mesh.name}\" has no physics:approximation (PhysX dynamic bodies need a convex or primitive approximation)`,\n key,\n );\n }\n }\n }\n }\n\n return issues.sort((a, b) => (a.severity === b.severity ? 0 : a.severity === \"error\" ? -1 : 1));\n}\n"]}
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UsdaFile, i as MetadataMap, q as UsdValue, P as PrimSpec, l as RelationshipSpec, m as SdfPath, f as AttributeSpec, r as Variability, n as Specifier, b as Vec3, V as Vec2, M as Mat4, L as LinkDescription, R as RobotDescription, J as JointType, A as Axis, d as LinkInertialDescription } from './buildKinematicTree-
|
|
2
|
-
export { e as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, c as JointDriveDescription, g as KinematicNode, K as KinematicTree, h as ListOp, j as PropertySpec, Q as Quat, k as RAD2DEG, S as SampleChannel, T as TreeEdge, o as UsdDictionary, p as UsdMatrix, 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-
|
|
1
|
+
import { U as UsdaFile, i as MetadataMap, q as UsdValue, P as PrimSpec, l as RelationshipSpec, m as SdfPath, f as AttributeSpec, r as Variability, n as Specifier, b as Vec3, V as Vec2, M as Mat4, L as LinkDescription, R as RobotDescription, J as JointType, A as Axis, d as LinkInertialDescription } from './buildKinematicTree-Ccd2DIKH.js';
|
|
2
|
+
export { e as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, c as JointDriveDescription, g as KinematicNode, K as KinematicTree, h as ListOp, j as PropertySpec, Q as Quat, k as RAD2DEG, S as SampleChannel, T as TreeEdge, o as UsdDictionary, p as UsdMatrix, 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-Ccd2DIKH.js';
|
|
3
3
|
import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
|
|
4
4
|
export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './AssetResolver-CpIJNgWZ.js';
|
|
5
5
|
|
|
@@ -393,10 +393,16 @@ type ComposeOptions = {
|
|
|
393
393
|
/** Guard against pathological recursion (default 64). */
|
|
394
394
|
maxDepth?: number;
|
|
395
395
|
};
|
|
396
|
+
/**
|
|
397
|
+
* Composed external layers, keyed by resolved URL, shared across one
|
|
398
|
+
* composition run. Real assets reference the same mesh layer from dozens of
|
|
399
|
+
* prims; without this each one would refetch and recompose it.
|
|
400
|
+
*/
|
|
401
|
+
type LayerCache = Map<string, Promise<UsdaFile | null>>;
|
|
396
402
|
/** Parse USDA text and fully compose it. */
|
|
397
|
-
declare function composeLayer(text: string, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string
|
|
403
|
+
declare function composeLayer(text: string, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>, cache?: LayerCache): Promise<UsdaFile>;
|
|
398
404
|
/** Compose an already-parsed layer (used by the binary-crate path too). */
|
|
399
|
-
declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string
|
|
405
|
+
declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>, cache?: LayerCache): Promise<UsdaFile>;
|
|
400
406
|
|
|
401
407
|
/**
|
|
402
408
|
* Resolves a prim's `xformOpOrder` into a single local transform matrix.
|
|
@@ -521,6 +527,12 @@ declare class CrateReader {
|
|
|
521
527
|
private readFloat32s;
|
|
522
528
|
private readFloat64s;
|
|
523
529
|
private readVec3fArray;
|
|
530
|
+
/**
|
|
531
|
+
* Read an `SdfVariantSelectionMap`: `[u64 count]` then `count` pairs of
|
|
532
|
+
* string indexes (`variantSetName → variantName`). Surfaces as a dictionary
|
|
533
|
+
* so it maps straight onto the USDA `variants = { ... }` metadatum.
|
|
534
|
+
*/
|
|
535
|
+
private readVariantSelectionMap;
|
|
524
536
|
/** Read a `[u64 count][count × uint32|int32 index]` vector → resolved strings. */
|
|
525
537
|
private readIndexVector;
|
|
526
538
|
/** Read an SdfListOp; returns the effective (explicit ∪ prepended ∪ added ∪ appended) items. */
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
2
|
-
export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, decomposeRigid, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toUsdMatrix, tokenize } from './chunk-
|
|
1
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-O7XP5FQ4.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, decomposeRigid, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toUsdMatrix, tokenize } from './chunk-4GPCBXUS.js';
|
|
3
3
|
//# sourceMappingURL=core.js.map
|
|
4
4
|
//# sourceMappingURL=core.js.map
|
package/dist/extras.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
1
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-Ljh4PDVD.js';
|
|
2
2
|
import 'three';
|
|
3
|
-
import './buildKinematicTree-
|
|
3
|
+
import './buildKinematicTree-Ccd2DIKH.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* `three-usd-robot/extras`
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { J as JointObject, T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
3
|
-
import './buildKinematicTree-
|
|
2
|
+
import { J as JointObject, T as ThreeUsdRobot } from './ThreeUsdRobot-Ljh4PDVD.js';
|
|
3
|
+
import './buildKinematicTree-Ccd2DIKH.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* An arrow drawn along a joint's motion axis (the rotation axis for
|
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
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';
|
|
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-
|
|
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-Ccd2DIKH.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-Ccd2DIKH.js';
|
|
6
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-Ljh4PDVD.js';
|
|
7
|
+
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions } from './ThreeUsdRobot-Ljh4PDVD.js';
|
|
8
8
|
import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
|
|
9
9
|
export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './AssetResolver-CpIJNgWZ.js';
|
|
10
|
-
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-
|
|
10
|
+
export { a as ThreeUsdRobotLoader, T as ThreeUsdRobotLoaderOptions } from './ThreeUsdRobotLoader-BSIVFA48.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;
|
|
@@ -49,6 +49,8 @@ type ResolvedTexture = {
|
|
|
49
49
|
bias?: [number, number, number, number];
|
|
50
50
|
};
|
|
51
51
|
type ResolvedMaterial = {
|
|
52
|
+
/** Name of the bound `Material` prim, for round-tripping and debugging. */
|
|
53
|
+
name?: string;
|
|
52
54
|
color?: Vec3;
|
|
53
55
|
opacity?: number;
|
|
54
56
|
metalness?: number;
|
|
@@ -129,7 +131,14 @@ type BindMeshesOptions = {
|
|
|
129
131
|
/** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
|
|
130
132
|
textureProvider?: TextureProvider;
|
|
131
133
|
};
|
|
132
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points.
|
|
136
|
+
*
|
|
137
|
+
* When the mesh carries `materialBind` face subsets, the triangles are ordered
|
|
138
|
+
* subset by subset and a geometry group is added for each — so the mesh can be
|
|
139
|
+
* drawn with one material per subset (see {@link buildMeshMaterials}). Group
|
|
140
|
+
* order matches {@link getMaterialSubsets}, with any unassigned faces last.
|
|
141
|
+
*/
|
|
133
142
|
declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
134
143
|
/**
|
|
135
144
|
* Build a material for a Mesh prim. Color priority: bound `UsdShade` material
|
|
@@ -139,7 +148,9 @@ declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
|
139
148
|
* (linear data) and emissive `emissiveMap`. Metalness / roughness / opacity /
|
|
140
149
|
* emissive constants come from the bound material when present.
|
|
141
150
|
*/
|
|
142
|
-
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider
|
|
151
|
+
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider,
|
|
152
|
+
/** Resolve the material binding from here instead (a `GeomSubset`). */
|
|
153
|
+
bindingPrim?: Prim): THREE.Material;
|
|
143
154
|
/**
|
|
144
155
|
* Attach visual (and optionally collision) meshes to every link of a built
|
|
145
156
|
* {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
|
|
@@ -255,6 +266,14 @@ type GeometryToExportMeshOptions = {
|
|
|
255
266
|
transform?: Mat4;
|
|
256
267
|
material?: ExportMaterial;
|
|
257
268
|
doubleSided?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Export only this slice of the index buffer — a `BufferGeometry` group, as
|
|
271
|
+
* used by multi-material meshes. Vertices are re-indexed onto the slice.
|
|
272
|
+
*/
|
|
273
|
+
group?: {
|
|
274
|
+
start: number;
|
|
275
|
+
count: number;
|
|
276
|
+
};
|
|
258
277
|
};
|
|
259
278
|
/**
|
|
260
279
|
* Convert a triangle `BufferGeometry` into exportable mesh data. Non-indexed
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,49 @@
|
|
|
1
|
-
import { stageGeometryProvider, exportRobotUsda } from './chunk-
|
|
2
|
-
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-
|
|
3
|
-
export { JointObject, LinkObject, ThreeUsdRobot, ThreeUsdRobotLoader, axisVector, bindRobotMeshes, bindSceneMeshes, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-
|
|
4
|
-
import { identity4, refineJointType, multiply, invert, buildKinematicTree } from './chunk-
|
|
5
|
-
export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, decomposeRigid, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toUsdMatrix, tokenize } from './chunk-
|
|
1
|
+
import { stageGeometryProvider, exportRobotUsda } from './chunk-O7XP5FQ4.js';
|
|
2
|
+
export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-O7XP5FQ4.js';
|
|
3
|
+
export { JointObject, LinkObject, ThreeUsdRobot, ThreeUsdRobotLoader, axisVector, bindRobotMeshes, bindSceneMeshes, buildMeshGeometry, buildMeshMaterial, createTextureProvider } from './chunk-FL554IS5.js';
|
|
4
|
+
import { identity4, refineJointType, multiply, invert, buildKinematicTree } from './chunk-4GPCBXUS.js';
|
|
5
|
+
export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, decomposeRigid, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toUsdMatrix, tokenize } from './chunk-4GPCBXUS.js';
|
|
6
6
|
import * as THREE from 'three';
|
|
7
7
|
|
|
8
8
|
function geometryToExportMesh(geometry, options) {
|
|
9
9
|
const position = geometry.getAttribute("position");
|
|
10
10
|
if (!position || position.count === 0) return null;
|
|
11
|
-
const points = [];
|
|
12
|
-
for (let i = 0; i < position.count; i++) {
|
|
13
|
-
points.push([position.getX(i), position.getY(i), position.getZ(i)]);
|
|
14
|
-
}
|
|
15
11
|
const index = geometry.getIndex();
|
|
16
|
-
|
|
17
|
-
const
|
|
12
|
+
const all = index ? Array.from(index.array) : Array.from({ length: position.count }, (_, i) => i);
|
|
13
|
+
const slice = options.group ? all.slice(options.group.start, options.group.start + options.group.count) : all;
|
|
14
|
+
const triangles = Math.floor(slice.length / 3);
|
|
18
15
|
if (triangles === 0) return null;
|
|
19
|
-
|
|
16
|
+
const normal = geometry.getAttribute("normal");
|
|
17
|
+
const uv = geometry.getAttribute("uv");
|
|
18
|
+
const hasNormals = !!normal && normal.count === position.count;
|
|
19
|
+
const hasUv = !!uv && uv.count === position.count;
|
|
20
|
+
const points = [];
|
|
21
|
+
const normals = [];
|
|
22
|
+
const st = [];
|
|
23
|
+
let faceVertexIndices;
|
|
24
|
+
if (options.group) {
|
|
25
|
+
const remap = /* @__PURE__ */ new Map();
|
|
26
|
+
faceVertexIndices = [];
|
|
27
|
+
for (const vertex of slice.slice(0, triangles * 3)) {
|
|
28
|
+
let mapped = remap.get(vertex);
|
|
29
|
+
if (mapped === void 0) {
|
|
30
|
+
mapped = points.length;
|
|
31
|
+
remap.set(vertex, mapped);
|
|
32
|
+
points.push([position.getX(vertex), position.getY(vertex), position.getZ(vertex)]);
|
|
33
|
+
if (hasNormals)
|
|
34
|
+
normals.push([normal.getX(vertex), normal.getY(vertex), normal.getZ(vertex)]);
|
|
35
|
+
if (hasUv) st.push([uv.getX(vertex), uv.getY(vertex)]);
|
|
36
|
+
}
|
|
37
|
+
faceVertexIndices.push(mapped);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
for (let i = 0; i < position.count; i++) {
|
|
41
|
+
points.push([position.getX(i), position.getY(i), position.getZ(i)]);
|
|
42
|
+
if (hasNormals) normals.push([normal.getX(i), normal.getY(i), normal.getZ(i)]);
|
|
43
|
+
if (hasUv) st.push([uv.getX(i), uv.getY(i)]);
|
|
44
|
+
}
|
|
45
|
+
faceVertexIndices = slice.slice(0, triangles * 3);
|
|
46
|
+
}
|
|
20
47
|
const mesh = {
|
|
21
48
|
name: options.name,
|
|
22
49
|
kind: options.kind ?? "visual",
|
|
@@ -24,20 +51,8 @@ function geometryToExportMesh(geometry, options) {
|
|
|
24
51
|
faceVertexCounts: new Array(triangles).fill(3),
|
|
25
52
|
faceVertexIndices
|
|
26
53
|
};
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
const normals = [];
|
|
30
|
-
for (let i = 0; i < normal.count; i++) {
|
|
31
|
-
normals.push([normal.getX(i), normal.getY(i), normal.getZ(i)]);
|
|
32
|
-
}
|
|
33
|
-
mesh.normals = normals;
|
|
34
|
-
}
|
|
35
|
-
const uv = geometry.getAttribute("uv");
|
|
36
|
-
if (uv && uv.count === position.count) {
|
|
37
|
-
const st = [];
|
|
38
|
-
for (let i = 0; i < uv.count; i++) st.push([uv.getX(i), uv.getY(i)]);
|
|
39
|
-
mesh.st = st;
|
|
40
|
-
}
|
|
54
|
+
if (hasNormals) mesh.normals = normals;
|
|
55
|
+
if (hasUv) mesh.st = st;
|
|
41
56
|
if (options.transform && !isIdentityMat4(options.transform)) mesh.transform = options.transform;
|
|
42
57
|
if (options.material) mesh.material = options.material;
|
|
43
58
|
if (options.doubleSided) mesh.doubleSided = true;
|
|
@@ -83,15 +98,33 @@ function threeGeometryProvider(robot, onWarn) {
|
|
|
83
98
|
for (const childObj of linkObj.children) {
|
|
84
99
|
const meshObj = childObj;
|
|
85
100
|
if (!meshObj.isMesh) continue;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
const kind = meshObj.userData.kind === "collision" ? "collision" : "visual";
|
|
102
|
+
const transform = [...meshObj.matrix.elements];
|
|
103
|
+
const baseName = meshObj.name || "mesh";
|
|
104
|
+
const materials = Array.isArray(meshObj.material) ? meshObj.material : [meshObj.material];
|
|
105
|
+
const groups = meshObj.geometry.groups;
|
|
106
|
+
if (materials.length > 1 && groups.length > 0) {
|
|
107
|
+
for (const [i, group] of groups.entries()) {
|
|
108
|
+
const material2 = materials[group.materialIndex ?? 0];
|
|
109
|
+
const exportMaterial2 = material2 ? convertMaterial(material2) : void 0;
|
|
110
|
+
const mesh2 = geometryToExportMesh(meshObj.geometry, {
|
|
111
|
+
name: `${baseName}_${material2?.name || i}`,
|
|
112
|
+
kind,
|
|
113
|
+
transform,
|
|
114
|
+
group: { start: group.start, count: group.count },
|
|
115
|
+
...exportMaterial2 ? { material: exportMaterial2 } : {},
|
|
116
|
+
doubleSided: material2?.side === THREE.DoubleSide
|
|
117
|
+
});
|
|
118
|
+
if (mesh2) out.push(mesh2);
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
89
121
|
}
|
|
122
|
+
const material = materials[0];
|
|
90
123
|
const exportMaterial = material ? convertMaterial(material) : void 0;
|
|
91
124
|
const mesh = geometryToExportMesh(meshObj.geometry, {
|
|
92
|
-
name:
|
|
93
|
-
kind
|
|
94
|
-
transform
|
|
125
|
+
name: baseName,
|
|
126
|
+
kind,
|
|
127
|
+
transform,
|
|
95
128
|
...exportMaterial ? { material: exportMaterial } : {},
|
|
96
129
|
doubleSided: material?.side === THREE.DoubleSide
|
|
97
130
|
});
|