three-usd-robot 0.3.0 → 0.5.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 +55 -9
- package/dist/AssetResolver-CpIJNgWZ.d.ts +29 -0
- package/dist/{ThreeUsdRobot-C6uqpNZA.d.ts → ThreeUsdRobot-D9AOUaVh.d.ts} +15 -1
- package/dist/ThreeUsdRobotLoader-BgsnuJWd.d.ts +61 -0
- package/dist/{buildKinematicTree-BJuC_-5_.d.ts → buildKinematicTree-3oKG00Sc.d.ts} +27 -1
- package/dist/{chunk-XH3L7XDJ.js → chunk-36T6YOEX.js} +2677 -2523
- package/dist/chunk-36T6YOEX.js.map +1 -0
- package/dist/chunk-OFUMT72H.js +7 -0
- package/dist/chunk-OFUMT72H.js.map +1 -0
- package/dist/chunk-Y3NXBSX3.js +841 -0
- package/dist/chunk-Y3NXBSX3.js.map +1 -0
- package/dist/core.d.ts +24 -31
- package/dist/core.js +2 -1
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.d.ts +118 -80
- package/dist/index.js +3 -575
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +72 -0
- package/dist/react.js +92 -0
- package/dist/react.js.map +1 -0
- package/package.json +22 -1
- package/dist/chunk-XH3L7XDJ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/three/axis.ts","../src/three/JointObject.ts","../src/three/LinkObject.ts","../src/three/MaterialBinding.ts","../src/three/MeshBinding.ts","../src/three/TextureBinding.ts","../src/three/ThreeUsdRobot.ts","../src/three/ThreeUsdRobotLoader.ts"],"names":["THREE","THREE2","THREE3","THREE5","THREE6"],"mappings":";;;AAIO,SAAS,WAAW,IAAA,EAA2B;AACpD,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,GAAA;AACH,MAAA,OAAO,IAAUA,MAAA,CAAA,OAAA,CAAQ,CAAA,EAAG,CAAA,EAAG,CAAC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AAC;AAAA,MACpF,GAAI,IAAA,CAAK,OAAA,CAAQ,8BAAA,KAAmC,MAAA,GAChD,EAAE,gBAAA,EAAkB,IAAA,CAAK,OAAA,CAAQ,8BAAA,EAA+B,GAChE;AAAC,KACP;AAAA,EACF;AAAA,EAEQ,cAAA,GAA6E;AACnF,IAAA,OAAO;AAAA,MACL,GAAI,IAAA,CAAK,OAAA,CAAQ,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,EAAW,IAAA,CAAK,OAAA,CAAQ,SAAA,EAAU,GAAI,EAAC;AAAA,MACpF,GAAI,IAAA,CAAK,OAAA,CAAQ,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,EAAQ,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAO,GAAI;AAAC,KAC7E;AAAA,EACF;AACF","file":"chunk-Y3NXBSX3.js","sourcesContent":["import * as THREE from \"three\";\nimport type { Axis } from \"../robot/RobotDescription.js\";\n\n/** Unit vector for a USD joint axis token. Returns a fresh vector each call. */\nexport function axisVector(axis: Axis): THREE.Vector3 {\n switch (axis) {\n case \"X\":\n return new THREE.Vector3(1, 0, 0);\n case \"Y\":\n return new THREE.Vector3(0, 1, 0);\n case \"Z\":\n return new THREE.Vector3(0, 0, 1);\n }\n}\n","import * as THREE from \"three\";\nimport type { Axis, JointDescription, JointType } from \"../robot/RobotDescription.js\";\nimport { axisVector } from \"./axis.js\";\n\n/**\n * The articulated \"motion\" node of a joint, inserted between the joint's two\n * fixed frames (`jointFrame0` and `inverse(jointFrame1)`). {@link setValue}\n * rotates it about the axis (revolute/continuous) or slides it along the axis\n * (prismatic); fixed joints are inert.\n */\nexport class JointObject extends THREE.Object3D {\n readonly isJointObject = true;\n readonly jointName: string;\n readonly jointType: JointType;\n readonly axisToken: Axis;\n readonly axis: THREE.Vector3;\n readonly lower: number | undefined;\n readonly upper: number | undefined;\n\n private _value = 0;\n\n constructor(joint: JointDescription) {\n super();\n this.name = joint.name;\n this.jointName = joint.name;\n this.jointType = joint.type;\n this.axisToken = joint.axis;\n this.axis = axisVector(joint.axis);\n this.lower = joint.lower;\n this.upper = joint.upper;\n }\n\n get value(): number {\n return this._value;\n }\n\n get articulated(): boolean {\n return this.jointType !== \"fixed\";\n }\n\n /**\n * Set the joint value (radians for revolute/continuous, length for prismatic).\n * Optionally clamps to authored limits. Returns the value actually applied.\n */\n setValue(value: number, clampToLimits = true): number {\n if (!this.articulated) return this._value; // fixed joint: inert\n\n let v = value;\n if (clampToLimits) {\n if (this.lower !== undefined && v < this.lower) v = this.lower;\n if (this.upper !== undefined && v > this.upper) v = this.upper;\n }\n this._value = v;\n\n if (this.jointType === \"prismatic\") {\n this.position.copy(this.axis).multiplyScalar(v);\n this.quaternion.identity();\n } else {\n this.quaternion.setFromAxisAngle(this.axis, v);\n this.position.set(0, 0, 0);\n }\n return v;\n }\n}\n","import * as THREE from \"three\";\nimport type { LinkDescription } from \"../robot/RobotDescription.js\";\n\n/**\n * Three.js node for a robot link. Its frame is the USD link prim's frame;\n * visual/collision meshes (M6) attach as children relative to it. Placement\n * relative to the parent is supplied by the joint chain, so a link's own local\n * matrix is identity (except the root, which carries the world-fixed placement).\n */\nexport class LinkObject extends THREE.Object3D {\n readonly isLinkObject = true;\n readonly linkName: string;\n readonly primPath: string;\n\n constructor(link: LinkDescription) {\n super();\n this.name = link.name;\n this.linkName = link.name;\n this.primPath = link.primPath;\n // Placement comes from the parent joint chain; keep the local matrix fixed.\n this.matrixAutoUpdate = false;\n }\n}\n","/**\n * Resolves `UsdShade` material bindings to flat PBR parameters.\n *\n * Follows a prim's (or an ancestor's) `material:binding` to a `Material`, finds\n * its surface `Shader`, and reads constant color/metalness/roughness/opacity/\n * emissive inputs plus the **texture** asset paths for the diffuse, normal,\n * roughness, metallic, occlusion and emissive channels. Handles both\n * `UsdPreviewSurface` (constant inputs or a connected `UsdUVTexture` network)\n * and Omniverse `OmniPBR` MDL (direct asset-valued texture inputs such as\n * `inputs:normalmap_texture`).\n */\n\nimport { AssetPath, type Vec2, type Vec3 } from \"../parser/ast.js\";\nimport type { Prim } from \"../usd/Prim.js\";\nimport type { Stage } from \"../usd/Stage.js\";\n\n/** `UsdUVTexture` wrap mode for one axis (`black` ≈ clamp; three has no border). */\nexport type TextureWrap = \"repeat\" | \"clamp\" | \"mirror\" | \"black\";\n\n/** `UsdTransform2d` applied to the `st` coords feeding a texture. */\nexport type TextureTransform = {\n /** `inputs:translation` (UV offset). */\n translation?: Vec2;\n /** `inputs:rotation` in degrees (CCW about the origin). */\n rotation?: number;\n /** `inputs:scale` (UV tiling). */\n scale?: Vec2;\n};\n\n/** A resolved texture reference plus its `UsdUVTexture` sampler/transform state. */\nexport type ResolvedTexture = {\n /** Authored asset path of the image. */\n path: string;\n wrapS?: TextureWrap;\n wrapT?: TextureWrap;\n /** `UsdTransform2d` on the `st` input, if any. */\n transform?: TextureTransform;\n /** `inputs:scale` — multiplies the sampled value (folded into material factors). */\n scale?: [number, number, number, number];\n /** `inputs:bias` — added to the sampled value. */\n bias?: [number, number, number, number];\n};\n\nexport type ResolvedMaterial = {\n color?: Vec3;\n opacity?: number;\n metalness?: number;\n roughness?: number;\n emissiveColor?: Vec3;\n /**\n * `inputs:opacityThreshold`. When `> 0`, opacity is a binary mask (alpha\n * clip / cutout); when `0`/absent, sub-unit opacity blends translucently.\n */\n opacityThreshold?: number;\n /** Diffuse/albedo texture, if any. */\n colorTexture?: ResolvedTexture;\n /** Opacity / alpha texture (may be the same image as `colorTexture`). */\n opacityTexture?: ResolvedTexture;\n /** Tangent-space normal map, if any. */\n normalTexture?: ResolvedTexture;\n /** Roughness map, if any. */\n roughnessTexture?: ResolvedTexture;\n /** Metallic map, if any. */\n metalnessTexture?: ResolvedTexture;\n /** Ambient-occlusion map, if any. */\n occlusionTexture?: ResolvedTexture;\n /** Emissive map, if any. */\n emissiveTexture?: ResolvedTexture;\n};\n\nconst DIFFUSE_INPUTS = [\n \"inputs:diffuseColor\", // UsdPreviewSurface\n \"inputs:diffuse_color_constant\", // OmniPBR\n \"inputs:diffuse_tint\",\n \"inputs:base_color\",\n \"inputs:baseColor\",\n];\nconst OPACITY_INPUTS = [\"inputs:opacity\", \"inputs:opacity_constant\"];\nconst OPACITY_THRESHOLD_INPUTS = [\"inputs:opacityThreshold\", \"inputs:opacity_threshold\"];\nconst METALLIC_INPUTS = [\"inputs:metallic\", \"inputs:metallic_constant\"];\nconst ROUGHNESS_INPUTS = [\"inputs:roughness\", \"inputs:reflection_roughness_constant\"];\nconst EMISSIVE_INPUTS = [\"inputs:emissiveColor\", \"inputs:emissive_color\"];\n\nconst SURFACE_OUTPUTS = [\"outputs:surface\", \"outputs:mdl:surface\"];\n\n/**\n * Per-channel texture lookup: `surface` names are `UsdPreviewSurface` inputs\n * that connect to a `UsdUVTexture` (we follow the connection to its\n * `inputs:file`); `direct` names are OmniPBR MDL asset-valued texture inputs.\n */\ntype TextureLookup = { surface: string[]; direct: string[] };\n\nconst TEXTURE_LOOKUPS: Record<\n \"color\" | \"opacity\" | \"normal\" | \"roughness\" | \"metalness\" | \"occlusion\" | \"emissive\",\n TextureLookup\n> = {\n color: {\n surface: [\"inputs:diffuseColor\"],\n direct: [\"inputs:diffuse_texture\", \"inputs:diffuse_color_texture\"],\n },\n opacity: {\n surface: [\"inputs:opacity\"],\n direct: [\"inputs:opacity_texture\", \"inputs:opacity_color_texture\"],\n },\n normal: {\n surface: [\"inputs:normal\"],\n direct: [\"inputs:normalmap_texture\", \"inputs:normal_texture\"],\n },\n roughness: {\n surface: [\"inputs:roughness\"],\n direct: [\"inputs:reflectionroughness_texture\", \"inputs:roughness_texture\"],\n },\n metalness: {\n surface: [\"inputs:metallic\"],\n direct: [\"inputs:metallic_texture\"],\n },\n occlusion: {\n surface: [\"inputs:occlusion\"],\n direct: [\"inputs:ao_texture\", \"inputs:occlusion_texture\"],\n },\n emissive: {\n surface: [\"inputs:emissiveColor\"],\n direct: [\"inputs:emissive_color_texture\", \"inputs:emissive_mask_texture\"],\n },\n};\n\n/** Resolve the bound material's flat parameters for `prim`, or `undefined`. */\nexport function resolveBoundMaterial(stage: Stage, prim: Prim): ResolvedMaterial | undefined {\n const materialPath = findBinding(prim);\n if (!materialPath) return undefined;\n const material = stage.GetPrimAtPath(materialPath);\n if (!material) return undefined;\n const shader = findSurfaceShader(material);\n if (!shader) return undefined;\n\n const result: ResolvedMaterial = {};\n const color = firstColor(shader, DIFFUSE_INPUTS);\n if (color) result.color = color;\n const opacity = firstNumber(shader, OPACITY_INPUTS);\n if (opacity !== undefined) result.opacity = opacity;\n const opacityThreshold = firstNumber(shader, OPACITY_THRESHOLD_INPUTS);\n if (opacityThreshold !== undefined) result.opacityThreshold = opacityThreshold;\n const metalness = firstNumber(shader, METALLIC_INPUTS);\n if (metalness !== undefined) result.metalness = metalness;\n const roughness = firstNumber(shader, ROUGHNESS_INPUTS);\n if (roughness !== undefined) result.roughness = roughness;\n\n const emissive = firstColor(shader, EMISSIVE_INPUTS);\n // OmniPBR gates emission behind `inputs:enable_emission`; UsdPreviewSurface\n // has no such input (undefined ⇒ honoured).\n if (emissive && shader.GetAttribute(\"inputs:enable_emission\").Get() !== false) {\n result.emissiveColor = emissive;\n }\n\n const colorTex = findTexture(shader, TEXTURE_LOOKUPS.color);\n if (colorTex !== undefined) result.colorTexture = colorTex;\n const opacityTex = findTexture(shader, TEXTURE_LOOKUPS.opacity);\n if (opacityTex !== undefined) result.opacityTexture = opacityTex;\n const normal = findTexture(shader, TEXTURE_LOOKUPS.normal);\n if (normal !== undefined) result.normalTexture = normal;\n const roughTex = findTexture(shader, TEXTURE_LOOKUPS.roughness);\n if (roughTex !== undefined) result.roughnessTexture = roughTex;\n const metalTex = findTexture(shader, TEXTURE_LOOKUPS.metalness);\n if (metalTex !== undefined) result.metalnessTexture = metalTex;\n const aoTex = findTexture(shader, TEXTURE_LOOKUPS.occlusion);\n if (aoTex !== undefined) result.occlusionTexture = aoTex;\n const emissiveTex = findTexture(shader, TEXTURE_LOOKUPS.emissive);\n if (emissiveTex !== undefined) result.emissiveTexture = emissiveTex;\n\n return result;\n}\n\n/**\n * Resolve a channel's texture: an OmniPBR direct asset input takes precedence\n * (path only), else follow a `UsdPreviewSurface` input's connection to a\n * `UsdUVTexture` and read its `inputs:file` plus sampler/transform state.\n */\nfunction findTexture(shader: Prim, lookup: TextureLookup): ResolvedTexture | undefined {\n for (const name of lookup.direct) {\n const v = shader.GetAttribute(name).Get();\n if (v instanceof AssetPath && v.path) return { path: v.path };\n }\n for (const name of lookup.surface) {\n const conn = shader.GetAttribute(name).GetConnections()[0];\n if (!conn) continue;\n const texPrim = shader.GetStage().GetPrimAtPath(conn.split(\".\")[0]!);\n if (!texPrim) continue;\n const file = texPrim.GetAttribute(\"inputs:file\").Get();\n if (file instanceof AssetPath && file.path) return readUvTexture(texPrim, file.path);\n }\n return undefined;\n}\n\nconst WRAP_VALUES = new Set([\"repeat\", \"clamp\", \"mirror\", \"black\"]);\n\n/** Read a `UsdUVTexture` prim's wrap modes, scale/bias, and `st` transform. */\nfunction readUvTexture(texPrim: Prim, path: string): ResolvedTexture {\n const tex: ResolvedTexture = { path };\n\n const wrapS = texPrim.GetAttribute(\"inputs:wrapS\").Get();\n if (typeof wrapS === \"string\" && WRAP_VALUES.has(wrapS)) tex.wrapS = wrapS as TextureWrap;\n const wrapT = texPrim.GetAttribute(\"inputs:wrapT\").Get();\n if (typeof wrapT === \"string\" && WRAP_VALUES.has(wrapT)) tex.wrapT = wrapT as TextureWrap;\n\n const scale = numArray(texPrim, \"inputs:scale\", 4);\n if (scale) tex.scale = scale as [number, number, number, number];\n const bias = numArray(texPrim, \"inputs:bias\", 4);\n if (bias) tex.bias = bias as [number, number, number, number];\n\n const transform = readTransform2d(texPrim);\n if (transform) tex.transform = transform;\n return tex;\n}\n\n/** Follow `inputs:st` to a `UsdTransform2d` node and read its translate/rotate/scale. */\nfunction readTransform2d(texPrim: Prim): TextureTransform | undefined {\n const conn = texPrim.GetAttribute(\"inputs:st\").GetConnections()[0];\n if (!conn) return undefined;\n const node = texPrim.GetStage().GetPrimAtPath(conn.split(\".\")[0]!);\n if (!node || node.GetAttribute(\"info:id\").Get() !== \"UsdTransform2d\") return undefined;\n\n const transform: TextureTransform = {};\n const translation = numArray(node, \"inputs:translation\", 2);\n if (translation) transform.translation = translation as Vec2;\n const scale = numArray(node, \"inputs:scale\", 2);\n if (scale) transform.scale = scale as Vec2;\n const rotation = node.GetAttribute(\"inputs:rotation\").Get();\n if (typeof rotation === \"number\") transform.rotation = rotation;\n return Object.keys(transform).length > 0 ? transform : undefined;\n}\n\n/** Read a numeric attribute as a fixed-length array, or `undefined`. */\nfunction numArray(prim: Prim, name: string, length: number): number[] | undefined {\n const v = prim.GetAttribute(name).Get();\n if (Array.isArray(v) && v.length >= length && v.every((n) => typeof n === \"number\")) {\n return (v as number[]).slice(0, length);\n }\n return undefined;\n}\n\n/** Walk up from `prim` to the first ancestor with a `material:binding`. */\nfunction findBinding(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];\n p = p.GetParent();\n }\n return undefined;\n}\n\nfunction findSurfaceShader(material: Prim): Prim | undefined {\n // Prefer the shader connected to a surface output.\n for (const out of SURFACE_OUTPUTS) {\n const conn = material.GetAttribute(out).GetConnections()[0];\n if (conn) {\n const shaderPath = conn.split(\".\")[0]!;\n const shader = material.GetStage().GetPrimAtPath(shaderPath);\n if (shader) return shader;\n }\n }\n // Fallback: the first child Shader prim.\n return material.GetChildren().find((c) => c.GetTypeName() === \"Shader\") ?? undefined;\n}\n\nfunction firstColor(shader: Prim, names: string[]): Vec3 | undefined {\n for (const name of names) {\n const v = shader.GetAttribute(name).Get();\n if (Array.isArray(v) && v.length >= 3 && v.every((n) => typeof n === \"number\")) {\n return [v[0], v[1], v[2]] as Vec3;\n }\n }\n return undefined;\n}\n\nfunction firstNumber(shader: Prim, names: string[]): number | undefined {\n for (const name of names) {\n const v = shader.GetAttribute(name).Get();\n if (typeof v === \"number\") return v;\n }\n return undefined;\n}\n","/**\n * Binds `UsdGeom.Mesh` prims to Three.js geometry and attaches them under the\n * robot's link objects.\n *\n * Triangulates polygons with a simple fan, uses authored per-vertex normals\n * when present (else computes smooth normals), and reads `primvars:st` UVs and\n * `primvars:displayColor`. Geometry is left in stage units; the global\n * `metersPerUnit` scale is applied at the root in M9.\n */\n\nimport * as THREE from \"three\";\nimport { type Mat4, identity4, multiply } from \"../kinematics/transforms.js\";\nimport type { Vec2, Vec3 } from \"../parser/ast.js\";\nimport type { RobotDescription } from \"../robot/RobotDescription.js\";\nimport type { Prim } from \"../usd/Prim.js\";\nimport type { Stage } from \"../usd/Stage.js\";\nimport { computeLocalTransform } from \"../usd/xformOps.js\";\nimport { type ResolvedTexture, resolveBoundMaterial } from \"./MaterialBinding.js\";\nimport type { TextureProvider } from \"./TextureBinding.js\";\nimport type { ThreeUsdRobot } from \"./ThreeUsdRobot.js\";\n\nexport type MeshKind = \"visual\" | \"collision\";\n\nconst DEFAULT_COLOR = 0x9a9a9a;\n\nexport type BindMeshesOptions = {\n loadVisuals?: boolean;\n loadCollisions?: boolean;\n /** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */\n textureProvider?: TextureProvider;\n};\n\n/** Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points. */\nexport function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null {\n const points = meshPrim.GetAttribute(\"points\").Get();\n if (!isVec3Array(points) || points.length === 0) return null;\n\n const geometry = new THREE.BufferGeometry();\n geometry.setAttribute(\"position\", new THREE.Float32BufferAttribute(flat3(points), 3));\n\n const counts = meshPrim.GetAttribute(\"faceVertexCounts\").Get();\n const indices = meshPrim.GetAttribute(\"faceVertexIndices\").Get();\n if (isNumberArray(counts) && isNumberArray(indices)) {\n geometry.setIndex(triangulate(counts, indices));\n } else if (isNumberArray(indices)) {\n geometry.setIndex(indices.slice());\n }\n\n const normals = meshPrim.GetAttribute(\"normals\").Get();\n if (isVec3Array(normals) && normals.length === points.length) {\n geometry.setAttribute(\"normal\", new THREE.Float32BufferAttribute(flat3(normals), 3));\n } else {\n geometry.computeVertexNormals();\n }\n\n const st = meshPrim.GetAttribute(\"primvars:st\").Get();\n if (isVec2Array(st) && st.length === points.length) {\n geometry.setAttribute(\"uv\", new THREE.Float32BufferAttribute(flat2(st), 2));\n }\n\n return geometry;\n}\n\n/**\n * Build a material for a Mesh prim. Color priority: bound `UsdShade` material\n * (when `stage` is given) → `primvars:displayColor` → default gray. Textures\n * (via `textures`) become the matching `MeshStandardMaterial` maps — diffuse →\n * `map` (sRGB), plus `normalMap` / `roughnessMap` / `metalnessMap` / `aoMap`\n * (linear data) and emissive `emissiveMap`. Metalness / roughness / opacity /\n * emissive constants come from the bound material when present.\n */\nexport function buildMeshMaterial(\n meshPrim: Prim,\n stage?: Stage,\n textures?: TextureProvider,\n): THREE.Material {\n const color = new THREE.Color(DEFAULT_COLOR);\n let opacity = 1;\n\n const bound = stage ? resolveBoundMaterial(stage, meshPrim) : undefined;\n if (bound?.color) {\n color.setRGB(bound.color[0], bound.color[1], bound.color[2]);\n } else {\n const displayColor = meshPrim.GetAttribute(\"primvars:displayColor\").Get();\n if (isVec3Array(displayColor) && displayColor[0]) {\n const [r, g, b] = displayColor[0];\n color.setRGB(r, g, b);\n }\n }\n if (bound?.opacity !== undefined) opacity = bound.opacity;\n\n // Resolve a channel's `THREE.Texture`, forwarding its wrap modes and\n // `UsdTransform2d` (the `UsdUVTexture.inputs:scale`/`bias` are folded into the\n // material factors below, not the sampler).\n const tex = (rt: ResolvedTexture | undefined, cs: \"srgb\" | \"linear\") =>\n rt && textures\n ? textures(rt.path, {\n colorSpace: cs,\n ...(rt.wrapS ? { wrapS: rt.wrapS } : {}),\n ...(rt.wrapT ? { wrapT: rt.wrapT } : {}),\n ...(rt.transform ? { transform: rt.transform } : {}),\n })\n : null;\n\n const map = tex(bound?.colorTexture, \"srgb\");\n // `inputs:scale` on the diffuse texture tints the map; otherwise pass through.\n if (map) {\n const s = bound?.colorTexture?.scale;\n if (s) color.setRGB(s[0], s[1], s[2]);\n else color.setRGB(1, 1, 1);\n }\n const normalMap = tex(bound?.normalTexture, \"linear\");\n const roughnessMap = tex(bound?.roughnessTexture, \"linear\");\n const metalnessMap = tex(bound?.metalnessTexture, \"linear\");\n const aoMap = tex(bound?.occlusionTexture, \"linear\");\n const emissiveMap = tex(bound?.emissiveTexture, \"srgb\");\n\n // A scalar map's `inputs:scale[0]` (or an authored constant) becomes three's\n // factor; three multiplies factor × map, so default to 1 to pass it through.\n const metalness =\n bound?.metalness ?? bound?.metalnessTexture?.scale?.[0] ?? (metalnessMap ? 1 : 0.1);\n const roughness =\n bound?.roughness ?? bound?.roughnessTexture?.scale?.[0] ?? (roughnessMap ? 1 : 0.8);\n\n const emissive = new THREE.Color(0x000000);\n if (bound?.emissiveColor) {\n emissive.setRGB(bound.emissiveColor[0], bound.emissiveColor[1], bound.emissiveColor[2]);\n } else if (emissiveMap) {\n emissive.setRGB(1, 1, 1); // let the map drive emission\n }\n\n // Opacity sourcing: a dedicated opacity texture → `alphaMap`; an opacity input\n // wired to the *same* image as the diffuse map → that map's own alpha channel\n // (no separate map needed). `opacityThreshold > 0` means alpha clip (a binary\n // cutout rendered in the opaque pass); otherwise sub-unit alpha blends.\n const opacityTex = bound?.opacityTexture;\n const sharesColorMap = !!(opacityTex && opacityTex.path === bound?.colorTexture?.path);\n const alphaMap = sharesColorMap ? null : tex(opacityTex, \"linear\");\n const hasAlphaSource = opacity < 1 || sharesColorMap || !!alphaMap;\n const threshold = bound?.opacityThreshold;\n const alphaTest = threshold !== undefined && threshold > 0 ? threshold : 0;\n // Alpha-clip masks render opaque (depth-written, discarded below the cutoff);\n // only true translucency uses the transparent/blended pass.\n const transparent = alphaTest === 0 && hasAlphaSource;\n\n const doubleSided = meshPrim.GetAttribute(\"doubleSided\").Get() === true;\n return new THREE.MeshStandardMaterial({\n color,\n metalness,\n roughness,\n emissive,\n transparent,\n opacity,\n ...(alphaTest > 0 ? { alphaTest } : {}),\n side: doubleSided ? THREE.DoubleSide : THREE.FrontSide,\n ...(map ? { map } : {}),\n ...(alphaMap ? { alphaMap } : {}),\n ...(normalMap ? { normalMap } : {}),\n ...(roughnessMap ? { roughnessMap } : {}),\n ...(metalnessMap ? { metalnessMap } : {}),\n ...(aoMap ? { aoMap } : {}),\n ...(emissiveMap ? { emissiveMap } : {}),\n });\n}\n\n/**\n * Attach visual (and optionally collision) meshes to every link of a built\n * {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to\n * the owning link prim.\n */\nexport function bindRobotMeshes(\n stage: Stage,\n robot3d: ThreeUsdRobot,\n desc: RobotDescription,\n options: BindMeshesOptions = {},\n): void {\n const loadVisuals = options.loadVisuals ?? true;\n const loadCollisions = options.loadCollisions ?? false;\n const textures = options.textureProvider;\n\n for (const [key, link] of Object.entries(desc.links)) {\n const linkObj = robot3d.getLinkObject(key);\n const linkPrim = stage.GetPrimAtPath(link.primPath);\n if (!linkObj || !linkPrim) continue;\n\n const collisionSet = new Set(link.collisionPrims ?? []);\n\n if (loadVisuals) {\n for (const meshPath of link.visualPrims) {\n if (collisionSet.has(meshPath)) continue; // collision-only handled below\n attachMesh(stage, linkPrim, meshPath, linkObj, \"visual\", textures);\n }\n }\n if (loadCollisions) {\n for (const meshPath of link.collisionPrims ?? []) {\n attachMesh(stage, linkPrim, meshPath, linkObj, \"collision\", textures);\n }\n }\n }\n}\n\nfunction attachMesh(\n stage: Stage,\n linkPrim: Prim,\n meshPath: string,\n parent: THREE.Object3D,\n kind: MeshKind,\n textures: TextureProvider | undefined,\n): void {\n const meshPrim = stage.GetPrimAtPath(meshPath);\n if (!meshPrim) return;\n const geometry = buildMeshGeometry(meshPrim);\n if (!geometry) return;\n\n const mesh = new THREE.Mesh(geometry, buildMeshMaterial(meshPrim, stage, textures));\n mesh.name = meshPrim.GetName();\n mesh.userData.kind = kind;\n mesh.userData.primPath = meshPath;\n // Collision meshes are loaded hidden; reveal via `robot.showCollision = true`.\n if (kind === \"collision\") mesh.visible = false;\n mesh.matrixAutoUpdate = false;\n mesh.matrix.fromArray(relativeTransform(linkPrim, meshPrim));\n mesh.matrixWorldNeedsUpdate = true;\n parent.add(mesh);\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(); // top-most (just under link) → mesh\n\n let m = identity4();\n for (const prim of chain) {\n m = multiply(m, computeLocalTransform(prim).matrix);\n }\n return m;\n}\n\n// --- triangulation & typed-array helpers -----------------------------------\n\n/** Fan-triangulate USD polygon faces into a flat triangle index list. */\nfunction triangulate(faceVertexCounts: number[], faceVertexIndices: number[]): number[] {\n const tris: number[] = [];\n let offset = 0;\n for (const count of faceVertexCounts) {\n for (let k = 2; k < count; k++) {\n tris.push(\n faceVertexIndices[offset]!,\n faceVertexIndices[offset + k - 1]!,\n faceVertexIndices[offset + k]!,\n );\n }\n offset += count;\n }\n return tris;\n}\n\nfunction flat3(v: Vec3[]): number[] {\n const out = new Array<number>(v.length * 3);\n for (let i = 0; i < v.length; i++) {\n out[i * 3] = v[i]![0];\n out[i * 3 + 1] = v[i]![1];\n out[i * 3 + 2] = v[i]![2];\n }\n return out;\n}\n\nfunction flat2(v: Vec2[]): number[] {\n const out = new Array<number>(v.length * 2);\n for (let i = 0; i < v.length; i++) {\n out[i * 2] = v[i]![0];\n out[i * 2 + 1] = v[i]![1];\n }\n return out;\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 * Loads texture image assets referenced by `UsdShade` materials.\n *\n * A {@link TextureProvider} maps an authored asset path (plus sampler/transform\n * options) to a `THREE.Texture`. The default provider fetches the image **bytes**\n * through the {@link AssetResolver} and decodes them via a blob URL — so it works\n * uniformly for textures served over HTTP and for images embedded inside a\n * `.usdz` package (whose resolver serves zip entries, not real URLs). Decoded\n * images are cached per resolved URL and shared across every texture that uses\n * them; each `THREE.Texture` carries its own color space / wrap / transform.\n */\n\nimport * as THREE from \"three\";\nimport type { AssetResolver } from \"../usd/AssetResolver.js\";\nimport type { TextureTransform, TextureWrap } from \"./MaterialBinding.js\";\n\n/**\n * Color space to interpret a texture in. Color/albedo and emissive maps are\n * `\"srgb\"`; data maps (normal, roughness, metalness, occlusion) are `\"linear\"`.\n */\nexport type TextureColorSpace = \"srgb\" | \"linear\";\n\n/** Per-use sampler state applied to the returned `THREE.Texture`. */\nexport type TextureOptions = {\n /** Defaults to `\"srgb\"`. */\n colorSpace?: TextureColorSpace;\n wrapS?: TextureWrap;\n wrapT?: TextureWrap;\n transform?: TextureTransform;\n};\n\n/** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */\nexport type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;\n\nconst DEG2RAD = Math.PI / 180;\n\n/**\n * A {@link TextureProvider} backed by the {@link AssetResolver}, resolving paths\n * against `baseUrl`. Image bytes are fetched once per URL (works for HTTP and\n * `.usdz` entries alike) and the decoded image is shared; each call returns a\n * distinct `THREE.Texture` carrying the requested color space / wrap / transform.\n */\nexport function createTextureProvider(resolver: AssetResolver, baseUrl: string): TextureProvider {\n const images = new Map<string, Promise<TexImageSource>>();\n\n const imageFor = (url: string): Promise<TexImageSource> => {\n let p = images.get(url);\n if (!p) {\n p = loadImage(resolver, url);\n images.set(url, p);\n }\n return p;\n };\n\n return (assetPath: string, options: TextureOptions = {}) => {\n let url: string;\n try {\n url = resolver.resolve(assetPath, baseUrl);\n } catch {\n return null;\n }\n\n const texture = new THREE.Texture();\n texture.colorSpace =\n options.colorSpace === \"linear\" ? THREE.NoColorSpace : THREE.SRGBColorSpace;\n texture.wrapS = toThreeWrap(options.wrapS);\n texture.wrapT = toThreeWrap(options.wrapT);\n applyTransform(texture, options.transform);\n\n imageFor(url)\n .then((image) => {\n texture.image = image;\n texture.needsUpdate = true;\n })\n .catch(() => {\n /* leave the texture blank if the image can't be decoded */\n });\n return texture;\n };\n}\n\n/**\n * Fetch image bytes through the resolver and decode them via a blob URL into an\n * `HTMLImageElement` (so three's default `flipY = true` orients USD's bottom-left\n * `st` origin correctly, matching the prior `TextureLoader` HTTP path).\n */\nasync function loadImage(resolver: AssetResolver, url: string): Promise<TexImageSource> {\n const bytes = resolver.fetchBytes\n ? await resolver.fetchBytes(url)\n : new TextEncoder().encode(await resolver.fetchText(url));\n const blob = new Blob([bytes as BlobPart], { type: mimeOf(url) });\n const objectUrl = URL.createObjectURL(blob);\n try {\n return await new Promise<HTMLImageElement>((resolve, reject) => {\n const img = new Image();\n img.onload = () => resolve(img);\n img.onerror = () => reject(new Error(`failed to decode texture: ${url}`));\n img.src = objectUrl;\n });\n } finally {\n // The decoded image keeps its pixels; the blob URL can be released.\n URL.revokeObjectURL(objectUrl);\n }\n}\n\nfunction toThreeWrap(wrap: TextureWrap | undefined): THREE.Wrapping {\n switch (wrap) {\n case \"clamp\":\n case \"black\": // three has no border color; clamp is the closest mode\n return THREE.ClampToEdgeWrapping;\n case \"mirror\":\n return THREE.MirroredRepeatWrapping;\n default:\n return THREE.RepeatWrapping;\n }\n}\n\n/** Map a `UsdTransform2d` onto a texture's offset / repeat / rotation. */\nfunction applyTransform(texture: THREE.Texture, t: TextureTransform | undefined): void {\n if (!t) return;\n if (t.scale) texture.repeat.set(t.scale[0], t.scale[1]);\n if (t.translation) texture.offset.set(t.translation[0], t.translation[1]);\n if (t.rotation !== undefined) {\n texture.rotation = t.rotation * DEG2RAD;\n texture.center.set(0, 0); // UsdTransform2d rotates about the origin\n }\n}\n\nfunction mimeOf(url: string): string {\n if (/\\.jpe?g$/i.test(url)) return \"image/jpeg\";\n if (/\\.webp$/i.test(url)) return \"image/webp\";\n return \"image/png\";\n}\n","import * as THREE from \"three\";\nimport { interpolate } from \"../kinematics/sampling.js\";\nimport { type Mat4, invert, multiply } from \"../kinematics/transforms.js\";\nimport type {\n JointDescription,\n LinkDescription,\n RobotDescription,\n} from \"../robot/RobotDescription.js\";\nimport type { KinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { JointObject } from \"./JointObject.js\";\nimport { LinkObject } from \"./LinkObject.js\";\n\nexport type ThreeUsdRobotOptions = {\n /** Clamp `setJointValue` to authored limits (default `true`). */\n clampJointLimits?: boolean;\n /** Size of the built-in joint-axis / link-frame helpers (stage units, default `0.15`). */\n helperSize?: number;\n /**\n * Up-axis correction applied at the robot root. `\"auto\"` rotates Z-up assets\n * into the Three.js Y-up scene; `\"Z\"` forces it, `\"Y\"`/`\"none\"` leave the\n * orientation as authored. Default `\"none\"` (the loader defaults to `\"auto\"`).\n */\n upAxisConversion?: \"auto\" | \"Y\" | \"Z\" | \"none\";\n /** Extra uniform scale multiplied with the stage `metersPerUnit` (default `1`). */\n unitScale?: number;\n /** Seed joints from their authored initial value (drive target / joint state). Default `true`. */\n applyInitialPose?: boolean;\n};\n\n/**\n * A Three.js `Object3D` that realizes a {@link RobotDescription} as a kinematic\n * hierarchy and drives forward kinematics via {@link setJointValue}.\n *\n * Per joint the hierarchy is\n * `parentLink → jointFrame0 → jointMotion → jointFrame1⁻¹ → childLink`,\n * where only `jointMotion` (a {@link JointObject}) changes with the joint value;\n * world poses then fall out of Three.js's `updateMatrixWorld`.\n */\nexport class ThreeUsdRobot extends THREE.Object3D {\n readonly isThreeUsdRobot = true;\n readonly robot: RobotDescription;\n readonly tree: KinematicTree;\n readonly clampJointLimits: boolean;\n\n private readonly linkObjects = new Map<string, LinkObject>();\n private readonly jointObjects = new Map<string, JointObject>();\n private dirty = true;\n\n private readonly helperSize: number;\n private _showVisual = true;\n private _showCollision = false;\n private _showJointAxes = false;\n private _showLinkFrames = false;\n private jointAxesHelpers: THREE.AxesHelper[] = [];\n private linkFrameHelpers: THREE.AxesHelper[] = [];\n\n constructor(robot: RobotDescription, tree: KinematicTree, options: ThreeUsdRobotOptions = {}) {\n super();\n this.name = robot.name;\n this.robot = robot;\n this.tree = tree;\n this.clampJointLimits = options.clampJointLimits ?? true;\n this.helperSize = options.helperSize ?? 0.15;\n\n // Create a node for every link up front.\n for (const [key, link] of Object.entries(robot.links)) {\n this.linkObjects.set(key, new LinkObject(link));\n }\n\n this.attachRoot();\n this.attachTreeEdges();\n this.attachIsolatedLinks();\n this.applyStageNormalization(robot, options);\n if (options.applyInitialPose ?? true) this.applyInitialPose(robot);\n }\n\n /** Orient (Z-up → Y-up) and scale (metersPerUnit × unitScale) the robot root. */\n private applyStageNormalization(robot: RobotDescription, options: ThreeUsdRobotOptions): void {\n const scale = (robot.metersPerUnit || 1) * (options.unitScale ?? 1);\n if (scale !== 1) this.scale.setScalar(scale);\n\n const conv = options.upAxisConversion ?? \"none\";\n const toY = conv === \"Z\" || (conv === \"auto\" && robot.upAxis === \"Z\");\n if (toY) this.quaternion.setFromAxisAngle(new THREE.Vector3(1, 0, 0), -Math.PI / 2);\n }\n\n /** Apply each joint's authored initial value, if any. */\n private applyInitialPose(robot: RobotDescription): void {\n for (const [key, joint] of Object.entries(robot.joints)) {\n if (joint.initialValue === undefined) continue;\n this.jointObjects.get(key)?.setValue(joint.initialValue, this.clampJointLimits);\n }\n this.dirty = true;\n }\n\n private attachRoot(): void {\n const rootObj = this.linkObjects.get(this.tree.root);\n if (!rootObj) return; // empty robot\n const rootJointKey = this.tree.rootJoint;\n if (rootJointKey) {\n const j = this.robot.joints[rootJointKey];\n // World-fixed placement: jointFrame0 (in world) · inverse(jointFrame1).\n if (j) setMatrix(rootObj, multiply(j.jointFrame0, invert(j.jointFrame1)));\n }\n this.add(rootObj);\n }\n\n private attachTreeEdges(): void {\n for (const linkKey of this.tree.order) {\n const node = this.tree.nodes[linkKey];\n if (!node || node.parent === null || node.jointToParent === null) continue;\n\n const parentObj = this.linkObjects.get(node.parent);\n const childObj = this.linkObjects.get(linkKey);\n const joint = this.robot.joints[node.jointToParent];\n if (!parentObj || !childObj || !joint) continue;\n\n this.attachJointChain(parentObj, childObj, node.jointToParent, joint);\n }\n }\n\n /** Build `parent → frame0 → motion → frame1⁻¹ → child` for one joint. */\n private attachJointChain(\n parent: LinkObject,\n child: LinkObject,\n jointKey: string,\n joint: JointDescription,\n ): void {\n const frame0 = new THREE.Group();\n frame0.name = `${joint.name}:frame0`;\n setMatrix(frame0, joint.jointFrame0);\n\n const motion = new JointObject(joint);\n\n const frame1Inv = new THREE.Group();\n frame1Inv.name = `${joint.name}:frame1Inv`;\n setMatrix(frame1Inv, invert(joint.jointFrame1));\n\n parent.add(frame0);\n frame0.add(motion);\n motion.add(frame1Inv);\n frame1Inv.add(child);\n\n this.jointObjects.set(jointKey, motion);\n }\n\n private attachIsolatedLinks(): void {\n for (const key of this.tree.isolatedLinks) {\n const obj = this.linkObjects.get(key);\n if (obj && !obj.parent) this.add(obj);\n }\n }\n\n // -- Joint control -------------------------------------------------------\n\n /** Set one joint value. Unknown joints are ignored. Returns whether it applied. */\n setJointValue(name: string, value: number): boolean {\n const joint = this.jointObjects.get(name);\n if (!joint) return false;\n joint.setValue(value, this.clampJointLimits);\n this.dirty = true;\n return true;\n }\n\n /** Set several joint values at once (matrix update is coalesced). */\n setJointValues(values: Record<string, number>): void {\n for (const [name, value] of Object.entries(values)) {\n const joint = this.jointObjects.get(name);\n if (joint) {\n joint.setValue(value, this.clampJointLimits);\n this.dirty = true;\n }\n }\n }\n\n getJointValue(name: string): number | undefined {\n return this.jointObjects.get(name)?.value;\n }\n\n /** Recompute world matrices. Called lazily by the getters; safe to call directly. */\n updateKinematics(): void {\n this.updateMatrixWorld(true);\n this.dirty = false;\n }\n\n private ensureUpdated(): void {\n if (this.dirty) this.updateKinematics();\n }\n\n // -- Queries -------------------------------------------------------------\n\n getLinkWorldMatrix(name: string): THREE.Matrix4 {\n const obj = this.linkObjects.get(name);\n if (!obj) throw new Error(`unknown link \"${name}\"`);\n this.ensureUpdated();\n return obj.matrixWorld.clone();\n }\n\n getLinkWorldPosition(name: string): THREE.Vector3 {\n return new THREE.Vector3().setFromMatrixPosition(this.getLinkWorldMatrix(name));\n }\n\n getLinkObject(name: string): LinkObject | undefined {\n return this.linkObjects.get(name);\n }\n\n getJointObject(name: string): JointObject | undefined {\n return this.jointObjects.get(name);\n }\n\n getJoints(): JointDescription[] {\n return Object.values(this.robot.joints);\n }\n\n getLinks(): LinkDescription[] {\n return Object.values(this.robot.links);\n }\n\n /** Names of the articulated (controllable) joints. */\n getJointNames(): string[] {\n return [...this.jointObjects.keys()];\n }\n\n getLinkNames(): string[] {\n return [...this.linkObjects.keys()];\n }\n\n getKinematicTree(): KinematicTree {\n return this.tree;\n }\n\n // -- Animation playback --------------------------------------------------\n\n /** Playback rate in time codes per second (from the stage; default 24). */\n getTimeCodesPerSecond(): number {\n return this.robot.timeCodesPerSecond ?? 24;\n }\n\n /** Whether any joint has a time-sampled trajectory. */\n hasAnimation(): boolean {\n return Object.values(this.robot.joints).some((j) => j.valueSamples !== undefined);\n }\n\n /**\n * Animation range in time codes: the union of authored joint sample ranges,\n * falling back to the stage `startTimeCode`/`endTimeCode`. `null` if neither.\n */\n getTimeRange(): { start: number; end: number } | null {\n let start = Number.POSITIVE_INFINITY;\n let end = Number.NEGATIVE_INFINITY;\n for (const joint of Object.values(this.robot.joints)) {\n const times = joint.valueSamples?.times;\n if (!times || times.length === 0) continue;\n start = Math.min(start, times[0]!);\n end = Math.max(end, times[times.length - 1]!);\n }\n if (start <= end) return { start, end };\n\n const { startTimeCode, endTimeCode } = this.robot;\n if (startTimeCode !== undefined && endTimeCode !== undefined) {\n return { start: startTimeCode, end: endTimeCode };\n }\n return null;\n }\n\n /** Sample every animated joint at time code `t` and apply the values. */\n setTime(t: number): void {\n for (const [key, joint] of Object.entries(this.robot.joints)) {\n if (joint.valueSamples) this.setJointValue(key, interpolate(joint.valueSamples, t));\n }\n }\n\n // -- Display toggles -----------------------------------------------------\n\n get showVisual(): boolean {\n return this._showVisual;\n }\n set showVisual(v: boolean) {\n this._showVisual = v;\n this.setKindVisibility(\"visual\", v);\n }\n\n get showCollision(): boolean {\n return this._showCollision;\n }\n set showCollision(v: boolean) {\n this._showCollision = v;\n this.setKindVisibility(\"collision\", v);\n }\n\n get showJointAxes(): boolean {\n return this._showJointAxes;\n }\n set showJointAxes(v: boolean) {\n this._showJointAxes = v;\n if (v && this.jointAxesHelpers.length === 0) {\n for (const joint of this.jointObjects.values()) {\n const h = new THREE.AxesHelper(this.helperSize);\n h.name = `${joint.jointName}:axes`;\n joint.add(h);\n this.jointAxesHelpers.push(h);\n }\n }\n for (const h of this.jointAxesHelpers) h.visible = v;\n }\n\n get showLinkFrames(): boolean {\n return this._showLinkFrames;\n }\n set showLinkFrames(v: boolean) {\n this._showLinkFrames = v;\n if (v && this.linkFrameHelpers.length === 0) {\n for (const link of this.linkObjects.values()) {\n const h = new THREE.AxesHelper(this.helperSize);\n h.name = `${link.linkName}:frame`;\n link.add(h);\n this.linkFrameHelpers.push(h);\n }\n }\n for (const h of this.linkFrameHelpers) h.visible = v;\n }\n\n private setKindVisibility(kind: string, visible: boolean): void {\n this.traverse((o) => {\n if ((o.userData as { kind?: string }).kind === kind) o.visible = visible;\n });\n }\n}\n\n/** Assign a fixed local matrix to an object (disables Three.js auto-update). */\nfunction setMatrix(obj: THREE.Object3D, m: Mat4): void {\n obj.matrixAutoUpdate = false;\n obj.matrix.fromArray(m);\n obj.matrixWorldNeedsUpdate = true;\n}\n","import type { RobotDescription } from \"../robot/RobotDescription.js\";\nimport { extractRobotDescription } from \"../robot/RobotExtractor.js\";\nimport { buildKinematicTree } from \"../robot/buildKinematicTree.js\";\nimport { type AssetResolver, DefaultAssetResolver } from \"../usd/AssetResolver.js\";\nimport { Stage } from \"../usd/Stage.js\";\nimport { composeFile, composeLayer } from \"../usd/composition.js\";\nimport { CrateReader } from \"../usd/crate/CrateReader.js\";\nimport { crateToUsdaFile } from \"../usd/crate/toUsdaFile.js\";\nimport { openUsdz } from \"../usd/usdz.js\";\nimport { bindRobotMeshes } from \"./MeshBinding.js\";\nimport { createTextureProvider } from \"./TextureBinding.js\";\nimport { ThreeUsdRobot, type ThreeUsdRobotOptions } from \"./ThreeUsdRobot.js\";\n\nexport type ThreeUsdRobotLoaderOptions = {\n /** Resolver for references / payloads / sublayers (default {@link DefaultAssetResolver}). */\n assetResolver?: AssetResolver;\n /** Render visual meshes (M6). */\n loadVisuals?: boolean;\n /** Render collision meshes (M6). */\n loadCollisions?: boolean;\n /** Load diffuse textures referenced by materials (default `true`). */\n loadTextures?: boolean;\n /** Up-axis correction strategy (M9). */\n upAxisConversion?: \"auto\" | \"Y\" | \"Z\" | \"none\";\n /** Extra uniform scale multiplied with `metersPerUnit` (M9). */\n unitScale?: number;\n /** Clamp `setJointValue` to authored limits (default `true`). */\n clampJointLimits?: boolean;\n /** Seed joints from drive targets / joint state (M9). */\n applyDriveTargetsAsInitialPose?: boolean;\n /** Override the robot name. */\n robotName?: string;\n /** Receives non-fatal load diagnostics. */\n onWarn?: (message: string) => void;\n};\n\n/**\n * Loads Isaac Sim / OpenUSD robot assets into a controllable {@link ThreeUsdRobot}.\n *\n * Composition (references / payloads / sublayers, M8) is resolved through an\n * {@link AssetResolver}. Mesh rendering is M6; unit / up-axis / initial-pose\n * handling is M9; USDC and variants are M10.\n */\nexport class ThreeUsdRobotLoader {\n readonly options: ThreeUsdRobotLoaderOptions;\n\n constructor(options: ThreeUsdRobotLoaderOptions = {}) {\n this.options = options;\n }\n\n private get resolver(): AssetResolver {\n return this.options.assetResolver ?? new DefaultAssetResolver();\n }\n\n /**\n * Fetch an asset by URL and build the robot. `.usdz` packages are unzipped and\n * composed from their entries; everything else is sniffed for the crate magic\n * and parsed as binary USDC or USDA text.\n */\n async loadAsync(url: string): Promise<ThreeUsdRobot> {\n const bytes = await this.fetchRootBytes(url);\n if (/\\.usdz$/i.test(url)) return this.parseUsdz(bytes);\n if (CrateReader.isCrate(bytes)) return this.parseCrate(bytes, url);\n return this.parse(new TextDecoder().decode(bytes), url);\n }\n\n private async fetchRootBytes(url: string): Promise<Uint8Array> {\n const resolver = this.resolver;\n if (resolver.fetchBytes) return resolver.fetchBytes(url);\n return new TextEncoder().encode(await resolver.fetchText(url));\n }\n\n /** Build a robot (composed, with meshes) from USDA source text. */\n async parse(text: string, baseUrl = \"\"): Promise<ThreeUsdRobot> {\n return this.buildFromStage(\n await this.composeStage(text, baseUrl, this.resolver),\n baseUrl,\n this.resolver,\n );\n }\n\n /** Build a robot from the bytes of a `.usdz` package. */\n async parseUsdz(bytes: Uint8Array): Promise<ThreeUsdRobot> {\n const pkg = openUsdz(bytes);\n // The root layer of a usdz is typically binary USDC — sniff, don't assume text.\n const rootBytes = await pkg.resolver.fetchBytes(pkg.rootEntry);\n const stage = await this.composeStageFromBytes(rootBytes, pkg.rootEntry, pkg.resolver);\n return this.buildFromStage(stage, pkg.rootEntry, pkg.resolver);\n }\n\n /** Build a robot from the bytes of a binary crate (`.usdc` / binary `.usd`). */\n async parseCrate(bytes: Uint8Array, baseUrl = \"\"): Promise<ThreeUsdRobot> {\n const stage = await this.composeStageFromBytes(bytes, baseUrl, this.resolver);\n return this.buildFromStage(stage, baseUrl, this.resolver);\n }\n\n /** Parse + compose USDA source into the Three.js-independent robot IR. */\n async parseRobotDescription(text: string, baseUrl = \"\"): Promise<RobotDescription> {\n const stage = await this.composeStage(text, baseUrl, this.resolver);\n return extractRobotDescription(stage, this.extractOptions());\n }\n\n private buildFromStage(stage: Stage, baseUrl: string, resolver: AssetResolver): ThreeUsdRobot {\n const robot = extractRobotDescription(stage, this.extractOptions());\n const tree = buildKinematicTree(robot);\n const robot3d = new ThreeUsdRobot(robot, tree, this.robotOptions());\n\n const loadVisuals = this.options.loadVisuals ?? true;\n const loadCollisions = this.options.loadCollisions ?? false;\n if (loadVisuals || loadCollisions) {\n const textureProvider =\n (this.options.loadTextures ?? true) ? createTextureProvider(resolver, baseUrl) : undefined;\n bindRobotMeshes(stage, robot3d, robot, {\n loadVisuals,\n loadCollisions,\n ...(textureProvider ? { textureProvider } : {}),\n });\n }\n return robot3d;\n }\n\n private async composeStage(\n text: string,\n baseUrl: string,\n resolver: AssetResolver,\n ): Promise<Stage> {\n const composeOptions = this.options.onWarn ? { onWarn: this.options.onWarn } : {};\n return Stage.OpenFromFile(await composeLayer(text, baseUrl, resolver, composeOptions));\n }\n\n /** Compose a layer from raw bytes, sniffing binary crate vs USDA text. */\n private async composeStageFromBytes(\n bytes: Uint8Array,\n baseUrl: string,\n resolver: AssetResolver,\n ): Promise<Stage> {\n const composeOptions = this.options.onWarn ? { onWarn: this.options.onWarn } : {};\n const composed = CrateReader.isCrate(bytes)\n ? await composeFile(\n crateToUsdaFile(new CrateReader(bytes)),\n baseUrl,\n resolver,\n composeOptions,\n )\n : await composeLayer(new TextDecoder().decode(bytes), baseUrl, resolver, composeOptions);\n return Stage.OpenFromFile(composed);\n }\n\n private robotOptions(): ThreeUsdRobotOptions {\n return {\n upAxisConversion: this.options.upAxisConversion ?? \"auto\",\n ...(this.options.clampJointLimits !== undefined\n ? { clampJointLimits: this.options.clampJointLimits }\n : {}),\n ...(this.options.unitScale !== undefined ? { unitScale: this.options.unitScale } : {}),\n ...(this.options.applyDriveTargetsAsInitialPose !== undefined\n ? { applyInitialPose: this.options.applyDriveTargetsAsInitialPose }\n : {}),\n };\n }\n\n private extractOptions(): { robotName?: string; onWarn?: (message: string) => void } {\n return {\n ...(this.options.robotName !== undefined ? { robotName: this.options.robotName } : {}),\n ...(this.options.onWarn !== undefined ? { onWarn: this.options.onWarn } : {}),\n };\n }\n}\n"]}
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { p as UsdaFile, h as MetadataMap, o as UsdValue, P as PrimSpec, m as Specifier, k as RelationshipSpec, l as SdfPath, d as AttributeSpec, q as Variability, M as Mat4, R as RobotDescription, J as JointType, A as Axis } from './buildKinematicTree-3oKG00Sc.js';
|
|
2
|
+
export { c as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, e as JointDriveDescription, f as KinematicNode, K as KinematicTree, L as LinkDescription, g as ListOp, i as PropertySpec, Q as Quat, j as RAD2DEG, S as SampleChannel, T as TreeEdge, U as UsdDictionary, n as UsdMatrix, V as Vec2, b as Vec3, r as Vec4, s as buildKinematicTree, t as channelFromSamples, u as fromUsdMatrix, v as getTranslation, w as identity4, x as interpolate, y as invert, z as makeEuler, E as makeRotationFromQuat, F as makeRotationX, G as makeRotationY, H as makeRotationZ, I as makeScale, N as makeTranslation, O as multiply, W as multiplyAll } from './buildKinematicTree-3oKG00Sc.js';
|
|
3
|
+
import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
|
|
4
|
+
export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './AssetResolver-CpIJNgWZ.js';
|
|
3
5
|
|
|
4
6
|
/** Package identity. Kept in one place so every entry point can re-export it. */
|
|
5
7
|
declare const PACKAGE_NAME = "three-usd-robot";
|
|
@@ -90,6 +92,12 @@ declare class Stage {
|
|
|
90
92
|
GetUpAxis(): UpAxis;
|
|
91
93
|
/** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
|
|
92
94
|
GetMetersPerUnit(): number;
|
|
95
|
+
/** Animation start time code, if authored. */
|
|
96
|
+
GetStartTimeCode(): number | undefined;
|
|
97
|
+
/** Animation end time code, if authored. */
|
|
98
|
+
GetEndTimeCode(): number | undefined;
|
|
99
|
+
/** Time codes per second for playback; defaults to 24. */
|
|
100
|
+
GetTimeCodesPerSecond(): number;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
/**
|
|
@@ -191,31 +199,6 @@ declare class Relationship {
|
|
|
191
199
|
GetTargets(): SdfPath[];
|
|
192
200
|
}
|
|
193
201
|
|
|
194
|
-
/**
|
|
195
|
-
* Resolves USD asset paths (from references / payloads / sublayers) to URLs and
|
|
196
|
-
* fetches their text. Composition (`composition.ts`) is I/O-agnostic and goes
|
|
197
|
-
* through an {@link AssetResolver}, so the same engine works in the browser, in
|
|
198
|
-
* Node, or against an in-memory file map in tests.
|
|
199
|
-
*/
|
|
200
|
-
interface AssetResolver {
|
|
201
|
-
/** Resolve an authored asset path against the layer's base URL to an absolute key. */
|
|
202
|
-
resolve(assetPath: string, baseUrl: string): string;
|
|
203
|
-
/** Fetch the text of a resolved asset; rejects if it cannot be read. */
|
|
204
|
-
fetchText(url: string): Promise<string>;
|
|
205
|
-
/** Fetch the raw bytes of a resolved asset (for binary USDC / USDZ). Optional. */
|
|
206
|
-
fetchBytes?(url: string): Promise<Uint8Array>;
|
|
207
|
-
}
|
|
208
|
-
/** URL-based resolver using the global `fetch` (browser / Node 18+). */
|
|
209
|
-
declare class DefaultAssetResolver implements AssetResolver {
|
|
210
|
-
resolve(assetPath: string, baseUrl: string): string;
|
|
211
|
-
fetchText(url: string): Promise<string>;
|
|
212
|
-
fetchBytes(url: string): Promise<Uint8Array>;
|
|
213
|
-
}
|
|
214
|
-
/** Resolver over an in-memory `{ path: contents }` map, with posix-style joins. */
|
|
215
|
-
declare function createMemoryResolver(files: Record<string, string>): AssetResolver;
|
|
216
|
-
/** Resolve `rel` against `baseUrl` using posix semantics, normalizing `.`/`..`. */
|
|
217
|
-
declare function joinPosix(baseUrl: string, rel: string): string;
|
|
218
|
-
|
|
219
202
|
/**
|
|
220
203
|
* Minimal USD composition: flattens references, payloads, sublayers, variant
|
|
221
204
|
* selections, and internal (intra-layer) reference/inherit arcs into a single
|
|
@@ -234,7 +217,10 @@ type ComposeOptions = {
|
|
|
234
217
|
/** Guard against pathological recursion (default 64). */
|
|
235
218
|
maxDepth?: number;
|
|
236
219
|
};
|
|
220
|
+
/** Parse USDA text and fully compose it. */
|
|
237
221
|
declare function composeLayer(text: string, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>): Promise<UsdaFile>;
|
|
222
|
+
/** Compose an already-parsed layer (used by the binary-crate path too). */
|
|
223
|
+
declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>): Promise<UsdaFile>;
|
|
238
224
|
|
|
239
225
|
/**
|
|
240
226
|
* USDZ (zipped USD package) support.
|
|
@@ -243,14 +229,15 @@ declare function composeLayer(text: string, baseUrl: string, resolver: AssetReso
|
|
|
243
229
|
* {@link openUsdz} unzips it (via `fflate`) and returns the root layer entry
|
|
244
230
|
* plus an {@link AssetResolver} that serves the package's other entries, so
|
|
245
231
|
* references inside the package resolve through the normal composition path.
|
|
246
|
-
*
|
|
232
|
+
* Layers must be read through `fetchBytes` — the root entry is typically a
|
|
233
|
+
* binary crate (`.usdc`), which composition sniffs and decodes (M10).
|
|
247
234
|
*/
|
|
248
235
|
|
|
249
236
|
type UsdzPackage = {
|
|
250
237
|
/** Archive path of the root layer to open. */
|
|
251
238
|
rootEntry: string;
|
|
252
|
-
/** Resolver over the package's entries. */
|
|
253
|
-
resolver: AssetResolver
|
|
239
|
+
/** Resolver over the package's entries (`fetchBytes` is always present). */
|
|
240
|
+
resolver: Required<AssetResolver>;
|
|
254
241
|
};
|
|
255
242
|
/** Unzip a `.usdz` package and build a resolver over its entries. */
|
|
256
243
|
declare function openUsdz(bytes: Uint8Array): UsdzPackage;
|
|
@@ -331,6 +318,12 @@ declare class CrateReader {
|
|
|
331
318
|
private readIndexVector;
|
|
332
319
|
/** Read an SdfListOp; returns the effective (explicit ∪ prepended ∪ added ∪ appended) items. */
|
|
333
320
|
private readListOp;
|
|
321
|
+
/**
|
|
322
|
+
* Read a Reference/Payload list-op into composition arcs. Each item is
|
|
323
|
+
* `[assetPath: string-index][primPath: path-index][layerOffset: 2 doubles]`,
|
|
324
|
+
* and a Reference additionally carries a (usually empty) customData dict.
|
|
325
|
+
*/
|
|
326
|
+
private readArcListOp;
|
|
334
327
|
}
|
|
335
328
|
|
|
336
329
|
/**
|
|
@@ -459,4 +452,4 @@ declare function getJointDrive(prim: Prim, kind: "angular" | "linear"): {
|
|
|
459
452
|
/** Read `PhysicsJointStateAPI` position for the given instance, as authored. */
|
|
460
453
|
declare function getJointStatePosition(prim: Prim, kind: "angular" | "linear"): number | undefined;
|
|
461
454
|
|
|
462
|
-
export { ARTICULATION_ROOT_API,
|
|
455
|
+
export { ARTICULATION_ROOT_API, AssetResolver, Attribute, AttributeSpec, Axis, COLLISION_API, type ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, type ExtractOptions, JointType, Layer, Mat4, MetadataMap, PACKAGE_NAME, ParseError, Prim, PrimSpec, RIGID_BODY_API, Relationship, RelationshipSpec, type ResolvedXform, RobotDescription, SdfPath, Specifier, Stage, TokenizeError, type UpAxis, UsdValue, UsdaFile, type UsdzPackage, VERSION, Variability, composeFile, composeLayer, computeLocalTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize };
|
package/dist/core.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PACKAGE_NAME, VERSION } from './chunk-OFUMT72H.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize } from './chunk-36T6YOEX.js';
|
|
2
3
|
//# sourceMappingURL=core.js.map
|
|
3
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-D9AOUaVh.js';
|
|
2
2
|
import 'three';
|
|
3
|
-
import './buildKinematicTree-
|
|
3
|
+
import './buildKinematicTree-3oKG00Sc.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-D9AOUaVh.js';
|
|
3
|
+
import './buildKinematicTree-3oKG00Sc.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,14 +1,117 @@
|
|
|
1
|
-
import { Stage, Prim
|
|
2
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT,
|
|
1
|
+
import { Stage, Prim } from './core.js';
|
|
2
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, ExtractOptions, Layer, PACKAGE_NAME, ParseError, RIGID_BODY_API, Relationship, ResolvedXform, TokenizeError, UpAxis, UsdzPackage, VERSION, composeFile, composeLayer, computeLocalTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize } from './core.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { A as Axis,
|
|
5
|
-
export {
|
|
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 } from './buildKinematicTree-3oKG00Sc.js';
|
|
5
|
+
export { c as AssetPath, d as AttributeSpec, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, e as JointDriveDescription, J as JointType, f as KinematicNode, K as KinematicTree, L as LinkDescription, g as ListOp, M as Mat4, h as MetadataMap, P as PrimSpec, i as PropertySpec, Q as Quat, j as RAD2DEG, k as RelationshipSpec, S as SampleChannel, l as SdfPath, m as Specifier, T as TreeEdge, U as UsdDictionary, n as UsdMatrix, o as UsdValue, p as UsdaFile, q as Variability, r as Vec4, s as buildKinematicTree, t as channelFromSamples, u as fromUsdMatrix, v as getTranslation, w as identity4, x as interpolate, y as invert, z as makeEuler, E as makeRotationFromQuat, F as makeRotationX, G as makeRotationY, H as makeRotationZ, I as makeScale, N as makeTranslation, O as multiply, W as multiplyAll } from './buildKinematicTree-3oKG00Sc.js';
|
|
6
|
+
import { T as ThreeUsdRobot } from './ThreeUsdRobot-D9AOUaVh.js';
|
|
7
|
+
export { J as JointObject, L as LinkObject, a as ThreeUsdRobotOptions } from './ThreeUsdRobot-D9AOUaVh.js';
|
|
8
|
+
import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
|
|
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-BgsnuJWd.js';
|
|
8
11
|
|
|
9
12
|
/** Unit vector for a USD joint axis token. Returns a fresh vector each call. */
|
|
10
13
|
declare function axisVector(axis: Axis): THREE.Vector3;
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Resolves `UsdShade` material bindings to flat PBR parameters.
|
|
17
|
+
*
|
|
18
|
+
* Follows a prim's (or an ancestor's) `material:binding` to a `Material`, finds
|
|
19
|
+
* its surface `Shader`, and reads constant color/metalness/roughness/opacity/
|
|
20
|
+
* emissive inputs plus the **texture** asset paths for the diffuse, normal,
|
|
21
|
+
* roughness, metallic, occlusion and emissive channels. Handles both
|
|
22
|
+
* `UsdPreviewSurface` (constant inputs or a connected `UsdUVTexture` network)
|
|
23
|
+
* and Omniverse `OmniPBR` MDL (direct asset-valued texture inputs such as
|
|
24
|
+
* `inputs:normalmap_texture`).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** `UsdUVTexture` wrap mode for one axis (`black` ≈ clamp; three has no border). */
|
|
28
|
+
type TextureWrap = "repeat" | "clamp" | "mirror" | "black";
|
|
29
|
+
/** `UsdTransform2d` applied to the `st` coords feeding a texture. */
|
|
30
|
+
type TextureTransform = {
|
|
31
|
+
/** `inputs:translation` (UV offset). */
|
|
32
|
+
translation?: Vec2;
|
|
33
|
+
/** `inputs:rotation` in degrees (CCW about the origin). */
|
|
34
|
+
rotation?: number;
|
|
35
|
+
/** `inputs:scale` (UV tiling). */
|
|
36
|
+
scale?: Vec2;
|
|
37
|
+
};
|
|
38
|
+
/** A resolved texture reference plus its `UsdUVTexture` sampler/transform state. */
|
|
39
|
+
type ResolvedTexture = {
|
|
40
|
+
/** Authored asset path of the image. */
|
|
41
|
+
path: string;
|
|
42
|
+
wrapS?: TextureWrap;
|
|
43
|
+
wrapT?: TextureWrap;
|
|
44
|
+
/** `UsdTransform2d` on the `st` input, if any. */
|
|
45
|
+
transform?: TextureTransform;
|
|
46
|
+
/** `inputs:scale` — multiplies the sampled value (folded into material factors). */
|
|
47
|
+
scale?: [number, number, number, number];
|
|
48
|
+
/** `inputs:bias` — added to the sampled value. */
|
|
49
|
+
bias?: [number, number, number, number];
|
|
50
|
+
};
|
|
51
|
+
type ResolvedMaterial = {
|
|
52
|
+
color?: Vec3;
|
|
53
|
+
opacity?: number;
|
|
54
|
+
metalness?: number;
|
|
55
|
+
roughness?: number;
|
|
56
|
+
emissiveColor?: Vec3;
|
|
57
|
+
/**
|
|
58
|
+
* `inputs:opacityThreshold`. When `> 0`, opacity is a binary mask (alpha
|
|
59
|
+
* clip / cutout); when `0`/absent, sub-unit opacity blends translucently.
|
|
60
|
+
*/
|
|
61
|
+
opacityThreshold?: number;
|
|
62
|
+
/** Diffuse/albedo texture, if any. */
|
|
63
|
+
colorTexture?: ResolvedTexture;
|
|
64
|
+
/** Opacity / alpha texture (may be the same image as `colorTexture`). */
|
|
65
|
+
opacityTexture?: ResolvedTexture;
|
|
66
|
+
/** Tangent-space normal map, if any. */
|
|
67
|
+
normalTexture?: ResolvedTexture;
|
|
68
|
+
/** Roughness map, if any. */
|
|
69
|
+
roughnessTexture?: ResolvedTexture;
|
|
70
|
+
/** Metallic map, if any. */
|
|
71
|
+
metalnessTexture?: ResolvedTexture;
|
|
72
|
+
/** Ambient-occlusion map, if any. */
|
|
73
|
+
occlusionTexture?: ResolvedTexture;
|
|
74
|
+
/** Emissive map, if any. */
|
|
75
|
+
emissiveTexture?: ResolvedTexture;
|
|
76
|
+
};
|
|
77
|
+
/** Resolve the bound material's flat parameters for `prim`, or `undefined`. */
|
|
78
|
+
declare function resolveBoundMaterial(stage: Stage, prim: Prim): ResolvedMaterial | undefined;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Loads texture image assets referenced by `UsdShade` materials.
|
|
82
|
+
*
|
|
83
|
+
* A {@link TextureProvider} maps an authored asset path (plus sampler/transform
|
|
84
|
+
* options) to a `THREE.Texture`. The default provider fetches the image **bytes**
|
|
85
|
+
* through the {@link AssetResolver} and decodes them via a blob URL — so it works
|
|
86
|
+
* uniformly for textures served over HTTP and for images embedded inside a
|
|
87
|
+
* `.usdz` package (whose resolver serves zip entries, not real URLs). Decoded
|
|
88
|
+
* images are cached per resolved URL and shared across every texture that uses
|
|
89
|
+
* them; each `THREE.Texture` carries its own color space / wrap / transform.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Color space to interpret a texture in. Color/albedo and emissive maps are
|
|
94
|
+
* `"srgb"`; data maps (normal, roughness, metalness, occlusion) are `"linear"`.
|
|
95
|
+
*/
|
|
96
|
+
type TextureColorSpace = "srgb" | "linear";
|
|
97
|
+
/** Per-use sampler state applied to the returned `THREE.Texture`. */
|
|
98
|
+
type TextureOptions = {
|
|
99
|
+
/** Defaults to `"srgb"`. */
|
|
100
|
+
colorSpace?: TextureColorSpace;
|
|
101
|
+
wrapS?: TextureWrap;
|
|
102
|
+
wrapT?: TextureWrap;
|
|
103
|
+
transform?: TextureTransform;
|
|
104
|
+
};
|
|
105
|
+
/** Resolve an authored texture asset path to a `THREE.Texture` (or `null`). */
|
|
106
|
+
type TextureProvider = (assetPath: string, options?: TextureOptions) => THREE.Texture | null;
|
|
107
|
+
/**
|
|
108
|
+
* A {@link TextureProvider} backed by the {@link AssetResolver}, resolving paths
|
|
109
|
+
* against `baseUrl`. Image bytes are fetched once per URL (works for HTTP and
|
|
110
|
+
* `.usdz` entries alike) and the decoded image is shared; each call returns a
|
|
111
|
+
* distinct `THREE.Texture` carrying the requested color space / wrap / transform.
|
|
112
|
+
*/
|
|
113
|
+
declare function createTextureProvider(resolver: AssetResolver, baseUrl: string): TextureProvider;
|
|
114
|
+
|
|
12
115
|
/**
|
|
13
116
|
* Binds `UsdGeom.Mesh` prims to Three.js geometry and attaches them under the
|
|
14
117
|
* robot's link objects.
|
|
@@ -23,15 +126,20 @@ type MeshKind = "visual" | "collision";
|
|
|
23
126
|
type BindMeshesOptions = {
|
|
24
127
|
loadVisuals?: boolean;
|
|
25
128
|
loadCollisions?: boolean;
|
|
129
|
+
/** Resolves diffuse texture asset paths to `THREE.Texture` (M-tex). */
|
|
130
|
+
textureProvider?: TextureProvider;
|
|
26
131
|
};
|
|
27
132
|
/** Build a `BufferGeometry` from a Mesh prim, or `null` if it has no points. */
|
|
28
133
|
declare function buildMeshGeometry(meshPrim: Prim): THREE.BufferGeometry | null;
|
|
29
134
|
/**
|
|
30
135
|
* Build a material for a Mesh prim. Color priority: bound `UsdShade` material
|
|
31
|
-
* (when `stage` is given) → `primvars:displayColor` → default gray.
|
|
32
|
-
*
|
|
136
|
+
* (when `stage` is given) → `primvars:displayColor` → default gray. Textures
|
|
137
|
+
* (via `textures`) become the matching `MeshStandardMaterial` maps — diffuse →
|
|
138
|
+
* `map` (sRGB), plus `normalMap` / `roughnessMap` / `metalnessMap` / `aoMap`
|
|
139
|
+
* (linear data) and emissive `emissiveMap`. Metalness / roughness / opacity /
|
|
140
|
+
* emissive constants come from the bound material when present.
|
|
33
141
|
*/
|
|
34
|
-
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage): THREE.Material;
|
|
142
|
+
declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage, textures?: TextureProvider): THREE.Material;
|
|
35
143
|
/**
|
|
36
144
|
* Attach visual (and optionally collision) meshes to every link of a built
|
|
37
145
|
* {@link ThreeUsdRobot}. Each mesh is positioned by its transform relative to
|
|
@@ -39,74 +147,4 @@ declare function buildMeshMaterial(meshPrim: Prim, stage?: Stage): THREE.Materia
|
|
|
39
147
|
*/
|
|
40
148
|
declare function bindRobotMeshes(stage: Stage, robot3d: ThreeUsdRobot, desc: RobotDescription, options?: BindMeshesOptions): void;
|
|
41
149
|
|
|
42
|
-
|
|
43
|
-
* Resolves `UsdShade` material bindings to flat PBR parameters.
|
|
44
|
-
*
|
|
45
|
-
* Follows a prim's (or an ancestor's) `material:binding` to a `Material`, finds
|
|
46
|
-
* its surface `Shader`, and reads constant color/metalness/roughness/opacity
|
|
47
|
-
* inputs. Handles both `UsdPreviewSurface` (`inputs:diffuseColor`, …) and
|
|
48
|
-
* Omniverse `OmniPBR` MDL (`inputs:diffuse_color_constant`, …) input names.
|
|
49
|
-
* Texture inputs and shading networks are not evaluated — constants only.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
type ResolvedMaterial = {
|
|
53
|
-
color?: Vec3;
|
|
54
|
-
opacity?: number;
|
|
55
|
-
metalness?: number;
|
|
56
|
-
roughness?: number;
|
|
57
|
-
};
|
|
58
|
-
/** Resolve the bound material's flat parameters for `prim`, or `undefined`. */
|
|
59
|
-
declare function resolveBoundMaterial(stage: Stage, prim: Prim): ResolvedMaterial | undefined;
|
|
60
|
-
|
|
61
|
-
type ThreeUsdRobotLoaderOptions = {
|
|
62
|
-
/** Resolver for references / payloads / sublayers (default {@link DefaultAssetResolver}). */
|
|
63
|
-
assetResolver?: AssetResolver;
|
|
64
|
-
/** Render visual meshes (M6). */
|
|
65
|
-
loadVisuals?: boolean;
|
|
66
|
-
/** Render collision meshes (M6). */
|
|
67
|
-
loadCollisions?: boolean;
|
|
68
|
-
/** Up-axis correction strategy (M9). */
|
|
69
|
-
upAxisConversion?: "auto" | "Y" | "Z" | "none";
|
|
70
|
-
/** Extra uniform scale multiplied with `metersPerUnit` (M9). */
|
|
71
|
-
unitScale?: number;
|
|
72
|
-
/** Clamp `setJointValue` to authored limits (default `true`). */
|
|
73
|
-
clampJointLimits?: boolean;
|
|
74
|
-
/** Seed joints from drive targets / joint state (M9). */
|
|
75
|
-
applyDriveTargetsAsInitialPose?: boolean;
|
|
76
|
-
/** Override the robot name. */
|
|
77
|
-
robotName?: string;
|
|
78
|
-
/** Receives non-fatal load diagnostics. */
|
|
79
|
-
onWarn?: (message: string) => void;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Loads Isaac Sim / OpenUSD robot assets into a controllable {@link ThreeUsdRobot}.
|
|
83
|
-
*
|
|
84
|
-
* Composition (references / payloads / sublayers, M8) is resolved through an
|
|
85
|
-
* {@link AssetResolver}. Mesh rendering is M6; unit / up-axis / initial-pose
|
|
86
|
-
* handling is M9; USDC and variants are M10.
|
|
87
|
-
*/
|
|
88
|
-
declare class ThreeUsdRobotLoader {
|
|
89
|
-
readonly options: ThreeUsdRobotLoaderOptions;
|
|
90
|
-
constructor(options?: ThreeUsdRobotLoaderOptions);
|
|
91
|
-
private get resolver();
|
|
92
|
-
/**
|
|
93
|
-
* Fetch an asset by URL and build the robot. `.usdz` packages are unzipped and
|
|
94
|
-
* composed from their entries; everything else is treated as USDA text.
|
|
95
|
-
*/
|
|
96
|
-
loadAsync(url: string): Promise<ThreeUsdRobot>;
|
|
97
|
-
private fetchRootBytes;
|
|
98
|
-
/** Build a robot (composed, with meshes) from USDA source text. */
|
|
99
|
-
parse(text: string, baseUrl?: string): Promise<ThreeUsdRobot>;
|
|
100
|
-
/** Build a robot from the bytes of a `.usdz` package. */
|
|
101
|
-
parseUsdz(bytes: Uint8Array): Promise<ThreeUsdRobot>;
|
|
102
|
-
/** Build a robot from the bytes of a binary crate (`.usdc` / binary `.usd`). */
|
|
103
|
-
parseCrate(bytes: Uint8Array): Promise<ThreeUsdRobot>;
|
|
104
|
-
/** Parse + compose USDA source into the Three.js-independent robot IR. */
|
|
105
|
-
parseRobotDescription(text: string, baseUrl?: string): Promise<RobotDescription>;
|
|
106
|
-
private buildFromStage;
|
|
107
|
-
private composeStage;
|
|
108
|
-
private robotOptions;
|
|
109
|
-
private extractOptions;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export { AssetResolver, Axis, type BindMeshesOptions, type MeshKind, Prim, type ResolvedMaterial, RobotDescription, Stage, ThreeUsdRobot, ThreeUsdRobotLoader, type ThreeUsdRobotLoaderOptions, Vec3, axisVector, bindRobotMeshes, buildMeshGeometry, buildMeshMaterial, resolveBoundMaterial };
|
|
150
|
+
export { AssetResolver, Axis, type BindMeshesOptions, type MeshKind, Prim, type ResolvedMaterial, type ResolvedTexture, RobotDescription, Stage, type TextureColorSpace, type TextureOptions, type TextureProvider, type TextureTransform, type TextureWrap, ThreeUsdRobot, Vec2, Vec3, axisVector, bindRobotMeshes, buildMeshGeometry, buildMeshMaterial, createTextureProvider, resolveBoundMaterial };
|