@ioai/robot_viewer 0.0.0-stage → 1.1.2

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.
Files changed (159) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +217 -2
  3. package/bin/cli.js +83 -0
  4. package/dist/assets/css/PlotPanel-3e7d7555.css +1 -0
  5. package/dist/assets/js/ColladaLoader-2a0c4638.js +1 -0
  6. package/dist/assets/js/GLTFLoader-7a7f40d7.js +1 -0
  7. package/dist/assets/js/MTLLoader-b6ce88b7.js +1 -0
  8. package/dist/assets/js/OBJLoader-7667aa01.js +1 -0
  9. package/dist/assets/js/PlotPanel-09f986c7.js +1 -0
  10. package/dist/assets/js/STLLoader-de0915d4.js +1 -0
  11. package/dist/assets/js/URDFLoader-a34b6917.js +1 -0
  12. package/dist/assets/js/USDZLoader-64197f74.js +7 -0
  13. package/dist/assets/js/__vite-browser-external-afb87ea8.js +1 -0
  14. package/dist/assets/js/codemirror-c3cec7b3.js +1 -0
  15. package/dist/assets/js/codemirror-themes-e6995a6a.js +1 -0
  16. package/dist/assets/js/d3-2e308866.js +1 -0
  17. package/dist/assets/js/index-56e94ce5.js +6 -0
  18. package/dist/assets/js/mujoco_wasm-345a2576.js +1 -0
  19. package/dist/assets/js/three-9c891de0.js +6 -0
  20. package/dist/camera-publish-worker.js +1 -0
  21. package/dist/favicon.svg +2 -0
  22. package/dist/heartbeat-worker.js +1 -0
  23. package/dist/index.html +4373 -0
  24. package/dist/models/mocap/blender_human.urdf +2319 -0
  25. package/dist/models/mocap/blender_human_skeleton_v4.urdf +1432 -0
  26. package/dist/models/mocap/blender_human_skeleton_v5.urdf +2717 -0
  27. package/dist/models/mocap/meshes/v4/L_base_link.STL +0 -0
  28. package/dist/models/mocap/meshes/v4/L_figer1_1.STL +0 -0
  29. package/dist/models/mocap/meshes/v4/L_figer1_2.STL +0 -0
  30. package/dist/models/mocap/meshes/v4/L_figer1_3.STL +0 -0
  31. package/dist/models/mocap/meshes/v4/L_figer1_4.STL +0 -0
  32. package/dist/models/mocap/meshes/v4/L_figer1_5.STL +0 -0
  33. package/dist/models/mocap/meshes/v4/L_figer1base.STL +0 -0
  34. package/dist/models/mocap/meshes/v4/L_figer2_1.STL +0 -0
  35. package/dist/models/mocap/meshes/v4/L_figer2_2.STL +0 -0
  36. package/dist/models/mocap/meshes/v4/L_figer2_3.STL +0 -0
  37. package/dist/models/mocap/meshes/v4/L_figer2_4.STL +0 -0
  38. package/dist/models/mocap/meshes/v4/L_figer2_5.STL +0 -0
  39. package/dist/models/mocap/meshes/v4/L_figer3_1.STL +0 -0
  40. package/dist/models/mocap/meshes/v4/L_figer3_2.STL +0 -0
  41. package/dist/models/mocap/meshes/v4/L_figer3_3.STL +0 -0
  42. package/dist/models/mocap/meshes/v4/L_figer3_4.STL +0 -0
  43. package/dist/models/mocap/meshes/v4/L_figer3_5.STL +0 -0
  44. package/dist/models/mocap/meshes/v4/L_figer4_1.STL +0 -0
  45. package/dist/models/mocap/meshes/v4/L_figer4_2.STL +0 -0
  46. package/dist/models/mocap/meshes/v4/L_figer4_3.STL +0 -0
  47. package/dist/models/mocap/meshes/v4/L_figer4_4.STL +0 -0
  48. package/dist/models/mocap/meshes/v4/L_figer4_5.STL +0 -0
  49. package/dist/models/mocap/meshes/v4/L_figer5_1.STL +0 -0
  50. package/dist/models/mocap/meshes/v4/L_figer5_2.STL +0 -0
  51. package/dist/models/mocap/meshes/v4/L_figer5_3.STL +0 -0
  52. package/dist/models/mocap/meshes/v4/L_figer5_4.STL +0 -0
  53. package/dist/models/mocap/meshes/v4/L_figer5_5.STL +0 -0
  54. package/dist/models/mocap/meshes/v4/L_handle.STL +0 -0
  55. package/dist/models/mocap/meshes/v4/L_handleseat.STL +0 -0
  56. package/dist/models/mocap/meshes/v4/L_mark.STL +0 -0
  57. package/dist/models/mocap/meshes/v4/L_markseat.STL +0 -0
  58. package/dist/models/mocap/meshes/v4/Lgamepadbase.STL +0 -0
  59. package/dist/models/mocap/meshes/v4/Link1.STL +0 -0
  60. package/dist/models/mocap/meshes/v4/Link2.STL +0 -0
  61. package/dist/models/mocap/meshes/v4/R_base_link.STL +0 -0
  62. package/dist/models/mocap/meshes/v4/R_figer1_1.STL +0 -0
  63. package/dist/models/mocap/meshes/v4/R_figer1_2.STL +0 -0
  64. package/dist/models/mocap/meshes/v4/R_figer1_3.STL +0 -0
  65. package/dist/models/mocap/meshes/v4/R_figer1_4.STL +0 -0
  66. package/dist/models/mocap/meshes/v4/R_figer1_5.STL +0 -0
  67. package/dist/models/mocap/meshes/v4/R_figer1base.STL +0 -0
  68. package/dist/models/mocap/meshes/v4/R_figer2_1.STL +0 -0
  69. package/dist/models/mocap/meshes/v4/R_figer2_2.STL +0 -0
  70. package/dist/models/mocap/meshes/v4/R_figer2_3.STL +0 -0
  71. package/dist/models/mocap/meshes/v4/R_figer2_4.STL +0 -0
  72. package/dist/models/mocap/meshes/v4/R_figer2_5.STL +0 -0
  73. package/dist/models/mocap/meshes/v4/R_figer3_1.STL +0 -0
  74. package/dist/models/mocap/meshes/v4/R_figer3_2.STL +0 -0
  75. package/dist/models/mocap/meshes/v4/R_figer3_3.STL +0 -0
  76. package/dist/models/mocap/meshes/v4/R_figer3_4.STL +0 -0
  77. package/dist/models/mocap/meshes/v4/R_figer3_5.STL +0 -0
  78. package/dist/models/mocap/meshes/v4/R_figer4_1.STL +0 -0
  79. package/dist/models/mocap/meshes/v4/R_figer4_2.STL +0 -0
  80. package/dist/models/mocap/meshes/v4/R_figer4_3.STL +0 -0
  81. package/dist/models/mocap/meshes/v4/R_figer4_4.STL +0 -0
  82. package/dist/models/mocap/meshes/v4/R_figer4_5.STL +0 -0
  83. package/dist/models/mocap/meshes/v4/R_figer5_1.STL +0 -0
  84. package/dist/models/mocap/meshes/v4/R_figer5_2.STL +0 -0
  85. package/dist/models/mocap/meshes/v4/R_figer5_3.STL +0 -0
  86. package/dist/models/mocap/meshes/v4/R_figer5_4.STL +0 -0
  87. package/dist/models/mocap/meshes/v4/R_figer5_5.STL +0 -0
  88. package/dist/models/mocap/meshes/v4/R_handle.STL +0 -0
  89. package/dist/models/mocap/meshes/v4/R_handleseat.STL +0 -0
  90. package/dist/models/mocap/meshes/v4/R_mark.STL +0 -0
  91. package/dist/models/mocap/meshes/v4/R_markseat.STL +0 -0
  92. package/dist/models/mocap/meshes/v4/Rgamepadbase.STL +0 -0
  93. package/dist/models/mocap/meshes/v4/base_link.STL +0 -0
  94. package/dist/models/mocap/meshes/v4/r_figer1_1.STL +0 -0
  95. package/dist/models/mocap/meshes/v5/L_handleseat.STL +0 -0
  96. package/dist/models/mocap/meshes/v5/R_handleseat.STL +0 -0
  97. package/dist/models/mocap/meshes/v5/link_LeftSkeletonBase.STL +0 -0
  98. package/dist/models/mocap/meshes/v5/link_LeftSkeletonIndex1.STL +0 -0
  99. package/dist/models/mocap/meshes/v5/link_LeftSkeletonIndex2.STL +0 -0
  100. package/dist/models/mocap/meshes/v5/link_LeftSkeletonIndex3.STL +0 -0
  101. package/dist/models/mocap/meshes/v5/link_LeftSkeletonIndex4.STL +0 -0
  102. package/dist/models/mocap/meshes/v5/link_LeftSkeletonMiddle1.STL +0 -0
  103. package/dist/models/mocap/meshes/v5/link_LeftSkeletonMiddle2.STL +0 -0
  104. package/dist/models/mocap/meshes/v5/link_LeftSkeletonMiddle3.STL +0 -0
  105. package/dist/models/mocap/meshes/v5/link_LeftSkeletonMiddle4.STL +0 -0
  106. package/dist/models/mocap/meshes/v5/link_LeftSkeletonPinky1.STL +0 -0
  107. package/dist/models/mocap/meshes/v5/link_LeftSkeletonPinky2.STL +0 -0
  108. package/dist/models/mocap/meshes/v5/link_LeftSkeletonPinky3.STL +0 -0
  109. package/dist/models/mocap/meshes/v5/link_LeftSkeletonPinky4.STL +0 -0
  110. package/dist/models/mocap/meshes/v5/link_LeftSkeletonRing1.STL +0 -0
  111. package/dist/models/mocap/meshes/v5/link_LeftSkeletonRing2.STL +0 -0
  112. package/dist/models/mocap/meshes/v5/link_LeftSkeletonRing3.STL +0 -0
  113. package/dist/models/mocap/meshes/v5/link_LeftSkeletonRing4.STL +0 -0
  114. package/dist/models/mocap/meshes/v5/link_LeftSkeletonThumb1.STL +0 -0
  115. package/dist/models/mocap/meshes/v5/link_LeftSkeletonThumb2.STL +0 -0
  116. package/dist/models/mocap/meshes/v5/link_LeftSkeletonThumb3.STL +0 -0
  117. package/dist/models/mocap/meshes/v5/link_LeftSkeletonThumb4.STL +0 -0
  118. package/dist/models/mocap/meshes/v5/link_LeftSkeletonThumbBase.STL +0 -0
  119. package/dist/models/mocap/meshes/v5/link_RightSkeletonBase.STL +0 -0
  120. package/dist/models/mocap/meshes/v5/link_RightSkeletonIndex1.STL +0 -0
  121. package/dist/models/mocap/meshes/v5/link_RightSkeletonIndex2.STL +0 -0
  122. package/dist/models/mocap/meshes/v5/link_RightSkeletonIndex3.STL +0 -0
  123. package/dist/models/mocap/meshes/v5/link_RightSkeletonIndex4.STL +0 -0
  124. package/dist/models/mocap/meshes/v5/link_RightSkeletonMiddle1.STL +0 -0
  125. package/dist/models/mocap/meshes/v5/link_RightSkeletonMiddle2.STL +0 -0
  126. package/dist/models/mocap/meshes/v5/link_RightSkeletonMiddle3.STL +0 -0
  127. package/dist/models/mocap/meshes/v5/link_RightSkeletonMiddle4.STL +0 -0
  128. package/dist/models/mocap/meshes/v5/link_RightSkeletonPinky1.STL +0 -0
  129. package/dist/models/mocap/meshes/v5/link_RightSkeletonPinky2.STL +0 -0
  130. package/dist/models/mocap/meshes/v5/link_RightSkeletonPinky3.STL +0 -0
  131. package/dist/models/mocap/meshes/v5/link_RightSkeletonPinky4.STL +0 -0
  132. package/dist/models/mocap/meshes/v5/link_RightSkeletonRing1.STL +0 -0
  133. package/dist/models/mocap/meshes/v5/link_RightSkeletonRing2.STL +0 -0
  134. package/dist/models/mocap/meshes/v5/link_RightSkeletonRing3.STL +0 -0
  135. package/dist/models/mocap/meshes/v5/link_RightSkeletonRing4.STL +0 -0
  136. package/dist/models/mocap/meshes/v5/link_RightSkeletonThumb1.STL +0 -0
  137. package/dist/models/mocap/meshes/v5/link_RightSkeletonThumb2.STL +0 -0
  138. package/dist/models/mocap/meshes/v5/link_RightSkeletonThumb3.STL +0 -0
  139. package/dist/models/mocap/meshes/v5/link_RightSkeletonThumb4.STL +0 -0
  140. package/dist/models/mocap/meshes/v5/link_RightSkeletonThumbBase.STL +0 -0
  141. package/dist/scripts/start-rosbridge.sh +77 -0
  142. package/dist/usd-iframe.html +41 -0
  143. package/dist/usd-viewer/bindings/.gitattributes +2 -0
  144. package/dist/usd-viewer/bindings/emHdBindings.data +19331 -0
  145. package/dist/usd-viewer/bindings/emHdBindings.js +12281 -0
  146. package/dist/usd-viewer/bindings/emHdBindings.wasm +0 -0
  147. package/dist/usd-viewer/bindings/emHdBindings.worker.js +124 -0
  148. package/dist/usd-viewer/environments/neutral.hdr +0 -0
  149. package/dist/usd-viewer/error-handler.js +57 -0
  150. package/dist/usd-viewer/hydra/HydraPrimitives.js +740 -0
  151. package/dist/usd-viewer/hydra/TextureRegistry.js +130 -0
  152. package/dist/usd-viewer/hydra/ThreeJsRenderDelegate.js +65 -0
  153. package/dist/usd-viewer/index.d.ts +1 -0
  154. package/dist/usd-viewer/main.js +1018 -0
  155. package/dist/usd-viewer/usd.html +36 -0
  156. package/dist/usd-viewer/usdUtils.js +67 -0
  157. package/package.json +70 -4
  158. package/server/package.json +14 -0
  159. package/server/static-server.js +106 -0
