aptechka 0.5.44 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Animation-6Na1MCtM.cjs +1 -0
- package/lib/Animation-CELiTw3n.js +132 -0
- package/lib/Composed-DmLYTh1b.js +35 -0
- package/lib/Composed-Dx2hs-va.cjs +1 -0
- package/lib/{Damped-P4MkCGoY.js → Damped-Mx_FNNVz.js} +2 -5
- package/lib/Damped-loFiBsBy.cjs +1 -0
- package/lib/{Derived-kPJs5JC5.js → Derived-DlCvc0xQ.js} +1 -1
- package/lib/{Derived-B-g8dYgh.cjs → Derived-a6MDQEPY.cjs} +1 -1
- package/lib/ElementConstructor-CAZ2ra8m.cjs +1 -0
- package/lib/ElementConstructor-OYlPJf2L.js +366 -0
- package/lib/Resource-D3TQormz.cjs +1 -0
- package/lib/Resource-DIcoALGo.js +64 -0
- package/lib/{SourceManager-Q-PB-Rkh.js → SourceManager-Bz329f90.js} +1 -1
- package/lib/{SourceManager-vSlsMKUE.cjs → SourceManager-kxr5eUyL.cjs} +1 -1
- package/lib/Store-6s0YXK4o.cjs +1 -0
- package/lib/{Store-BQXXikps.js → Store-BI2xxXOA.js} +42 -42
- package/lib/Tweened-B_mclQ61.cjs +1 -0
- package/lib/Tweened-NE8M9onF.js +48 -0
- package/lib/{Viewport-DMB0dO-s.cjs → Viewport-CJeKnL5V.cjs} +1 -1
- package/lib/{Viewport-CFFhFKqX.js → Viewport-D9IL7kUQ.js} +1 -1
- package/lib/_createStore-Cf1MyeHa.cjs +1 -0
- package/lib/_createStore-Ck9bHolX.js +12 -0
- package/lib/accordion/AccordionElement.d.ts +3 -0
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +140 -104
- package/lib/animation/Animation.d.ts +10 -18
- package/lib/animation/Damped.d.ts +3 -5
- package/lib/animation/Tweened.d.ts +0 -2
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +31 -31
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +3 -3
- package/lib/checkbox/index.cjs +1 -1
- package/lib/checkbox/index.js +3 -3
- package/lib/class-linked-status/index.cjs +1 -1
- package/lib/class-linked-status/index.js +1 -1
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +3 -3
- package/lib/counter/index.d.ts +8 -0
- package/lib/{createStylesheet-DBCEbDjI.js → createStylesheet-CR_yi5tp.js} +1 -1
- package/lib/{createStylesheet-CqHU9_qv.cjs → createStylesheet-p23sZ7Ey.cjs} +1 -1
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.d.ts +1 -0
- package/lib/css-property/index.js +36 -32
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +1 -1
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/element-constructor/index.cjs +1 -1
- package/lib/element-constructor/index.js +114 -113
- package/lib/en3/core/En3Raycaster.d.ts +20 -0
- package/lib/en3/core/En3View.d.ts +1 -1
- package/lib/en3/core/en3.d.ts +5 -1
- package/lib/en3/helpers/En3Controls.d.ts +5 -0
- package/lib/en3/helpers/En3GridHelper.d.ts +8 -0
- package/lib/en3/helpers/En3Object3dManager.d.ts +12 -0
- package/lib/en3/helpers/En3OrbitControls.d.ts +8 -0
- package/lib/en3/helpers/En3TransformControls.d.ts +8 -0
- package/lib/en3/helpers/index.cjs +1 -0
- package/lib/en3/helpers/index.d.ts +2 -0
- package/lib/en3/helpers/index.js +1165 -0
- package/lib/en3/index.cjs +1 -213
- package/lib/en3/index.d.ts +1 -19
- package/lib/en3/index.js +4 -3305
- package/lib/en3/libs/index.d.ts +1 -0
- package/lib/en3/loaders/{en3GLTFLoader.d.ts → _En3GLTFLoader.d.ts} +2 -4
- package/lib/en3/loaders/_En3TextureLoader.d.ts +8 -0
- package/lib/en3/loaders/index.cjs +1 -0
- package/lib/en3/loaders/index.d.ts +3 -0
- package/lib/en3/loaders/index.js +1757 -0
- package/lib/en3/loaders/loaders.d.ts +13 -0
- package/lib/en3/misc/index.cjs +10 -0
- package/lib/en3/misc/index.d.ts +2 -0
- package/lib/en3/misc/index.js +115 -0
- package/lib/en3/objects/En3Clip.d.ts +1 -1
- package/lib/en3/objects/En3GLTF.d.ts +2 -1
- package/lib/en3/objects/En3ImageLike.d.ts +2 -1
- package/lib/en3/objects/En3SourceConsumer.d.ts +1 -1
- package/lib/en3/objects/fluid/index.d.ts +0 -3
- package/lib/en3/objects/index.d.ts +7 -0
- package/lib/en3/utils/index.cjs +1 -0
- package/lib/en3/utils/index.d.ts +5 -0
- package/lib/en3/utils/index.js +43 -0
- package/lib/en3-C4mzaF6q.cjs +8 -0
- package/lib/en3-hbkN1OPu.js +343 -0
- package/lib/globals-DMjysUXI.js +8 -0
- package/lib/globals-bYKki-b9.cjs +1 -0
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{index-BN9X-l9M.js → index-BAH_fO2N.js} +3 -3
- package/lib/{index-BbgmbQ-5.cjs → index-D1LQUR-R.cjs} +1 -1
- package/lib/instantiate-D19Uvc31.js +125 -0
- package/lib/instantiate-Db5gGSYG.cjs +1 -0
- package/lib/jsx/ComponentElement.d.ts +18 -0
- package/lib/jsx/globals.d.ts +13 -0
- package/lib/jsx/h.d.ts +7 -0
- package/lib/jsx/hooks/basic/_createStore.d.ts +4 -0
- package/lib/jsx/hooks/basic/attachInternals.d.ts +1 -0
- package/lib/jsx/hooks/basic/attachShadow.d.ts +1 -0
- package/lib/jsx/hooks/basic/attachStylesheet.d.ts +3 -0
- package/lib/jsx/hooks/basic/createContext.d.ts +2 -0
- package/lib/jsx/hooks/basic/onConnect.d.ts +3 -0
- package/lib/jsx/hooks/basic/onDisconnect.d.ts +3 -0
- package/lib/jsx/hooks/onAnimationFrame.cjs +1 -0
- package/lib/jsx/hooks/onAnimationFrame.d.ts +6 -0
- package/lib/jsx/hooks/onAnimationFrame.js +22 -0
- package/lib/jsx/hooks/onElementResize.cjs +1 -0
- package/lib/jsx/hooks/onElementResize.d.ts +5 -0
- package/lib/jsx/hooks/onElementResize.js +11 -0
- package/lib/jsx/hooks/onIntersection.cjs +1 -0
- package/lib/jsx/hooks/onIntersection.d.ts +5 -0
- package/lib/jsx/hooks/onIntersection.js +11 -0
- package/lib/jsx/hooks/onWindowResize.cjs +1 -0
- package/lib/jsx/hooks/onWindowResize.d.ts +3 -0
- package/lib/jsx/hooks/onWindowResize.js +8 -0
- package/lib/jsx/hooks/store/createArrayStore.d.ts +3 -0
- package/lib/jsx/hooks/store/createComposed.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerived.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedArray.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedComponent.d.ts +3 -0
- package/lib/jsx/hooks/store/createDerivedComponents.d.ts +3 -0
- package/lib/jsx/hooks/store/createResource.d.ts +3 -0
- package/lib/jsx/hooks/store/createStore.d.ts +3 -0
- package/lib/jsx/hooks/store/index.cjs +1 -0
- package/lib/jsx/hooks/store/index.d.ts +7 -0
- package/lib/jsx/hooks/store/index.js +49 -0
- package/lib/jsx/hooks/watchAttribute.cjs +1 -0
- package/lib/jsx/hooks/watchAttribute.d.ts +6 -0
- package/lib/jsx/hooks/watchAttribute.js +17 -0
- package/lib/jsx/hooks/watchCSSProperty.cjs +1 -0
- package/lib/jsx/hooks/watchCSSProperty.d.ts +7 -0
- package/lib/jsx/hooks/watchCSSProperty.js +17 -0
- package/lib/jsx/index.cjs +1 -0
- package/lib/jsx/index.d.ts +13 -0
- package/lib/jsx/index.js +91 -0
- package/lib/jsx/instantiate.d.ts +5 -0
- package/lib/jsx/register.d.ts +1 -0
- package/lib/jsx/render.d.ts +6 -0
- package/lib/jsx/type.d.ts +188 -0
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.d.ts +2 -0
- package/lib/ladder/index.js +84 -66
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.d.ts +9 -0
- package/lib/layout-box/index.js +190 -164
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +1 -1
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +7 -7
- package/lib/morph/Morph.d.ts +2 -2
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.d.ts +1 -1
- package/lib/morph/index.js +135 -143
- package/lib/notifier/index.d.ts +2 -2
- package/lib/notifier/index.js +3 -1
- package/lib/onConnect-DGP866cj.cjs +1 -0
- package/lib/onConnect-y5DrxJ9P.js +7 -0
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +2 -2
- package/lib/polyfills-CM4SCDTt.cjs +1 -0
- package/lib/polyfills-X6KXuHg-.js +33 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +2 -2
- package/lib/router/Router.d.ts +11 -3
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.d.ts +1 -1
- package/lib/router/index.js +185 -165
- package/lib/scroll/ScrollElement.d.ts +2 -19
- package/lib/scroll/ScrollSection.d.ts +23 -0
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +81 -77
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +2 -2
- package/lib/store/ArrayStore.d.ts +21 -0
- package/lib/store/Store.d.ts +1 -7
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.d.ts +2 -2
- package/lib/store/index.js +65 -139
- package/lib/tags-BqJKcIve.js +485 -0
- package/lib/tags-ld5jemJw.cjs +1 -0
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.js +2 -2
- package/lib/tweaker/TweakerBooleanManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerColorManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerFolderElement.d.ts +2 -0
- package/lib/tweaker/TweakerLinkManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerNumberManagerElement.d.ts +4 -8
- package/lib/tweaker/TweakerSelectManagerElement.d.ts +1 -1
- package/lib/tweaker/TweakerStoreManagerElement.d.ts +7 -7
- package/lib/tweaker/TweakerStringManagerElement.d.ts +3 -5
- package/lib/tweaker/index.cjs +3 -3
- package/lib/tweaker/index.js +535 -412
- package/lib/tweaker/tweakerManagerConstructors.d.ts +2 -2
- package/lib/tweaker/tweakerStorage.d.ts +8 -1
- package/lib/url-C3dWnJQg.cjs +1 -0
- package/lib/url-DMNfW7uN.js +22 -0
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +39 -34
- package/lib/utils/number.d.ts +1 -0
- package/lib/utils/url.d.ts +9 -0
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/package.json +107 -3
- package/lib/Animation-DDHjrbtL.cjs +0 -1
- package/lib/Animation-Dq_05jlR.js +0 -217
- package/lib/DRACOLoader-C2CFpMGS.cjs +0 -2
- package/lib/DRACOLoader-D2KY2dku.js +0 -241
- package/lib/Damped-l0mnlhar.cjs +0 -1
- package/lib/KTX2Loader-DdUl1XiY.cjs +0 -2
- package/lib/KTX2Loader-DqpAffDj.js +0 -536
- package/lib/Store-C-1ruEIm.cjs +0 -1
- package/lib/Tweened-CwDC2zl8.js +0 -51
- package/lib/Tweened-DIt9j9B-.cjs +0 -1
- package/lib/animation/AnimationLink.d.ts +0 -13
- package/lib/en3/loaders/en3TextureLoader.d.ts +0 -3
- package/lib/en3/test/En3HTML.d.ts +0 -10
- package/lib/polyfills-BA-CL_HF.js +0 -27
- package/lib/polyfills-DHs2SNbz.cjs +0 -1
- package/lib/store/CumulativeResource.d.ts +0 -13
- package/lib/tags-CMPg9ETZ.js +0 -848
- package/lib/tags-Djb6mb1o.cjs +0 -1
- package/lib/tweaker/TweakerRangeManagerElement.d.ts +0 -11
- /package/lib/en3/{loaders → core}/en3Cache.d.ts +0 -0
- /package/lib/{MeshoptDecoder-CMeN3oU0.cjs → en3/libs/index.cjs} +0 -0
- /package/lib/{MeshoptDecoder-6XfTpOG2.js → en3/libs/index.js} +0 -0
- /package/lib/en3/{test → misc}/En3ModifiedMaterial.d.ts +0 -0
- /package/lib/en3/{attachments → misc}/En3SourceManager.d.ts +0 -0
package/lib/en3/index.cjs
CHANGED
|
@@ -1,213 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
position: fixed;
|
|
3
|
-
left: 0;
|
|
4
|
-
top: 0;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
z-index: -1;
|
|
8
|
-
`,r(this,Z).append(r(this,C).domElement),r(this,P).set("default",new Jt("default",W({sizeElement:r(this,Z)},t==null?void 0:t.view))),y(this,gt,(t==null?void 0:t.cacheAssets)||!1),y(this,be,!0),Ae.windowResizer.subscribe(r(this,xt),ft.RESIZE_ORDER.EN3),ve.ticker.subscribe(r(this,yt),{order:ft.TICK_ORDER.EN3})}destroy(){if(!r(this,be)){console.warn("[en3.setup]: You are trying to destory en3 but it has not been initialized.");return}Ae.windowResizer.unsubscribe(r(this,xt)),ve.ticker.unsubscribe(r(this,yt)),r(this,P).forEach(t=>{t.destroy()}),r(this,C).dispose(),r(this,C).domElement.remove(),y(this,C,null),y(this,be,!1),V.forEach(t=>{t.dispose()}),V.clear()}createView(t,e){const s=r(this,P).size,n=new Jt(t,e);return r(this,P).set(t,n),s===1&&r(this,C).setScissorTest(!0),n}getView(t){return r(this,P).get(t)}destroyView(t){const e=r(this,P).get(t);e&&(r(this,P).delete(t),e.destroy(),r(this,P).size<=1&&r(this,C).setScissorTest(!1))}render(t){var e;if(r(this,P).size>1||this.view.isClipped){const s=t.box.left+t.box.CSSTranslation.x+t.box.scrollValue.x,n=R.height-t.box.height-t.box.top+t.box.CSSTranslation.y+t.box.scrollValue.y*-1;r(this,C).setScissor(s,n,t.box.width,t.box.height),r(this,C).setViewport(s,n,t.box.width,t.box.height)}(e=t.beforeRenderCallback)==null||e.call(t),r(this,C).render(t.scene,t.camera)}}kt=new WeakMap,Z=new WeakMap,C=new WeakMap,P=new WeakMap,Be=new WeakMap,Ge=new WeakMap,He=new WeakMap,mt=new WeakMap,be=new WeakMap,gt=new WeakMap,xt=new WeakMap,yt=new WeakMap;const R=new Vn,Te=new l.TextureLoader,Un=Te.load.bind(Te),zn=Te.loadAsync.bind(Te);Te.load=(h,t,...e)=>{if(R.cacheAssets&&V.has(h)){const s=V.get(h);return t==null||t(s.data),s.data}return Un(h,s=>{R.cacheAssets&&V.set(h,{data:s,dispose:()=>s.dispose()}),t==null||t(s)},...e)};Te.loadAsync=(h,...t)=>Kt(exports,null,function*(){if(R.cacheAssets&&V.has(h))return V.get(h).data;const e=yield zn(h,...t);return R.cacheAssets&&V.set(h,{data:e,dispose:()=>e.dispose()}),e});function hn(h,t){if(t===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===l.TriangleFanDrawMode||t===l.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const o=[],c=h.getAttribute("position");if(c!==void 0){for(let a=0;a<c.count;a++)o.push(a);h.setIndex(o),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const s=e.count-2,n=[];if(t===l.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(e.getX(0)),n.push(e.getX(o)),n.push(e.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(e.getX(o)),n.push(e.getX(o+1)),n.push(e.getX(o+2))):(n.push(e.getX(o+2)),n.push(e.getX(o+1)),n.push(e.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=h.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class Kn extends l.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new Yn(e)}),this.register(function(e){return new Qn(e)}),this.register(function(e){return new rs(e)}),this.register(function(e){return new os(e)}),this.register(function(e){return new as(e)}),this.register(function(e){return new Zn(e)}),this.register(function(e){return new Jn(e)}),this.register(function(e){return new es(e)}),this.register(function(e){return new ts(e)}),this.register(function(e){return new Wn(e)}),this.register(function(e){return new ns(e)}),this.register(function(e){return new $n(e)}),this.register(function(e){return new is(e)}),this.register(function(e){return new ss(e)}),this.register(function(e){return new Xn(e)}),this.register(function(e){return new cs(e)}),this.register(function(e){return new ls(e)})}load(t,e,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const u=l.LoaderUtils.extractUrlBase(t);o=l.LoaderUtils.resolveURL(u,this.path)}else o=l.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const c=function(u){n?n(u):console.error(u),i.manager.itemError(t),i.manager.itemEnd(t)},a=new l.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(u){try{i.parse(u,o,function(f){e(f),i.manager.itemEnd(t)},c)}catch(f){c(f)}},s,c)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,s,n){let i;const o={},c={},a=new TextDecoder;if(typeof t=="string")i=JSON.parse(t);else if(t instanceof ArrayBuffer)if(a.decode(new Uint8Array(t,0,4))===Tn){try{o[S.KHR_BINARY_GLTF]=new us(t)}catch(d){n&&n(d);return}i=JSON.parse(o[S.KHR_BINARY_GLTF].content)}else i=JSON.parse(a.decode(t));else i=t;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new Ss(i,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const d=this.pluginCallbacks[f](u);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[d.name]=d,o[d.name]=!0}if(i.extensionsUsed)for(let f=0;f<i.extensionsUsed.length;++f){const d=i.extensionsUsed[f],m=i.extensionsRequired||[];switch(d){case S.KHR_MATERIALS_UNLIT:o[d]=new qn;break;case S.KHR_DRACO_MESH_COMPRESSION:o[d]=new hs(i,this.dracoLoader);break;case S.KHR_TEXTURE_TRANSFORM:o[d]=new ds;break;case S.KHR_MESH_QUANTIZATION:o[d]=new fs;break;default:m.indexOf(d)>=0&&c[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(o),u.setPlugins(c),u.parse(s,n)}parseAsync(t,e){const s=this;return new Promise(function(n,i){s.parse(t,e,n,i)})}}function jn(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},removeAll:function(){h={}}}}const S={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Xn{constructor(t){this.parser=t,this.name=S.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let s=0,n=e.length;s<n;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,s="light:"+t;let n=e.cache.get(s);if(n)return n;const i=e.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[t];let u;const f=new l.Color(16777215);a.color!==void 0&&f.setRGB(a.color[0],a.color[1],a.color[2],l.LinearSRGBColorSpace);const d=a.range!==void 0?a.range:0;switch(a.type){case"directional":u=new l.DirectionalLight(f),u.target.position.set(0,0,-1),u.add(u.target);break;case"point":u=new l.PointLight(f),u.distance=d;break;case"spot":u=new l.SpotLight(f),u.distance=d,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,u.angle=a.spot.outerConeAngle,u.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,u.target.position.set(0,0,-1),u.add(u.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return u.position.set(0,0,0),u.decay=2,$(u,a),a.intensity!==void 0&&(u.intensity=a.intensity),u.name=e.createUniqueName(a.name||"light_"+t),n=Promise.resolve(u),e.cache.add(s,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,s=this.parser,i=s.json.nodes[t],c=(i.extensions&&i.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(a){return s._getNodeRef(e.cache,c,a)})}}class qn{constructor(){this.name=S.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(t,e,s){const n=[];t.color=new l.Color(1,1,1),t.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;t.color.setRGB(o[0],o[1],o[2],l.LinearSRGBColorSpace),t.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(t,"map",i.baseColorTexture,l.SRGBColorSpace))}return Promise.all(n)}}class Wn{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(e.emissiveIntensity=i),Promise.resolve()}}class Yn{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(e.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const c=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new l.Vector2(c,c)}return Promise.all(i)}}class Qn{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_DISPERSION}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}}class $n{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(e.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(e,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(e.iridescenceIOR=o.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(e,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class Zn{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_SHEEN}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];e.sheenColor=new l.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const c=o.sheenColorFactor;e.sheenColor.setRGB(c[0],c[1],c[2],l.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(e,"sheenColorMap",o.sheenColorTexture,l.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(e,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class Jn{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(e.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class es{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_VOLUME}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];e.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(e,"thicknessMap",o.thicknessTexture)),e.attenuationDistance=o.attenuationDistance||1/0;const c=o.attenuationColor||[1,1,1];return e.attenuationColor=new l.Color().setRGB(c[0],c[1],c[2],l.LinearSRGBColorSpace),Promise.all(i)}}class ts{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_IOR}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class ns{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_SPECULAR}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];e.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(e,"specularIntensityMap",o.specularTexture));const c=o.specularColorFactor||[1,1,1];return e.specularColor=new l.Color().setRGB(c[0],c[1],c[2],l.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&i.push(s.assignTexture(e,"specularColorMap",o.specularColorTexture,l.SRGBColorSpace)),Promise.all(i)}}class ss{constructor(t){this.parser=t,this.name=S.EXT_MATERIALS_BUMP}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return e.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&i.push(s.assignTexture(e,"bumpMap",o.bumpTexture)),Promise.all(i)}}class is{constructor(t){this.parser=t,this.name=S.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const s=this.parser.json.materials[t];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(t,e){const s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(e.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(e.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(e,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class rs{constructor(t){this.parser=t,this.name=S.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,s=e.json,n=s.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,i.source,o)}}class os{constructor(t){this.parser=t,this.name=S.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,n=s.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;const o=i.extensions[e],c=n.images[o.source];let a=s.textureLoader;if(c.uri){const u=s.options.manager.getHandler(c.uri);u!==null&&(a=u)}return this.detectSupport().then(function(u){if(u)return s.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class as{constructor(t){this.parser=t,this.name=S.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,n=s.json,i=n.textures[t];if(!i.extensions||!i.extensions[e])return null;const o=i.extensions[e],c=n.images[o.source];let a=s.textureLoader;if(c.uri){const u=s.options.manager.getHandler(c.uri);u!==null&&(a=u)}return this.detectSupport().then(function(u){if(u)return s.loadTextureImage(t,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class cs{constructor(t){this.name=S.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,s=e.bufferViews[t];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(c){const a=n.byteOffset||0,u=n.byteLength||0,f=n.count,d=n.byteStride,m=new Uint8Array(c,a,u);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(f,d,m,n.mode,n.filter).then(function(A){return A.buffer}):o.ready.then(function(){const A=new ArrayBuffer(f*d);return o.decodeGltfBuffer(new Uint8Array(A),f,d,m,n.mode,n.filter),A})})}else return null}}class ls{constructor(t){this.name=S.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,s=e.nodes[t];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=e.meshes[s.mesh];for(const u of n.primitives)if(u.mode!==G.TRIANGLES&&u.mode!==G.TRIANGLE_STRIP&&u.mode!==G.TRIANGLE_FAN&&u.mode!==void 0)return null;const o=s.extensions[this.name].attributes,c=[],a={};for(const u in o)c.push(this.parser.getDependency("accessor",o[u]).then(f=>(a[u]=f,a[u])));return c.length<1?null:(c.push(this.parser.createNodeMesh(t)),Promise.all(c).then(u=>{const f=u.pop(),d=f.isGroup?f.children:[f],m=u[0].count,A=[];for(const v of d){const b=new l.Matrix4,x=new l.Vector3,p=new l.Quaternion,T=new l.Vector3(1,1,1),_=new l.InstancedMesh(v.geometry,v.material,m);for(let w=0;w<m;w++)a.TRANSLATION&&x.fromBufferAttribute(a.TRANSLATION,w),a.ROTATION&&p.fromBufferAttribute(a.ROTATION,w),a.SCALE&&T.fromBufferAttribute(a.SCALE,w),_.setMatrixAt(w,b.compose(x,p,T));for(const w in a)if(w==="_COLOR_0"){const L=a[w];_.instanceColor=new l.InstancedBufferAttribute(L.array,L.itemSize,L.normalized)}else w!=="TRANSLATION"&&w!=="ROTATION"&&w!=="SCALE"&&v.geometry.setAttribute(w,a[w]);l.Object3D.prototype.copy.call(_,v),this.parser.assignFinalMaterial(_),A.push(_)}return f.isGroup?(f.clear(),f.add(...A),f):A[0]}))}}const Tn="glTF",ht=12,dn={JSON:1313821514,BIN:5130562};class us{constructor(t){this.name=S.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,ht),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Tn)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-ht,i=new DataView(t,ht);let o=0;for(;o<n;){const c=i.getUint32(o,!0);o+=4;const a=i.getUint32(o,!0);if(o+=4,a===dn.JSON){const u=new Uint8Array(t,ht+o,c);this.content=s.decode(u)}else if(a===dn.BIN){const u=ht+o;this.body=t.slice(u,u+c)}o+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class hs{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=S.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const s=this.json,n=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,c={},a={},u={};for(const f in o){const d=en[f]||f.toLowerCase();c[d]=o[f]}for(const f in t.attributes){const d=en[f]||f.toLowerCase();if(o[f]!==void 0){const m=s.accessors[t.attributes[f]],A=Pe[m.componentType];u[d]=A.name,a[d]=m.normalized===!0}}return e.getDependency("bufferView",i).then(function(f){return new Promise(function(d,m){n.decodeDracoFile(f,function(A){for(const v in A.attributes){const b=A.attributes[v],x=a[v];x!==void 0&&(b.normalized=x)}d(A)},c,u,l.LinearSRGBColorSpace,m)})})}}class ds{constructor(){this.name=S.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class fs{constructor(){this.name=S.KHR_MESH_QUANTIZATION}}class wn extends l.Interpolant{constructor(t,e,s,n){super(t,e,s,n)}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=t*n*3+n;for(let o=0;o!==n;o++)e[o]=s[i+o];return e}interpolate_(t,e,s,n){const i=this.resultBuffer,o=this.sampleValues,c=this.valueSize,a=c*2,u=c*3,f=n-e,d=(s-e)/f,m=d*d,A=m*d,v=t*u,b=v-u,x=-2*A+3*m,p=A-m,T=1-x,_=p-m+d;for(let w=0;w!==c;w++){const L=o[b+w+c],I=o[b+w+a]*f,N=o[v+w+c],U=o[v+w]*f;i[w]=T*L+_*I+x*N+p*U}return i}}const ps=new l.Quaternion;class ms extends wn{interpolate_(t,e,s,n){const i=super.interpolate_(t,e,s,n);return ps.fromArray(i).normalize().toArray(i),i}}const G={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Pe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},fn={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},pn={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},qt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},en={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},re={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},gs={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},Wt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xs(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),h.DefaultMaterial}function we(h,t,e){for(const s in e.extensions)h[s]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=e.extensions[s])}function $(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ys(h,t,e){let s=!1,n=!1,i=!1;for(let u=0,f=t.length;u<f;u++){const d=t[u];if(d.POSITION!==void 0&&(s=!0),d.NORMAL!==void 0&&(n=!0),d.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(h);const o=[],c=[],a=[];for(let u=0,f=t.length;u<f;u++){const d=t[u];if(s){const m=d.POSITION!==void 0?e.getDependency("accessor",d.POSITION):h.attributes.position;o.push(m)}if(n){const m=d.NORMAL!==void 0?e.getDependency("accessor",d.NORMAL):h.attributes.normal;c.push(m)}if(i){const m=d.COLOR_0!==void 0?e.getDependency("accessor",d.COLOR_0):h.attributes.color;a.push(m)}}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(a)]).then(function(u){const f=u[0],d=u[1],m=u[2];return s&&(h.morphAttributes.position=f),n&&(h.morphAttributes.normal=d),i&&(h.morphAttributes.color=m),h.morphTargetsRelative=!0,h})}function As(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,s=t.weights.length;e<s;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let s=0,n=e.length;s<n;s++)h.morphTargetDictionary[e[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function vs(h){let t;const e=h.extensions&&h.extensions[S.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+Yt(e.attributes):t=h.indices+":"+Yt(h.attributes)+":"+h.mode,h.targets!==void 0)for(let s=0,n=h.targets.length;s<n;s++)t+=":"+Yt(h.targets[s]);return t}function Yt(h){let t="";const e=Object.keys(h).sort();for(let s=0,n=e.length;s<n;s++)t+=e[s]+":"+h[e[s]]+";";return t}function tn(h){switch(h){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Ts(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ws=new l.Matrix4;class Ss{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new jn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=!1,i=-1;typeof navigator!="undefined"&&(s=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,i=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap=="undefined"||s||n&&i<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const c={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return we(i,c,n),$(c,n),Promise.all(s._invokeAll(function(a){return a.afterRoot&&a.afterRoot(c)})).then(function(){for(const a of c.scenes)a.updateMatrixWorld();t(c)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=e.length;n<i;n++){const o=e[n].joints;for(let c=0,a=o.length;c<a;c++)t[o[c]].isBone=!0}for(let n=0,i=t.length;n<i;n++){const o=t[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,s){if(t.refs[e]<=1)return s;const n=s.clone(),i=(o,c)=>{const a=this.associations.get(o);a!=null&&this.associations.set(c,a);for(const[u,f]of o.children.entries())i(f,c.children[u])};return i(s,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const n=t(e[s]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let n=0;n<e.length;n++){const i=t(e[n]);i&&s.push(i)}return s}getDependency(t,e){const s=t+":"+e;let n=this.cache.get(s);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(e)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(s,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const s=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(i,o){return s.getDependency(t,o)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],s=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[S.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(l.LoaderUtils.resolveURL(e.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(s){const n=e.byteLength||0,i=e.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(t){const e=this,s=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const o=qt[n.type],c=Pe[n.componentType],a=n.normalized===!0,u=new c(n.count*o);return Promise.resolve(new l.BufferAttribute(u,o,a))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const c=o[0],a=qt[n.type],u=Pe[n.componentType],f=u.BYTES_PER_ELEMENT,d=f*a,m=n.byteOffset||0,A=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,v=n.normalized===!0;let b,x;if(A&&A!==d){const p=Math.floor(m/A),T="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+p+":"+n.count;let _=e.cache.get(T);_||(b=new u(c,p*A,n.count*A/f),_=new l.InterleavedBuffer(b,A/f),e.cache.add(T,_)),x=new l.InterleavedBufferAttribute(_,a,m%A/f,v)}else c===null?b=new u(n.count*a):b=new u(c,m,n.count*a),x=new l.BufferAttribute(b,a,v);if(n.sparse!==void 0){const p=qt.SCALAR,T=Pe[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,w=n.sparse.values.byteOffset||0,L=new T(o[1],_,n.sparse.count*p),I=new u(o[2],w,n.sparse.count*a);c!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let N=0,U=L.length;N<U;N++){const ie=L[N];if(x.setX(ie,I[N*a]),a>=2&&x.setY(ie,I[N*a+1]),a>=3&&x.setZ(ie,I[N*a+2]),a>=4&&x.setW(ie,I[N*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(t){const e=this.json,s=this.options,i=e.textures[t].source,o=e.images[i];let c=this.textureLoader;if(o.uri){const a=s.manager.getHandler(o.uri);a!==null&&(c=a)}return this.loadTextureImage(t,i,c)}loadTextureImage(t,e,s){const n=this,i=this.json,o=i.textures[t],c=i.images[e],a=(c.uri||c.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const u=this.loadImageSource(e,s).then(function(f){f.flipY=!1,f.name=o.name||c.name||"",f.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(f.name=c.uri);const m=(i.samplers||{})[o.sampler]||{};return f.magFilter=fn[m.magFilter]||l.LinearFilter,f.minFilter=fn[m.minFilter]||l.LinearMipmapLinearFilter,f.wrapS=pn[m.wrapS]||l.RepeatWrapping,f.wrapT=pn[m.wrapT]||l.RepeatWrapping,n.associations.set(f,{textures:t}),f}).catch(function(){return null});return this.textureCache[a]=u,u}loadImageSource(t,e){const s=this,n=this.json,i=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(d=>d.clone());const o=n.images[t],c=self.URL||self.webkitURL;let a=o.uri||"",u=!1;if(o.bufferView!==void 0)a=s.getDependency("bufferView",o.bufferView).then(function(d){u=!0;const m=new Blob([d],{type:o.mimeType});return a=c.createObjectURL(m),a});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(a).then(function(d){return new Promise(function(m,A){let v=m;e.isImageBitmapLoader===!0&&(v=function(b){const x=new l.Texture(b);x.needsUpdate=!0,m(x)}),e.load(l.LoaderUtils.resolveURL(d,i.path),v,void 0,A)})}).then(function(d){return u===!0&&c.revokeObjectURL(a),$(d,o),d.userData.mimeType=o.mimeType||Ts(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),d});return this.sourceCache[t]=f,f}assignTexture(t,e,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[S.KHR_TEXTURE_TRANSFORM]){const c=s.extensions!==void 0?s.extensions[S.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const a=i.associations.get(o);o=i.extensions[S.KHR_TEXTURE_TRANSFORM].extendTexture(o,c),i.associations.set(o,a)}}return n!==void 0&&(o.colorSpace=n),t[e]=o,o})}assignFinalMaterial(t){const e=t.geometry;let s=t.material;const n=e.attributes.tangent===void 0,i=e.attributes.color!==void 0,o=e.attributes.normal===void 0;if(t.isPoints){const c="PointsMaterial:"+s.uuid;let a=this.cache.get(c);a||(a=new l.PointsMaterial,l.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,a.sizeAttenuation=!1,this.cache.add(c,a)),s=a}else if(t.isLine){const c="LineBasicMaterial:"+s.uuid;let a=this.cache.get(c);a||(a=new l.LineBasicMaterial,l.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,this.cache.add(c,a)),s=a}if(n||i||o){let c="ClonedMaterial:"+s.uuid+":";n&&(c+="derivative-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:");let a=this.cache.get(c);a||(a=s.clone(),i&&(a.vertexColors=!0),o&&(a.flatShading=!0),n&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(c,a),this.associations.set(a,this.associations.get(s))),s=a}t.material=s}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(t){const e=this,s=this.json,n=this.extensions,i=s.materials[t];let o;const c={},a=i.extensions||{},u=[];if(a[S.KHR_MATERIALS_UNLIT]){const d=n[S.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),u.push(d.extendParams(c,i,e))}else{const d=i.pbrMetallicRoughness||{};if(c.color=new l.Color(1,1,1),c.opacity=1,Array.isArray(d.baseColorFactor)){const m=d.baseColorFactor;c.color.setRGB(m[0],m[1],m[2],l.LinearSRGBColorSpace),c.opacity=m[3]}d.baseColorTexture!==void 0&&u.push(e.assignTexture(c,"map",d.baseColorTexture,l.SRGBColorSpace)),c.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,c.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(u.push(e.assignTexture(c,"metalnessMap",d.metallicRoughnessTexture)),u.push(e.assignTexture(c,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(t)}),u.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(t,c)})))}i.doubleSided===!0&&(c.side=l.DoubleSide);const f=i.alphaMode||Wt.OPAQUE;if(f===Wt.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,f===Wt.MASK&&(c.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==l.MeshBasicMaterial&&(u.push(e.assignTexture(c,"normalMap",i.normalTexture)),c.normalScale=new l.Vector2(1,1),i.normalTexture.scale!==void 0)){const d=i.normalTexture.scale;c.normalScale.set(d,d)}if(i.occlusionTexture!==void 0&&o!==l.MeshBasicMaterial&&(u.push(e.assignTexture(c,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==l.MeshBasicMaterial){const d=i.emissiveFactor;c.emissive=new l.Color().setRGB(d[0],d[1],d[2],l.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==l.MeshBasicMaterial&&u.push(e.assignTexture(c,"emissiveMap",i.emissiveTexture,l.SRGBColorSpace)),Promise.all(u).then(function(){const d=new o(c);return i.name&&(d.name=i.name),$(d,i),e.associations.set(d,{materials:t}),i.extensions&&we(n,d,i),d})}createUniqueName(t){const e=l.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,s=this.extensions,n=this.primitiveCache;function i(c){return s[S.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,e).then(function(a){return mn(a,c,e)})}const o=[];for(let c=0,a=t.length;c<a;c++){const u=t[c],f=vs(u),d=n[f];if(d)o.push(d.promise);else{let m;u.extensions&&u.extensions[S.KHR_DRACO_MESH_COMPRESSION]?m=i(u):m=mn(new l.BufferGeometry,u,e),n[f]={primitive:u,promise:m},o.push(m)}}return Promise.all(o)}loadMesh(t){const e=this,s=this.json,n=this.extensions,i=s.meshes[t],o=i.primitives,c=[];for(let a=0,u=o.length;a<u;a++){const f=o[a].material===void 0?xs(this.cache):this.getDependency("material",o[a].material);c.push(f)}return c.push(e.loadGeometries(o)),Promise.all(c).then(function(a){const u=a.slice(0,a.length-1),f=a[a.length-1],d=[];for(let A=0,v=f.length;A<v;A++){const b=f[A],x=o[A];let p;const T=u[A];if(x.mode===G.TRIANGLES||x.mode===G.TRIANGLE_STRIP||x.mode===G.TRIANGLE_FAN||x.mode===void 0)p=i.isSkinnedMesh===!0?new l.SkinnedMesh(b,T):new l.Mesh(b,T),p.isSkinnedMesh===!0&&p.normalizeSkinWeights(),x.mode===G.TRIANGLE_STRIP?p.geometry=hn(p.geometry,l.TriangleStripDrawMode):x.mode===G.TRIANGLE_FAN&&(p.geometry=hn(p.geometry,l.TriangleFanDrawMode));else if(x.mode===G.LINES)p=new l.LineSegments(b,T);else if(x.mode===G.LINE_STRIP)p=new l.Line(b,T);else if(x.mode===G.LINE_LOOP)p=new l.LineLoop(b,T);else if(x.mode===G.POINTS)p=new l.Points(b,T);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(p.geometry.morphAttributes).length>0&&As(p,i),p.name=e.createUniqueName(i.name||"mesh_"+t),$(p,i),x.extensions&&we(n,p,x),e.assignFinalMaterial(p),d.push(p)}for(let A=0,v=d.length;A<v;A++)e.associations.set(d[A],{meshes:t,primitives:A});if(d.length===1)return i.extensions&&we(n,d[0],i),d[0];const m=new l.Group;i.extensions&&we(n,m,i),e.associations.set(m,{meshes:t});for(let A=0,v=d.length;A<v;A++)m.add(d[A]);return m})}loadCamera(t){let e;const s=this.json.cameras[t],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?e=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(e=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),$(e,s),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],s=[];for(let n=0,i=e.joints.length;n<i;n++)s.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,c=[],a=[];for(let u=0,f=o.length;u<f;u++){const d=o[u];if(d){c.push(d);const m=new l.Matrix4;i!==null&&m.fromArray(i.array,u*16),a.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[u])}return new l.Skeleton(c,a)})}loadAnimation(t){const e=this.json,s=this,n=e.animations[t],i=n.name?n.name:"animation_"+t,o=[],c=[],a=[],u=[],f=[];for(let d=0,m=n.channels.length;d<m;d++){const A=n.channels[d],v=n.samplers[A.sampler],b=A.target,x=b.node,p=n.parameters!==void 0?n.parameters[v.input]:v.input,T=n.parameters!==void 0?n.parameters[v.output]:v.output;b.node!==void 0&&(o.push(this.getDependency("node",x)),c.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",T)),u.push(v),f.push(b))}return Promise.all([Promise.all(o),Promise.all(c),Promise.all(a),Promise.all(u),Promise.all(f)]).then(function(d){const m=d[0],A=d[1],v=d[2],b=d[3],x=d[4],p=[];for(let T=0,_=m.length;T<_;T++){const w=m[T],L=A[T],I=v[T],N=b[T],U=x[T];if(w===void 0)continue;w.updateMatrix&&w.updateMatrix();const ie=s._createAnimationTracks(w,L,I,N,U);if(ie)for(let Ut=0;Ut<ie.length;Ut++)p.push(ie[Ut])}return new l.AnimationClip(i,void 0,p)})}createNodeMesh(t){const e=this.json,s=this,n=e.nodes[t];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(c){if(c.isMesh)for(let a=0,u=n.weights.length;a<u;a++)c.morphTargetInfluences[a]=n.weights[a]}),o})}loadNode(t){const e=this.json,s=this,n=e.nodes[t],i=s._loadNodeShallow(t),o=[],c=n.children||[];for(let u=0,f=c.length;u<f;u++)o.push(s.getDependency("node",c[u]));const a=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),a]).then(function(u){const f=u[0],d=u[1],m=u[2];m!==null&&f.traverse(function(A){A.isSkinnedMesh&&A.bind(m,ws)});for(let A=0,v=d.length;A<v;A++)f.add(d[A]);return f})}_loadNodeShallow(t){const e=this.json,s=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const i=e.nodes[t],o=i.name?n.createUniqueName(i.name):"",c=[],a=n._invokeOne(function(u){return u.createNodeMesh&&u.createNodeMesh(t)});return a&&c.push(a),i.camera!==void 0&&c.push(n.getDependency("camera",i.camera).then(function(u){return n._getNodeRef(n.cameraCache,i.camera,u)})),n._invokeAll(function(u){return u.createNodeAttachment&&u.createNodeAttachment(t)}).forEach(function(u){c.push(u)}),this.nodeCache[t]=Promise.all(c).then(function(u){let f;if(i.isBone===!0?f=new l.Bone:u.length>1?f=new l.Group:u.length===1?f=u[0]:f=new l.Object3D,f!==u[0])for(let d=0,m=u.length;d<m;d++)f.add(u[d]);if(i.name&&(f.userData.name=i.name,f.name=o),$(f,i),i.extensions&&we(s,f,i),i.matrix!==void 0){const d=new l.Matrix4;d.fromArray(i.matrix),f.applyMatrix4(d)}else i.translation!==void 0&&f.position.fromArray(i.translation),i.rotation!==void 0&&f.quaternion.fromArray(i.rotation),i.scale!==void 0&&f.scale.fromArray(i.scale);return n.associations.has(f)||n.associations.set(f,{}),n.associations.get(f).nodes=t,f}),this.nodeCache[t]}loadScene(t){const e=this.extensions,s=this.json.scenes[t],n=this,i=new l.Group;s.name&&(i.name=n.createUniqueName(s.name)),$(i,s),s.extensions&&we(e,i,s);const o=s.nodes||[],c=[];for(let a=0,u=o.length;a<u;a++)c.push(n.getDependency("node",o[a]));return Promise.all(c).then(function(a){for(let f=0,d=a.length;f<d;f++)i.add(a[f]);const u=f=>{const d=new Map;for(const[m,A]of n.associations)(m instanceof l.Material||m instanceof l.Texture)&&d.set(m,A);return f.traverse(m=>{const A=n.associations.get(m);A!=null&&d.set(m,A)}),d};return n.associations=u(i),i})}_createAnimationTracks(t,e,s,n,i){const o=[],c=t.name?t.name:t.uuid,a=[];re[i.path]===re.weights?t.traverse(function(m){m.morphTargetInfluences&&a.push(m.name?m.name:m.uuid)}):a.push(c);let u;switch(re[i.path]){case re.weights:u=l.NumberKeyframeTrack;break;case re.rotation:u=l.QuaternionKeyframeTrack;break;case re.position:case re.scale:u=l.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:u=l.NumberKeyframeTrack;break;case 2:case 3:default:u=l.VectorKeyframeTrack;break}break}const f=n.interpolation!==void 0?gs[n.interpolation]:l.InterpolateLinear,d=this._getArrayFromAccessor(s);for(let m=0,A=a.length;m<A;m++){const v=new u(a[m]+"."+re[i.path],e.array,d,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),o.push(v)}return o}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const s=tn(e.constructor),n=new Float32Array(e.length);for(let i=0,o=e.length;i<o;i++)n[i]=e[i]*s;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(s){const n=this instanceof l.QuaternionKeyframeTrack?ms:wn;return new n(this.times,this.values,this.getValueSize()/3,s)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function bs(h,t,e){const s=t.attributes,n=new l.Box3;if(s.POSITION!==void 0){const c=e.json.accessors[s.POSITION],a=c.min,u=c.max;if(a!==void 0&&u!==void 0){if(n.set(new l.Vector3(a[0],a[1],a[2]),new l.Vector3(u[0],u[1],u[2])),c.normalized){const f=tn(Pe[c.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=t.targets;if(i!==void 0){const c=new l.Vector3,a=new l.Vector3;for(let u=0,f=i.length;u<f;u++){const d=i[u];if(d.POSITION!==void 0){const m=e.json.accessors[d.POSITION],A=m.min,v=m.max;if(A!==void 0&&v!==void 0){if(a.setX(Math.max(Math.abs(A[0]),Math.abs(v[0]))),a.setY(Math.max(Math.abs(A[1]),Math.abs(v[1]))),a.setZ(Math.max(Math.abs(A[2]),Math.abs(v[2]))),m.normalized){const b=tn(Pe[m.componentType]);a.multiplyScalar(b)}c.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(c)}h.boundingBox=n;const o=new l.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=o}function mn(h,t,e){const s=t.attributes,n=[];function i(o,c){return e.getDependency("accessor",o).then(function(a){h.setAttribute(c,a)})}for(const o in s){const c=en[o]||o.toLowerCase();c in h.attributes||n.push(i(s[o],c))}if(t.indices!==void 0&&!h.index){const o=e.getDependency("accessor",t.indices).then(function(c){h.setIndex(c)});n.push(o)}return l.ColorManagement.workingColorSpace!==l.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${l.ColorManagement.workingColorSpace}" not supported.`),$(h,t),bs(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?ys(h,t.targets,e):h})}var Ee;class Es{constructor(){g(this,Ee,new Kn)}get gltfLoader(){return r(this,Ee)}setLoaders(t){return Kt(this,null,function*(){if(t!=null&&t.draco){const{DRACOLoader:e}=yield Promise.resolve().then(()=>require("../DRACOLoader-C2CFpMGS.cjs")),s=new e,n=typeof t.draco=="boolean"?`${R.CDNVersion}/examples/jsm/libs/draco/gltf/`:t.draco;s.setDecoderPath(n),r(this,Ee).setDRACOLoader(s)}if(t!=null&&t.ktx2){const{KTX2Loader:e}=yield Promise.resolve().then(()=>require("../KTX2Loader-DdUl1XiY.cjs")),s=new e,n=typeof t.ktx2=="boolean"?`${R.CDNVersion}/examples/jsm/libs/basis/`:t.ktx2;s.setTranscoderPath(n),r(this,Ee).setKTX2Loader(s.detectSupport(R.webglRenderer))}if(t!=null&&t.meshopt){const{MeshoptDecoder:e}=yield Promise.resolve().then(()=>require("../MeshoptDecoder-CMeN3oU0.cjs"));r(this,Ee).setMeshoptDecoder(e())}})}load(...t){const[e,s,...n]=t;if(R.cacheAssets&&V.has(e)){const i=V.get(e).data;s(i)}else this.gltfLoader.load(e,i=>{R.cacheAssets&&V.set(e,{data:i,dispose:()=>{i.cameras.forEach(o=>Ne(o)),i.scenes.forEach(o=>{Ne(o)})}}),s(i)},...n)}}Ee=new WeakMap;const Sn=new Es;var J,D,ee,At;class Rs{constructor(t,e){g(this,J,void 0);g(this,D,void 0);g(this,ee,[]);g(this,At,()=>{const t=r(this,D).left-r(this,J).box.left,e=r(this,D).top-r(this,J).box.top;let s=0,n=0;r(this,J).isClipped||(s=r(this,D).position.x-r(this,D).left,n=r(this,D).position.y-r(this,D).top);const i=r(this,J).box.width-r(this,D).scale.x,o=t-i,c=r(this,J).box.height-r(this,D).scale.y,a=e-c;r(this,ee)[0].constant=r(this,D).scale.y/2+n*-1-c/2-a,r(this,ee)[1].constant=r(this,D).scale.y/2+n+c/2+a,r(this,ee)[2].constant=r(this,D).scale.x/2+s+i/2+o,r(this,ee)[3].constant=r(this,D).scale.x/2+s*-1-i/2-o});y(this,J,R.getView((e==null?void 0:e.viewName)||"default")),y(this,D,new Zt.LayoutBox(t,{cartesian:!1}));const s=(e==null?void 0:e.scale)||1;y(this,ee,[new l.Plane(new l.Vector3(0,-1*s,0)),new l.Plane(new l.Vector3(0,1*s,0)),new l.Plane(new l.Vector3(-1*s,0,0)),new l.Plane(new l.Vector3(1*s,0,0))]),ve.ticker.subscribe(r(this,At),{order:ft.TICK_ORDER.LAYOUT_BOX})}get planes(){return r(this,ee)}get layoutBox(){return r(this,D)}destroy(){ve.ticker.unsubscribe(r(this,At)),r(this,D).destroy()}}J=new WeakMap,D=new WeakMap,ee=new WeakMap,At=new WeakMap;class Ms extends l.Group{constructor(t,e=500){super(),this.add(new l.PlaneHelper(t.planes[0],e,16711680)),this.add(new l.PlaneHelper(t.planes[1],e,16711680)),this.add(new l.PlaneHelper(t.planes[2],e,16711680)),this.add(new l.PlaneHelper(t.planes[3],e,16711680))}}var Ve,Re,Ue,vt,Tt,ue,ze,wt;class on extends Nn.SourceManager{constructor(e){super(e);g(this,Ve,new F.Store(null));g(this,Re,new F.Store(void 0));g(this,Ue,void 0);g(this,vt,void 0);g(this,Tt,void 0);g(this,ue,void 0);g(this,ze,!1);g(this,wt,()=>{if(!(r(this,ue)&&!r(this,ze))&&(this.current!==this.previous&&(r(this,Ve).current=null),this.current)){const e=r(this,Tt)?this.current.url:this.current.name+this.current.extension;r(this,ue)||jt.loading.setTotal(e,1),r(this,Re).current="start",r(this,vt).load(e,s=>{var n;r(this,Ve).current=((n=this.processData)==null?void 0:n.call(this,s))||s,r(this,Re).current="complete",r(this,ue)||jt.loading.setLoaded(e,1)},void 0,()=>{r(this,ue)||(r(this,Re).current="error",jt.loading.setError(e,e))})}});y(this,Ue,e.consumer),y(this,vt,e.loader),y(this,Tt,e.keepSourceParameters||!1),y(this,ue,e.lazy||!1),this.subscribe(r(this,wt)),r(this,Ue).addEventListener("added",()=>{this.connect()}),r(this,Ue).addEventListener("removed",()=>{this.disconnect()})}get data(){return r(this,Ve)}get loading(){return r(this,Re)}lazyLoad(){r(this,ze)||(y(this,ze,!0),r(this,wt).call(this))}}Ve=new WeakMap,Re=new WeakMap,Ue=new WeakMap,vt=new WeakMap,Tt=new WeakMap,ue=new WeakMap,ze=new WeakMap,wt=new WeakMap;var Me;class _s extends l.Group{constructor(e){super();g(this,Me,void 0);y(this,Me,new on(W({loader:Sn,consumer:this},e))),r(this,Me).processData=s=>{if(R.cacheAssets){const n=W({},s);return n.scene=s.scene.clone(!0),n.scenes=s.scenes.map(i=>s.scene===i?n.scene:i.clone(!0)),n}return s},r(this,Me).data.subscribe(s=>{s.current?this.add(...s.current.scene.children):this.children.forEach(n=>{this.remove(n),Ne(n)})})}get sourceManager(){return r(this,Me)}}Me=new WeakMap;const ct=`attribute vec3 position;
|
|
9
|
-
uniform vec2 px;
|
|
10
|
-
uniform vec2 boundarySpace;
|
|
11
|
-
varying vec2 uv;
|
|
12
|
-
|
|
13
|
-
precision highp float;
|
|
14
|
-
|
|
15
|
-
void main(){
|
|
16
|
-
vec3 pos = position;
|
|
17
|
-
vec2 scale = 1.0 - boundarySpace * 2.0;
|
|
18
|
-
pos.xy = pos.xy * scale;
|
|
19
|
-
uv = vec2(0.5)+(pos.xy)*0.5;
|
|
20
|
-
gl_Position = vec4(pos, 1.0);
|
|
21
|
-
}`,Ls=`precision highp float;
|
|
22
|
-
uniform vec3 backgroundColor;
|
|
23
|
-
uniform float backgroundOpacity;
|
|
24
|
-
uniform vec3 fluidColor;
|
|
25
|
-
uniform float fluidOpacity;
|
|
26
|
-
uniform float backgroundMixThreshold;
|
|
27
|
-
uniform sampler2D velocity;
|
|
28
|
-
varying vec2 uv;
|
|
29
|
-
|
|
30
|
-
void main(){
|
|
31
|
-
vec2 vel = texture2D(velocity, uv).xy;
|
|
32
|
-
|
|
33
|
-
float len = length(vel);
|
|
34
|
-
|
|
35
|
-
vel = vel * 0.5 + 0.5;
|
|
36
|
-
|
|
37
|
-
vec4 backgroundColorA = mix(vec4(vec3(0.0,0.0,0.0), backgroundOpacity), vec4(backgroundColor, backgroundOpacity), backgroundMixThreshold);
|
|
38
|
-
vec4 fluidColorA = vec4(fluidColor, fluidOpacity);
|
|
39
|
-
vec4 finalColor = mix(backgroundColorA, fluidColorA, len);
|
|
40
|
-
|
|
41
|
-
gl_FragColor = finalColor;
|
|
42
|
-
}`,Cs=`attribute vec3 position;
|
|
43
|
-
varying vec2 uv;
|
|
44
|
-
uniform vec2 px;
|
|
45
|
-
|
|
46
|
-
precision highp float;
|
|
47
|
-
|
|
48
|
-
void main(){
|
|
49
|
-
vec3 pos = position;
|
|
50
|
-
uv = 0.5 + pos.xy * 0.5;
|
|
51
|
-
vec2 n = sign(pos.xy);
|
|
52
|
-
pos.xy = abs(pos.xy) - px * 1.0;
|
|
53
|
-
pos.xy *= n;
|
|
54
|
-
gl_Position = vec4(pos, 1.0);
|
|
55
|
-
}`,gn=`precision highp float;
|
|
56
|
-
uniform sampler2D velocity;
|
|
57
|
-
uniform float dt;
|
|
58
|
-
uniform bool isBFECC;
|
|
59
|
-
// uniform float uvScale;
|
|
60
|
-
uniform vec2 fboSize;
|
|
61
|
-
uniform vec2 px;
|
|
62
|
-
varying vec2 uv;
|
|
63
|
-
|
|
64
|
-
void main(){
|
|
65
|
-
vec2 ratio = max(fboSize.x, fboSize.y) / fboSize;
|
|
66
|
-
|
|
67
|
-
if(isBFECC == false){
|
|
68
|
-
vec2 vel = texture2D(velocity, uv).xy;
|
|
69
|
-
vec2 uv2 = uv - vel * dt * ratio;
|
|
70
|
-
vec2 newVel = texture2D(velocity, uv2).xy;
|
|
71
|
-
gl_FragColor = vec4(newVel, 0.0, 0.0);
|
|
72
|
-
} else {
|
|
73
|
-
vec2 spot_new = uv;
|
|
74
|
-
vec2 vel_old = texture2D(velocity, uv).xy;
|
|
75
|
-
// back trace
|
|
76
|
-
vec2 spot_old = spot_new - vel_old * dt * ratio;
|
|
77
|
-
vec2 vel_new1 = texture2D(velocity, spot_old).xy;
|
|
78
|
-
|
|
79
|
-
// forward trace
|
|
80
|
-
vec2 spot_new2 = spot_old + vel_new1 * dt * ratio;
|
|
81
|
-
|
|
82
|
-
vec2 error = spot_new2 - spot_new;
|
|
83
|
-
|
|
84
|
-
vec2 spot_new3 = spot_new - error / 2.0;
|
|
85
|
-
vec2 vel_2 = texture2D(velocity, spot_new3).xy;
|
|
86
|
-
|
|
87
|
-
// back trace 2
|
|
88
|
-
vec2 spot_old2 = spot_new3 - vel_2 * dt * ratio;
|
|
89
|
-
// gl_FragColor = vec4(spot_old2, 0.0, 0.0);
|
|
90
|
-
vec2 newVel2 = texture2D(velocity, spot_old2).xy;
|
|
91
|
-
gl_FragColor = vec4(newVel2, 0.0, 0.0);
|
|
92
|
-
}
|
|
93
|
-
}`;var he,_e,St,bt,Et,Rt,Le;class lt{constructor(t){g(this,he,null);g(this,_e,null);g(this,St,null);g(this,bt,null);g(this,Et,null);g(this,Rt,void 0);g(this,Le,{});var e;if(y(this,Rt,t.material),(e=t.material)!=null&&e.uniforms)for(const s in t.material.uniforms)r(this,Le)[s]={value:t.material.uniforms[s]};this.output=t.output}get scene(){return r(this,he)}get camera(){return r(this,_e)}get uniforms(){return r(this,Le)}update(...t){R.webglRenderer.setRenderTarget(this.output),R.webglRenderer.render(r(this,he),r(this,_e)),R.webglRenderer.setRenderTarget(null)}dispose(){Ne(r(this,_e)),Ne(r(this,he))}init(...t){y(this,he,new l.Scene),y(this,_e,new l.Camera),Object.keys(r(this,Le)).length&&(y(this,St,new l.PlaneGeometry(2,2)),y(this,bt,new l.RawShaderMaterial(ut(W({},r(this,Rt)),{uniforms:r(this,Le)}))),y(this,Et,new l.Mesh(r(this,St),r(this,bt))),r(this,he).add(r(this,Et)))}}he=new WeakMap,_e=new WeakMap,St=new WeakMap,bt=new WeakMap,Et=new WeakMap,Rt=new WeakMap,Le=new WeakMap;var Ke,Bt,bn;class Ds extends lt{constructor(e){super({material:{vertexShader:ct,fragmentShader:gn,uniforms:{boundarySpace:e.cellScale,px:e.cellScale,fboSize:e.fboSize,velocity:e.src.texture,dt:e.dt,isBFECC:e.BFECC}},output:e.dst});g(this,Bt);g(this,Ke,null);this.init()}update(e){this.uniforms.dt.value=e.dt,r(this,Ke).visible=e.isBounce,this.uniforms.isBFECC.value=e.BFECC,super.update()}init(){super.init(),Y(this,Bt,bn).call(this)}}Ke=new WeakMap,Bt=new WeakSet,bn=function(){const e=new l.BufferGeometry,s=new Float32Array([-1,-1,0,-1,1,0,-1,1,0,1,1,0,1,1,0,1,-1,0,1,-1,0,-1,-1,0]);e.setAttribute("position",new l.BufferAttribute(s,3));const n=new l.RawShaderMaterial({vertexShader:Cs,fragmentShader:gn,uniforms:this.uniforms});y(this,Ke,new l.LineSegments(e,n)),this.scene.add(r(this,Ke))};const Os=`precision highp float;
|
|
94
|
-
|
|
95
|
-
attribute vec3 position;
|
|
96
|
-
attribute vec2 uv;
|
|
97
|
-
uniform vec2 center;
|
|
98
|
-
uniform vec2 scale;
|
|
99
|
-
uniform vec2 px;
|
|
100
|
-
varying vec2 vUv;
|
|
101
|
-
|
|
102
|
-
void main(){
|
|
103
|
-
vec2 pos = position.xy * scale * 2.0 * px + center;
|
|
104
|
-
vUv = uv;
|
|
105
|
-
gl_Position = vec4(pos, 0.0, 1.0);
|
|
106
|
-
}
|
|
107
|
-
`,Fs=`precision highp float;
|
|
108
|
-
|
|
109
|
-
uniform vec2 force;
|
|
110
|
-
uniform vec2 center;
|
|
111
|
-
uniform vec2 scale;
|
|
112
|
-
uniform vec2 px;
|
|
113
|
-
varying vec2 vUv;
|
|
114
|
-
|
|
115
|
-
void main(){
|
|
116
|
-
vec2 circle = (vUv - 0.5) * 2.0;
|
|
117
|
-
float d = 1.0-min(length(circle), 1.0);
|
|
118
|
-
d *= d;
|
|
119
|
-
gl_FragColor = vec4(force * d, 0, 1);
|
|
120
|
-
}
|
|
121
|
-
`;var z,K,de,je;class Is{constructor(){g(this,z,void 0);g(this,K,void 0);g(this,de,void 0);g(this,je,void 0);this.disabled=!1,y(this,z,new Xt.Vector2),y(this,K,new Xt.Vector2),y(this,de,new Xt.Vector2),y(this,je,t=>{this.disabled||this.updateCoords(t.clientX,t.clientY)})}init(){document.body.addEventListener("pointermove",r(this,je),!1)}dispose(){document.body.removeEventListener("pointermove",r(this,je),!1)}get coords(){return r(this,z)}get diff(){return r(this,de)}updateCoords(t=0,e=0){r(this,z).set(t/R.width*2-1,-(e/R.height)*2+1),Math.abs(r(this,z).x-r(this,K).x)>.2&&(r(this,K).copy(r(this,z)),r(this,de).subVectors(r(this,z),r(this,K)))}update(){r(this,de).subVectors(r(this,z),r(this,K)),r(this,K).copy(r(this,z)),r(this,K).x===0&&r(this,K).y===0&&r(this,de).set(0,0)}}z=new WeakMap,K=new WeakMap,de=new WeakMap,je=new WeakMap;const ye=new Is;var Xe;class Ns extends lt{constructor(e){super({output:e.dst});g(this,Xe,null);this.init(e)}update(e){const s=ye.diff.x/2*e.pointerForce,n=ye.diff.y/2*e.pointerForce,i=e.pointerSize*e.cellScale.x,o=e.pointerSize*e.cellScale.y,c=Math.min(Math.max(ye.coords.x,-1+i+e.cellScale.x*2),1-i-e.cellScale.x*2),a=Math.min(Math.max(ye.coords.y,-1+o+e.cellScale.y*2),1-o-e.cellScale.y*2),u=r(this,Xe).material.uniforms;u.force.value.set(s,n),u.center.value.set(c,a),u.scale.value.set(e.pointerSize,e.pointerSize),super.update()}init(e){super.init();const s=new l.PlaneGeometry(1,1),n=new l.RawShaderMaterial({vertexShader:Os,fragmentShader:Fs,blending:l.AdditiveBlending,uniforms:{px:{value:e.cellScale},force:{value:new l.Vector2(0,0)},center:{value:new l.Vector2(0,0)},scale:{value:new l.Vector2(e.pointerSize,e.pointerSize)}}});y(this,Xe,new l.Mesh(s,n)),this.scene.add(r(this,Xe))}}Xe=new WeakMap;const Ps=`precision highp float;
|
|
122
|
-
uniform sampler2D velocity;
|
|
123
|
-
uniform sampler2D velocity_new;
|
|
124
|
-
uniform float v;
|
|
125
|
-
uniform vec2 px;
|
|
126
|
-
uniform float dt;
|
|
127
|
-
|
|
128
|
-
varying vec2 uv;
|
|
129
|
-
|
|
130
|
-
void main(){
|
|
131
|
-
// poisson equation
|
|
132
|
-
vec2 old = texture2D(velocity, uv).xy;
|
|
133
|
-
vec2 new0 = texture2D(velocity_new, uv + vec2(px.x * 2.0, 0)).xy;
|
|
134
|
-
vec2 new1 = texture2D(velocity_new, uv - vec2(px.x * 2.0, 0)).xy;
|
|
135
|
-
vec2 new2 = texture2D(velocity_new, uv + vec2(0, px.y * 2.0)).xy;
|
|
136
|
-
vec2 new3 = texture2D(velocity_new, uv - vec2(0, px.y * 2.0)).xy;
|
|
137
|
-
|
|
138
|
-
vec2 new = 4.0 * old + v * dt * (new0 + new1 + new2 + new3);
|
|
139
|
-
new /= 4.0 * (1.0 + v * dt);
|
|
140
|
-
|
|
141
|
-
gl_FragColor = vec4(new, 0.0, 0.0);
|
|
142
|
-
}
|
|
143
|
-
`;var qe,We;class ks extends lt{constructor(e){super({material:{vertexShader:ct,fragmentShader:Ps,uniforms:{boundarySpace:e.boundarySpace,velocity:e.src.texture,velocity_new:e.dst_.texture,v:e.viscous,px:e.cellScale,dt:e.dt}},output:e.dst});g(this,qe,void 0);g(this,We,void 0);y(this,qe,e.dst_),y(this,We,e.dst),this.init()}update(e){let s=null,n=null;this.uniforms.v.value=e.viscous;for(var i=0;i<e.iterations;i++)i%2==0?(s=r(this,qe),n=r(this,We)):(s=r(this,We),n=r(this,qe)),this.uniforms.velocity_new.value=s.texture,this.output=n,this.uniforms.dt.value=e.dt,super.update();return n}}qe=new WeakMap,We=new WeakMap;const Bs=`precision highp float;
|
|
144
|
-
uniform sampler2D velocity;
|
|
145
|
-
uniform float dt;
|
|
146
|
-
uniform vec2 px;
|
|
147
|
-
varying vec2 uv;
|
|
148
|
-
|
|
149
|
-
void main(){
|
|
150
|
-
float x0 = texture2D(velocity, uv-vec2(px.x, 0)).x;
|
|
151
|
-
float x1 = texture2D(velocity, uv+vec2(px.x, 0)).x;
|
|
152
|
-
float y0 = texture2D(velocity, uv-vec2(0, px.y)).y;
|
|
153
|
-
float y1 = texture2D(velocity, uv+vec2(0, px.y)).y;
|
|
154
|
-
float divergence = (x1-x0 + y1-y0) / 2.0;
|
|
155
|
-
|
|
156
|
-
gl_FragColor = vec4(divergence / dt);
|
|
157
|
-
}
|
|
158
|
-
`;class Gs extends lt{constructor(t){super({material:{vertexShader:ct,fragmentShader:Bs,uniforms:{boundarySpace:t.boundarySpace,velocity:t.src.texture,px:t.cellScale,dt:t.dt}},output:t.dst}),this.init()}update(t){this.uniforms.velocity.value=t.vel.texture,super.update()}}const Hs=`precision highp float;
|
|
159
|
-
uniform sampler2D pressure;
|
|
160
|
-
uniform sampler2D divergence;
|
|
161
|
-
uniform vec2 px;
|
|
162
|
-
varying vec2 uv;
|
|
163
|
-
|
|
164
|
-
void main(){
|
|
165
|
-
// poisson equation
|
|
166
|
-
float p0 = texture2D(pressure, uv+vec2(px.x * 2.0, 0)).r;
|
|
167
|
-
float p1 = texture2D(pressure, uv-vec2(px.x * 2.0, 0)).r;
|
|
168
|
-
float p2 = texture2D(pressure, uv+vec2(0, px.y * 2.0 )).r;
|
|
169
|
-
float p3 = texture2D(pressure, uv-vec2(0, px.y * 2.0 )).r;
|
|
170
|
-
float div = texture2D(divergence, uv).r;
|
|
171
|
-
|
|
172
|
-
float newP = (p0 + p1 + p2 + p3) / 4.0 - div;
|
|
173
|
-
gl_FragColor = vec4(newP);
|
|
174
|
-
}
|
|
175
|
-
`;var Ye,Qe;class Vs extends lt{constructor(e){super({material:{vertexShader:ct,fragmentShader:Hs,uniforms:{boundarySpace:e.boundarySpace,pressure:e.dst_.texture,divergence:e.src.texture,px:e.cellScale}},output:e.dst});g(this,Ye,void 0);g(this,Qe,void 0);y(this,Ye,e.dst_),y(this,Qe,e.dst),this.init()}update(e){let s=null,n=null;for(var i=0;i<e.iterations;i++)i%2==0?(s=r(this,Ye),n=r(this,Qe)):(s=r(this,Qe),n=r(this,Ye)),this.uniforms.pressure.value=s.texture,this.output=n,super.update();return n}}Ye=new WeakMap,Qe=new WeakMap;const Us=`precision highp float;
|
|
176
|
-
uniform sampler2D pressure;
|
|
177
|
-
uniform sampler2D velocity;
|
|
178
|
-
uniform vec2 px;
|
|
179
|
-
uniform float dt;
|
|
180
|
-
varying vec2 uv;
|
|
181
|
-
|
|
182
|
-
void main(){
|
|
183
|
-
float step = 1.0;
|
|
184
|
-
|
|
185
|
-
float p0 = texture2D(pressure, uv+vec2(px.x * step, 0)).r;
|
|
186
|
-
float p1 = texture2D(pressure, uv-vec2(px.x * step, 0)).r;
|
|
187
|
-
float p2 = texture2D(pressure, uv+vec2(0, px.y * step)).r;
|
|
188
|
-
float p3 = texture2D(pressure, uv-vec2(0, px.y * step)).r;
|
|
189
|
-
|
|
190
|
-
vec2 v = texture2D(velocity, uv).xy;
|
|
191
|
-
vec2 gradP = vec2(p0 - p1, p2 - p3) * 0.5;
|
|
192
|
-
v = v - gradP * dt;
|
|
193
|
-
gl_FragColor = vec4(v, 0.0, 1.0);
|
|
194
|
-
}
|
|
195
|
-
`;class zs extends lt{constructor(t){super({material:{vertexShader:ct,fragmentShader:Us,uniforms:{boundarySpace:t.boundarySpace,pressure:t.srcP.texture,velocity:t.srcV.texture,px:t.cellScale,dt:t.dt}},output:t.dst}),this.init()}update(t){this.uniforms.velocity.value=t.vel.texture,this.uniforms.pressure.value=t.pressure.texture,super.update()}}var E,M,te,H,ne,$e,Mt,Ze,Je,et,tt,_t,nn,Gt,En,Ht,Rn;class Ks{constructor(){g(this,_t);g(this,Gt);g(this,Ht);g(this,E,{isViscous:new F.Store(!1,{passport:{name:"Fluid.Вязкость.Активна",manager:{type:"boolean"}}}),viscous:new F.Store(30,{passport:{name:"Fluid.Вязкость.Величина",manager:{type:"range",min:0,max:500}}}),iterationsViscous:new F.Store(16,{passport:{name:"Fluid.Вязкость.Количество итераций",manager:{type:"range",min:1,max:32,step:1}}}),pointerForce:new F.Store(20,{passport:{name:"Fluid.Курсор.Сила",manager:{type:"range",min:1,max:200,step:1}}}),pointerSize:new F.Store(100,{passport:{name:"Fluid.Курсор.Размер",manager:{type:"range",min:10,max:200,step:1}}}),dt:new F.Store(.014,{passport:{name:"Fluid.Скорость",manager:{type:"range",min:.001,max:.1,step:.001}}}),iterationsPoisson:new F.Store(16,{passport:{name:"Fluid.Poisson",manager:{type:"range",min:1,max:32,step:1}}}),resolution:new F.Store(.5,{passport:{name:"Fluid.Разрешение",manager:{type:"range",min:.1,max:1}}}),isBounce:new F.Store(!1,{passport:{name:"Fluid.Bounce",manager:{type:"boolean"}}}),BFECC:new F.Store(!0,{passport:{name:"Fluid.BFECC",manager:{type:"boolean"}}})});g(this,M,{vel0:null,vel1:null,velViscous0:null,velViscous1:null,div:null,pressure0:null,pressure1:null});g(this,te,new l.Vector2);g(this,H,new l.Vector2);g(this,ne,new l.Vector2);g(this,$e,null);g(this,Mt,null);g(this,Ze,null);g(this,Je,null);g(this,et,null);g(this,tt,null);this.init()}get parameters(){return r(this,E)}get fbos(){return r(this,M)}resize(){Y(this,_t,nn).call(this);for(let t in this.fbos)r(this,M)[t].setSize(r(this,te).x,r(this,te).y)}update(){r(this,E).isBounce.current?r(this,ne).set(0,0):r(this,ne).copy(r(this,H)),r(this,$e).update({BFECC:r(this,E).BFECC.current,dt:r(this,E).dt.current,isBounce:r(this,E).isBounce.current}),r(this,Mt).update({pointerSize:r(this,E).pointerSize.current,pointerForce:r(this,E).pointerForce.current,cellScale:r(this,H)});let t=r(this,M).vel1;r(this,E).isViscous.current&&(t=r(this,Ze).update({viscous:r(this,E).viscous.current,iterations:r(this,E).iterationsViscous.current,dt:r(this,E).dt.current})),r(this,Je).update({vel:t});const e=r(this,et).update({iterations:r(this,E).iterationsPoisson.current});r(this,tt).update({vel:t,pressure:e})}dispose(){r(this,$e).dispose(),r(this,Ze).dispose(),r(this,Je).dispose(),r(this,et).dispose(),r(this,tt).dispose();for(const t in r(this,M))r(this,M)[t].dispose();for(const t in r(this,E))r(this,E)[t].close()}init(){Y(this,_t,nn).call(this),Y(this,Gt,En).call(this),Y(this,Ht,Rn).call(this),setTimeout(()=>{r(this,E).isViscous.subscribe(()=>{}),r(this,E).viscous.subscribe(()=>{}),r(this,E).iterationsViscous.subscribe(()=>{}),r(this,E).pointerSize.subscribe(()=>{}),r(this,E).pointerForce.subscribe(()=>{}),r(this,E).dt.subscribe(()=>{}),r(this,E).resolution.subscribe(()=>{this.resize()}),r(this,E).iterationsPoisson.subscribe(()=>{}),r(this,E).isBounce.subscribe(()=>{}),r(this,E).BFECC.subscribe(()=>{})})}}E=new WeakMap,M=new WeakMap,te=new WeakMap,H=new WeakMap,ne=new WeakMap,$e=new WeakMap,Mt=new WeakMap,Ze=new WeakMap,Je=new WeakMap,et=new WeakMap,tt=new WeakMap,_t=new WeakSet,nn=function(){const t=Math.round(r(this,E).resolution.current*R.width),e=Math.round(r(this,E).resolution.current*R.height),s=1/t,n=1/e;r(this,H).set(s,n),r(this,te).set(t,e)},Gt=new WeakSet,En=function(){const t=Gn.device.isApple?l.HalfFloatType:l.FloatType;for(let e in r(this,M))r(this,M)[e]=new l.WebGLRenderTarget(r(this,te).x,r(this,te).y,{type:t})},Ht=new WeakSet,Rn=function(){y(this,$e,new Ds({cellScale:r(this,H),fboSize:r(this,te),dt:r(this,E).dt.current,src:r(this,M).vel0,dst:r(this,M).vel1,BFECC:r(this,E).BFECC.current})),y(this,Mt,new Ns({cellScale:r(this,H),pointerSize:r(this,E).pointerSize.current,dst:r(this,M).vel1})),y(this,Ze,new ks({cellScale:r(this,H),boundarySpace:r(this,ne),viscous:r(this,E).viscous.current,src:r(this,M).vel1,dst:r(this,M).velViscous1,dst_:r(this,M).velViscous0,dt:r(this,E).dt.current})),y(this,Je,new Gs({cellScale:r(this,H),boundarySpace:r(this,ne),src:r(this,M).velViscous0,dst:r(this,M).div,dt:r(this,E).dt.current})),y(this,et,new Vs({cellScale:r(this,H),boundarySpace:r(this,ne),src:r(this,M).div,dst:r(this,M).pressure1,dst_:r(this,M).pressure0})),y(this,tt,new zs({cellScale:r(this,H),boundarySpace:r(this,ne),srcP:r(this,M).pressure0,srcV:r(this,M).velViscous0,dst:r(this,M).vel0,dt:r(this,E).dt.current}))};var fe,Ce,De,pe,Oe,me,Fe,nt,st,it,rt,ot;class Mn extends l.Mesh{constructor(){super();g(this,fe,void 0);g(this,Ce,void 0);g(this,De,void 0);g(this,pe,void 0);g(this,Oe,void 0);g(this,me,void 0);g(this,Fe,void 0);g(this,nt,void 0);g(this,st,void 0);g(this,it,void 0);g(this,rt,void 0);g(this,ot,void 0);this.colorTweenDuration=1e3,y(this,Ce,new F.Store("#000000",{passport:{name:"Fluid.Цвета.Фон.Цвет",manager:{type:"color"}}})),y(this,De,new F.Store(1,{passport:{name:"Fluid.Цвета.Фон.Порог",manager:{type:"range"}}})),y(this,pe,new F.Store(1,{passport:{name:"Fluid.Цвета.Фон.Прозрачность",manager:{type:"range"}}})),y(this,Oe,new F.Store("#ffffff",{passport:{name:"Fluid.Цвета.Жидкость.Цвет",manager:{type:"color"}}})),y(this,me,new F.Store(1,{passport:{name:"Fluid.Цвета.Жидкость.Прозрачность",manager:{type:"range"}}})),y(this,Fe,new Bn.Tweened(0,{easing:Pn.easeInOutCubic,min:0,max:1,duration:this.colorTweenDuration})),y(this,nt,new l.Color),y(this,st,new l.Color),y(this,it,new l.Color),y(this,rt,new l.Color),y(this,ot,kn.debounce(()=>{r(this,Fe).reset(),r(this,Fe).set(1)},0)),y(this,fe,new Ks),ye.init(),this.geometry=new l.PlaneGeometry(2,2),this.material=new l.RawShaderMaterial({vertexShader:ct,fragmentShader:Ls,transparent:!0,uniforms:{velocity:{value:r(this,fe).fbos.vel0.texture},backgroundColor:{value:r(this,st)},backgroundOpacity:{value:r(this,pe).current},fluidColor:{value:r(this,nt)},fluidOpacity:{value:r(this,me).current},backgroundMixThreshold:{value:0},opacity:{value:1},boundarySpace:{value:new l.Vector2(0,0)}}}),r(this,Ce).subscribe(e=>{y(this,rt,new l.Color(e.current)),r(this,ot).call(this)}),r(this,Oe).subscribe(e=>{y(this,it,new l.Color(e.current)),r(this,ot).call(this)}),r(this,pe).subscribe(e=>{this.material.uniforms.backgroundOpacity.value=e.current}),r(this,me).subscribe(e=>{this.material.uniforms.fluidOpacity.value=e.current}),r(this,De).subscribe(e=>{this.material.uniforms.backgroundMixThreshold.value=e.current}),r(this,Fe).subscribe(e=>{r(this,st).lerp(r(this,rt),e.current),r(this,nt).lerp(r(this,it),e.current)})}get backgroundColor(){return r(this,Ce)}get backgroundMixThreshold(){return r(this,De)}get backgroundOpacity(){return r(this,pe)}get fluidColor(){return r(this,Oe)}get fluidOpacity(){return r(this,me)}resize(){r(this,fe).resize()}update(){ye.update(),r(this,fe).update()}dispose(){ye.dispose(),r(this,fe).dispose(),r(this,Ce).close(),r(this,pe).close(),r(this,Oe).close(),r(this,me).close(),r(this,De).close()}}fe=new WeakMap,Ce=new WeakMap,De=new WeakMap,pe=new WeakMap,Oe=new WeakMap,me=new WeakMap,Fe=new WeakMap,nt=new WeakMap,st=new WeakMap,it=new WeakMap,rt=new WeakMap,ot=new WeakMap;var js=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,qs=(h,t,e,s)=>{for(var n=s>1?void 0:s?Xs(t,e):t,i=h.length-1,o;i>=0;i--)(o=h[i])&&(n=(s?o(t,e,n):o(n))||n);return s&&n&&js(t,e,n),n},_n=(h,t,e)=>{if(!t.has(h))throw TypeError("Cannot "+e)},j=(h,t,e)=>(_n(h,t,"read from private field"),e?e.call(h):t.get(h)),Qt=(h,t,e)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,e)},Ws=(h,t,e,s)=>(_n(h,t,"write to private field"),t.set(h,e),e),Q,Nt,Pt;exports.En3FluidElement=class extends vn.CustomElement{constructor(){super(...arguments),Qt(this,Q,null),Qt(this,Nt,()=>{j(this,Q).resize()}),Qt(this,Pt,()=>{R.width&&j(this,Q).update()})}get fluid(){return j(this,Q)}connectedCallback(){Ws(this,Q,new Mn),R.view.add(j(this,Q)),Ae.windowResizer.subscribe(j(this,Nt)),ve.ticker.subscribe(j(this,Pt))}disconnectedCallback(){R.view.remove(j(this,Q)),j(this,Q).dispose(),Ae.windowResizer.unsubscribe(j(this,Nt)),ve.ticker.unsubscribe(j(this,Pt))}};Q=new WeakMap;Nt=new WeakMap;Pt=new WeakMap;exports.En3FluidElement=qs([vn.define("en3-fluid")],exports.En3FluidElement);function an(h,t,e){const s=t.x,n=t.y,i=e||h.image.width/h.image.height;let o=0,c=0,a=h.offset.x,u=h.offset.y,f=h.rotation,d=h.center.x,m=h.center.y;s/n>i?(o=1,c=n/s*i):(c=1,o=s/n/i),h.matrix.setUvTransform(a,u,o,c,f,d,m)}const dt=new l.Vector3;function B(h,t,e,s,n,i){const o=2*Math.PI*n/4,c=Math.max(i-2*n,0),a=Math.PI/4;dt.copy(t),dt[s]=0,dt.normalize();const u=.5*o/(o+c),f=1-dt.angleTo(h)/a;return Math.sign(dt[e])===1?f*u:c/(o+c)+u+u*(1-f)}class Ys extends l.BoxGeometry{constructor(t=1,e=1,s=1,n=2,i=.1){if(n=n*2+1,i=Math.min(t/2,e/2,s/2,i),super(1,1,1,n,n,n),n===1)return;const o=this.toNonIndexed();this.index=null,this.attributes.position=o.attributes.position,this.attributes.normal=o.attributes.normal,this.attributes.uv=o.attributes.uv;const c=new l.Vector3,a=new l.Vector3,u=new l.Vector3(t,e,s).divideScalar(2).subScalar(i),f=this.attributes.position.array,d=this.attributes.normal.array,m=this.attributes.uv.array,A=f.length/6,v=new l.Vector3,b=.5/n;for(let x=0,p=0;x<f.length;x+=3,p+=2)switch(c.fromArray(f,x),a.copy(c),a.x-=Math.sign(a.x)*b,a.y-=Math.sign(a.y)*b,a.z-=Math.sign(a.z)*b,a.normalize(),f[x+0]=u.x*Math.sign(c.x)+a.x*i,f[x+1]=u.y*Math.sign(c.y)+a.y*i,f[x+2]=u.z*Math.sign(c.z)+a.z*i,d[x+0]=a.x,d[x+1]=a.y,d[x+2]=a.z,Math.floor(x/A)){case 0:v.set(1,0,0),m[p+0]=B(v,a,"z","y",i,s),m[p+1]=1-B(v,a,"y","z",i,e);break;case 1:v.set(-1,0,0),m[p+0]=1-B(v,a,"z","y",i,s),m[p+1]=1-B(v,a,"y","z",i,e);break;case 2:v.set(0,1,0),m[p+0]=1-B(v,a,"x","z",i,t),m[p+1]=B(v,a,"z","x",i,s);break;case 3:v.set(0,-1,0),m[p+0]=1-B(v,a,"x","z",i,t),m[p+1]=1-B(v,a,"z","x",i,s);break;case 4:v.set(0,0,1),m[p+0]=1-B(v,a,"x","y",i,t),m[p+1]=1-B(v,a,"y","x",i,e);break;case 5:v.set(0,0,-1),m[p+0]=B(v,a,"x","y",i,t),m[p+1]=1-B(v,a,"y","x",i,e);break}}}var se,at,Ie;class cn extends l.Mesh{constructor(e){super(e.round?new Ys(e.width,e.height,1,e.segments,e.round):new l.PlaneGeometry(e.width,e.height,e.segments,e.segments),e.material);g(this,se,void 0);g(this,at,void 0);g(this,Ie,()=>{r(this,se).data.current&&r(this,at)==="cover"&&this.onCoverResize(r(this,se).data.current)});y(this,se,new on(W({consumer:this},e))),y(this,at,e.fit),this.addEventListener("added",()=>{Ae.windowResizer.subscribe(r(this,Ie))}),this.addEventListener("removed",()=>{Ae.windowResizer.unsubscribe(r(this,Ie))}),r(this,se).processData=s=>R.cacheAssets?s.clone():s,r(this,se).data.subscribe(s=>{!s.current&&s.previous?s.previous.dispose():s.current&&this.material&&(r(this,at)&&(s.current.matrixAutoUpdate=!1),s.current.colorSpace=l.SRGBColorSpace,s.current.center.set(.5,.5),this.material.map=s.current,this.material.needsUpdate=!0,r(this,Ie).call(this))})}get sourceManager(){return r(this,se)}updateTexture(){r(this,Ie).call(this)}onCoverResize(e){an(e,{x:this.scale.x,y:this.scale.y})}}se=new WeakMap,at=new WeakMap,Ie=new WeakMap;class Qs extends cn{constructor(t){super(ut(W({},t),{loader:Te}))}}class $s{load(...t){const e=t[0],s=t[1],n=t[3],i=document.createElement("video");i.src=e,i.onloadeddata=()=>{s(new l.VideoTexture(i)),i.onerror=null,i.onloadeddata=null},i.onerror=()=>{n==null||n(e),i.onerror=null,i.onloadeddata=null}}}var Lt,Ct,Dt;class Zs extends cn{constructor(e){super(ut(W({},e),{loader:new $s}));g(this,Lt,void 0);g(this,Ct,void 0);g(this,Dt,void 0);y(this,Lt,e.autoplay||!1),y(this,Ct,e.muted||!1),y(this,Dt,e.loop||!1),this.sourceManager.data.subscribe(s=>{if(s.current){const n=s.current.image;r(this,Ct)&&(n.muted=!0),r(this,Dt)&&(n.loop=!0),r(this,Lt)&&n.play()}})}onCoverResize(e){const s=e.image;an(e,{x:this.scale.x,y:this.scale.y},s.videoWidth/s.videoHeight)}}Lt=new WeakMap,Ct=new WeakMap,Dt=new WeakMap;function Js(h,t){h.traverse(e=>{e instanceof l.Mesh&&t(e)})}function ei(h,t){h.traverse(e=>{e instanceof l.Mesh&&e.material&&(Array.isArray(e.material)?e.material:[e.material]).forEach(t)})}const $t=new l.Vector3,ti=new l.Vector3;function ni(h,t="default"){const e=R.getView(t),{width:s,height:n}=R,i=s/n;h instanceof l.Vector3?$t.copy(h):$t.set(...h);const o=e.camera.getWorldPosition(ti).distanceTo($t);if(e.camera instanceof l.OrthographicCamera)return{width:s/e.camera.zoom,height:n/e.camera.zoom,factor:1,distance:o,aspect:i};{const c=e.camera.fov*Math.PI/180,a=2*Math.tan(c/2)*o,u=a*(s/n);return{width:u,height:a,factor:s/u,distance:o,aspect:i}}}const xn=new l.Vector3,si=new l.Quaternion,yn=new l.Vector3;class ii extends l.Object3D{constructor(t=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof Element&&e.element.parentNode!==null&&e.element.parentNode.removeChild(e.element)})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this}}const X=new l.Matrix4,ri=new l.Matrix4;class oi{constructor(t={}){const e=this;let s,n,i,o;const c={camera:{style:""},objects:new WeakMap},a=t.element!==void 0?t.element:document.createElement("div");a.style.overflow="hidden",this.domElement=a;const u=document.createElement("div");u.style.transformOrigin="0 0",u.style.pointerEvents="none",a.appendChild(u);const f=document.createElement("div");f.style.transformStyle="preserve-3d",u.appendChild(f),this.getSize=function(){return{width:s,height:n}},this.render=function(x,p){const T=p.projectionMatrix.elements[5]*o;p.view&&p.view.enabled?(u.style.transform=`translate( ${-p.view.offsetX*(s/p.view.width)}px, ${-p.view.offsetY*(n/p.view.height)}px )`,u.style.transform+=`scale( ${p.view.fullWidth/p.view.width}, ${p.view.fullHeight/p.view.height} )`):u.style.transform="",x.matrixWorldAutoUpdate===!0&&x.updateMatrixWorld(),p.parent===null&&p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld();let _,w;p.isOrthographicCamera&&(_=-(p.right+p.left)/2,w=(p.top+p.bottom)/2);const L=p.view&&p.view.enabled?p.view.height/p.view.fullHeight:1,I=p.isOrthographicCamera?`scale( ${L} )scale(`+T+")translate("+d(_)+"px,"+d(w)+"px)"+m(p.matrixWorldInverse):`scale( ${L} )translateZ(`+T+"px)"+m(p.matrixWorldInverse),U=(p.isPerspectiveCamera?"perspective("+T+"px) ":"")+I+"translate("+i+"px,"+o+"px)";c.camera.style!==U&&(f.style.transform=U,c.camera.style=U),b(x,x,p)},this.setSize=function(x,p){s=x,n=p,i=s/2,o=n/2,a.style.width=x+"px",a.style.height=p+"px",u.style.width=x+"px",u.style.height=p+"px",f.style.width=x+"px",f.style.height=p+"px"};function d(x){return Math.abs(x)<1e-10?0:x}function m(x){const p=x.elements;return"matrix3d("+d(p[0])+","+d(-p[1])+","+d(p[2])+","+d(p[3])+","+d(p[4])+","+d(-p[5])+","+d(p[6])+","+d(p[7])+","+d(p[8])+","+d(-p[9])+","+d(p[10])+","+d(p[11])+","+d(p[12])+","+d(-p[13])+","+d(p[14])+","+d(p[15])+")"}function A(x){const p=x.elements;return"translate(-50%,-50%)"+("matrix3d("+d(p[0])+","+d(p[1])+","+d(p[2])+","+d(p[3])+","+d(-p[4])+","+d(-p[5])+","+d(-p[6])+","+d(-p[7])+","+d(p[8])+","+d(p[9])+","+d(p[10])+","+d(p[11])+","+d(p[12])+","+d(p[13])+","+d(p[14])+","+d(p[15])+")")}function v(x){x.isCSS3DObject&&(x.element.style.display="none");for(let p=0,T=x.children.length;p<T;p++)v(x.children[p])}function b(x,p,T,_){if(x.visible===!1){v(x);return}if(x.isCSS3DObject){const w=x.layers.test(T.layers)===!0,L=x.element;if(L.style.display=w===!0?"":"none",w===!0){x.onBeforeRender(e,p,T);let I;x.isCSS3DSprite?(X.copy(T.matrixWorldInverse),X.transpose(),x.rotation2D!==0&&X.multiply(ri.makeRotationZ(x.rotation2D)),x.matrixWorld.decompose(xn,si,yn),X.setPosition(xn),X.scale(yn),X.elements[3]=0,X.elements[7]=0,X.elements[11]=0,X.elements[15]=1,I=A(X)):I=A(x.matrixWorld);const N=c.objects.get(x);if(N===void 0||N.style!==I){L.style.transform=I;const U={style:I};c.objects.set(x,U)}L.parentNode!==f&&f.appendChild(L),x.onAfterRender(e,p,T)}}for(let w=0,L=x.children.length;w<L;w++)b(x.children[w],p,T)}}}var q,Vt,Ln,Ot,Ft;const k=class k extends ii{static destroy(){Ae.windowResizer.unsubscribe(r(this,Ft)),ve.ticker.unsubscribe(r(this,Ot)),y(this,q,null)}constructor(t){var e;super(t.element),r(k,q)||Y(e=k,Vt,Ln).call(e)}};q=new WeakMap,Vt=new WeakSet,Ln=function(){y(k,q,new oi),r(k,q).domElement.style.cssText=`
|
|
196
|
-
position: fixed;
|
|
197
|
-
left: 0;
|
|
198
|
-
top: 0;
|
|
199
|
-
width: 100%;
|
|
200
|
-
height: 100%;
|
|
201
|
-
z-index: 1;
|
|
202
|
-
pointer-events: none;
|
|
203
|
-
overflow: hidden;
|
|
204
|
-
`,R.containerElement.prepend(r(k,q).domElement),Ae.windowResizer.subscribe(r(this,Ft),ft.RESIZE_ORDER.EN3+1),ve.ticker.subscribe(r(this,Ot),{order:ft.TICK_ORDER.EN3+1})},Ot=new WeakMap,Ft=new WeakMap,g(k,Vt),g(k,q,null),g(k,Ot,()=>{r(k,q).render(R.view.scene,R.view.camera)}),g(k,Ft,()=>{r(k,q).setSize(R.width,R.height)});let sn=k;var ge,xe,It,rn;class ai{constructor(t){g(this,It);g(this,ge,void 0);g(this,xe,void 0);y(this,ge,t.material),y(this,xe,t.uniforms||{}),r(this,ge).userData.uniforms=r(this,xe);let e;const s=()=>{e==null||e()};r(this,ge).addEventListener("dispose",s),r(this,ge).onBeforeCompile=n=>{var i;e==null||e();for(const o in r(this,xe))n.uniforms[o]=r(this,xe)[o];t.vertextDeclarations&&(n.vertexShader=`
|
|
205
|
-
${t.vertextDeclarations}
|
|
206
|
-
${n.vertexShader}
|
|
207
|
-
`),t.fragmentDeclarations&&(n.fragmentShader=`
|
|
208
|
-
${t.fragmentDeclarations}
|
|
209
|
-
${n.fragmentShader}
|
|
210
|
-
`),Y(this,It,rn).call(this,n,"vertex",t),Y(this,It,rn).call(this,n,"fragment",t),e=(i=t.onReady)==null?void 0:i.call(t,this),t.log&&(console.log("VERTEX SHADER: ",n.vertexShader),console.log("FRAGMENT SHADER: ",n.fragmentShader))}}get material(){return r(this,ge)}get uniforms(){return r(this,xe)}}ge=new WeakMap,xe=new WeakMap,It=new WeakSet,rn=function(t,e,s){const n=e==="vertex"?"vertexChunk":"fragmentChunk",i=e==="vertex"?"vertexShader":"fragmentShader";s[n]&&(s[n].replace?t[i]=t[i].replace(`#include <${s[n].replace}>`,s[n].content):s[n].update&&(t[i]=t[i].replace(`#include <${s[n].update}>`,`
|
|
211
|
-
#include <${s[n].update}>
|
|
212
|
-
${s[n].content}
|
|
213
|
-
`)))};exports.En3Clip=Rs;exports.En3ClipHelpers=Ms;exports.En3Fluid=Mn;exports.En3GLTF=_s;exports.En3HTML=sn;exports.En3Image=Qs;exports.En3ImageLike=cn;exports.En3ModifiedMaterial=ai;exports.En3SourceManager=on;exports.En3Video=Zs;exports.En3View=Jt;exports.coverTexture=an;exports.dispose=Ne;exports.en3=R;exports.en3Cache=V;exports.en3FluidPointer=ye;exports.en3GLTFLoader=Sn;exports.en3TextureLoader=Te;exports.getCurrentViewport=ni;exports.traverseMaterials=ei;exports.traverseMeshes=Js;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../en3-C4mzaF6q.cjs");exports.En3View=e.En3View;exports.en3=e.en3;exports.en3Cache=e.en3Cache;
|
package/lib/en3/index.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
export { en3 } from './core/en3';
|
|
2
2
|
export { En3View, type En3ViewOptions, type En3AttachedObject3D, type En3AttachOptions, type En3ViewBeforeRenderCallback, } from './core/En3View';
|
|
3
|
-
export { en3Cache } from './
|
|
4
|
-
export { en3TextureLoader } from './loaders/en3TextureLoader';
|
|
5
|
-
export { en3GLTFLoader } from './loaders/en3GLTFLoader';
|
|
6
|
-
export { En3Clip } from './objects/En3Clip';
|
|
7
|
-
export { En3ClipHelpers } from './objects/En3ClipHelpers';
|
|
8
|
-
export { En3GLTF } from './objects/En3GLTF';
|
|
9
|
-
export { En3Fluid, En3FluidElement, en3FluidPointer } from './objects/fluid';
|
|
10
|
-
export { En3ImageLike, type En3ImageLikeParameters, type En3ImageLikeMaterial, } from './objects/En3ImageLike';
|
|
11
|
-
export { En3Image, type En3ImageParameters } from './objects/En3Image';
|
|
12
|
-
export { En3Video, type En3VideoParameters } from './objects/En3Video';
|
|
13
|
-
export { type En3SourceConsumer } from './objects/En3SourceConsumer';
|
|
14
|
-
export { En3SourceManager, type En3SourceManagerParameters, type En3SourceManagerFullParameters, type En3SourceManagerLoader, } from './attachments/En3SourceManager';
|
|
15
|
-
export { dispose } from './utils/dispose';
|
|
16
|
-
export { traverseMeshes } from './utils/traverseMeshes';
|
|
17
|
-
export { traverseMaterials } from './utils/traverseMaterials';
|
|
18
|
-
export { coverTexture } from './utils/coverTexture';
|
|
19
|
-
export { getCurrentViewport } from './utils/getCurrentViewport';
|
|
20
|
-
export { En3HTML, type En3HTMLParameters } from './test/En3HTML';
|
|
21
|
-
export { En3ModifiedMaterial, type En3ModifiedMaterialParameters, type En3VertexChunk, type En3FragmentChunk, } from './test/En3ModifiedMaterial';
|
|
3
|
+
export { en3Cache } from './core/en3Cache';
|