@volter/model-editor 0.5.66 → 0.5.67
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/dist/.vite/manifest.json +1022 -1006
- package/dist/assets/AudioViewer-DVXaSSYC.js +1 -0
- package/dist/assets/{BVHLoader-xUHWsz84.js → BVHLoader-msuIvJVn.js} +1 -1
- package/dist/assets/ColladaLoader-BpvxwqkB.js +3 -0
- package/dist/assets/EntityModelDocument-BtlQZcoU.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-BH3zT9rt.js +1 -0
- package/dist/assets/FBXLoader-CsdO937F.js +1 -0
- package/dist/assets/{GameplaySessionTimeline-HJLZUV4Q.js → GameplaySessionTimeline-Dko95kB7.js} +10 -10
- package/dist/assets/ImageViewer-CZ_RMER2.js +1 -0
- package/dist/assets/{InspectorCanvasPreview-CLDhscy0.js → InspectorCanvasPreview-BLecDHpc.js} +1 -1
- package/dist/assets/InspectorObjectPreview-CSIWwJQE.js +1 -0
- package/dist/assets/JsonAssetDocument-CGYSeJyl.js +2 -0
- package/dist/assets/{LineSegments2-C8H20K8w.js → LineSegments2-BKEsgiC8.js} +2 -2
- package/dist/assets/LiveModuleDocument-CIvS-SUT.js +2 -0
- package/dist/assets/LutAssetDocument-BA70uU3w.js +1 -0
- package/dist/assets/{MTLLoader-C-rA0fNF.js → MTLLoader-DNh2pFDc.js} +2 -2
- package/dist/assets/ModelAssetDocument-D0lNEhOg.js +1 -0
- package/dist/assets/NonThreeAuthoringBootstrap-C0pCfkJ4.js +2 -0
- package/dist/assets/OBJLoader-DPi99VIm.js +5 -0
- package/dist/assets/Object3DDocumentToolbar-PGYkZEwr.js +1 -0
- package/dist/assets/Object3DPreview-BROKXSTC.js +2 -0
- package/dist/assets/OnlineAssetDetail-lEHnhdUS.js +1 -0
- package/dist/assets/OrbitControls-smIenN60.js +1 -0
- package/dist/assets/PLYLoader-Cx9Yc9xe.js +2 -0
- package/dist/assets/QuarksAssetDocument-C_8eG4KG.js +2 -0
- package/dist/assets/RectAreaLightUniformsLib-Iam8rS8R.js +1 -0
- package/dist/assets/STLLoader-BaJkM-k1.js +1 -0
- package/dist/assets/{ShaderAssetDocument-qlLeb2S3.js → ShaderAssetDocument-Gdp7OCfv.js} +5 -5
- package/dist/assets/SourceAssetViewer-l72u0hOa.js +1 -0
- package/dist/assets/StageHost-CdzuP0NS.js +1179 -0
- package/dist/assets/TDSLoader-BskhMiUy.js +1 -0
- package/dist/assets/ToolObject3DPreview-CU5klD6l.js +1 -0
- package/dist/assets/Toolbar-DI0LGx25.js +1 -0
- package/dist/assets/TransientHint-myZtSdd6.js +1 -0
- package/dist/assets/VideoViewer-z0JPXPKa.js +1 -0
- package/dist/assets/ViewportShadingMenu-CVU2bU_3.js +1 -0
- package/dist/assets/animation-mixers.service-DSIsxWG5.js +1 -0
- package/dist/assets/animation-timeline.utility-BEgDQC04.js +1 -0
- package/dist/assets/asset-editor-persistence-BtRQI8t6.js +1 -0
- package/dist/assets/bitmap-label-Ct4k6ehY.js +1 -0
- package/dist/assets/{blender-emscripten-engine-CEsWgnR7.js → blender-emscripten-engine-BeWFjMn-.js} +1 -1
- package/dist/assets/blender-node-editor.document-C_kpsARB.js +1 -0
- package/dist/assets/{blender-properties-tab-C5tUuCSv.js → blender-properties-tab-B_XBg6S8.js} +3 -3
- package/dist/assets/blender-runtime-host-CYhl4T9S.js +4 -0
- package/dist/assets/{blender-runtime-skin-DMq0XAvO.js → blender-runtime-skin-Bk6uXECD.js} +98 -51
- package/dist/assets/blender-runtime.document-CAPDRCvN.js +12 -0
- package/dist/assets/blender-timeline.document-CcEymQyL.js +1 -0
- package/dist/assets/blender-uv-editor.document-DSPvSEuE.js +1 -0
- package/dist/assets/blender-version.status-CEu7vCi3.js +1 -0
- package/dist/assets/{blender-wali-engine-D3iKpzn9.js → blender-wali-engine-da698rDf.js} +1 -1
- package/dist/assets/blender.command-BCb_c9lw.js +1 -0
- package/dist/assets/blender.keymap-_rF_vRX8.js +1 -0
- package/dist/assets/{blender.status-ujwGU6dU.js → blender.status-DrasQhJV.js} +1 -1
- package/dist/assets/{blender.style-CxfbTFcE.js → blender.style-DaIh9SiA.js} +1 -1
- package/dist/assets/{client-DNXj_opT.js → client-mkWk8S65.js} +1 -1
- package/dist/assets/content-bounds-_QWiKD5_.js +85 -0
- package/dist/assets/{hosted-asset-materialization-BXM49Qkc.js → hosted-asset-materialization-hUS3IhTD.js} +2 -2
- package/dist/assets/index-0Lm0Nf1M.css +1 -0
- package/dist/assets/{index-CJbYy-CF.js → index-7vd2obXq.js} +2 -2
- package/dist/assets/{index-DgapqSPi.js → index-BRLA7zdc.js} +1 -1
- package/dist/assets/{index-BtfYaG4D.js → index-CQG6JOSy.js} +18 -18
- package/dist/assets/{index-CanA16PU.js → index-CnvSS9lU.js} +1 -1
- package/dist/assets/{index-Bge9JUr6.js → index-DYNMP0kE.js} +1 -1
- package/dist/assets/index-Dm_h-T4x.js +1406 -0
- package/dist/assets/{index-gHZae-lw.js → index-Dz8qGBZc.js} +1 -1
- package/dist/assets/{index-BncK9THk.js → index-Fv4R0cYr.js} +1 -1
- package/dist/assets/{index-IEjydI9d.js → index-f-MQ14bP.js} +1 -1
- package/dist/assets/{index-D2LwEE0L.js → index-jib6KJY8.js} +6 -6
- package/dist/assets/{index-DUqP1RMl.js → index-ux8XhRyW.js} +1 -1
- package/dist/assets/{jsx-runtime-DPjLkJKQ.js → jsx-runtime-CAUTK36e.js} +1 -1
- package/dist/assets/layered-pick-CT4HlEpW.js +1 -0
- package/dist/assets/live-mixers-B-bwLZ7c.js +1 -0
- package/dist/assets/model-inspection-DDZE59vp.js +1 -0
- package/dist/assets/models.finder-Caf-3Yix.js +1 -0
- package/dist/assets/product-DbFrUS6F.js +1 -0
- package/dist/assets/properties-bone-constraints.inspector-DB3Rc_Hf.js +1 -0
- package/dist/assets/properties-bone.inspector-B7f7H_Co.js +1 -0
- package/dist/assets/properties-collection.inspector-JCtV3h3Y.js +1 -0
- package/dist/assets/properties-constraints.inspector-Cs8MwS-1.js +1 -0
- package/dist/assets/properties-data.inspector-DKGiHu8O.js +1 -0
- package/dist/assets/properties-material.inspector-Dc18RI13.js +1 -0
- package/dist/assets/properties-modifiers.inspector-DvGvXq2v.js +1 -0
- package/dist/assets/properties-object.inspector-Bl9nrytP.js +1 -0
- package/dist/assets/properties-output.inspector-B6QsU94n.js +1 -0
- package/dist/assets/properties-particles.inspector-B1dMnZSA.js +1 -0
- package/dist/assets/properties-physics.inspector-BwfNykfW.js +1 -0
- package/dist/assets/properties-render.inspector-KrL2EiTH.js +1 -0
- package/dist/assets/properties-scene.inspector-CewQnyRt.js +1 -0
- package/dist/assets/properties-texture.inspector-BITMzY-f.js +1 -0
- package/dist/assets/properties-view-layer.inspector-BpkDbmcb.js +1 -0
- package/dist/assets/properties-world.inspector-DLRH45Oj.js +1 -0
- package/dist/assets/{react-18-DyywM-Z2.js → react-18-D335xReo.js} +1 -1
- package/dist/assets/{react-story-board-B9V-j_Y5.js → react-story-board-CkaP4mEG.js} +1 -1
- package/dist/assets/{session-CsR0lApe.js → session-CTXsU1lK.js} +176 -1
- package/dist/assets/{spark.module-gG1EsWx8.js → spark.module-DMQ9J7rT.js} +11 -11
- package/dist/assets/stage-keyboard-BY7u9_MB.js +1 -0
- package/dist/assets/stage-overlay-set-DRFcVd27.js +1 -0
- package/dist/assets/stage-presence-markers-D2IpuOAY.js +1 -0
- package/dist/assets/stage-transform-tools-BGcIULoe.js +1 -0
- package/dist/assets/story-capture-RSWY8I8h.js +1 -0
- package/dist/assets/three-integration.service-0EyPpd5f.js +4 -0
- package/dist/assets/{three.module-ZILb6uB7.js → three.module-CrYDk-Xr.js} +1 -1
- package/dist/assets/transform-mode-request-Cz6fzydi.js +1 -0
- package/dist/assets/transport-strip-Co-ZDkf-.js +1 -0
- package/dist/assets/{vgai-shared-fontawesome-CFSkqz69.js → vgai-shared-fontawesome-2ZSGa7vM.js} +1 -1
- package/dist/assets/vgai-shared-jsx-dev-runtime-hkPLeIJV.js +1 -0
- package/dist/assets/vgai-shared-jsx-runtime-CUvvjEqj.js +1 -0
- package/dist/assets/{vgai-shared-react-dom-client-S0ozfl6_.js → vgai-shared-react-dom-client-CS681GK2.js} +1 -1
- package/dist/assets/{vgai-shared-three-DzfWDqlp.js → vgai-shared-three-CLJ0K3jQ.js} +1 -1
- package/dist/assets/viewport-door-BdL0u5rd.js +1 -0
- package/dist/assets/viewport-editor-controls-BYaAZ_Ku.js +1 -0
- package/dist/assets/viewport-surface-status-yS6CrXH7.js +24 -0
- package/dist/assets/{worker-B7zhIsFh.js → worker-CC9Ug5Ei.js} +1 -1
- package/dist/assets/world-documents-B5IWN-ng.js +3 -0
- package/dist/vgai-shared-react.json +4 -4
- package/dist/vgai-shared-three.json +1 -1
- package/dist-node/cli.js +248 -209
- package/dist-node/create.js +77 -77
- package/package.json +10 -10
- package/src/index.ts +1 -0
- package/dist/assets/AudioViewer-CRWsJVYN.js +0 -1
- package/dist/assets/ColladaLoader-Ccy_gHsu.js +0 -3
- package/dist/assets/EntityModelDocument-Dal8YnLK.js +0 -1
- package/dist/assets/EnvironmentAssetDocument-DFOFYX5v.js +0 -1
- package/dist/assets/FBXLoader-Dh0pOBW2.js +0 -1
- package/dist/assets/ImageViewer-BzqBpqL-.js +0 -1
- package/dist/assets/InspectorObjectPreview-BUZEp4xS.js +0 -1
- package/dist/assets/JsonAssetDocument-DCkqRS0N.js +0 -2
- package/dist/assets/LiveModuleDocument-CuOBVz3A.js +0 -2
- package/dist/assets/LutAssetDocument-IyEir1rq.js +0 -1
- package/dist/assets/ModelAssetDocument-DNStNyCc.js +0 -1
- package/dist/assets/NonThreeAuthoringBootstrap-BE15Wpmw.js +0 -2
- package/dist/assets/OBJLoader-CopWRneC.js +0 -5
- package/dist/assets/Object3DDocumentToolbar-5Dv_8caG.js +0 -1
- package/dist/assets/Object3DPreview-C09u9uQZ.js +0 -2
- package/dist/assets/OnlineAssetDetail-DOPUI1iu.js +0 -1
- package/dist/assets/OrbitControls-DrFzvAAB.js +0 -1
- package/dist/assets/PLYLoader-D_esTZ2f.js +0 -2
- package/dist/assets/QuarksAssetDocument-BbSJ970L.js +0 -2
- package/dist/assets/RectAreaLightUniformsLib-u1ciScuw.js +0 -1
- package/dist/assets/STLLoader-Cl5I0sAi.js +0 -1
- package/dist/assets/SourceAssetViewer-DwhuqbA4.js +0 -1
- package/dist/assets/StageHost-D-o8MsFS.js +0 -1122
- package/dist/assets/TDSLoader-KKBg8ef1.js +0 -1
- package/dist/assets/ToolObject3DPreview-ILbch3kN.js +0 -1
- package/dist/assets/Toolbar-DYJjJKTt.js +0 -1
- package/dist/assets/TransientHint-D94hsJSR.js +0 -1
- package/dist/assets/VideoViewer-Bx3FPbgE.js +0 -1
- package/dist/assets/ViewportShadingMenu-B3N6hSdN.js +0 -1
- package/dist/assets/animation-mixers.service-N9HxGOMf.js +0 -1
- package/dist/assets/asset-editor-persistence-DGD05u26.js +0 -1
- package/dist/assets/blender-node-editor.document-BT2M622g.js +0 -1
- package/dist/assets/blender-runtime-host-4ufXy47O.js +0 -4
- package/dist/assets/blender-runtime.document-DeFQQsF6.js +0 -8
- package/dist/assets/blender-timeline.document-BnlSdxy0.js +0 -1
- package/dist/assets/blender-uv-editor.document-UC-XeNn0.js +0 -1
- package/dist/assets/blender-version.status-BZP39oH7.js +0 -1
- package/dist/assets/blender.command-IGP5wuda.js +0 -1
- package/dist/assets/blender.keymap-GAQgeklK.js +0 -1
- package/dist/assets/browserAll-2r3AVaAO.js +0 -14
- package/dist/assets/canvas-preview-frames-CO60PDM7.js +0 -5
- package/dist/assets/index-B4bmKkgY.css +0 -1
- package/dist/assets/index-cpXNKgvz.js +0 -1498
- package/dist/assets/live-mixers-BRkRHd6g.js +0 -1
- package/dist/assets/material-preview.view-DqNcpd_b.js +0 -1
- package/dist/assets/model-inspection-JC6gbV8Q.js +0 -1
- package/dist/assets/models.finder-BplPGS4I.js +0 -1
- package/dist/assets/product-CfZaqLpw.js +0 -1
- package/dist/assets/properties-bone-constraints.inspector-Di8kNtAi.js +0 -1
- package/dist/assets/properties-bone.inspector-CqAIKNsE.js +0 -1
- package/dist/assets/properties-collection.inspector-DpHC_fXW.js +0 -1
- package/dist/assets/properties-constraints.inspector-C7G7NOZU.js +0 -1
- package/dist/assets/properties-data.inspector-D1sUUst6.js +0 -1
- package/dist/assets/properties-material.inspector-BUSjc8tl.js +0 -1
- package/dist/assets/properties-modifiers.inspector-Sq9bcfFz.js +0 -1
- package/dist/assets/properties-object.inspector-BzqiU_29.js +0 -1
- package/dist/assets/properties-output.inspector-BWpFqvfT.js +0 -1
- package/dist/assets/properties-particles.inspector-DO1KoaTz.js +0 -1
- package/dist/assets/properties-physics.inspector-BgkrTNSA.js +0 -1
- package/dist/assets/properties-render.inspector-BU5NOVoQ.js +0 -1
- package/dist/assets/properties-scene.inspector-DbMErJ48.js +0 -1
- package/dist/assets/properties-texture.inspector-toPpEwqp.js +0 -1
- package/dist/assets/properties-view-layer.inspector-COpx9iEK.js +0 -1
- package/dist/assets/properties-world.inspector-CxU0DrYX.js +0 -1
- package/dist/assets/react-three-rapier.esm-CN6t4A7c.js +0 -1
- package/dist/assets/stage-keyboard-CzlqI0nh.js +0 -1
- package/dist/assets/stage-overlay-set-DQeskS16.js +0 -1
- package/dist/assets/stage-presence-markers-S1lMOwIa.js +0 -1
- package/dist/assets/stage-transform-tools-Cqtv-ZQ1.js +0 -1
- package/dist/assets/story-capture-DmIUyEQn.js +0 -1
- package/dist/assets/story-mount-turn-2IYGgHob.js +0 -1
- package/dist/assets/story-pixi-preview-aw8xQhvF.js +0 -1
- package/dist/assets/story-three-preview-DDmMjlI8.js +0 -37
- package/dist/assets/transform-mode-request-DSPwviXs.js +0 -1
- package/dist/assets/vgai-shared-jsx-dev-runtime-DFDKL7fx.js +0 -1
- package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +0 -1
- package/dist/assets/viewport-pick-context-DkawXbEi.js +0 -1
- package/dist/assets/viewport-surface-status-DuININWe.js +0 -20
- package/dist/assets/webworkerAll-CqQUotBj.js +0 -101
- package/dist/assets/world-documents-DkBqH8VU.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-CAUTK36e.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{al as r,aS as k,aT as w,aU as z,aV as C}from"./index-Dm_h-T4x.js";import"./index-jib6KJY8.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-mkWk8S65.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function L({assetPath:s}){const i=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,g]=l.useState(!1),[v,y]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{i.current?.pause()},[]);const S=()=>{const t=i.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const o=Math.floor(t/60),u=Math.floor(t%60);return`${o}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"vgai-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--vgai-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--vgai-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const o=t.currentTarget.getBoundingClientRect(),u=(t.clientX-o.left)/o.width;i.current&&(i.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--vgai-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,o)=>e.jsx("i",{style:{flex:1,height:`${20+o*37%75}%`,background:"var(--vgai-asset-icon-audio)",opacity:o/48<=c/(n||1)?1:.3}},o))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>g(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:v,onChange:t=>{const o=Number(t.target.value);y(o),i.current&&(i.current.volume=o)}})]})]}),e.jsx("audio",{ref:i,src:s,loop:h,onLoadedMetadata:()=>{i.current&&f(i.current.duration)},onTimeUpdate:()=>{i.current&&x(i.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{L as AudioViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aT as B,aU as I,ak as R,V as u,Q as N,ai as x,am as L,al as g,ao as k}from"./three.module-CrYDk-Xr.js";class A extends B{constructor(c){super(c),this.animateBonePositions=!0,this.animateBoneRotations=!0}load(c,H,d,f){const p=this,h=new I(p.manager);h.setPath(p.path),h.setRequestHeader(p.requestHeader),h.setWithCredentials(p.withCredentials),h.load(c,function(l){try{H(p.parse(l))}catch(m){f?f(m):console.error(m),p.manager.itemError(c)}},d,f)}parse(c){function H(t){l(t)!=="HIERARCHY"&&console.error("THREE.BVHLoader: HIERARCHY expected.");const s=[],n=f(t,l(t),s);l(t)!=="MOTION"&&console.error("THREE.BVHLoader: MOTION expected.");let e=l(t).split(/[\s]+/);const o=parseInt(e[1]);isNaN(o)&&console.error("THREE.BVHLoader: Failed to read number of frames."),e=l(t).split(/[\s]+/);const i=parseFloat(e[2]);isNaN(i)&&console.error("THREE.BVHLoader: Failed to read frame time.");for(let r=0;r<o;r++)e=l(t).split(/[\s]+/),d(e,r*i,n);return s}function d(t,s,n){if(n.type==="ENDSITE")return;const e={time:s,position:new u,rotation:new N};n.frames.push(e);const o=new N,i=new u(1,0,0),r=new u(0,1,0),E=new u(0,0,1);for(let a=0;a<n.channels.length;a++)switch(n.channels[a]){case"Xposition":e.position.x=parseFloat(t.shift().trim());break;case"Yposition":e.position.y=parseFloat(t.shift().trim());break;case"Zposition":e.position.z=parseFloat(t.shift().trim());break;case"Xrotation":o.setFromAxisAngle(i,parseFloat(t.shift().trim())*Math.PI/180),e.rotation.multiply(o);break;case"Yrotation":o.setFromAxisAngle(r,parseFloat(t.shift().trim())*Math.PI/180),e.rotation.multiply(o);break;case"Zrotation":o.setFromAxisAngle(E,parseFloat(t.shift().trim())*Math.PI/180),e.rotation.multiply(o);break;default:console.warn("THREE.BVHLoader: Invalid channel type.")}for(let a=0;a<n.children.length;a++)d(t,s,n.children[a])}function f(t,s,n){const e={name:"",type:"",frames:[]};n.push(e);let o=s.split(/[\s]+/);o[0].toUpperCase()==="END"&&o[1].toUpperCase()==="SITE"?(e.type="ENDSITE",e.name="ENDSITE"):(e.name=o[1],e.type=o[0].toUpperCase()),l(t)!=="{"&&console.error("THREE.BVHLoader: Expected opening { after type & name"),o=l(t).split(/[\s]+/),o[0]!=="OFFSET"&&console.error("THREE.BVHLoader: Expected OFFSET but got: "+o[0]),o.length!==4&&console.error("THREE.BVHLoader: Invalid number of values for OFFSET.");const i=new u(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));if((isNaN(i.x)||isNaN(i.y)||isNaN(i.z))&&console.error("THREE.BVHLoader: Invalid values of OFFSET."),e.offset=i,e.type!=="ENDSITE"){o=l(t).split(/[\s]+/),o[0]!=="CHANNELS"&&console.error("THREE.BVHLoader: Expected CHANNELS definition.");const r=parseInt(o[1]);e.channels=o.splice(2,r),e.children=[]}for(;;){const r=l(t);if(r==="}")return e;e.children.push(f(t,r,n))}}function p(t,s){const n=new x;if(s.push(n),n.position.add(t.offset),n.name=t.name,t.type!=="ENDSITE")for(let e=0;e<t.children.length;e++)n.add(p(t.children[e],s));return n}function h(t){const s=[];for(let n=0;n<t.length;n++){const e=t[n];if(e.type==="ENDSITE")continue;const o=[],i=[],r=[];for(let E=0;E<e.frames.length;E++){const a=e.frames[E];o.push(a.time),i.push(a.position.x+e.offset.x),i.push(a.position.y+e.offset.y),i.push(a.position.z+e.offset.z),r.push(a.rotation.x),r.push(a.rotation.y),r.push(a.rotation.z),r.push(a.rotation.w)}m.animateBonePositions&&s.push(new L(e.name+".position",o,i)),m.animateBoneRotations&&s.push(new g(e.name+".quaternion",o,r))}return new k("animation",-1,s)}function l(t){let s;for(;(s=t.shift().trim()).length===0;);return s}const m=this,y=c.split(/[\r\n]+/g),T=H(y),F=[];p(T[0],F);const w=h(T);return{skeleton:new R(F),clip:w}}}export{A as BVHLoader};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{ay as kn,ac as wn,aT as it,aY as Nn,aU as An,V as $,a as X,e as at,Y as Tn,a_ as En,C as rt,j as pe,ao as ot,a6 as _n,cH as ct,aE as Ee,f as ee,g as xn,a2 as Cn,b as vn,P as lt,at as In,A as Ln,p as Rn,o as Mn,D as Sn,G as dt,Q as Gn,am as ut,al as On,B as jn,F as ne,ai as qn,a1 as ft,aj as Pn,c as Hn,b7 as Un,a0 as Bn,ak as zn,N as _e,I as ht}from"./three.module-CrYDk-Xr.js";class pt extends kn{constructor(K){super(K)}parse(K){function se(h){switch(h.image_type){case me:case z:if(h.colormap_length>256||h.colormap_size!==24||h.colormap_type!==1)throw new Error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case B:case V:case ue:case be:if(h.colormap_type)throw new Error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case Ce:throw new Error("THREE.TGALoader: No data.");default:throw new Error("THREE.TGALoader: Invalid type "+h.image_type)}if(h.width<=0||h.height<=0)throw new Error("THREE.TGALoader: Invalid image size.");if(h.pixel_size!==8&&h.pixel_size!==16&&h.pixel_size!==24&&h.pixel_size!==32)throw new Error("THREE.TGALoader: Invalid pixel size "+h.pixel_size)}function U(h,q,R,C,P){let _,v;const A=R.pixel_size>>3,N=R.width*R.height*A;if(q&&(v=P.subarray(C,C+=R.colormap_length*(R.colormap_size>>3))),h){_=new Uint8Array(N);let y,u,k,M=0;const W=new Uint8Array(A);for(;M<N;)if(y=P[C++],u=(y&127)+1,y&128){for(k=0;k<A;++k)W[k]=P[C++];for(k=0;k<u;++k)_.set(W,M+k*A);M+=A*u}else{for(u*=A,k=0;k<u;++k)_[M+k]=P[C++];M+=u}}else _=P.subarray(C,C+=q?R.width*R.height:N);return{pixel_data:_,palettes:v}}function te(h,q,R,C,P,_,v,A,N){const y=N;let u,k=0,M,W;const re=j.width;for(W=q;W!==C;W+=R)for(M=P;M!==v;M+=_,k++)u=A[k],h[(M+re*W)*4+3]=255,h[(M+re*W)*4+2]=y[u*3+0],h[(M+re*W)*4+1]=y[u*3+1],h[(M+re*W)*4+0]=y[u*3+2];return h}function I(h,q,R,C,P,_,v,A){let N,y=0,u,k;const M=j.width;for(k=q;k!==C;k+=R)for(u=P;u!==v;u+=_,y+=2)N=A[y+0]+(A[y+1]<<8),h[(u+M*k)*4+0]=(N&31744)>>7,h[(u+M*k)*4+1]=(N&992)>>2,h[(u+M*k)*4+2]=(N&31)<<3,h[(u+M*k)*4+3]=N&32768?0:255;return h}function Z(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=3)h[(y+k*u)*4+3]=255,h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+1]=A[N+1],h[(y+k*u)*4+0]=A[N+2];return h}function S(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=4)h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+1]=A[N+1],h[(y+k*u)*4+0]=A[N+2],h[(y+k*u)*4+3]=A[N+3];return h}function de(h,q,R,C,P,_,v,A){let N,y=0,u,k;const M=j.width;for(k=q;k!==C;k+=R)for(u=P;u!==v;u+=_,y++)N=A[y],h[(u+M*k)*4+0]=N,h[(u+M*k)*4+1]=N,h[(u+M*k)*4+2]=N,h[(u+M*k)*4+3]=255;return h}function Q(h,q,R,C,P,_,v,A){let N=0,y,u;const k=j.width;for(u=q;u!==C;u+=R)for(y=P;y!==v;y+=_,N+=2)h[(y+k*u)*4+0]=A[N+0],h[(y+k*u)*4+1]=A[N+0],h[(y+k*u)*4+2]=A[N+0],h[(y+k*u)*4+3]=A[N+1];return h}function xe(h,q,R,C,P){let _,v,A,N,y,u;switch((j.flags&ve)>>ge){default:case Le:_=0,A=1,y=q,v=0,N=1,u=R;break;case ye:_=0,A=1,y=q,v=R-1,N=-1,u=-1;break;case ie:_=q-1,A=-1,y=-1,v=0,N=1,u=R;break;case Ie:_=q-1,A=-1,y=-1,v=R-1,N=-1,u=-1;break}if(he)switch(j.pixel_size){case 8:de(h,v,N,u,_,A,y,C);break;case 16:Q(h,v,N,u,_,A,y,C);break;default:throw new Error("THREE.TGALoader: Format not supported.")}else switch(j.pixel_size){case 8:te(h,v,N,u,_,A,y,C,P);break;case 16:I(h,v,N,u,_,A,y,C);break;case 24:Z(h,v,N,u,_,A,y,C);break;case 32:S(h,v,N,u,_,A,y,C);break;default:throw new Error("THREE.TGALoader: Format not supported.")}return h}const Ce=0,me=1,B=2,V=3,z=9,ue=10,be=11,ve=48,ge=4,ye=0,Ie=1,Le=2,ie=3;if(K.length<19)throw new Error("THREE.TGALoader: Not enough data to contain header.");let L=0;const G=new Uint8Array(K),j={id_length:G[L++],colormap_type:G[L++],image_type:G[L++],colormap_index:G[L++]|G[L++]<<8,colormap_length:G[L++]|G[L++]<<8,colormap_size:G[L++],origin:[G[L++]|G[L++]<<8,G[L++]|G[L++]<<8],width:G[L++]|G[L++]<<8,height:G[L++]|G[L++]<<8,pixel_size:G[L++],flags:G[L++]};if(se(j),j.id_length+L>K.length)throw new Error("THREE.TGALoader: No data.");L+=j.id_length;let ae=!1,fe=!1,he=!1;switch(j.image_type){case z:ae=!0,fe=!0;break;case me:fe=!0;break;case ue:ae=!0;break;case B:break;case be:ae=!0,he=!0;break;case V:he=!0;break}const ke=new Uint8Array(j.width*j.height*4),we=U(ae,fe,j,L,G);return xe(ke,j.width,j.height,we.pixel_data,we.palettes),{data:ke,width:j.width,height:j.height,flipY:!0,generateMipmaps:!0,minFilter:wn}}}class Vn extends it{load(K,se,U,te){const I=this,Z=I.path===""?Nn.extractUrlBase(K):I.path,S=new An(I.manager);S.setPath(I.path),S.setRequestHeader(I.requestHeader),S.setWithCredentials(I.withCredentials),S.load(K,function(de){try{se(I.parse(de,Z))}catch(Q){te?te(Q):console.error(Q),I.manager.itemError(K)}},U,te)}parse(K,se){function U(t,e){const s=[],n=t.childNodes;for(let i=0,a=n.length;i<a;i++){const r=n[i];r.nodeName===e&&s.push(r)}return s}function te(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=e[n];return s}function I(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=parseFloat(e[n]);return s}function Z(t){if(t.length===0)return[];const e=t.trim().split(/\s+/),s=new Array(e.length);for(let n=0,i=e.length;n<i;n++)s[n]=parseInt(e[n]);return s}function S(t){return t.substring(1)}function de(){return"three_default_"+gn++}function Q(t){return Object.keys(t).length===0}function xe(t){return{unit:Ce(U(t,"unit")[0]),upAxis:me(U(t,"up_axis")[0])}}function Ce(t){return t!==void 0&&t.hasAttribute("meter")===!0?parseFloat(t.getAttribute("meter")):1}function me(t){return t!==void 0?t.textContent:"Y_UP"}function B(t,e,s,n){const i=U(t,e)[0];if(i!==void 0){const a=U(i,s);for(let r=0;r<a.length;r++)n(a[r])}}function V(t,e){for(const s in t){const n=t[s];n.build=e(t[s])}}function z(t,e){return t.build!==void 0||(t.build=e(t)),t.build}function ue(t){const e={sources:{},samplers:{},channels:{}};let s=!1;for(let n=0,i=t.childNodes.length;n<i;n++){const a=t.childNodes[n];if(a.nodeType!==1)continue;let r;switch(a.nodeName){case"source":r=a.getAttribute("id"),e.sources[r]=Re(a);break;case"sampler":r=a.getAttribute("id"),e.samplers[r]=be(a);break;case"channel":r=a.getAttribute("target"),e.channels[r]=ve(a);break;case"animation":ue(a),s=!0;break;default:console.log(a)}}s===!1&&(w.animations[t.getAttribute("id")||pe.generateUUID()]=e)}function be(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=S(i.getAttribute("source")),r=i.getAttribute("semantic");e.inputs[r]=a;break}}return e}function ve(t){const e={};let n=t.getAttribute("target").split("/");const i=n.shift();let a=n.shift();const r=a.indexOf("(")!==-1,d=a.indexOf(".")!==-1;if(d)n=a.split("."),a=n.shift(),e.member=n.shift();else if(r){const c=a.split("(");a=c.shift();for(let l=0;l<c.length;l++)c[l]=parseInt(c[l].replace(/\)/,""));e.indices=c}return e.id=i,e.sid=a,e.arraySyntax=r,e.memberSyntax=d,e.sampler=S(t.getAttribute("source")),e}function ge(t){const e=[],s=t.channels,n=t.samplers,i=t.sources;for(const a in s)if(s.hasOwnProperty(a)){const r=s[a],d=n[r.sampler],c=d.inputs.INPUT,l=d.inputs.OUTPUT,m=i[c],o=i[l],p=Ie(r,m,o);j(p,e)}return e}function ye(t){return z(w.animations[t],ge)}function Ie(t,e,s){const n=w.nodes[t.id],i=ce(n.id),a=n.transforms[t.sid],r=n.matrix.clone().transpose();let d,c,l,m,o,p;const f={};switch(a){case"matrix":for(l=0,m=e.array.length;l<m;l++)if(d=e.array[l],c=l*s.stride,f[d]===void 0&&(f[d]={}),t.arraySyntax===!0){const O=s.array[c],x=t.indices[0]+4*t.indices[1];f[d][x]=O}else for(o=0,p=s.stride;o<p;o++)f[d][o]=s.array[c+o];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',a);break}const g=Le(f,r);return{name:i.uuid,keyframes:g}}function Le(t,e){const s=[];for(const i in t)s.push({time:parseFloat(i),value:t[i]});s.sort(n);for(let i=0;i<16;i++)ae(s,i,e.elements[i]);return s;function n(i,a){return i.time-a.time}}const ie=new $,L=new $,G=new Gn;function j(t,e){const s=t.keyframes,n=t.name,i=[],a=[],r=[],d=[];for(let c=0,l=s.length;c<l;c++){const m=s[c],o=m.time,p=m.value;D.fromArray(p).transpose(),D.decompose(ie,G,L),i.push(o),a.push(ie.x,ie.y,ie.z),r.push(G.x,G.y,G.z,G.w),d.push(L.x,L.y,L.z)}return a.length>0&&e.push(new ut(n+".position",i,a)),r.length>0&&e.push(new On(n+".quaternion",i,r)),d.length>0&&e.push(new ut(n+".scale",i,d)),e}function ae(t,e,s){let n,i=!0,a,r;for(a=0,r=t.length;a<r;a++)n=t[a],n.value[e]===void 0?n.value[e]=null:i=!1;if(i===!0)for(a=0,r=t.length;a<r;a++)n=t[a],n.value[e]=s;else fe(t,e)}function fe(t,e){let s,n;for(let i=0,a=t.length;i<a;i++){const r=t[i];if(r.value[e]===null){if(s=he(t,i,e),n=ke(t,i,e),s===null){r.value[e]=n.value[e];continue}if(n===null){r.value[e]=s.value[e];continue}we(r,s,n,e)}}}function he(t,e,s){for(;e>=0;){const n=t[e];if(n.value[s]!==null)return n;e--}return null}function ke(t,e,s){for(;e<t.length;){const n=t[e];if(n.value[s]!==null)return n;e++}return null}function we(t,e,s,n){if(s.time-e.time===0){t.value[n]=e.value[n];return}t.value[n]=(t.time-e.time)*(s.value[n]-e.value[n])/(s.time-e.time)+e.value[n]}function h(t){const e={name:t.getAttribute("id")||"default",start:parseFloat(t.getAttribute("start")||0),end:parseFloat(t.getAttribute("end")||0),animations:[]};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"instance_animation":e.animations.push(S(i.getAttribute("url")));break}}w.clips[t.getAttribute("id")]=e}function q(t){const e=[],s=t.name,n=t.end-t.start||-1,i=t.animations;for(let a=0,r=i.length;a<r;a++){const d=ye(i[a]);for(let c=0,l=d.length;c<l;c++)e.push(d[c])}return new ot(s,n,e)}function R(t){return z(w.clips[t],q)}function C(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"skin":e.id=S(i.getAttribute("source")),e.skin=P(i);break;case"morph":e.id=S(i.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}w.controllers[t.getAttribute("id")]=e}function P(t){const e={sources:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"bind_shape_matrix":e.bindShapeMatrix=I(i.textContent);break;case"source":const a=i.getAttribute("id");e.sources[a]=Re(i);break;case"joints":e.joints=_(i);break;case"vertex_weights":e.vertexWeights=v(i);break}}return e}function _(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=i.getAttribute("semantic"),r=S(i.getAttribute("source"));e.inputs[a]=r;break}}return e}function v(t){const e={inputs:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=i.getAttribute("semantic"),r=S(i.getAttribute("source")),d=parseInt(i.getAttribute("offset"));e.inputs[a]={id:r,offset:d};break;case"vcount":e.vcount=Z(i.textContent);break;case"v":e.v=Z(i.textContent);break}}return e}function A(t){const e={id:t.id},s=w.geometries[e.id];return t.skin!==void 0&&(e.skin=N(t.skin),s.sources.skinIndices=e.skin.indices,s.sources.skinWeights=e.skin.weights),e}function N(t){const s={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},n=t.sources,i=t.vertexWeights,a=i.vcount,r=i.v,d=i.inputs.JOINT.offset,c=i.inputs.WEIGHT.offset,l=t.sources[t.joints.inputs.JOINT],m=t.sources[t.joints.inputs.INV_BIND_MATRIX],o=n[i.inputs.WEIGHT.id].array;let p=0,f,g,b;for(f=0,b=a.length;f<b;f++){const x=a[f],T=[];for(g=0;g<x;g++){const E=r[p+d],Y=r[p+c],F=o[Y];T.push({index:E,weight:F}),p+=2}for(T.sort(O),g=0;g<4;g++){const E=T[g];E!==void 0?(s.indices.array.push(E.index),s.weights.array.push(E.weight)):(s.indices.array.push(0),s.weights.array.push(0))}}for(t.bindShapeMatrix?s.bindMatrix=new X().fromArray(t.bindShapeMatrix).transpose():s.bindMatrix=new X().identity(),f=0,b=l.array.length;f<b;f++){const x=l.array[f],T=new X().fromArray(m.array,f*m.stride).transpose();s.joints.push({name:x,boneInverse:T})}return s;function O(x,T){return T.weight-x.weight}}function y(t){return z(w.controllers[t],A)}function u(t){const e={init_from:U(t,"init_from")[0].textContent};w.images[t.getAttribute("id")]=e}function k(t){return t.build!==void 0?t.build:t.init_from}function M(t){const e=w.images[t];return e!==void 0?z(e,k):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",t),null)}function W(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"profile_COMMON":e.profile=re(i);break}}w.effects[t.getAttribute("id")]=e}function re(t){const e={surfaces:{},samplers:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"newparam":bt(i,e);break;case"technique":e.technique=kt(i);break;case"extra":e.extra=qe(i);break}}return e}function bt(t,e){const s=t.getAttribute("sid");for(let n=0,i=t.childNodes.length;n<i;n++){const a=t.childNodes[n];if(a.nodeType===1)switch(a.nodeName){case"surface":e.surfaces[s]=gt(a);break;case"sampler2D":e.samplers[s]=yt(a);break}}}function gt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"init_from":e.init_from=i.textContent;break}}return e}function yt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"source":e.source=i.textContent;break}}return e}function kt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"constant":case"lambert":case"blinn":case"phong":e.type=i.nodeName,e.parameters=wt(i);break;case"extra":e.extra=qe(i);break}}return e}function wt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":e[i.nodeName]=Oe(i);break;case"transparent":e[i.nodeName]={opaque:i.hasAttribute("opaque")?i.getAttribute("opaque"):"A_ONE",data:Oe(i)};break}}return e}function Oe(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"color":e[i.nodeName]=I(i.textContent);break;case"float":e[i.nodeName]=parseFloat(i.textContent);break;case"texture":e[i.nodeName]={id:i.getAttribute("texture"),extra:je(i)};break}}return e}function je(t){const e={technique:{}};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"extra":Nt(i,e);break}}return e}function Nt(t,e){for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique":At(i,e);break}}}function At(t,e){for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":e.technique[i.nodeName]=parseFloat(i.textContent);break;case"wrapU":case"wrapV":i.textContent.toUpperCase()==="TRUE"?e.technique[i.nodeName]=1:i.textContent.toUpperCase()==="FALSE"?e.technique[i.nodeName]=0:e.technique[i.nodeName]=parseInt(i.textContent);break;case"bump":e[i.nodeName]=Pe(i);break}}}function qe(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique":e.technique=Tt(i);break}}return e}function Tt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"double_sided":e[i.nodeName]=parseInt(i.textContent);break;case"bump":e[i.nodeName]=Pe(i);break}}return e}function Pe(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"texture":e[i.nodeName]={id:i.getAttribute("texture"),texcoord:i.getAttribute("texcoord"),extra:je(i)};break}}return e}function He(t){return t}function Et(t){return z(w.effects[t],He)}function _t(t){const e={name:t.getAttribute("name")};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"instance_effect":e.url=S(i.getAttribute("url"));break}}w.materials[t.getAttribute("id")]=e}function xt(t){let e,s=t.slice((t.lastIndexOf(".")-1>>>0)+2);switch(s=s.toLowerCase(),s){case"tga":e=Ge;break;default:e=tt}return e}function Ue(t){const e=Et(t.url),s=e.profile.technique;let n;switch(s.type){case"phong":case"blinn":n=new ct;break;case"lambert":n=new _n;break;default:n=new at;break}n.name=t.name||"";function i(c,l=null){const m=e.profile.samplers[c.id];let o=null;if(m!==void 0){const p=e.profile.surfaces[m.source];o=M(p.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),o=M(c.id);if(o!==null){const p=xt(o);if(p!==void 0){const f=p.load(o),g=c.extra;if(g!==void 0&&g.technique!==void 0&&Q(g.technique)===!1){const b=g.technique;f.wrapS=b.wrapU?_e:ht,f.wrapT=b.wrapV?_e:ht,f.offset.set(b.offsetU||0,b.offsetV||0),f.repeat.set(b.repeatU||1,b.repeatV||1)}else f.wrapS=_e,f.wrapT=_e;return l!==null&&(f.colorSpace=l),f}else return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",o),null}else return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",c.id),null}const a=s.parameters;for(const c in a){const l=a[c];switch(c){case"diffuse":l.color&&n.color.fromArray(l.color),l.texture&&(n.map=i(l.texture,ee));break;case"specular":l.color&&n.specular&&n.specular.fromArray(l.color),l.texture&&(n.specularMap=i(l.texture));break;case"bump":l.texture&&(n.normalMap=i(l.texture));break;case"ambient":l.texture&&(n.lightMap=i(l.texture,ee));break;case"shininess":l.float&&n.shininess&&(n.shininess=l.float);break;case"emission":l.color&&n.emissive&&n.emissive.fromArray(l.color),l.texture&&(n.emissiveMap=i(l.texture,ee));break}}Ee.colorSpaceToWorking(n.color,ee),n.specular&&Ee.colorSpaceToWorking(n.specular,ee),n.emissive&&Ee.colorSpaceToWorking(n.emissive,ee);let r=a.transparent,d=a.transparency;if(d===void 0&&r&&(d={float:1}),r===void 0&&d&&(r={opaque:"A_ONE",data:{color:[1,1,1,1]}}),r&&d)if(r.data.texture)n.transparent=!0;else{const c=r.data.color;switch(r.opaque){case"A_ONE":n.opacity=c[3]*d.float;break;case"RGB_ZERO":n.opacity=1-c[0]*d.float;break;case"A_ZERO":n.opacity=1-c[3]*d.float;break;case"RGB_ONE":n.opacity=c[0]*d.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',r.opaque)}n.opacity<1&&(n.transparent=!0)}if(s.extra!==void 0&&s.extra.technique!==void 0){const c=s.extra.technique;for(const l in c){const m=c[l];switch(l){case"double_sided":n.side=m===1?Cn:vn;break;case"bump":n.normalMap=i(m.texture),n.normalScale=new xn(1,1);break}}}return n}function Ct(t){return z(w.materials[t],Ue)}function vt(t){const e={name:t.getAttribute("name")};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"optics":e.optics=It(i);break}}w.cameras[t.getAttribute("id")]=e}function It(t){for(let e=0;e<t.childNodes.length;e++){const s=t.childNodes[e];switch(s.nodeName){case"technique_common":return Lt(s)}}return{}}function Lt(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"perspective":case"orthographic":e.technique=n.nodeName,e.parameters=Rt(n);break}}return e}function Rt(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":e[n.nodeName]=parseFloat(n.textContent);break}}return e}function Be(t){let e;switch(t.optics.technique){case"perspective":e=new lt(t.optics.parameters.yfov,t.optics.parameters.aspect_ratio,t.optics.parameters.znear,t.optics.parameters.zfar);break;case"orthographic":let s=t.optics.parameters.ymag,n=t.optics.parameters.xmag;const i=t.optics.parameters.aspect_ratio;n=n===void 0?s*i:n,s=s===void 0?n/i:s,n*=.5,s*=.5,e=new In(-n,n,s,-s,t.optics.parameters.znear,t.optics.parameters.zfar);break;default:e=new lt;break}return e.name=t.name||"",e}function Mt(t){const e=w.cameras[t];return e!==void 0?z(e,Be):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",t),null)}function St(t){let e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"technique_common":e=Gt(i);break}}w.lights[t.getAttribute("id")]=e}function Gt(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"directional":case"point":case"spot":case"ambient":e.technique=i.nodeName,e.parameters=Ot(i)}}return e}function Ot(t){const e={};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"color":const a=I(i.textContent);e.color=new rt().fromArray(a),Ee.colorSpaceToWorking(e.color,ee);break;case"falloff_angle":e.falloffAngle=parseFloat(i.textContent);break;case"quadratic_attenuation":const r=parseFloat(i.textContent);e.distance=r?Math.sqrt(1/r):0;break}}return e}function ze(t){let e;switch(t.technique){case"directional":e=new Sn;break;case"point":e=new Mn;break;case"spot":e=new Rn;break;case"ambient":e=new Ln;break}return t.parameters.color&&e.color.copy(t.parameters.color),t.parameters.distance&&(e.distance=t.parameters.distance),e}function jt(t){const e=w.lights[t];return e!==void 0?z(e,ze):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",t),null)}function qt(t){const e={name:t.getAttribute("name"),sources:{},vertices:{},primitives:[]},s=U(t,"mesh")[0];if(s!==void 0){for(let n=0;n<s.childNodes.length;n++){const i=s.childNodes[n];if(i.nodeType!==1)continue;const a=i.getAttribute("id");switch(i.nodeName){case"source":e.sources[a]=Re(i);break;case"vertices":e.vertices=Pt(i);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",i.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":e.primitives.push(Ht(i));break;default:console.log(i)}}w.geometries[t.getAttribute("id")]=e}}function Re(t){const e={array:[],stride:3};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"float_array":e.array=I(n.textContent);break;case"Name_array":e.array=te(n.textContent);break;case"technique_common":const i=U(n,"accessor")[0];i!==void 0&&(e.stride=parseInt(i.getAttribute("stride")));break}}return e}function Pt(t){const e={};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];n.nodeType===1&&(e[n.getAttribute("semantic")]=S(n.getAttribute("source")))}return e}function Ht(t){const e={type:t.nodeName,material:t.getAttribute("material"),count:parseInt(t.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let s=0,n=t.childNodes.length;s<n;s++){const i=t.childNodes[s];if(i.nodeType===1)switch(i.nodeName){case"input":const a=S(i.getAttribute("source")),r=i.getAttribute("semantic"),d=parseInt(i.getAttribute("offset")),c=parseInt(i.getAttribute("set")),l=c>0?r+c:r;e.inputs[l]={id:a,offset:d},e.stride=Math.max(e.stride,d+1),r==="TEXCOORD"&&(e.hasUV=!0);break;case"vcount":e.vcount=Z(i.textContent);break;case"p":e.p=Z(i.textContent);break}}return e}function Ut(t){const e={};for(let s=0;s<t.length;s++){const n=t[s];e[n.type]===void 0&&(e[n.type]=[]),e[n.type].push(n)}return e}function Bt(t){let e=0;for(let s=0,n=t.length;s<n;s++)t[s].hasUV===!0&&e++;e>0&&e<t.length&&(t.uvsNeedsFix=!0)}function Fe(t){const e={},s=t.sources,n=t.vertices,i=t.primitives;if(i.length===0)return{};const a=Ut(i);for(const r in a){const d=a[r];Bt(d),e[r]=zt(d,s,n)}return e}function zt(t,e,s){const n={},i={array:[],stride:0},a={array:[],stride:0},r={array:[],stride:0},d={array:[],stride:0},c={array:[],stride:0},l={array:[],stride:4},m={array:[],stride:4},o=new jn,p=[];let f=0;for(let g=0;g<t.length;g++){const b=t[g],O=b.inputs;let x=0;switch(b.type){case"lines":case"linestrips":x=b.count*2;break;case"triangles":x=b.count*3;break;case"polylist":for(let T=0;T<b.count;T++){const E=b.vcount[T];switch(E){case 3:x+=3;break;case 4:x+=6;break;default:x+=(E-2)*3;break}}break;default:console.warn("THREE.ColladaLoader: Unknown primitive type:",b.type)}o.addGroup(f,x,g),f+=x,b.material&&p.push(b.material);for(const T in O){const E=O[T];switch(T){case"VERTEX":for(const Y in s){const F=s[Y];switch(Y){case"POSITION":const le=i.array.length;if(J(b,e[F],E.offset,i.array),i.stride=e[F].stride,e.skinWeights&&e.skinIndices&&(J(b,e.skinIndices,E.offset,l.array),J(b,e.skinWeights,E.offset,m.array)),b.hasUV===!1&&t.uvsNeedsFix===!0){const yn=(i.array.length-le)/i.stride;for(let st=0;st<yn;st++)r.array.push(0,0)}break;case"NORMAL":J(b,e[F],E.offset,a.array),a.stride=e[F].stride;break;case"COLOR":J(b,e[F],E.offset,c.array),c.stride=e[F].stride;break;case"TEXCOORD":J(b,e[F],E.offset,r.array),r.stride=e[F].stride;break;case"TEXCOORD1":J(b,e[F],E.offset,d.array),r.stride=e[F].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',Y)}}break;case"NORMAL":J(b,e[E.id],E.offset,a.array),a.stride=e[E.id].stride;break;case"COLOR":J(b,e[E.id],E.offset,c.array,!0),c.stride=e[E.id].stride;break;case"TEXCOORD":J(b,e[E.id],E.offset,r.array),r.stride=e[E.id].stride;break;case"TEXCOORD1":J(b,e[E.id],E.offset,d.array),d.stride=e[E.id].stride;break}}}return i.array.length>0&&o.setAttribute("position",new ne(i.array,i.stride)),a.array.length>0&&o.setAttribute("normal",new ne(a.array,a.stride)),c.array.length>0&&o.setAttribute("color",new ne(c.array,c.stride)),r.array.length>0&&o.setAttribute("uv",new ne(r.array,r.stride)),d.array.length>0&&o.setAttribute("uv1",new ne(d.array,d.stride)),l.array.length>0&&o.setAttribute("skinIndex",new ne(l.array,l.stride)),m.array.length>0&&o.setAttribute("skinWeight",new ne(m.array,m.stride)),n.data=o,n.type=t[0].type,n.materialKeys=p,n}function J(t,e,s,n,i=!1){const a=t.p,r=t.stride,d=t.vcount;function c(o){let p=a[o+s]*m;const f=p+m;for(;p<f;p++)n.push(l[p]);if(i){const g=n.length-m-1;Ne.setRGB(n[g+0],n[g+1],n[g+2],ee),n[g+0]=Ne.r,n[g+1]=Ne.g,n[g+2]=Ne.b}}const l=e.array,m=e.stride;if(t.vcount!==void 0){let o=0;for(let p=0,f=d.length;p<f;p++){const g=d[p];if(g===4){const b=o+r*0,O=o+r*1,x=o+r*2,T=o+r*3;c(b),c(O),c(T),c(O),c(x),c(T)}else if(g===3){const b=o+r*0,O=o+r*1,x=o+r*2;c(b),c(O),c(x)}else if(g>4)for(let b=1,O=g-2;b<=O;b++){const x=o+r*0,T=o+r*b,E=o+r*(b+1);c(x),c(T),c(E)}o+=r*g}}else for(let o=0,p=a.length;o<p;o+=r)c(o)}function Ve(t){return z(w.geometries[t],Fe)}function Ft(t){const e={name:t.getAttribute("name")||"",joints:{},links:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"technique_common":Kt(n,e);break}}w.kinematicsModels[t.getAttribute("id")]=e}function Vt(t){return t.build!==void 0?t.build:t}function Dt(t){return z(w.kinematicsModels[t],Vt)}function Kt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"joint":e.joints[n.getAttribute("sid")]=Wt(n);break;case"link":e.links.push(De(n));break}}}function Wt(t){let e;for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"prismatic":case"revolute":e=Jt(n);break}}return e}function Jt(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",axis:new $,limits:{min:0,max:0},type:t.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"axis":const i=I(n.textContent);e.axis.fromArray(i);break;case"limits":const a=n.getElementsByTagName("max")[0],r=n.getElementsByTagName("min")[0];e.limits.max=parseFloat(a.textContent),e.limits.min=parseFloat(r.textContent);break}}return e.limits.min>=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function De(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"attachment_full":e.attachments.push(Yt(n));break;case"matrix":case"translate":case"rotate":e.transforms.push(Ke(n));break}}return e}function Yt(t){const e={joint:t.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"link":e.links.push(De(n));break;case"matrix":case"translate":case"rotate":e.transforms.push(Ke(n));break}}return e}function Ke(t){const e={type:t.nodeName},s=I(t.textContent);switch(e.type){case"matrix":e.obj=new X,e.obj.fromArray(s).transpose();break;case"translate":e.obj=new $,e.obj.fromArray(s);break;case"rotate":e.obj=new $,e.obj.fromArray(s),e.angle=pe.degToRad(s[3]);break}return e}function Xt(t){const e={name:t.getAttribute("name")||"",rigidBodies:{}};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"rigid_body":e.rigidBodies[n.getAttribute("name")]={},Zt(n,e.rigidBodies[n.getAttribute("name")]);break}}w.physicsModels[t.getAttribute("id")]=e}function Zt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"technique_common":Qt(n,e);break}}}function Qt(t,e){for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"inertia":e.inertia=I(n.textContent);break;case"mass":e.mass=I(n.textContent)[0];break}}}function $t(t){const e={bindJointAxis:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"bind_joint_axis":e.bindJointAxis.push(en(n));break}}w.kinematicsScenes[S(t.getAttribute("url"))]=e}function en(t){const e={target:t.getAttribute("target").split("/").pop()};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType===1)switch(n.nodeName){case"axis":const i=n.getElementsByTagName("param")[0];e.axis=i.textContent;const a=e.axis.split("inst_").pop().split("axis")[0];e.jointIndex=a.substring(0,a.length-1);break}}return e}function tn(t){return t.build!==void 0?t.build:t}function nn(t){return z(w.kinematicsScenes[t],tn)}function sn(){const t=Object.keys(w.kinematicsModels)[0],e=Object.keys(w.kinematicsScenes)[0],s=Object.keys(w.visualScenes)[0];if(t===void 0||e===void 0)return;const n=Dt(t),i=nn(e),a=Qe(s),r=i.bindJointAxis,d={};for(let m=0,o=r.length;m<o;m++){const p=r[m],f=H.querySelector('[sid="'+p.target+'"]');if(f){const g=f.parentElement;c(p.jointIndex,g)}}function c(m,o){const p=o.getAttribute("name"),f=n.joints[m];a.traverse(function(g){g.name===p&&(d[m]={object:g,transforms:an(o),joint:f,position:f.zeroPosition})})}const l=new X;nt={joints:n&&n.joints,getJointValue:function(m){const o=d[m];if(o)return o.position;console.warn("THREE.ColladaLoader: Joint "+m+" doesn't exist.")},setJointValue:function(m,o){const p=d[m];if(p){const f=p.joint;if(o>f.limits.max||o<f.limits.min)console.warn("THREE.ColladaLoader: Joint "+m+" value "+o+" outside of limits (min: "+f.limits.min+", max: "+f.limits.max+").");else if(f.static)console.warn("THREE.ColladaLoader: Joint "+m+" is static.");else{const g=p.object,b=f.axis,O=p.transforms;D.identity();for(let x=0;x<O.length;x++){const T=O[x];if(T.sid&&T.sid.indexOf(m)!==-1)switch(f.type){case"revolute":D.multiply(l.makeRotationAxis(b,pe.degToRad(o)));break;case"prismatic":D.multiply(l.makeTranslation(b.x*o,b.y*o,b.z*o));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+f.type);break}else switch(T.type){case"matrix":D.multiply(T.obj);break;case"translate":D.multiply(l.makeTranslation(T.obj.x,T.obj.y,T.obj.z));break;case"scale":D.scale(T.obj);break;case"rotate":D.multiply(l.makeRotationAxis(T.obj,T.angle));break}}g.matrix.copy(D),g.matrix.decompose(g.position,g.quaternion,g.scale),d[m].position=o}}else console.log("THREE.ColladaLoader: "+m+" does not exist.")}}}function an(t){const e=[],s=H.querySelector('[id="'+t.id+'"]');for(let n=0;n<s.childNodes.length;n++){const i=s.childNodes[n];if(i.nodeType!==1)continue;let a,r;switch(i.nodeName){case"matrix":a=I(i.textContent);const d=new X().fromArray(a).transpose();e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:d});break;case"translate":case"scale":a=I(i.textContent),r=new $().fromArray(a),e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:r});break;case"rotate":a=I(i.textContent),r=new $().fromArray(a);const c=pe.degToRad(a[3]);e.push({sid:i.getAttribute("sid"),type:i.nodeName,obj:r,angle:c});break}}return e}function rn(t){const e=t.getElementsByTagName("node");for(let s=0;s<e.length;s++){const n=e[s];n.hasAttribute("id")===!1&&n.setAttribute("id",de())}}const D=new X,oe=new $;function Me(t){const e={name:t.getAttribute("name")||"",type:t.getAttribute("type"),id:t.getAttribute("id"),sid:t.getAttribute("sid"),matrix:new X,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];if(n.nodeType!==1)continue;let i;switch(n.nodeName){case"node":e.nodes.push(n.getAttribute("id")),Me(n);break;case"instance_camera":e.instanceCameras.push(S(n.getAttribute("url")));break;case"instance_controller":e.instanceControllers.push(We(n));break;case"instance_light":e.instanceLights.push(S(n.getAttribute("url")));break;case"instance_geometry":e.instanceGeometries.push(We(n));break;case"instance_node":e.instanceNodes.push(S(n.getAttribute("url")));break;case"matrix":i=I(n.textContent),e.matrix.multiply(D.fromArray(i).transpose()),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"translate":i=I(n.textContent),oe.fromArray(i),e.matrix.multiply(D.makeTranslation(oe.x,oe.y,oe.z)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"rotate":i=I(n.textContent);const a=pe.degToRad(i[3]);e.matrix.multiply(D.makeRotationAxis(oe.fromArray(i),a)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"scale":i=I(n.textContent),e.matrix.scale(oe.fromArray(i)),e.transforms[n.getAttribute("sid")]=n.nodeName;break;case"extra":break;default:console.log(n)}}return Xe(e.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",e.id):w.nodes[e.id]=e,e}function We(t){const e={id:S(t.getAttribute("url")),materials:{},skeletons:[]};for(let s=0;s<t.childNodes.length;s++){const n=t.childNodes[s];switch(n.nodeName){case"bind_material":const i=n.getElementsByTagName("instance_material");for(let a=0;a<i.length;a++){const r=i[a],d=r.getAttribute("symbol"),c=r.getAttribute("target");e.materials[d]=S(c)}break;case"skeleton":e.skeletons.push(S(n.textContent));break}}return e}function on(t,e){const s=[],n=[];let i,a,r;for(i=0;i<t.length;i++){const l=t[i];let m;if(Xe(l))m=ce(l),Je(m,e,s);else if(fn(l)){const p=w.visualScenes[l].children;for(let f=0;f<p.length;f++){const g=p[f];if(g.type==="JOINT"){const b=ce(g.id);Je(b,e,s)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",l)}for(i=0;i<e.length;i++)for(a=0;a<s.length;a++)if(r=s[a],r.bone.name===e[i].name){n[i]=r,r.processed=!0;break}for(i=0;i<s.length;i++)r=s[i],r.processed===!1&&(n.push(r),r.processed=!0);const d=[],c=[];for(i=0;i<n.length;i++)r=n[i],d.push(r.bone),c.push(r.boneInverse);return new zn(d,c)}function Je(t,e,s){t.traverse(function(n){if(n.isBone===!0){let i;for(let a=0;a<e.length;a++){const r=e[a];if(r.name===n.name){i=r.boneInverse;break}}i===void 0&&(i=new X),s.push({bone:n,boneInverse:i,processed:!1})}})}function cn(t){const e=[],s=t.matrix,n=t.nodes,i=t.type,a=t.instanceCameras,r=t.instanceControllers,d=t.instanceLights,c=t.instanceGeometries,l=t.instanceNodes;for(let o=0,p=n.length;o<p;o++)e.push(ce(n[o]));for(let o=0,p=a.length;o<p;o++){const f=Mt(a[o]);f!==null&&e.push(f.clone())}for(let o=0,p=r.length;o<p;o++){const f=r[o],g=y(f.id),b=Ve(g.id),O=Ye(b,f.materials),x=f.skeletons,T=g.skin.joints,E=on(x,T);for(let Y=0,F=O.length;Y<F;Y++){const le=O[Y];le.isSkinnedMesh&&(le.bind(E,g.skin.bindMatrix),le.normalizeSkinWeights()),e.push(le)}}for(let o=0,p=d.length;o<p;o++){const f=jt(d[o]);f!==null&&e.push(f.clone())}for(let o=0,p=c.length;o<p;o++){const f=c[o],g=Ve(f.id),b=Ye(g,f.materials);for(let O=0,x=b.length;O<x;O++)e.push(b[O])}for(let o=0,p=l.length;o<p;o++)e.push(ce(l[o]).clone());let m;if(n.length===0&&e.length===1)m=e[0];else{m=i==="JOINT"?new qn:new dt;for(let o=0;o<e.length;o++)m.add(e[o])}return m.name=i==="JOINT"?t.sid:t.name,m.matrix.copy(s),m.matrix.decompose(m.position,m.quaternion,m.scale),m}const ln=new at({name:it.DEFAULT_MATERIAL_NAME,color:16711935});function dn(t,e){const s=[];for(let n=0,i=t.length;n<i;n++){const a=e[t[n]];a===void 0?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",t[n]),s.push(ln)):s.push(Ct(a))}return s}function Ye(t,e){const s=[];for(const n in t){const i=t[n],a=dn(i.materialKeys,e);if(a.length===0&&(n==="lines"||n==="linestrips"?a.push(new ft):a.push(new ct)),n==="lines"||n==="linestrips")for(let l=0,m=a.length;l<m;l++){const o=a[l];if(o.isMeshPhongMaterial===!0||o.isMeshLambertMaterial===!0){const p=new ft;p.color.copy(o.color),p.opacity=o.opacity,p.transparent=o.transparent,a[l]=p}}const r=i.data.attributes.skinIndex!==void 0,d=a.length===1?a[0]:a;let c;switch(n){case"lines":c=new Bn(i.data,d);break;case"linestrips":c=new Un(i.data,d);break;case"triangles":case"polylist":r?c=new Pn(i.data,d):c=new Hn(i.data,d);break}s.push(c)}return s}function Xe(t){return w.nodes[t]!==void 0}function ce(t){return z(w.nodes[t],cn)}function un(t){const e={name:t.getAttribute("name"),children:[]};rn(t);const s=U(t,"node");for(let n=0;n<s.length;n++)e.children.push(Me(s[n]));w.visualScenes[t.getAttribute("id")]=e}function Ze(t){const e=new dt;e.name=t.name;const s=t.children;for(let n=0;n<s.length;n++){const i=s[n];e.add(ce(i.id))}return e}function fn(t){return w.visualScenes[t]!==void 0}function Qe(t){return z(w.visualScenes[t],Ze)}function hn(t){const e=U(t,"instance_visual_scene")[0];return Qe(S(e.getAttribute("url")))}function pn(){const t=w.clips;if(Q(t)===!0){if(Q(w.animations)===!1){const e=[];for(const s in w.animations){const n=ye(s);for(let i=0,a=n.length;i<a;i++)e.push(n[i])}Ae.push(new ot("default",-1,e))}}else for(const e in t)Ae.push(R(e))}function mn(t){let e="";const s=[t];for(;s.length;){const n=s.shift();n.nodeType===Node.TEXT_NODE?e+=n.textContent:(e+=`
|
|
2
|
+
`,s.push(...n.childNodes))}return e.trim()}if(K.length===0)return{scene:new Tn};const $e=new DOMParser().parseFromString(K,"application/xml"),H=U($e,"COLLADA")[0],Se=$e.getElementsByTagName("parsererror")[0];if(Se!==void 0){const t=U(Se,"div")[0];let e;return t?e=t.textContent:e=mn(Se),console.error(`THREE.ColladaLoader: Failed to parse collada file.
|
|
3
|
+
`,e),null}const bn=H.getAttribute("version");console.debug("THREE.ColladaLoader: File version",bn);const et=xe(U(H,"asset")[0]),tt=new En(this.manager);tt.setPath(this.resourcePath||se).setCrossOrigin(this.crossOrigin);let Ge;pt&&(Ge=new pt(this.manager),Ge.setPath(this.resourcePath||se));const Ne=new rt,Ae=[];let nt={},gn=0;const w={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};B(H,"library_animations","animation",ue),B(H,"library_animation_clips","animation_clip",h),B(H,"library_controllers","controller",C),B(H,"library_images","image",u),B(H,"library_effects","effect",W),B(H,"library_materials","material",_t),B(H,"library_cameras","camera",vt),B(H,"library_lights","light",St),B(H,"library_geometries","geometry",qt),B(H,"library_nodes","node",Me),B(H,"library_visual_scenes","visual_scene",un),B(H,"library_kinematics_models","kinematics_model",Ft),B(H,"library_physics_models","physics_model",Xt),B(H,"scene","instance_kinematics_scene",$t),V(w.animations,ge),V(w.clips,q),V(w.controllers,A),V(w.images,k),V(w.effects,He),V(w.materials,Ue),V(w.cameras,Be),V(w.lights,ze),V(w.geometries,Fe),V(w.visualScenes,Ze),pn(),sn();const Te=hn(U(H,"scene")[0]);return Te.animations=Ae,et.upAxis==="Z_UP"&&(console.warn("THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289."),Te.rotation.set(-Math.PI/2,0,0)),Te.scale.multiplyScalar(et.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Ae},kinematics:nt,library:w,scene:Te}}}export{Vn as ColladaLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as p}from"./jsx-runtime-CAUTK36e.js";import{I as f,M as d,N as v,O as S}from"./three-integration.service-0EyPpd5f.js";import{cH as h,al as x}from"./index-Dm_h-T4x.js";import{r as l}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-jib6KJY8.js";import{a as b}from"./live-mixers-B-bwLZ7c.js";import{O as j}from"./StageHost-CdzuP0NS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./content-bounds-_QWiKD5_.js";import"./three.module-CrYDk-Xr.js";import"./layered-pick-CT4HlEpW.js";import"./viewport-door-BdL0u5rd.js";import"./bitmap-label-Ct4k6ehY.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./viewport-surface-status-yS6CrXH7.js";import"./model-inspection-DDZE59vp.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-smIenN60.js";import"./LineSegments2-BKEsgiC8.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./transport-strip-Co-ZDkf-.js";function w(i){const t=new Set;return i.traverse(e=>{const r=b(e);if(r)for(const o of r.clips.values())t.add(o);for(const o of e.animations)t.add(o)}),[...t]}function E({documentId:i,source:t,sourcePath:e,displayName:r,active:o,chromeless:s=!1,revision:n=0,modelSource:m}){const u=l.useCallback(()=>{const a=d(v(t)),c=w(t);return a.animations=[...c],{root:a,animations:c,dispose(){S(a)}}},[t,n]);return p.jsx(j,{documentId:i,sourcePath:e??r,displayName:r,build:u,active:o,chromeless:s,rendererLane:s?"inspector-preview":"own",assetType:"entity",...m?{modelSource:m}:{}})}function W({documentId:i,entityId:t,displayName:e,active:r}){const o=f(h()),s=l.useSyncExternalStore(o.shell.subscribe,o.shell.getSnapshot),n=o.objectMap.get(t);return n?p.jsx(E,{documentId:i,source:n,sourcePath:`Entity ${t}`,displayName:e,active:r,revision:s,modelSource:{kind:"entity",entityId:t}}):p.jsxs("div",{role:"alert",style:{padding:20,color:x.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{W as EntityModelDocument,E as Object3DSnapshotDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-CAUTK36e.js";import{cI as M,cJ as C,cK as D,cL as P,al as y,b2 as R,cM as b}from"./index-Dm_h-T4x.js";import{r as f}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-jib6KJY8.js";import{m as k,aB as A,f as z,aJ as I,Y as L,P as O,C as B,X as H,e as T,c as E,aw as j,d as S,cg as F,j as G}from"./three.module-CrYDk-Xr.js";import{O as $}from"./OrbitControls-smIenN60.js";import{E as N,H as q}from"./content-bounds-_QWiKD5_.js";import{s as X}from"./asset-editor-persistence-BtRQI8t6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-mkWk8S65.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function _(e){return e.split("/").pop()??e}function v(e,t,r){return Math.min(r,Math.max(t,e))}function U(e){return e.split(/[?#]/,1)[0].toLowerCase().endsWith(".exr")}async function J(e){const t=U(e)?"EXR":"HDR",s=await(t==="EXR"?new N:new q).loadAsync(e),p=s.image,n=p.width??0,a=p.height??0,c=n>0&&a>0&&Math.abs(n/a-2)<=.04;return s.mapping=k,s.needsUpdate=!0,{texture:s,width:n,height:a,format:t,panorama:c}}function W(e){const t=new L,r=new O(38,1,.05,100);r.position.set(6.2,3.4,7.8),r.lookAt(0,.7,0);const s=[],p=[];if(!e.panorama){t.background=new B("#11141b");const i=e.width>0&&e.height>0?e.width/e.height:1,d=new H(i>=1?4.8:4.8*i,i>=1?4.8/i:4.8),m=new T({map:e.texture,toneMapped:!0});return s.push(d),p.push(m),t.add(new E(d,m)),r.position.set(0,0,6.5),r.lookAt(0,0,0),{scene:t,camera:r,geometries:s,materials:p}}t.background=e.texture,t.environment=e.texture;const n=(i,d,m)=>{s.push(i),p.push(d);const x=new E(i,d);x.position.set(...m),t.add(x)};n(new S(1,64,40),new j({color:"#d8dde5",roughness:.08,metalness:1}),[-2.3,1.15,0]),n(new S(1,64,40),new j({color:"#c97341",roughness:.32,metalness:.25}),[0,1.15,0]),n(new S(1,64,40),new j({color:"#d7d5cf",roughness:.82,metalness:0}),[2.3,1.15,0]);const a=new F(5.7,96),c=new j({color:"#737881",roughness:.58,metalness:0});s.push(a),p.push(c);const l=new E(a,c);return l.rotation.x=-Math.PI/2,l.position.y=.08,t.add(l),{scene:t,camera:r,geometries:s,materials:p}}function K({image:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const s=r.current;if(!s)return;let p=!1,n=0;const a=document.createElement("canvas");a.setAttribute("aria-label",`${e.format} environment preview`),a.style.width="100%",a.style.height="100%",a.style.display="block",s.replaceChildren(a);const c=new A({canvas:a,antialias:!0});c.outputColorSpace=z,c.toneMapping=I;const l=W(e),i=new $(l.camera,a);i.target.set(0,e.panorama?.8:0,0),i.enableDamping=!0,i.enablePan=!1,i.minDistance=e.panorama?3.8:4,i.maxDistance=e.panorama?14:10,i.update();const d={width:1,height:1},m=()=>{const u=t.current;if(c.toneMappingExposure=v(u.exposure,.05,8),e.panorama){const h=G.degToRad(u.rotation);l.scene.backgroundRotation.y=h,l.scene.environmentRotation.y=h,l.scene.backgroundBlurriness=v(u.blur,0,1),l.scene.environmentIntensity=v(u.intensity,0,8)}i.update(),c.render(l.scene,l.camera)},x=()=>{const u=s.getBoundingClientRect();d.width=Math.max(1,Math.floor(u.width)),d.height=Math.max(1,Math.floor(u.height)),c.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),c.setSize(d.width,d.height,!1),l.camera.aspect=d.width/d.height,l.camera.updateProjectionMatrix(),m()};x();const w=new ResizeObserver(x);w.observe(s);const g=()=>{p||(m(),n=requestAnimationFrame(g))};return n=requestAnimationFrame(g),()=>{p=!0,cancelAnimationFrame(n),w.disconnect(),i.dispose();for(const u of l.geometries)u.dispose();for(const u of l.materials)u.dispose();c.dispose(),a.remove()}},[e,t]),o.jsx("div",{ref:r,"data-testid":"environment-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#11141b"}})}function V({panorama:e,settings:t,onChange:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Exposure",o.jsx(b,{value:t.exposure,onChange:s=>r({...t,exposure:v(s,.05,8)}),step:.05,precision:2})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Lighting intensity",o.jsx(b,{value:t.intensity,onChange:s=>r({...t,intensity:v(s,0,8)}),step:.05,precision:2})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Rotation",o.jsx(b,{value:t.rotation,onChange:s=>r({...t,rotation:s%360}),step:1,precision:0})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Background blur",o.jsx(b,{value:t.blur,onChange:s=>r({...t,blur:v(s,0,1)}),step:.05,precision:2})]})]}),o.jsx("div",{style:{color:y.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the image, orientation, and accepted intensity in the owning scene source."})]})}function de({documentId:e,assetPath:t,active:r=!0}){const[s,p]=f.useState(0),[n,a]=f.useState(null),[c,l]=f.useState(null),[i,d]=f.useState({exposure:1,intensity:1,rotation:0,blur:0}),m=f.useRef(i);m.current=i,f.useEffect(()=>{if(r)return X(t,()=>p(g=>g+1))},[r,t]),f.useEffect(()=>{if(!r)return;let g=!1,u=null;return a(null),l(null),J(t).then(h=>{if(u=h,g){h.texture.dispose();return}a(h)},h=>{g||l(h instanceof Error?h.message:String(h))}),()=>{g=!0,u?.texture.dispose()}},[r,t,s]);const x=f.useMemo(()=>[{id:"environment-image",title:"Environment Image",icon:C,order:M,body:{kind:"custom",...n?{data:{format:n.format,width:n.width,height:n.height,panorama:n.panorama}}:{},render:()=>o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[o.jsx("span",{style:{color:y.content.muted},children:"Format"}),o.jsx("span",{children:n?.format??"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Resolution"}),o.jsx("span",{children:n?`${n.width} × ${n.height}`:"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Projection"}),o.jsx("span",{children:n?.panorama?"2:1 equirectangular":"Flat image"})]})}},{id:"environment-preview-settings",title:"Preview",icon:P,order:D,body:{kind:"custom",data:{...i},render:()=>o.jsx(V,{panorama:n?.panorama??!1,settings:i,onChange:d})}}],[n,i]),w=_(t);return c?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"HDR image unavailable",children:o.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:c})}):n?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,sections:x,status:`${n.format} · ${n.width} × ${n.height}`,fill:!0,children:o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0},children:[o.jsx(K,{image:n,settingsRef:m}),o.jsx("div",{style:{position:"absolute",left:12,bottom:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:n.panorama?"Drag to orbit · wheel to frame":"Non-2:1 image · flat preview"})]})}):o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"Loading HDR image",children:o.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading environment…"})})}export{de as EnvironmentAssetDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as G,V as M,cG as ue,aT as Z,aY as he,aU as fe,a_ as me,N as $,I as J,ag as de,cH as _,a6 as ge,aE as B,C as R,f as D,m as ye,a as I,G as ee,ai as te,b6 as W,O as H,P as ve,o as ne,j as S,p as we,D as Te,aj as Ie,c as Fe,a1 as xe,b7 as Pe,ak as Ae,A as Se,B as Y,F as V,ah as Ee,M as De,g as Le,h as Me,E as O,ao as ke,Q as b,am as Ce,al as re,bc as Re}from"./three.module-CrYDk-Xr.js";import{u as be}from"./content-bounds-_QWiKD5_.js";function ae(h,e,t){const n=t.length-h-1;if(e>=t[n])return n-1;if(e<=t[h])return h;let r=h,s=n,i=Math.floor((r+s)/2);for(;e<t[i]||e>=t[i+1];)e<t[i]?s=i:r=i,i=Math.floor((r+s)/2);return i}function Be(h,e,t,n){const r=[],s=[],i=[];r[0]=1;for(let a=1;a<=t;++a){s[a]=e-n[h+1-a],i[a]=n[h+a]-e;let o=0;for(let l=0;l<a;++l){const p=i[l+1],c=s[a-l],u=r[l]/(p+c);r[l]=o+p*u,o=c*u}r[a]=o}return r}function Oe(h,e,t,n){const r=ae(h,n,e),s=Be(r,n,h,e),i=new G(0,0,0,0);for(let a=0;a<=h;++a){const o=t[r-h+a],l=s[a],p=o.w*l;i.x+=o.x*p,i.y+=o.y*p,i.z+=o.z*p,i.w+=o.w*l}return i}function Ve(h,e,t,n,r){const s=[];for(let c=0;c<=t;++c)s[c]=0;const i=[];for(let c=0;c<=n;++c)i[c]=s.slice(0);const a=[];for(let c=0;c<=t;++c)a[c]=s.slice(0);a[0][0]=1;const o=s.slice(0),l=s.slice(0);for(let c=1;c<=t;++c){o[c]=e-r[h+1-c],l[c]=r[h+c]-e;let u=0;for(let f=0;f<c;++f){const m=l[f+1],g=o[c-f];a[c][f]=m+g;const d=a[f][c-1]/a[c][f];a[f][c]=u+m*d,u=g*d}a[c][c]=u}for(let c=0;c<=t;++c)i[0][c]=a[c][t];for(let c=0;c<=t;++c){let u=0,f=1;const m=[];for(let g=0;g<=t;++g)m[g]=s.slice(0);m[0][0]=1;for(let g=1;g<=n;++g){let d=0;const w=c-g,T=t-g;c>=g&&(m[f][0]=m[u][0]/a[T+1][w],d=m[f][0]*a[w][T]);const v=w>=-1?1:-w,x=c-1<=T?g-1:t-c;for(let P=v;P<=x;++P)m[f][P]=(m[u][P]-m[u][P-1])/a[T+1][w+P],d+=m[f][P]*a[w+P][T];c<=T&&(m[f][g]=-m[u][g-1]/a[T+1][c],d+=m[f][g]*a[c][T]),i[g][c]=d;const E=u;u=f,f=E}}let p=t;for(let c=1;c<=n;++c){for(let u=0;u<=t;++u)i[c][u]*=p;p*=t-c}return i}function Ue(h,e,t,n,r){const s=r<h?r:h,i=[],a=ae(h,n,e),o=Ve(a,n,h,s,e),l=[];for(let p=0;p<t.length;++p){const c=t[p].clone(),u=c.w;c.x*=u,c.y*=u,c.z*=u,l[p]=c}for(let p=0;p<=s;++p){const c=l[a-h].clone().multiplyScalar(o[p][0]);for(let u=1;u<=h;++u)c.add(l[a-h+u].clone().multiplyScalar(o[p][u]));i[p]=c}for(let p=s+1;p<=r+1;++p)i[p]=new G(0,0,0);return i}function Xe(h,e){let t=1;for(let r=2;r<=h;++r)t*=r;let n=1;for(let r=2;r<=e;++r)n*=r;for(let r=2;r<=h-e;++r)n*=r;return t/n}function Ge(h){const e=h.length,t=[],n=[];for(let s=0;s<e;++s){const i=h[s];t[s]=new M(i.x,i.y,i.z),n[s]=i.w}const r=[];for(let s=0;s<e;++s){const i=t[s].clone();for(let a=1;a<=s;++a)i.sub(r[s-a].clone().multiplyScalar(Xe(s,a)*n[a]));r[s]=i.divideScalar(n[0])}return r}function ze(h,e,t,n,r){const s=Ue(h,e,t,n,r);return Ge(s)}class je extends ue{constructor(e,t,n,r,s){super();const i=t?t.length-1:0,a=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||i;for(let o=0;o<a;++o){const l=n[o];this.controlPoints[o]=new G(l.x,l.y,l.z,l.w)}}getPoint(e,t=new M){const n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Oe(this.degree,this.knots,this.controlPoints,r);return s.w!==1&&s.divideScalar(s.w),n.set(s.x,s.y,s.z)}getTangent(e,t=new M){const n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=ze(this.degree,this.knots,this.controlPoints,r,1);return n.copy(s[1]).normalize(),n}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=>t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=>new G(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}let y,F,A;class nt extends Z{constructor(e){super(e)}load(e,t,n,r){const s=this,i=s.path===""?he.extractUrlBase(e):s.path,a=new fe(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(o,i))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},n,r)}parse(e,t){if(Ye(e))y=new Ne().parse(e);else{const r=ce(e);if(!Qe(r))throw new Error("THREE.FBXLoader: Unknown format.");if(ie(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ie(r));y=new We().parse(r)}const n=new me(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new _e(n,this.manager).parse(y)}}class _e{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){F=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),s=new He().parse(r);return this.parseScene(r,s,n),A}parseConnections(){const e=new Map;return"Connections"in y&&y.Connections.connections.forEach(function(n){const r=n[0],s=n[1],i=n[2];e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:s,relationship:i};e.get(r).parents.push(a),e.has(s)||e.set(s,{parents:[],children:[]});const o={ID:r,relationship:i};e.get(s).children.push(o)}),e}parseImages(){const e={},t={};if("Video"in y.Objects){const n=y.Objects.Video;for(const r in n){const s=n[r],i=parseInt(r);if(e[i]=s.RelativeFilename||s.Filename,"Content"in s){const a=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,o=typeof s.Content=="string"&&s.Content!=="";if(a||o){const l=this.parseImage(n[r]);t[s.RelativeFilename||s.Filename]=l}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;case"webp":s="image/webp";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in y.Objects){const n=y.Objects.Texture;for(const r in n){const s=this.parseTexture(n[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,i=r!==void 0?r.value:0,a=s!==void 0?s.value:0;if(n.wrapS=i===0?$:J,n.wrapT=a===0?$:J,"Scaling"in e){const o=e.Scaling.value;n.repeat.x=o[0],n.repeat.y=o[1]}if("Translation"in e){const o=e.Translation.value;n.offset.x=o[0],n.offset.y=o[1]}return n}loadTexture(e,t){const n=e.FileName.split(".").pop().toLowerCase();let r=this.manager.getHandler(`.${n}`);r===null&&(r=this.textureLoader);const s=r.path;s||r.setPath(this.textureLoader.path);const i=F.get(e.id).children;let a;if(i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(a=t[i[0].ID],(a.indexOf("blob:")===0||a.indexOf("data:")===0)&&r.setPath(void 0)),a===void 0)return console.warn("FBXLoader: Undefined filename, creating placeholder texture."),new de;const o=r.load(a);return r.setPath(s),o}parseMaterials(e){const t=new Map;if("Material"in y.Objects){const n=y.Objects.Material;for(const r in n){const s=this.parseMaterial(n[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!F.has(n))return null;const i=this.parseParameters(e,t,n);let a;switch(s.toLowerCase()){case"phong":a=new _;break;case"lambert":a=new ge;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new _;break}return a.setValues(i),a.name=r,a}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=B.colorSpaceToWorking(new R().fromArray(e.Diffuse.value),D):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=B.colorSpaceToWorking(new R().fromArray(e.DiffuseColor.value),D)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=B.colorSpaceToWorking(new R().fromArray(e.Emissive.value),D):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=B.colorSpaceToWorking(new R().fromArray(e.EmissiveColor.value),D)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),r.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&&(r.opacity=e.Opacity?parseFloat(e.Opacity.value):null,r.opacity===null&&(r.opacity=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=B.colorSpaceToWorking(new R().fromArray(e.Specular.value),D):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=B.colorSpaceToWorking(new R().fromArray(e.SpecularColor.value),D));const s=this;return F.get(n).children.forEach(function(i){const a=i.relationship;switch(a){case"Bump":r.bumpMap=s.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,i.ID),r.map!==void 0&&(r.map.colorSpace=D);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,i.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,i.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=D);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,i.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,i.ID),r.envMap!==void 0&&(r.envMap.mapping=ye,r.envMap.colorSpace=D);break;case"SpecularColor":r.specularMap=s.getTexture(t,i.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=D);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,i.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),r}getTexture(e,t){return"LayeredTexture"in y.Objects&&t in y.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=F.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in y.Objects){const n=y.Objects.Deformer;for(const r in n){const s=n[r],i=F.get(parseInt(r));if(s.attrType==="Skin"){const a=this.parseSkeleton(i,n);a.ID=r,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=i.parents[0].ID,e[r]=a}else if(s.attrType==="BlendShape"){const a={id:r};a.rawTargets=this.parseMorphTargets(i,n),a.id=r,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const i={ID:r.ID,indices:[],weights:[],transformLink:new I().fromArray(s.TransformLink.a)};"Indexes"in s&&(i.indices=s.Indexes.a,i.weights=s.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r<e.children.length;r++){const s=e.children[r],i=t[s.ID],a={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if(i.attrType!=="BlendShapeChannel")return;a.geoID=F.get(parseInt(s.ID)).children.filter(function(o){return o.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){A=new ee;const r=this.parseModels(e.skeletons,t,n),s=y.Objects.Model,i=this;r.forEach(function(o){const l=s[o.ID];i.setLookAtProperties(o,l),F.get(o.ID).parents.forEach(function(c){const u=r.get(c.ID);u!==void 0&&u.add(o)}),o.parent===null&&A.add(o)}),this.bindSkeleton(e.skeletons,t,r),this.addGlobalSceneSettings(),A.traverse(function(o){if(o.userData.transformData){o.parent&&(o.userData.transformData.parentMatrix=o.parent.matrix,o.userData.transformData.parentMatrixWorld=o.parent.matrixWorld);const l=le(o.userData.transformData);o.applyMatrix4(l),o.updateWorldMatrix()}});const a=new Ke().parse();A.children.length===1&&A.children[0].isGroup&&(A.children[0].animations=a,A=A.children[0]),A.animations=a}parseModels(e,t,n){const r=new Map,s=y.Objects.Model;for(const i in s){const a=parseInt(i),o=s[i],l=F.get(a);let p=this.buildSkeleton(l,e,a,o.attrName);if(!p){switch(o.attrType){case"Camera":p=this.createCamera(l);break;case"Light":p=this.createLight(l);break;case"Mesh":p=this.createMesh(l,t,n);break;case"NurbsCurve":p=this.createCurve(l,t);break;case"LimbNode":case"Root":p=new te;break;case"Null":default:p=new ee;break}p.name=o.attrName?W.sanitizeNodeName(o.attrName):"",p.userData.originalName=o.attrName,p.ID=a}this.getTransformData(p,o),r.set(a,p)}return r}buildSkeleton(e,t,n,r){let s=null;return e.parents.forEach(function(i){for(const a in t){const o=t[a];o.rawBones.forEach(function(l,p){if(l.ID===i.ID){const c=s;s=new te,s.matrixWorld.copy(l.transformLink),s.name=r?W.sanitizeNodeName(r):"",s.userData.originalName=r,s.ID=n,o.bones[p]=s,c!==null&&s.add(c)}})}}),s}createCamera(e){let t,n;if(e.children.forEach(function(r){const s=y.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)t=new H;else{let r=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(r=1);let s=1;n.NearPlane!==void 0&&(s=n.NearPlane.value/1e3);let i=1e3;n.FarPlane!==void 0&&(i=n.FarPlane.value/1e3);let a=window.innerWidth,o=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,o=n.AspectHeight.value);const l=a/o;let p=45;n.FieldOfView!==void 0&&(p=n.FieldOfView.value);const c=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new ve(p,l,s,i),c!==null&&t.setFocalLength(c);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new H;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new H;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(r){const s=y.Objects.NodeAttribute[r.ID];s!==void 0&&(n=s)}),n===void 0)t=new H;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let s=16777215;n.Color!==void 0&&(s=B.colorSpaceToWorking(new R().fromArray(n.Color.value),D));let i=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(i=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);const o=1;switch(r){case 0:t=new ne(s,i,a,o);break;case 1:t=new Te(s,i);break;case 2:let l=Math.PI/3;n.InnerAngle!==void 0&&(l=S.degToRad(n.InnerAngle.value));let p=0;n.OuterAngle!==void 0&&(p=S.degToRad(n.OuterAngle.value),p=Math.max(p,1)),t=new we(s,i,a,l,p,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new ne(s,i);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let r,s=null,i=null;const a=[];if(e.children.forEach(function(o){t.has(o.ID)&&(s=t.get(o.ID)),n.has(o.ID)&&a.push(n.get(o.ID))}),a.length>1?i=a:a.length>0?i=a[0]:(i=new _({name:Z.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(i)),"color"in s.attributes&&a.forEach(function(o){o.vertexColors=!0}),s.groups.length>0){let o=!1;for(let l=0,p=s.groups.length;l<p;l++){const c=s.groups[l];(c.materialIndex<0||c.materialIndex>=a.length)&&(c.materialIndex=a.length,o=!0)}if(o){const l=new _;a.push(l)}}return s.FBX_Deformer?(r=new Ie(s,i),r.normalizeSkinWeights()):r=new Fe(s,i),r}createCurve(e,t){const n=e.children.reduce(function(s,i){return t.has(i.ID)&&(s=t.get(i.ID)),s},null),r=new xe({name:Z.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Pe(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=z(t.RotationOrder.value):n.eulerOrder=z(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&F.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=y.Objects.Model[r.ID];if("Lcl_Translation"in s){const i=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),A.add(e.target)):e.lookAt(new M().fromArray(i))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const s in e){const i=e[s];F.get(parseInt(i.ID)).parents.forEach(function(o){if(t.has(o.ID)){const l=o.ID;F.get(l).parents.forEach(function(c){n.has(c.ID)&&n.get(c.ID).bind(new Ae(i.bones),r[c.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in y.Objects){const t=y.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new I().fromArray(s.Matrix.a)}):e[r.Node]=new I().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in y){if("AmbientColor"in y.GlobalSettings){const e=y.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const s=new R().setRGB(t,n,r,D);A.add(new Se(s,1))}}"UnitScaleFactor"in y.GlobalSettings&&(A.userData.unitScaleFactor=y.GlobalSettings.UnitScaleFactor.value)}}}class He{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in y.Objects){const n=y.Objects.Geometry;for(const r in n){const s=F.get(parseInt(r)),i=this.parseGeometry(s,n[r],e);t.set(parseInt(r),i)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,s=[],i=e.parents.map(function(c){return y.Objects.Model[c.ID]});if(i.length===0)return;const a=e.children.reduce(function(c,u){return r[u.ID]!==void 0&&(c=r[u.ID]),c},null);e.children.forEach(function(c){n.morphTargets[c.ID]!==void 0&&s.push(n.morphTargets[c.ID])});const o=i[0],l={};"RotationOrder"in o&&(l.eulerOrder=z(o.RotationOrder.value)),"InheritType"in o&&(l.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(l.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(l.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(l.scale=o.GeometricScaling.value);const p=le(l);return this.genGeometry(t,a,s,p)}genGeometry(e,t,n,r){const s=new Y;e.attrName&&(s.name=e.attrName);const i=this.parseGeoNode(e,t),a=this.genBuffers(i),o=new V(a.vertex,3);if(o.applyMatrix4(r),s.setAttribute("position",o),a.colors.length>0&&s.setAttribute("color",new V(a.colors,3)),t&&(s.setAttribute("skinIndex",new Ee(a.weightsIndices,4)),s.setAttribute("skinWeight",new V(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const l=new De().getNormalMatrix(r),p=new V(a.normal,3);p.applyNormalMatrix(l),s.setAttribute("normal",p)}if(a.uvs.forEach(function(l,p){const c=p===0?"uv":`uv${p}`;s.setAttribute(c,new V(a.uvs[p],2))}),i.material&&i.material.mappingType!=="AllSame"){let l=a.materialIndex[0],p=0;if(a.materialIndex.forEach(function(c,u){c!==l&&(s.addGroup(p,u-p,l),l=c,p=u)}),s.groups.length>0){const c=s.groups[s.groups.length-1],u=c.start+c.count;u!==a.materialIndex.length&&s.addGroup(u,a.materialIndex.length-u,l)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,n,r),s}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&e.LayerElementColor[0].Colors&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(i,a){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:s,weight:r.weights[a]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,s=!1,i=[],a=[],o=[],l=[],p=[],c=[];const u=this;return e.vertexIndices.forEach(function(f,m){let g,d=!1;f<0&&(f=f^-1,d=!0);let w=[],T=[];if(i.push(f*3,f*3+1,f*3+2),e.color){const v=K(m,n,f,e.color);o.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(v){T.push(v.weight),w.push(v.id)}),T.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const v=[0,0,0,0],x=[0,0,0,0];T.forEach(function(E,P){let C=E,L=w[P];x.forEach(function(j,X,k){if(C>j){k[X]=C,C=j;const N=v[X];v[X]=L,L=N}})}),w=v,T=x}for(;T.length<4;)T.push(0),w.push(0);for(let v=0;v<4;++v)p.push(T[v]),c.push(w[v])}if(e.normal){const v=K(m,n,f,e.normal);a.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=K(m,n,f,e.material)[0],g<0&&(u.negativeMaterialIndices=!0,g=0)),e.uv&&e.uv.forEach(function(v,x){const E=K(m,n,f,v);l[x]===void 0&&(l[x]=[]),l[x].push(E[0]),l[x].push(E[1])}),r++,d&&(u.genFace(t,e,i,g,a,o,l,p,c,r),n++,r=0,i=[],a=[],o=[],l=[],p=[],c=[])}),t}getNormalNewell(e){const t=new M(0,0,0);for(let n=0;n<e.length;n++){const r=e[n],s=e[(n+1)%e.length];t.x+=(r.y-s.y)*(r.z+s.z),t.y+=(r.z-s.z)*(r.x+s.x),t.z+=(r.x-s.x)*(r.y+s.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),r=(Math.abs(t.z)>.5?new M(0,1,0):new M(0,0,1)).cross(t).normalize(),s=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:s}}flattenVertex(e,t,n){return new Le(e.dot(t),e.dot(n))}genFace(e,t,n,r,s,i,a,o,l,p){let c;if(p>3){const u=[],f=t.baseVertexPositions||t.vertexPositions;for(let w=0;w<n.length;w+=3)u.push(new M(f[n[w]],f[n[w+1]],f[n[w+2]]));const{tangent:m,bitangent:g}=this.getNormalTangentAndBitangent(u),d=[];for(const w of u)d.push(this.flattenVertex(w,m,g));c=Me.triangulateShape(d,[])}else c=[[0,1,2]];for(const[u,f,m]of c)e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),e.vertex.push(t.vertexPositions[n[m*3]]),e.vertex.push(t.vertexPositions[n[m*3+1]]),e.vertex.push(t.vertexPositions[n[m*3+2]]),t.skeleton&&(e.vertexWeights.push(o[u*4]),e.vertexWeights.push(o[u*4+1]),e.vertexWeights.push(o[u*4+2]),e.vertexWeights.push(o[u*4+3]),e.vertexWeights.push(o[f*4]),e.vertexWeights.push(o[f*4+1]),e.vertexWeights.push(o[f*4+2]),e.vertexWeights.push(o[f*4+3]),e.vertexWeights.push(o[m*4]),e.vertexWeights.push(o[m*4+1]),e.vertexWeights.push(o[m*4+2]),e.vertexWeights.push(o[m*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3]),e.weightsIndices.push(l[m*4]),e.weightsIndices.push(l[m*4+1]),e.weightsIndices.push(l[m*4+2]),e.weightsIndices.push(l[m*4+3])),t.color&&(e.colors.push(i[u*3]),e.colors.push(i[u*3+1]),e.colors.push(i[u*3+2]),e.colors.push(i[f*3]),e.colors.push(i[f*3+1]),e.colors.push(i[f*3+2]),e.colors.push(i[m*3]),e.colors.push(i[m*3+1]),e.colors.push(i[m*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(s[u*3]),e.normal.push(s[u*3+1]),e.normal.push(s[u*3+2]),e.normal.push(s[f*3]),e.normal.push(s[f*3+1]),e.normal.push(s[f*3+2]),e.normal.push(s[m*3]),e.normal.push(s[m*3+1]),e.normal.push(s[m*3+2])),t.uv&&t.uv.forEach(function(g,d){e.uvs[d]===void 0&&(e.uvs[d]=[]),e.uvs[d].push(a[d][u*2]),e.uvs[d].push(a[d][u*2+1]),e.uvs[d].push(a[d][f*2]),e.uvs[d].push(a[d][f*2+1]),e.uvs[d].push(a[d][m*2]),e.uvs[d].push(a[d][m*2+1])})}addMorphTargets(e,t,n,r){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;n.forEach(function(i){i.rawTargets.forEach(function(a){const o=y.Objects.Geometry[a.geoID];o!==void 0&&s.genMorphGeometry(e,t,o,r,a.name)})})}genMorphGeometry(e,t,n,r,s){const i=t.Vertices!==void 0?t.Vertices.a:[],a=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],o=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],p=e.attributes.position.count*3,c=new Float32Array(p);for(let g=0;g<l.length;g++){const d=l[g]*3;c[d]=o[g*3],c[d+1]=o[g*3+1],c[d+2]=o[g*3+2]}const u={vertexIndices:a,vertexPositions:c,baseVertexPositions:i},f=this.genBuffers(u),m=new V(f.vertex,3);m.name=s||n.attrName,m.applyMatrix4(r),e.morphAttributes.position.push(m)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a;let s=[];return n==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a;let s=[];return n==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a;let s=[];n==="IndexToDirect"&&(s=e.ColorIndex.a);for(let i=0,a=new R;i<r.length;i+=4)a.fromArray(r,i),B.colorSpaceToWorking(a,D),a.toArray(r,i);return{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=e.Materials.a,s=[];for(let i=0;i<r.length;++i)s.push(i);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Y;const n=t-1,r=e.KnotVector.a,s=[],i=e.Points.a;for(let c=0,u=i.length;c<u;c+=4)s.push(new G().fromArray(i,c));let a,o;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){a=n,o=r.length-1-a;for(let c=0;c<n;++c)s.push(s[c])}const p=new je(n,r,s,a,o).getPoints(s.length*12);return new Y().setFromPoints(p)}}class Ke{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const r=t[n],s=this.addClip(r);e.push(s)}return e}parseClips(){if(y.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=y.Objects.AnimationCurveNode,t=new Map;for(const n in e){const r=e[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=y.Objects.AnimationCurve;for(const n in t){const r={id:t[n].id,times:t[n].KeyTime.a.map(qe),values:t[n].KeyValueFloat.a},s=F.get(r.id);if(s!==void 0){const i=s.parents[0].ID,a=s.parents[0].relationship;a.match(/X/)?e.get(i).curves.x=r:a.match(/Y/)?e.get(i).curves.y=r:a.match(/Z/)?e.get(i).curves.z=r:a.match(/DeformPercent/)&&e.has(i)&&(e.get(i).curves.morph=r)}}}parseAnimationLayers(e){const t=y.Objects.AnimationLayer,n=new Map;for(const r in t){const s=[],i=F.get(parseInt(r));i!==void 0&&(i.children.forEach(function(o,l){if(e.has(o.ID)){const p=e.get(o.ID);if(p.curves.x!==void 0||p.curves.y!==void 0||p.curves.z!==void 0){if(s[l]===void 0){const c=F.get(o.ID).parents.filter(function(u){return u.relationship!==void 0})[0].ID;if(c!==void 0){const u=y.Objects.Model[c.toString()];if(u===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",o);return}const f={modelName:u.attrName?W.sanitizeNodeName(u.attrName):"",ID:u.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};A.traverse(function(m){m.ID===u.id&&(f.transform=m.matrix,m.userData.transformData&&(f.eulerOrder=m.userData.transformData.eulerOrder))}),f.transform||(f.transform=new I),"PreRotation"in u&&(f.preRotation=u.PreRotation.value),"PostRotation"in u&&(f.postRotation=u.PostRotation.value),s[l]=f}}s[l]&&(s[l][p.attr]=p)}else if(p.curves.morph!==void 0){if(s[l]===void 0){const c=F.get(o.ID).parents.filter(function(w){return w.relationship!==void 0})[0].ID,u=F.get(c).parents[0].ID,f=F.get(u).parents[0].ID,m=F.get(f).parents[0].ID,g=y.Objects.Model[m],d={modelName:g.attrName?W.sanitizeNodeName(g.attrName):"",morphName:y.Objects.Deformer[c].attrName};s[l]=d}s[l][p.attr]=p}}}),n.set(parseInt(r),s))}return n}parseAnimStacks(e){const t=y.Objects.AnimationStack,n={};for(const r in t){const s=F.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(s[0].ID);n[r]={name:t[r].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new ke(e.name,-1,t)}generateTracks(e){const t=[];let n=new M,r=new M;if(e.transform&&e.transform.decompose(n,new b,r),n=n.toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,n,r){const s=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(s,t,n);return new Ce(e+"."+r,s,i)}generateRotationTrack(e,t,n,r,s){let i,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const u=this.interpolateRotations(t.x,t.y,t.z,s);i=u[0],a=u[1]}const o=z(0);n!==void 0&&(n=n.map(S.degToRad),n.push(o),n=new O().fromArray(n),n=new b().setFromEuler(n)),r!==void 0&&(r=r.map(S.degToRad),r.push(o),r=new O().fromArray(r),r=new b().setFromEuler(r).invert());const l=new b,p=new O,c=[];if(!a||!i)return new re(e+".quaternion",[0],[0]);for(let u=0;u<a.length;u+=3)p.set(a[u],a[u+1],a[u+2],s),l.setFromEuler(p),n!==void 0&&l.premultiply(n),r!==void 0&&l.multiply(r),u>2&&new b().fromArray(c,(u-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(c,u/3*4);return new re(e+".quaternion",i,c)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),r=A.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Re(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,r){return n-r}),t.length>1){let n=1,r=t[0];for(let s=1;s<t.length;s++){const i=t[s];i!==r&&(t[n]=i,r=i,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const r=n,s=[];let i=-1,a=-1,o=-1;return e.forEach(function(l){if(t.x&&(i=t.x.times.indexOf(l)),t.y&&(a=t.y.times.indexOf(l)),t.z&&(o=t.z.times.indexOf(l)),i!==-1){const p=t.x.values[i];s.push(p),r[0]=p}else s.push(r[0]);if(a!==-1){const p=t.y.values[a];s.push(p),r[1]=p}else s.push(r[1]);if(o!==-1){const p=t.z.values[o];s.push(p),r[2]=p}else s.push(r[2])}),s}interpolateRotations(e,t,n,r){const s=[],i=[];s.push(e.times[0]),i.push(S.degToRad(e.values[0])),i.push(S.degToRad(t.values[0])),i.push(S.degToRad(n.values[0]));for(let a=1;a<e.values.length;a++){const o=[e.values[a-1],t.values[a-1],n.values[a-1]];if(isNaN(o[0])||isNaN(o[1])||isNaN(o[2]))continue;const l=o.map(S.degToRad),p=[e.values[a],t.values[a],n.values[a]];if(isNaN(p[0])||isNaN(p[1])||isNaN(p[2]))continue;const c=p.map(S.degToRad),u=[p[0]-o[0],p[1]-o[1],p[2]-o[2]],f=[Math.abs(u[0]),Math.abs(u[1]),Math.abs(u[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){const g=Math.max(...f)/180,d=new O(...l,r),w=new O(...c,r),T=new b().setFromEuler(d),v=new b().setFromEuler(w);T.dot(v)&&v.set(-v.x,-v.y,-v.z,-v.w);const x=e.times[a-1],E=e.times[a]-x,P=new b,C=new O;for(let L=0;L<1;L+=1/g)P.copy(T.clone().slerp(v.clone(),L)),s.push(x+L*E),C.setFromQuaternion(P,r),i.push(C.x),i.push(C.y),i.push(C.z)}else s.push(e.times[a]),i.push(S.degToRad(e.values[a])),i.push(S.degToRad(t.values[a])),i.push(S.degToRad(n.values[a]))}return[s,i]}}class We{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new oe,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(r,s){const i=r.match(/^[\s\t]*;/),a=r.match(/^[\s\t]*$/);if(i||a)return;const o=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=r.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(r,o):l?t.parseNodeProperty(r,l,n[++s]):p?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(o){return o.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},i=this.parseNodeAttr(r),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in a?(n==="PoseNode"?a.PoseNode.push(s):a[n].id!==void 0&&(a[n]={},a[n][a[n].id]=a[n]),i.id!==""&&(a[n][i.id]=s)):typeof i.id=="number"?(a[n]={},a[n][i.id]=s):n!=="Properties70"&&(n==="PoseNode"?a[n]=[s]:a[n]=s),typeof i.id=="number"&&(s.id=i.id),i.name!==""&&(s.attrName=i.name),i.type!==""&&(s.attrType=i.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const o=s.split(",").slice(1),l=parseInt(o[0]),p=parseInt(o[1]);let c=s.split(",").slice(3);c=c.map(function(u){return u.trim().replace(/^"/,"")}),r="connections",s=[l,p],$e(s,c),i[r]===void 0&&(i[r]=[])}r==="Node"&&(i.id=s),r in i&&Array.isArray(i[r])?i[r].push(s):r!=="a"?i[r]=s:i.a=s,this.setCurrentProp(i,r),r==="a"&&s.slice(-1)!==","&&(i.a=q(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=q(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],i=r[1],a=r[2],o=r[3];let l=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=q(l);break}this.getPrevNode()[s]={type:i,type2:a,flag:o,value:l},this.setCurrentProp(this.getPrevNode(),s)}}class Ne{parse(e){const t=new se(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new oe;for(;!this.endOfContent(t);){const s=this.parseNode(t,n);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),a=e.getString(i);if(r===0)return null;const o=[];for(let u=0;u<s;u++)o.push(this.parseProperty(e));const l=o.length>0?o[0]:"",p=o.length>1?o[1]:"",c=o.length>2?o[2]:"";for(n.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const u=this.parseNode(e,t);u!==null&&this.parseSubNode(a,n,u)}return n.propertyList=o,typeof l=="number"&&(n.id=l),p!==""&&(n.attrName=p),c!==""&&(n.attrType=c),a!==""&&(n.name=a),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&&n.name==="C"){const r=[];n.propertyList.forEach(function(s,i){i!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let r=n.propertyList[0],s=n.propertyList[1];const i=n.propertyList[2],a=n.propertyList[3];let o;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?o=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:o=n.propertyList[4],t[r]={type:s,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),i=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const a=be(new Uint8Array(e.getArrayBuffer(i))),o=new se(a.buffer);switch(t){case"b":case"c":return o.getBooleanArray(r);case"d":return o.getFloat64Array(r);case"f":return o.getFloat32Array(r);case"i":return o.getInt32Array(r);case"l":return o.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class se{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}class oe{add(e,t){this[e]=t}}function Ye(h){const e="Kaydara FBX Binary \0";return h.byteLength>=e.length&&e===ce(h,0,e.length)}function Qe(h){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const s=h[r-1];return h=h.slice(t+r),t++,s}for(let r=0;r<e.length;++r)if(n(1)===e[r])return!1;return!0}function ie(h){const e=/FBXVersion: (\d+)/,t=h.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function qe(h){return h/46186158e3}const Ze=[];function K(h,e,t,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=h;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(r=n.indices[r]);const s=r*n.dataSize,i=s+n.dataSize;return Je(Ze,n.buffer,s,i)}const Q=new O,U=new M;function le(h){const e=new I,t=new I,n=new I,r=new I,s=new I,i=new I,a=new I,o=new I,l=new I,p=new I,c=new I,u=new I,f=h.inheritType?h.inheritType:0;h.translation&&e.setPosition(U.fromArray(h.translation));const m=z(0);if(h.preRotation){const k=h.preRotation.map(S.degToRad);k.push(m),t.makeRotationFromEuler(Q.fromArray(k))}if(h.rotation){const k=h.rotation.map(S.degToRad);k.push(h.eulerOrder||m),n.makeRotationFromEuler(Q.fromArray(k))}if(h.postRotation){const k=h.postRotation.map(S.degToRad);k.push(m),r.makeRotationFromEuler(Q.fromArray(k)),r.invert()}h.scale&&s.scale(U.fromArray(h.scale)),h.scalingOffset&&a.setPosition(U.fromArray(h.scalingOffset)),h.scalingPivot&&i.setPosition(U.fromArray(h.scalingPivot)),h.rotationOffset&&o.setPosition(U.fromArray(h.rotationOffset)),h.rotationPivot&&l.setPosition(U.fromArray(h.rotationPivot)),h.parentMatrixWorld&&(c.copy(h.parentMatrix),p.copy(h.parentMatrixWorld));const g=t.clone().multiply(n).multiply(r),d=new I;d.extractRotation(p);const w=new I;w.copyPosition(p);const T=w.clone().invert().multiply(p),v=d.clone().invert().multiply(T),x=s,E=new I;if(f===0)E.copy(d).multiply(g).multiply(v).multiply(x);else if(f===1)E.copy(d).multiply(v).multiply(g).multiply(x);else{const N=new I().scale(new M().setFromMatrixScale(c)).clone().invert(),pe=v.clone().multiply(N);E.copy(d).multiply(g).multiply(pe).multiply(x)}const P=l.clone().invert(),C=i.clone().invert();let L=e.clone().multiply(o).multiply(l).multiply(t).multiply(n).multiply(r).multiply(P).multiply(a).multiply(i).multiply(s).multiply(C);const j=new I().copyPosition(L),X=p.clone().multiply(j);return u.copyPosition(X),L=u.clone().multiply(E),L.premultiply(p.invert()),L}function z(h){h=h||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return h===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[h]}function q(h){return h.split(",").map(function(t){return parseFloat(t)})}function ce(h,e,t){return e===void 0&&(e=0),t===void 0&&(t=h.byteLength),new TextDecoder().decode(new Uint8Array(h,e,t))}function $e(h,e){for(let t=0,n=h.length,r=e.length;t<r;t++,n++)h[n]=e[t]}function Je(h,e,t,n){for(let r=t,s=0;r<n;r++,s++)h[s]=e[r];return h}export{nt as FBXLoader};
|