@@ -0,0 +1 @@
1
+ import{Vector3 as t,Matrix4 as i,Euler as e,Quaternion as s,Object3D as o,DefaultLoadingManager as n,LoaderUtils as r,Mesh as a,MeshPhongMaterial as l,TextureLoader as u,SRGBColorSpace as h,BoxGeometry as c,SphereGeometry as m,CylinderGeometry as d}from"./three-9c891de0.js";import{STLLoader as p}from"./STLLoader-de0915d4.js";import{ColladaLoader as f}from"./ColladaLoader-2a0c4638.js";const g=new t,j=new e,w=new i,y=new i,V=new s,b=new t(1,1,1),N=new t;class x extends o{constructor(...t){super(...t),this.urdfNode=null,this.urdfName=""}copy(t,i){return super.copy(t,i),this.urdfNode=t.urdfNode,this.urdfName=t.urdfName,this}}class A extends x{constructor(...t){super(...t),this.isURDFCollider=!0,this.type="URDFCollider"}}class F extends x{constructor(...t){super(...t),this.isURDFVisual=!0,this.type="URDFVisual"}}class L extends x{constructor(...t){super(...t),this.isURDFLink=!0,this.type="URDFLink"}}class k extends x{get jointType(){return this._jointType}set jointType(i){if(this.jointType!==i)switch(this._jointType=i,this.matrixWorldNeedsUpdate=!0,i){case"fixed":this.jointValue=[];break;case"continuous":case"revolute":case"prismatic":this.jointValue=new Array(1).fill(0);break;case"planar":this.jointValue=new Array(3).fill(0),this.axis=new t(0,0,1);break;case"floating":this.jointValue=new Array(6).fill(0)}}get angle(){return this.jointValue[0]}constructor(...i){super(...i),this.isURDFJoint=!0,this.type="URDFJoint",this.jointValue=null,this.jointType="fixed",this.axis=new t(1,0,0),this.limit={lower:0,upper:0},this.ignoreLimits=!1,this.origPosition=null,this.origQuaternion=null,this.mimicJoints=[]}copy(t,i){return super.copy(t,i),this.jointType=t.jointType,this.axis=t.axis.clone(),this.limit.lower=t.limit.lower,this.limit.upper=t.limit.upper,this.ignoreLimits=!1,this.jointValue=[...t.jointValue],this.origPosition=t.origPosition?t.origPosition.clone():null,this.origQuaternion=t.origQuaternion?t.origQuaternion.clone():null,this.mimicJoints=[...t.mimicJoints],this}setJointValue(...t){t=t.map(t=>null===t?null:parseFloat(t)),this.origPosition&&this.origQuaternion||(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let i=!1;switch(this.mimicJoints.forEach(e=>{i=e.updateFromMimickedJoint(...t)||i}),this.jointType){case"fixed":return i;case"continuous":case"revolute":{let e=t[0];return null==e||e===this.jointValue[0]?i:(this.ignoreLimits||"revolute"!==this.jointType||(e=Math.min(this.limit.upper,e),e=Math.max(this.limit.lower,e)),this.quaternion.setFromAxisAngle(this.axis,e).premultiply(this.origQuaternion),this.jointValue[0]!==e?(this.jointValue[0]=e,this.matrixWorldNeedsUpdate=!0,!0):i)}case"prismatic":{let e=t[0];return null==e||e===this.jointValue[0]?i:(this.ignoreLimits||(e=Math.min(this.limit.upper,e),e=Math.max(this.limit.lower,e)),this.position.copy(this.origPosition),g.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(g,e),this.jointValue[0]!==e?(this.jointValue[0]=e,this.matrixWorldNeedsUpdate=!0,!0):i)}case"floating":return this.jointValue.every((i,e)=>t[e]===i||null===t[e])?i:(this.jointValue[0]=null!==t[0]?t[0]:this.jointValue[0],this.jointValue[1]=null!==t[1]?t[1]:this.jointValue[1],this.jointValue[2]=null!==t[2]?t[2]:this.jointValue[2],this.jointValue[3]=null!==t[3]?t[3]:this.jointValue[3],this.jointValue[4]=null!==t[4]?t[4]:this.jointValue[4],this.jointValue[5]=null!==t[5]?t[5]:this.jointValue[5],y.compose(this.origPosition,this.origQuaternion,b),V.setFromEuler(j.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],"XYZ")),N.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),w.compose(N,V,b),y.premultiply(w),this.position.setFromMatrixPosition(y),this.rotation.setFromRotationMatrix(y),this.matrixWorldNeedsUpdate=!0,!0);case"planar":return this.jointValue.every((i,e)=>t[e]===i||null===t[e])?i:(this.jointValue[0]=null!==t[0]?t[0]:this.jointValue[0],this.jointValue[1]=null!==t[1]?t[1]:this.jointValue[1],this.jointValue[2]=null!==t[2]?t[2]:this.jointValue[2],y.compose(this.origPosition,this.origQuaternion,b),V.setFromAxisAngle(this.axis,this.jointValue[2]),N.set(this.jointValue[0],this.jointValue[1],0),w.compose(N,V,b),y.premultiply(w),this.position.setFromMatrixPosition(y),this.rotation.setFromRotationMatrix(y),this.matrixWorldNeedsUpdate=!0,!0)}return i}}class J extends k{constructor(...t){super(...t),this.type="URDFMimicJoint",this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...t){const i=t.map(t=>t*this.multiplier+this.offset);return super.setJointValue(...i)}copy(t,i){return super.copy(t,i),this.mimicJoint=t.mimicJoint,this.offset=t.offset,this.multiplier=t.multiplier,this}}class R extends L{constructor(...t){super(...t),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(t,i){super.copy(t,i),this.urdfRobotNode=t.urdfRobotNode,this.robotName=t.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(i=>{i.isURDFJoint&&i.urdfName in t.joints&&(this.joints[i.urdfName]=i),i.isURDFLink&&i.urdfName in t.links&&(this.links[i.urdfName]=i),i.isURDFCollider&&i.urdfName in t.colliders&&(this.colliders[i.urdfName]=i),i.isURDFVisual&&i.urdfName in t.visual&&(this.visual[i.urdfName]=i)});for(const e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(t=>this.joints[t.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(t){return this.frames[t]}setJointValue(t,...i){const e=this.joints[t];return!!e&&e.setJointValue(...i)}setJointValues(t){let i=!1;for(const e in t){const s=t[e];i=Array.isArray(s)?this.setJointValue(e,...s)||i:this.setJointValue(e,s)||i}return i}}const U=new s,C=new e;function E(t){return t?t.trim().split(/\s+/g).map(t=>parseFloat(t)):[0,0,0]}function D(t,i,e=!1){e||t.rotation.set(0,0,0),C.set(i[0],i[1],i[2],"ZYX"),U.setFromEuler(C),U.multiply(t.quaternion),t.quaternion.copy(U)}class M{constructor(t){this.manager=t||n,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages="",this.workingPath="",this.fetchOptions={}}loadAsync(t){return new Promise((i,e)=>{this.load(t,i,null,e)})}load(t,i,e,s){const o=this.manager,n=r.extractUrlBase(t),a=this.manager.resolveURL(t);o.itemStart(a),fetch(a,this.fetchOptions).then(t=>{if(t.ok)return e&&e(null),t.text();throw new Error(`URDFLoader: Failed to load url '${a}' with error code ${t.status} : ${t.statusText}.`)}).then(t=>{const e=this.parse(t,this.workingPath||n);i(e),o.itemEnd(a)}).catch(t=>{s&&s(t),o.itemError(a),o.itemEnd(a)})}parse(i,e=this.workingPath){const s=this.packages,o=this.loadMeshCb,n=this.parseVisual,r=this.parseCollision,p=this.manager,f={},g={},j={};function w(t){if(!/^package:\/\//.test(t))return e?e+t:t;const[i,o]=t.replace(/^package:\/\//,"").split(/\/(.+)/);return"string"==typeof s?s.endsWith(i)?s+"/"+o:s+"/"+i+"/"+o:s instanceof Function?s(i)+"/"+o:"object"==typeof s?i in s?s[i]+"/"+o:null:void 0}function y(t){const i=[...t.children],e=new l;return e.name=t.getAttribute("name")||"",i.forEach(t=>{const i=t.nodeName.toLowerCase();if("color"===i){const i=t.getAttribute("rgba").split(/\s/g).map(t=>parseFloat(t));e.color.setRGB(i[0],i[1],i[2]),e.opacity=i[3],e.transparent=i[3]<1,e.depthWrite=!e.transparent}else if("texture"===i){const i=t.getAttribute("filename");if(i){const t=new u(p),s=w(i);e.map=t.load(s),e.map.colorSpace=h}}}),e}function V(t,i={}){const e="collision"===t.nodeName.toLowerCase(),s=[...t.children];let n=null;const r=s.filter(t=>"material"===t.nodeName.toLowerCase())[0];if(r){const t=r.getAttribute("name");n=t&&t in i?i[t]:y(r)}else n=new l;const u=e?new A:new F;return u.urdfNode=t,s.forEach(t=>{const i=t.nodeName.toLowerCase();if("geometry"===i){const i=t.children[0].nodeName.toLowerCase();if("mesh"===i){const i=w(t.children[0].getAttribute("filename"));if(null!==i){const e=t.children[0].getAttribute("scale");if(e){const t=E(e);u.scale.set(t[0],t[1],t[2])}o(i,p,(t,i)=>{i||t&&(t instanceof a&&(t.material=n),t.position.set(0,0,0),t.quaternion.identity(),u.add(t))})}}else if("box"===i){const i=new a;i.geometry=new c(1,1,1),i.material=n;const e=E(t.children[0].getAttribute("size"));i.scale.set(e[0],e[1],e[2]),u.add(i)}else if("sphere"===i){const i=new a;i.geometry=new m(1,30,30),i.material=n;const e=parseFloat(t.children[0].getAttribute("radius"))||0;i.scale.set(e,e,e),u.add(i)}else if("cylinder"===i){const i=new a;i.geometry=new d(1,1,1,30),i.material=n;const e=parseFloat(t.children[0].getAttribute("radius"))||0,s=parseFloat(t.children[0].getAttribute("length"))||0;i.scale.set(e,s,e),i.rotation.set(Math.PI/2,0,0),u.add(i)}}else if("origin"===i){const i=E(t.getAttribute("xyz")),e=E(t.getAttribute("rpy"));u.position.set(i[0],i[1],i[2]),u.rotation.set(0,0,0),D(u,e)}}),u}return function(i){let e;if(i instanceof Document)e=[...i.children];else if(i instanceof Element)e=[i];else{e=[...(new DOMParser).parseFromString(i,"text/xml").children]}return function(i){const e=[...i.children],s=e.filter(t=>"link"===t.nodeName.toLowerCase()),o=e.filter(t=>"joint"===t.nodeName.toLowerCase()),a=e.filter(t=>"material"===t.nodeName.toLowerCase()),l=new R;l.robotName=i.getAttribute("name"),l.urdfRobotNode=i,a.forEach(t=>{const i=t.getAttribute("name");j[i]=y(t)});const u={},h={};s.forEach(t=>{const e=t.getAttribute("name"),s=null===i.querySelector(`child[link="${e}"]`);f[e]=function(t,i,e,s=null){null===s&&(s=new L);const o=[...t.children];if(s.name=t.getAttribute("name"),s.urdfName=s.name,s.urdfNode=t,n){o.filter(t=>"visual"===t.nodeName.toLowerCase()).forEach(t=>{const e=V(t,j);if(s.add(e),t.hasAttribute("name")){const s=t.getAttribute("name");e.name=s,e.urdfName=s,i[s]=e}})}if(r){o.filter(t=>"collision"===t.nodeName.toLowerCase()).forEach(t=>{const i=V(t);if(s.add(i),t.hasAttribute("name")){const s=t.getAttribute("name");i.name=s,i.urdfName=s,e[s]=i}})}return s}(t,u,h,s?l:null)}),o.forEach(i=>{const e=i.getAttribute("name");g[e]=function(i){const e=[...i.children],s=i.getAttribute("type");let o;const n=e.find(t=>"mimic"===t.nodeName.toLowerCase());n?(o=new J,o.mimicJoint=n.getAttribute("joint"),o.multiplier=parseFloat(n.getAttribute("multiplier")||1),o.offset=parseFloat(n.getAttribute("offset")||0)):o=new k;o.urdfNode=i,o.name=i.getAttribute("name"),o.urdfName=o.name,o.jointType=s;let r=null,a=null,l=[0,0,0],u=[0,0,0];e.forEach(t=>{const i=t.nodeName.toLowerCase();"origin"===i?(l=E(t.getAttribute("xyz")),u=E(t.getAttribute("rpy"))):"child"===i?a=f[t.getAttribute("link")]:"parent"===i?r=f[t.getAttribute("link")]:"limit"===i&&(o.limit.lower=parseFloat(t.getAttribute("lower")||o.limit.lower),o.limit.upper=parseFloat(t.getAttribute("upper")||o.limit.upper))}),r.add(o),o.add(a),D(o,u),o.position.set(l[0],l[1],l[2]);const h=e.filter(t=>"axis"===t.nodeName.toLowerCase())[0];if(h){const i=h.getAttribute("xyz").split(/\s+/g).map(t=>parseFloat(t));o.axis=new t(i[0],i[1],i[2]),o.axis.normalize()}return o}(i)}),l.joints=g,l.links=f,l.colliders=h,l.visual=u;const c=Object.values(g);return c.forEach(t=>{t instanceof J&&g[t.mimicJoint].mimicJoints.push(t)}),c.forEach(t=>{const i=new Set,e=t=>{if(i.has(t))throw new Error("URDFLoader: Detected an infinite loop of mimic joints.");i.add(t),t.mimicJoints.forEach(t=>{e(t)})};e(t)}),l.frames={...h,...u,...f,...g},l}(e.filter(t=>"robot"===t.nodeName).pop())}(i)}defaultMeshLoader(t,i,e){if(/\.stl$/i.test(t)){new p(i).load(t,t=>{const i=new a(t,new l);e(i)})}else if(/\.dae$/i.test(t)){new f(i).load(t,t=>e(t.scene))}}}export{M as default};
@@ -0,0 +1,7 @@
1
+ import{Loader as e,FileLoader as r,Group as n,Mesh as t,Object3D as o,BufferGeometry as a,BufferAttribute as i,MeshPhysicalMaterial as s,SRGBColorSpace as f,NoColorSpace as c,TextureLoader as l,Vector2 as u,ClampToEdgeWrapping as p,MirroredRepeatWrapping as d,RepeatWrapping as m}from"./three-9c891de0.js";
2
+ /*!
3
+ fflate - fast JavaScript compression/decompression
4
+ <https://101arrowz.github.io/fflate>
5
+ Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
6
+ version 0.8.2
7
+ */var h=Uint8Array,v=Uint16Array,g=Int32Array,w=new h([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),S=new h([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),y=new h([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x=function(e,r){for(var n=new v(31),t=0;t<31;++t)n[t]=r+=1<<e[t-1];var o=new g(n[30]);for(t=1;t<30;++t)for(var a=n[t];a<n[t+1];++a)o[a]=a-n[t]<<5|t;return{b:n,r:o}},b=x(w,2),C=b.b,M=b.r;C[28]=258,M[258]=28;for(var T=x(S,0).b,_=new v(32768),A=0;A<32768;++A){var W=(43690&A)>>1|(21845&A)<<1;W=(61680&(W=(52428&W)>>2|(13107&W)<<2))>>4|(3855&W)<<4,_[A]=((65280&W)>>8|(255&W)<<8)>>1}var R=function(e,r,n){for(var t=e.length,o=0,a=new v(r);o<t;++o)e[o]&&++a[e[o]-1];var i,s=new v(r);for(o=1;o<r;++o)s[o]=s[o-1]+a[o-1]<<1;if(n){i=new v(1<<r);var f=15-r;for(o=0;o<t;++o)if(e[o])for(var c=o<<4|e[o],l=r-e[o],u=s[e[o]-1]++<<l,p=u|(1<<l)-1;u<=p;++u)i[_[u]>>f]=c}else for(i=new v(t),o=0;o<t;++o)e[o]&&(i[o]=_[s[e[o]-1]++]>>15-e[o]);return i},k=new h(288);for(A=0;A<144;++A)k[A]=8;for(A=144;A<256;++A)k[A]=9;for(A=256;A<280;++A)k[A]=7;for(A=280;A<288;++A)k[A]=8;var O=new h(32);for(A=0;A<32;++A)O[A]=5;var N=R(k,9,1),F=R(O,5,1),J=function(e){for(var r=e[0],n=1;n<e.length;++n)e[n]>r&&(r=e[n]);return r},U=function(e,r,n){var t=r/8|0;return(e[t]|e[t+1]<<8)>>(7&r)&n},j=function(e,r){var n=r/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&r)},E=function(e){return(e+7)/8|0},I=function(e,r,n){return(null==r||r<0)&&(r=0),(null==n||n>e.length)&&(n=e.length),new h(e.subarray(r,n))},$=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],z=function(e,r,n){var t=new Error(r||$[e]);if(t.code=e,Error.captureStackTrace&&Error.captureStackTrace(t,z),!n)throw t;return t},q=new h(0),P=function(e,r){return e[r]|e[r+1]<<8},V=function(e,r){return(e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)>>>0},X=function(e,r){return V(e,r)+4294967296*V(e,r+4)};function D(e,r){return function(e,r,n,t){var o=e.length,a=t?t.length:0;if(!o||r.f&&!r.l)return n||new h(0);var i=!n,s=i||2!=r.i,f=r.i;i&&(n=new h(3*o));var c=function(e){var r=n.length;if(e>r){var t=new h(Math.max(2*r,e));t.set(n),n=t}},l=r.f||0,u=r.p||0,p=r.b||0,d=r.l,m=r.d,v=r.m,g=r.n,x=8*o;do{if(!d){l=U(e,u,1);var b=U(e,u+1,3);if(u+=3,!b){var M=e[(D=E(u)+4)-4]|e[D-3]<<8,_=D+M;if(_>o){f&&z(0);break}s&&c(p+M),n.set(e.subarray(D,_),p),r.b=p+=M,r.p=u=8*_,r.f=l;continue}if(1==b)d=N,m=F,v=9,g=5;else if(2==b){var A=U(e,u,31)+257,W=U(e,u+10,15)+4,k=A+U(e,u+5,31)+1;u+=14;for(var O=new h(k),$=new h(19),q=0;q<W;++q)$[y[q]]=U(e,u+3*q,7);u+=3*W;var P=J($),V=(1<<P)-1,X=R($,P,1);for(q=0;q<k;){var D,H=X[U(e,u,V)];if(u+=15&H,(D=H>>4)<16)O[q++]=D;else{var L=0,B=0;for(16==D?(B=3+U(e,u,3),u+=2,L=O[q-1]):17==D?(B=3+U(e,u,7),u+=3):18==D&&(B=11+U(e,u,127),u+=7);B--;)O[q++]=L}}var G=O.subarray(0,A),K=O.subarray(A);v=J(G),g=J(K),d=R(G,v,1),m=R(K,g,1)}else z(1);if(u>x){f&&z(0);break}}s&&c(p+131072);for(var Q=(1<<v)-1,Y=(1<<g)-1,Z=u;;Z=u){var ee=(L=d[j(e,u)&Q])>>4;if((u+=15&L)>x){f&&z(0);break}if(L||z(2),ee<256)n[p++]=ee;else{if(256==ee){Z=u,d=null;break}var re=ee-254;if(ee>264){var ne=w[q=ee-257];re=U(e,u,(1<<ne)-1)+C[q],u+=ne}var te=m[j(e,u)&Y],oe=te>>4;if(te||z(3),u+=15&te,K=T[oe],oe>3&&(ne=S[oe],K+=j(e,u)&(1<<ne)-1,u+=ne),u>x){f&&z(0);break}s&&c(p+131072);var ae=p+re;if(p<K){var ie=a-K,se=Math.min(K,ae);for(ie+p<0&&z(3);p<se;++p)n[p]=t[ie+p]}for(;p<ae;++p)n[p]=n[p-K]}}r.l=d,r.p=Z,r.b=p,r.f=l,d&&(l=1,r.m=v,r.d=m,r.n=g)}while(!l);return p!=n.length&&i?I(n,0,p):n.subarray(0,p)}(e,{i:2},r&&r.out,r&&r.dictionary)}var H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(q,{stream:!0})}catch(Z){}function L(e,r){if(r){for(var n="",t=0;t<e.length;t+=16384)n+=String.fromCharCode.apply(null,e.subarray(t,t+16384));return n}if(H)return H.decode(e);var o=function(e){for(var r="",n=0;;){var t=e[n++],o=(t>127)+(t>223)+(t>239);if(n+o>e.length)return{s:r,r:I(e,n-1)};o?3==o?(t=((15&t)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,r+=String.fromCharCode(55296|t>>10,56320|1023&t)):r+=1&o?String.fromCharCode((31&t)<<6|63&e[n++]):String.fromCharCode((15&t)<<12|(63&e[n++])<<6|63&e[n++]):r+=String.fromCharCode(t)}}(e),a=o.s;return(n=o.r).length&&z(8),a}var B=function(e,r){return r+30+P(e,r+26)+P(e,r+28)},G=function(e,r,n){var t=P(e,r+28),o=L(e.subarray(r+46,r+46+t),!(2048&P(e,r+8))),a=r+46+t,i=V(e,r+20),s=n&&4294967295==i?K(e,a):[i,V(e,r+24),V(e,r+42)],f=s[0],c=s[1],l=s[2];return[P(e,r+10),f,c,o,a+P(e,r+30)+P(e,r+32),l]},K=function(e,r){for(;1!=P(e,r);r+=4+P(e,r+2));return[X(e,r+12),X(e,r+4),X(e,r+20)]};class Q{parse(e){const r={},n=e.split("\n");let t=null,o=r;const a=[r];for(const i of n)if(i.includes("=")){const e=i.split("="),r=e[0].trim(),n=e[1].trim();if(n.endsWith("{")){const e={};a.push(e),o[r]=e,o=e}else o[r]=n}else if(i.endsWith("{")){const e=o[t]||{};a.push(e),o[t]=e,o=e}else if(i.endsWith("}")){if(a.pop(),0===a.length)continue;o=a[a.length-1]}else if(i.endsWith("(")){const e={};a.push(e),t=i.split("(")[0].trim()||t,o[t]=e,o=e}else i.endsWith(")")?(a.pop(),o=a[a.length-1]):t=i.trim();return r}}class Y extends e{constructor(e){super(e)}load(e,n,t,o){const a=this,i=new r(a.manager);i.setPath(a.path),i.setResponseType("arraybuffer"),i.setRequestHeader(a.requestHeader),i.setWithCredentials(a.withCredentials),i.load(e,function(r){try{n(a.parse(r))}catch(Z){o&&o(Z),a.manager.itemError(e)}},t,o)}parse(e){const v=new Q;function g(e){const r=e.slice(0,7),n=new Uint8Array([80,88,82,45,85,83,68,67]);return r.every((e,r)=>e===n[r])}const w=function(e,r){for(var n={},t=e.length-22;101010256!=V(e,t);--t)(!t||e.length-t>65558)&&z(13);var o=P(e,t+8);if(!o)return{};var a=V(e,t+16),i=4294967295==a||65535==o;if(i){var s=V(e,t-12);(i=101075792==V(e,s))&&(o=V(e,s+32),a=V(e,s+48))}for(var f=r&&r.filter,c=0;c<o;++c){var l=G(e,a,i),u=l[0],p=l[1],d=l[2],m=l[3],v=l[4],g=l[5],w=B(e,g);a=v,f&&!f({name:m,size:p,originalSize:d,compression:u})||(u?8==u?n[m]=D(e.subarray(w,w+p),{out:new h(d)}):z(14,"unknown compression type "+u):n[m]=I(e,w,w+p))}return n}(new Uint8Array(e)),S=function(e){const n={};(new r).setResponseType("arraybuffer");for(const r in e){if(r.endsWith("png")){const t=new Blob([e[r]],{type:{type:"image/png"}});n[r]=URL.createObjectURL(t)}if(r.endsWith("usd")||r.endsWith("usda")){if(g(e[r]))continue;const t=L(e[r]);n[r]=v.parse(t)}}return n}(w),y=function(e){if(e.length<1)return;const r=Object.keys(e)[0];let n=!1;if(r.endsWith("usda"))return e[r];if(r.endsWith("usdc"))n=!0;else if(r.endsWith("usd")){if(!g(e[r]))return e[r];n=!0}}(w);if(void 0===y)return new n;const x=L(y),b=v.parse(x);function C(e,r){if(e){if(void 0!==r){const n=`def Mesh "${r}"`;if(n in e)return e[n]}for(const r in e){const n=e[r];if(r.startsWith("def Mesh"))return"point3f[] points"in e&&(n["point3f[] points"]=e["point3f[] points"]),"texCoord2f[] primvars:st"in e&&(n["texCoord2f[] primvars:st"]=e["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in e&&(n["int[] primvars:st:indices"]=e["int[] primvars:st:indices"]),n;if("object"==typeof n){const e=C(n);if(e)return e}}}}function M(e){if(!e)return;let r=new a;if("int[] faceVertexIndices"in e){const n=JSON.parse(e["int[] faceVertexIndices"]);r.setIndex(n)}if("point3f[] points"in e){const n=JSON.parse(e["point3f[] points"].replace(/[()]*/g,"")),t=new i(new Float32Array(n),3);r.setAttribute("position",t)}if("normal3f[] normals"in e){const n=JSON.parse(e["normal3f[] normals"].replace(/[()]*/g,"")),t=new i(new Float32Array(n),3);r.setAttribute("normal",t)}else r.computeVertexNormals();if("float2[] primvars:st"in e&&(e["texCoord2f[] primvars:st"]=e["float2[] primvars:st"]),"texCoord2f[] primvars:st"in e){const n=JSON.parse(e["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),t=new i(new Float32Array(n),2);if("int[] primvars:st:indices"in e){r=r.toNonIndexed();const n=JSON.parse(e["int[] primvars:st:indices"]);r.setAttribute("uv",function(e,r){const n=e.array,t=e.itemSize,o=new n.constructor(r.length*t);let a=0,s=0;for(let i=0,f=r.length;i<f;i++){a=r[i]*t;for(let e=0;e<t;e++)o[s++]=n[a++]}return new i(o,t)}(t,n))}else r.setAttribute("uv",t)}return r}function T(e,r=""){for(const n in e){const t=e[n];if(n.startsWith("def Material"+r))return t;if("object"==typeof t){const e=T(t,r);if(e)return e}}}function _(e,r){r["float inputs:rotation"]&&(e.rotation=parseFloat(r["float inputs:rotation"])),r["float2 inputs:scale"]&&(e.repeat=(new u).fromArray(JSON.parse("["+r["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),r["float2 inputs:translation"]&&(e.offset=(new u).fromArray(JSON.parse("["+r["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function A(e,r){for(const n in e){const t=e[n];if(n.startsWith(`def Shader "${r}"`))return t;if("object"==typeof t){const e=A(t,r);if(e)return e}}}function W(e){if("asset inputs:file"in e){const r=e["asset inputs:file"].replace(/@*/g,""),n=(new l).load(S[r]),t={'"clamp"':p,'"mirror"':d,'"repeat"':m};return"token inputs:wrapS"in e&&(n.wrapS=t[e["token inputs:wrapS"]]),"token inputs:wrapT"in e&&(n.wrapT=t[e["token inputs:wrapT"]]),n}return null}function R(e){const r=M(function(e){if(e){if("prepend references"in e){const r=e["prepend references"].split("@"),n=r[1].replace(/^.\//,""),t=r[2].replace(/^<\//,"").replace(/>$/,"");return C(S[n],t)}return C(e)}}(e)),n=function(e){const r=new s;if(void 0!==e){if('def Shader "PreviewSurface"'in e){const n=e['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in n){const t=n["color3f inputs:diffuseColor.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.map=W(o),r.map.colorSpace=f,'def Shader "Transform2d_diffuse"'in e&&_(r.map,e['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in n){const e=n["color3f inputs:diffuseColor"].replace(/[()]*/g,"");r.color.fromArray(JSON.parse("["+e+"]"))}if("color3f inputs:emissiveColor.connect"in n){const t=n["color3f inputs:emissiveColor.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.emissiveMap=W(o),r.emissiveMap.colorSpace=f,r.emissive.set(16777215),'def Shader "Transform2d_emissive"'in e&&_(r.emissiveMap,e['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in n){const e=n["color3f inputs:emissiveColor"].replace(/[()]*/g,"");r.emissive.fromArray(JSON.parse("["+e+"]"))}if("normal3f inputs:normal.connect"in n){const t=n["normal3f inputs:normal.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.normalMap=W(o),r.normalMap.colorSpace=c,'def Shader "Transform2d_normal"'in e&&_(r.normalMap,e['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in n){const t=n["float inputs:roughness.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.roughness=1,r.roughnessMap=W(o),r.roughnessMap.colorSpace=c,'def Shader "Transform2d_roughness"'in e&&_(r.roughnessMap,e['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in n&&(r.roughness=parseFloat(n["float inputs:roughness"]));if("float inputs:metallic.connect"in n){const t=n["float inputs:metallic.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.metalness=1,r.metalnessMap=W(o),r.metalnessMap.colorSpace=c,'def Shader "Transform2d_metallic"'in e&&_(r.metalnessMap,e['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in n&&(r.metalness=parseFloat(n["float inputs:metallic"]));if("float inputs:clearcoat.connect"in n){const t=n["float inputs:clearcoat.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.clearcoat=1,r.clearcoatMap=W(o),r.clearcoatMap.colorSpace=c,'def Shader "Transform2d_clearcoat"'in e&&_(r.clearcoatMap,e['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in n&&(r.clearcoat=parseFloat(n["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in n){const t=n["float inputs:clearcoatRoughness.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.clearcoatRoughness=1,r.clearcoatRoughnessMap=W(o),r.clearcoatRoughnessMap.colorSpace=c,'def Shader "Transform2d_clearcoatRoughness"'in e&&_(r.clearcoatRoughnessMap,e['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in n&&(r.clearcoatRoughness=parseFloat(n["float inputs:clearcoatRoughness"]));if("float inputs:ior"in n&&(r.ior=parseFloat(n["float inputs:ior"])),"float inputs:occlusion.connect"in n){const t=n["float inputs:occlusion.connect"],o=A(b,/(\w+).output/.exec(t)[1]);r.aoMap=W(o),r.aoMap.colorSpace=c,'def Shader "Transform2d_occlusion"'in e&&_(r.aoMap,e['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in e){const n=e['def Shader "diffuseColor_texture"'];r.map=W(n),r.map.colorSpace=f}if('def Shader "normal_texture"'in e){const n=e['def Shader "normal_texture"'];r.normalMap=W(n),r.normalMap.colorSpace=c}}return r}(function(e){if(e){if("rel material:binding"in e){const r=e["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return T(b,` "${r[1]}"`)}return T(e)}}(e)),a=r?new t(r,n):new o;if("matrix4d xformOp:transform"in e){const r=JSON.parse("["+e["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");a.matrix.fromArray(r),a.matrix.decompose(a.position,a.quaternion,a.scale)}return a}const k=new n;return function e(r,n){for(const t in r)if(t.startsWith("def Scope"))e(r[t],n);else if(t.startsWith("def Xform")){const o=R(r[t]);/def Xform "(\w+)"/.test(t)&&(o.name=/def Xform "(\w+)"/.exec(t)[1]),n.add(o),e(r[t],o)}}(b,k),k}}export{Y as USDZLoader};
@@ -0,0 +1 @@
1
+ const t={};export{t as default};