shop-components 0.0.26 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{stories/device-viewer/roller.d.ts → device-viewer/belt.d.ts} +1 -4
- package/dist/device-viewer/index.d.ts +3 -1
- package/dist/shop-components.mjs +62270 -0
- package/dist/shop-components.umd.js +9644 -0
- package/package.json +4 -2
- package/dist/assets/Color-RQJUDNI5-leAiB7jg.js +0 -1
- package/dist/assets/Configure-OUhXg2g0.js +0 -173
- package/dist/assets/DRACOLoader-FOpiHRUS.js +0 -2
- package/dist/assets/DocsRenderer-K4EAMTCU-wTc0yUaa.js +0 -7
- package/dist/assets/Header-Yyx952jD.css +0 -1
- package/dist/assets/Header.stories-8tnkOwSt.js +0 -31
- package/dist/assets/Page-fZ7a-HXz.css +0 -1
- package/dist/assets/Page.stories-53Crpe03.js +0 -61
- package/dist/assets/RGBELoader-re-MEsjP.js +0 -5
- package/dist/assets/SFL-CDD14-9UY62fbR.glb +0 -0
- package/dist/assets/WithTooltip-Y7J54OF7-e8Yh5ASp.js +0 -1
- package/dist/assets/_commonjsHelpers-4gQjN7DL.js +0 -1
- package/dist/assets/accessibility-Fv4dmnDm.png +0 -0
- package/dist/assets/addon-library-VlAgJsjc.png +0 -0
- package/dist/assets/bg-circle-d8WfpvaX.png +0 -0
- package/dist/assets/context-tKiKnkuP.png +0 -0
- package/dist/assets/docs-Pvr7BWzI.png +0 -0
- package/dist/assets/entry-preview-TptA_luc.js +0 -8
- package/dist/assets/entry-preview-docs-AhrJ3R4Z.js +0 -2
- package/dist/assets/figma-plugin-h9oRC4jr.png +0 -0
- package/dist/assets/formatter-B5HCVTEV-DKi3GmSv.js +0 -58
- package/dist/assets/iframe-tlQuLR4E.js +0 -7
- package/dist/assets/img-radar-kufDNNXQ.png +0 -0
- package/dist/assets/img-radar2-1cPZO_cj.png +0 -0
- package/dist/assets/index-CXFn8OGe.js +0 -513
- package/dist/assets/index-C_uo8BdM.js +0 -1
- package/dist/assets/index-PPLHz8o0.js +0 -6
- package/dist/assets/index-jFdhmKfM.js +0 -3
- package/dist/assets/index-jtEywAqJ.js +0 -1
- package/dist/assets/index-ogXoivrg.js +0 -1
- package/dist/assets/index.stories-TVZrSYZv.js +0 -20
- package/dist/assets/index.stories-Uq0Yg-kp.js +0 -896
- package/dist/assets/index.stories-VJP6Jo4U.js +0 -22
- package/dist/assets/index.stories-VoNcNCFd.js +0 -27
- package/dist/assets/index.stories-YIFSciWI.js +0 -1174
- package/dist/assets/index.stories-iMKoZNyH.js +0 -46
- package/dist/assets/lightroom_14b-MJkJLVlP.hdr +0 -0
- package/dist/assets/lightroom_14b_512-e_XJNpR6.js +0 -3981
- package/dist/assets/lightroom_14b_512-nMVn659Q.hdr +0 -0
- package/dist/assets/lit-element-P_wTzRvl.js +0 -19
- package/dist/assets/preview-1q4RDNOi.js +0 -1
- package/dist/assets/preview-6iG64ELu.js +0 -20
- package/dist/assets/preview-7nNmfNVr.js +0 -7
- package/dist/assets/preview-9bpQVOkQ.js +0 -1
- package/dist/assets/preview-FnnPJHgu.js +0 -1
- package/dist/assets/preview-VI2eoWmp.js +0 -1
- package/dist/assets/preview-bEa2SesL.js +0 -7
- package/dist/assets/preview-u8M_OEO2.js +0 -396
- package/dist/assets/preview-zZA4w0lH.js +0 -1
- package/dist/assets/property-EQZXZ3dt.js +0 -5
- package/dist/assets/query-7eORIRsG.js +0 -13
- package/dist/assets/roller-8Vy8W3X_.glb +0 -0
- package/dist/assets/roller-hopper-Heae_wy5.glb +0 -0
- package/dist/assets/share-xgPlHEHy.png +0 -0
- package/dist/assets/styling-ZOs40c1G.png +0 -0
- package/dist/assets/syntaxhighlighter-JOJW2KGS-uBo08tOF.js +0 -1
- package/dist/assets/testing-HG80fZfa.png +0 -0
- package/dist/assets/theming--liSzaFj.png +0 -0
- package/dist/assets/three.module-9MfFqitO.js +0 -3825
- package/dist/assets/tiny-invariant-VyoA2Os1.js +0 -1
- package/dist/assets/worker-h5IcTUxB.js +0 -1
- package/dist/favicon.svg +0 -7
- package/dist/iframe.html +0 -495
- package/dist/index.html +0 -155
- package/dist/index.json +0 -1
- package/dist/package.json +0 -60
- package/dist/project.json +0 -1
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +0 -12
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js +0 -60
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -18
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +0 -3
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/links-1/manager-bundle.js +0 -3
- package/dist/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/fonts.css +0 -31
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/WithTooltip-Y7J54OF7-3AIPQNGM.js +0 -1
- package/dist/sb-manager/chunk-I53COLQ6.js +0 -183
- package/dist/sb-manager/chunk-L35575BZ.js +0 -234
- package/dist/sb-manager/chunk-TZAR34JC.js +0 -6
- package/dist/sb-manager/chunk-UOBNU442.js +0 -347
- package/dist/sb-manager/chunk-VMGB76WP.js +0 -9
- package/dist/sb-manager/chunk-XP3HGWTR.js +0 -1
- package/dist/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +0 -58
- package/dist/sb-manager/globals-module-info.js +0 -1
- package/dist/sb-manager/globals-runtime.js +0 -1
- package/dist/sb-manager/globals.js +0 -1
- package/dist/sb-manager/index.js +0 -1
- package/dist/sb-manager/runtime.js +0 -1
- package/dist/sb-manager/syntaxhighlighter-JOJW2KGS-7BF26SBB.js +0 -1
- package/dist/sb-preview/globals.js +0 -1
- package/dist/sb-preview/runtime.js +0 -128
- package/dist/stories/cropper/index.d.ts +0 -18
- package/dist/stories/cropper/index.js +0 -118
- package/dist/stories/cropper/index.js.map +0 -1
- package/dist/stories/cropper/index.stories.d.ts +0 -11
- package/dist/stories/cropper/index.stories.js +0 -14
- package/dist/stories/cropper/index.stories.js.map +0 -1
- package/dist/stories/device-viewer/amr.d.ts +0 -75
- package/dist/stories/device-viewer/amr.js +0 -554
- package/dist/stories/device-viewer/amr.js.map +0 -1
- package/dist/stories/device-viewer/assembly.d.ts +0 -11
- package/dist/stories/device-viewer/assembly.js +0 -47
- package/dist/stories/device-viewer/assembly.js.map +0 -1
- package/dist/stories/device-viewer/asserts/fonts/type.json +0 -1281
- package/dist/stories/device-viewer/dimension/index.d.ts +0 -31
- package/dist/stories/device-viewer/dimension/index.js +0 -131
- package/dist/stories/device-viewer/dimension/index.js.map +0 -1
- package/dist/stories/device-viewer/dimension/line3.d.ts +0 -21
- package/dist/stories/device-viewer/dimension/line3.js +0 -98
- package/dist/stories/device-viewer/dimension/line3.js.map +0 -1
- package/dist/stories/device-viewer/dimension/size-box.d.ts +0 -39
- package/dist/stories/device-viewer/dimension/size-box.js +0 -176
- package/dist/stories/device-viewer/dimension/size-box.js.map +0 -1
- package/dist/stories/device-viewer/group-roller.d.ts +0 -20
- package/dist/stories/device-viewer/group-roller.js +0 -65
- package/dist/stories/device-viewer/group-roller.js.map +0 -1
- package/dist/stories/device-viewer/index.d.ts +0 -47
- package/dist/stories/device-viewer/index.js +0 -530
- package/dist/stories/device-viewer/index.js.map +0 -1
- package/dist/stories/device-viewer/index.stories.d.ts +0 -27
- package/dist/stories/device-viewer/index.stories.js +0 -37
- package/dist/stories/device-viewer/index.stories.js.map +0 -1
- package/dist/stories/device-viewer/lines.d.ts +0 -36
- package/dist/stories/device-viewer/lines.js +0 -171
- package/dist/stories/device-viewer/lines.js.map +0 -1
- package/dist/stories/device-viewer/main.d.ts +0 -1
- package/dist/stories/device-viewer/main.js +0 -2
- package/dist/stories/device-viewer/main.js.map +0 -1
- package/dist/stories/device-viewer/mechanism/mechanism.d.ts +0 -29
- package/dist/stories/device-viewer/mechanism/mechanism.js +0 -164
- package/dist/stories/device-viewer/mechanism/mechanism.js.map +0 -1
- package/dist/stories/device-viewer/outerline.d.ts +0 -16
- package/dist/stories/device-viewer/outerline.js +0 -63
- package/dist/stories/device-viewer/outerline.js.map +0 -1
- package/dist/stories/device-viewer/roller.js +0 -121
- package/dist/stories/device-viewer/roller.js.map +0 -1
- package/dist/stories/device-viewer/row.d.ts +0 -18
- package/dist/stories/device-viewer/row.js +0 -58
- package/dist/stories/device-viewer/row.js.map +0 -1
- package/dist/stories/device-viewer/scene.d.ts +0 -101
- package/dist/stories/device-viewer/scene.js +0 -535
- package/dist/stories/device-viewer/scene.js.map +0 -1
- package/dist/stories/device-viewer/slot/slot-item.d.ts +0 -20
- package/dist/stories/device-viewer/slot/slot-item.js +0 -82
- package/dist/stories/device-viewer/slot/slot-item.js.map +0 -1
- package/dist/stories/device-viewer/slot.d.ts +0 -71
- package/dist/stories/device-viewer/slot.js +0 -272
- package/dist/stories/device-viewer/slot.js.map +0 -1
- package/dist/stories/device-viewer/sound.d.ts +0 -5
- package/dist/stories/device-viewer/sound.js +0 -13
- package/dist/stories/device-viewer/sound.js.map +0 -1
- package/dist/stories/device-viewer/text2.d.ts +0 -4
- package/dist/stories/device-viewer/text2.js +0 -12
- package/dist/stories/device-viewer/text2.js.map +0 -1
- package/dist/stories/device-viewer/text3.d.ts +0 -4
- package/dist/stories/device-viewer/text3.js +0 -14
- package/dist/stories/device-viewer/text3.js.map +0 -1
- package/dist/stories/device-viewer/utils/index.d.ts +0 -36
- package/dist/stories/device-viewer/utils/index.js +0 -166
- package/dist/stories/device-viewer/utils/index.js.map +0 -1
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.d.ts +0 -8
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js +0 -88
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js.map +0 -1
- package/dist/stories/device-viewer/worker/generateAsync.worker.d.ts +0 -1
- package/dist/stories/device-viewer/worker/generateAsync.worker.js +0 -57
- package/dist/stories/device-viewer/worker/generateAsync.worker.js.map +0 -1
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.d.ts +0 -16
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js +0 -29
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js.map +0 -1
- package/dist/stories/main/index.d.ts +0 -1
- package/dist/stories/main/index.js +0 -2
- package/dist/stories/main/index.js.map +0 -1
- package/dist/stories/main.d.ts +0 -4
- package/dist/stories/main.js +0 -5
- package/dist/stories/main.js.map +0 -1
- package/dist/stories/plugin.d.ts +0 -5
- package/dist/stories/plugin.js +0 -6
- package/dist/stories/plugin.js.map +0 -1
- package/dist/stories/plugins/change-slot/index.d.ts +0 -0
- package/dist/stories/plugins/change-slot/index.js +0 -2
- package/dist/stories/plugins/change-slot/index.js.map +0 -1
- package/dist/stories/sglb/index.d.ts +0 -27
- package/dist/stories/sglb/index.js +0 -151
- package/dist/stories/sglb/index.js.map +0 -1
- package/dist/stories/smap-viewer/index.d.ts +0 -14
- package/dist/stories/smap-viewer/index.js +0 -59
- package/dist/stories/smap-viewer/index.js.map +0 -1
- package/dist/stories/smap-viewer/index.stories.d.ts +0 -22
- package/dist/stories/smap-viewer/index.stories.js +0 -27
- package/dist/stories/smap-viewer/index.stories.js.map +0 -1
- package/dist/stories/step-viewer/index.d.ts +0 -17
- package/dist/stories/step-viewer/index.js +0 -109
- package/dist/stories/step-viewer/index.js.map +0 -1
- package/dist/stories/step-viewer/index.stories.d.ts +0 -20
- package/dist/stories/step-viewer/index.stories.js +0 -24
- package/dist/stories/step-viewer/index.stories.js.map +0 -1
- package/dist/stories/test/index.d.ts +0 -25
- package/dist/stories/test/index.js +0 -99
- package/dist/stories/test/index.js.map +0 -1
- package/dist/stories/test/index.stories.d.ts +0 -14
- package/dist/stories/test/index.stories.js +0 -16
- package/dist/stories/test/index.stories.js.map +0 -1
- package/dist/stories/test/scene.d.ts +0 -20
- package/dist/stories/test/scene.js +0 -86
- package/dist/stories/test/scene.js.map +0 -1
- package/dist/stories/utils/index.d.ts +0 -4
- package/dist/stories/utils/index.js +0 -28
- package/dist/stories/utils/index.js.map +0 -1
|
@@ -1,3825 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2010-2024 Three.js Authors
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Cs="164",Gm={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Wm={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Dl=0,Ks=1,Il=2,Go=1,Ul=2,Ze=3,_n=0,Se=1,Je=2,mn=0,Qn=1,js=2,Zs=3,Js=4,Nl=5,Ln=100,Fl=101,Ol=102,Bl=103,zl=104,Vl=200,Hl=201,kl=202,Gl=203,xs=204,Ms=205,Wl=206,Xl=207,ql=208,Yl=209,$l=210,Kl=211,jl=212,Zl=213,Jl=214,Ql=0,tc=1,ec=2,mr=3,nc=4,ic=5,rc=6,sc=7,Wo=0,ac=1,oc=2,gn=0,lc=1,cc=2,hc=3,uc=4,dc=5,fc=6,pc=7,Qs="attached",mc="detached",Xo=300,ii=301,ri=302,Ss=303,ys=304,Ar=306,Es=1e3,tn=1001,Ts=1002,Me=1003,gc=1004,Ui=1005,xe=1006,Nr=1007,fn=1008,Xm=1008,vn=1009,_c=1010,vc=1011,qo=1012,Yo=1013,si=1014,He=1015,wr=1016,$o=1017,Ko=1018,Ri=1020,xc=35902,Mc=1021,Sc=1022,Fe=1023,yc=1024,Ec=1025,ti=1026,Ai=1027,jo=1028,Zo=1029,Tc=1030,Jo=1031,Qo=1033,Fr=33776,Or=33777,Br=33778,zr=33779,ta=35840,ea=35841,na=35842,ia=35843,ra=36196,sa=37492,aa=37496,oa=37808,la=37809,ca=37810,ha=37811,ua=37812,da=37813,fa=37814,pa=37815,ma=37816,ga=37817,_a=37818,va=37819,xa=37820,Ma=37821,Vr=36492,Sa=36494,ya=36495,bc=36283,Ea=36284,Ta=36285,ba=36286,gr=2300,_r=2301,Hr=2302,Aa=2400,wa=2401,Ra=2402,Ac=2500,qm=0,Ym=1,$m=2,wc=3200,Rc=3201,tl=0,Cc=1,dn="",ze="srgb",Mn="srgb-linear",Ps="display-p3",Rr="display-p3-linear",vr="linear",Zt="srgb",xr="rec709",Mr="p3",Un=7680,Ca=519,Pc=512,Lc=513,Dc=514,el=515,Ic=516,Uc=517,Nc=518,Fc=519,bs=35044,Pa="300 es",en=2e3,Sr=2001;class li{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(r!==void 0){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,t);t.target=null}}}const fe=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let La=1234567;const ei=Math.PI/180,ai=180/Math.PI;function Oe(){const i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(fe[i&255]+fe[i>>8&255]+fe[i>>16&255]+fe[i>>24&255]+"-"+fe[t&255]+fe[t>>8&255]+"-"+fe[t>>16&15|64]+fe[t>>24&255]+"-"+fe[e&63|128]+fe[e>>8&255]+"-"+fe[e>>16&255]+fe[e>>24&255]+fe[n&255]+fe[n>>8&255]+fe[n>>16&255]+fe[n>>24&255]).toLowerCase()}function ne(i,t,e){return Math.max(t,Math.min(e,i))}function Ls(i,t){return(i%t+t)%t}function Oc(i,t,e,n,r){return n+(i-t)*(r-n)/(e-t)}function Bc(i,t,e){return i!==t?(e-i)/(t-i):0}function bi(i,t,e){return(1-e)*i+e*t}function zc(i,t,e,n){return bi(i,t,1-Math.exp(-e*n))}function Vc(i,t=1){return t-Math.abs(Ls(i,t*2)-t)}function Hc(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*(3-2*i))}function kc(i,t,e){return i<=t?0:i>=e?1:(i=(i-t)/(e-t),i*i*i*(i*(i*6-15)+10))}function Gc(i,t){return i+Math.floor(Math.random()*(t-i+1))}function Wc(i,t){return i+Math.random()*(t-i)}function Xc(i){return i*(.5-Math.random())}function qc(i){i!==void 0&&(La=i);let t=La+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Yc(i){return i*ei}function $c(i){return i*ai}function Kc(i){return(i&i-1)===0&&i!==0}function jc(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Zc(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Jc(i,t,e,n,r){const s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+n)/2),h=a((t+n)/2),d=s((t-n)/2),u=a((t-n)/2),p=s((n-t)/2),g=a((n-t)/2);switch(r){case"XYX":i.set(o*h,l*d,l*u,o*c);break;case"YZY":i.set(l*u,o*h,l*d,o*c);break;case"ZXZ":i.set(l*d,l*u,o*h,o*c);break;case"XZX":i.set(o*h,l*g,l*p,o*c);break;case"YXY":i.set(l*p,o*h,l*g,o*c);break;case"ZYZ":i.set(l*g,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ue(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Gt(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Km={DEG2RAD:ei,RAD2DEG:ai,generateUUID:Oe,clamp:ne,euclideanModulo:Ls,mapLinear:Oc,inverseLerp:Bc,lerp:bi,damp:zc,pingpong:Vc,smoothstep:Hc,smootherstep:kc,randInt:Gc,randFloat:Wc,randFloatSpread:Xc,seededRandom:qc,degToRad:Yc,radToDeg:$c,isPowerOfTwo:Kc,ceilPowerOfTwo:jc,floorPowerOfTwo:Zc,setQuaternionFromProperEuler:Jc,normalize:Gt,denormalize:Ue};class Lt{constructor(t=0,e=0){Lt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ne(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*r+t.x,this.y=s*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Tt{constructor(t,e,n,r,s,a,o,l,c){Tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c)}set(t,e,n,r,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],p=n[5],g=n[8],_=r[0],m=r[3],f=r[6],E=r[1],S=r[4],b=r[7],I=r[2],A=r[5],w=r[8];return s[0]=a*_+o*E+l*I,s[3]=a*m+o*S+l*A,s[6]=a*f+o*b+l*w,s[1]=c*_+h*E+d*I,s[4]=c*m+h*S+d*A,s[7]=c*f+h*b+d*w,s[2]=u*_+p*E+g*I,s[5]=u*m+p*S+g*A,s[8]=u*f+p*b+g*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=h*a-o*c,u=o*l-h*s,p=c*s-a*l,g=e*d+n*u+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return t[0]=d*_,t[1]=(r*c-h*n)*_,t[2]=(o*n-r*a)*_,t[3]=u*_,t[4]=(h*e-r*l)*_,t[5]=(r*s-o*e)*_,t[6]=p*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-r*c,r*l,-r*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(kr.makeScale(t,e)),this}rotate(t){return this.premultiply(kr.makeRotation(-t)),this}translate(t,e){return this.premultiply(kr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const kr=new Tt;function nl(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function wi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Qc(){const i=wi("canvas");return i.style.display="block",i}const Da={};function il(i){i in Da||(Da[i]=!0,console.warn(i))}const Ia=new Tt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ua=new Tt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ni={[Mn]:{transfer:vr,primaries:xr,toReference:i=>i,fromReference:i=>i},[ze]:{transfer:Zt,primaries:xr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Rr]:{transfer:vr,primaries:Mr,toReference:i=>i.applyMatrix3(Ua),fromReference:i=>i.applyMatrix3(Ia)},[Ps]:{transfer:Zt,primaries:Mr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Ua),fromReference:i=>i.applyMatrix3(Ia).convertLinearToSRGB()}},th=new Set([Mn,Rr]),Xt={enabled:!0,_workingColorSpace:Mn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!th.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,t,e){if(this.enabled===!1||t===e||!t||!e)return i;const n=Ni[t].toReference,r=Ni[e].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,t){return this.convert(i,this._workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this._workingColorSpace)},getPrimaries:function(i){return Ni[i].primaries},getTransfer:function(i){return i===dn?vr:Ni[i].transfer}};function ni(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Gr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Nn;class eh{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Nn===void 0&&(Nn=wi("canvas")),Nn.width=t.width,Nn.height=t.height;const n=Nn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Nn}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=wi("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=ni(s[a]/255)*255;return n.putImageData(r,0,0),e}else if(t.data){const e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(ni(e[n]/255)*255):e[n]=ni(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let nh=0;class rl{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:nh++}),this.uuid=Oe(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Wr(r[a].image)):s.push(Wr(r[a]))}else s=Wr(r);n.url=s}return e||(t.images[this.uuid]=n),n}}function Wr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?eh.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ih=0;class ce extends li{constructor(t=ce.DEFAULT_IMAGE,e=ce.DEFAULT_MAPPING,n=tn,r=tn,s=xe,a=fn,o=Fe,l=vn,c=ce.DEFAULT_ANISOTROPY,h=dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ih++}),this.uuid=Oe(),this.name="",this.source=new rl(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Lt(0,0),this.repeat=new Lt(1,1),this.center=new Lt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Tt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Xo)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Es:t.x=t.x-Math.floor(t.x);break;case tn:t.x=t.x<0?0:1;break;case Ts:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Es:t.y=t.y-Math.floor(t.y);break;case tn:t.y=t.y<0?0:1;break;case Ts:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}ce.DEFAULT_IMAGE=null;ce.DEFAULT_MAPPING=Xo;ce.DEFAULT_ANISOTROPY=1;class qt{constructor(t=0,e=0,n=0,r=1){qt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,s;const l=t.elements,c=l[0],h=l[4],d=l[8],u=l[1],p=l[5],g=l[9],_=l[2],m=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const S=(c+1)/2,b=(p+1)/2,I=(f+1)/2,A=(h+u)/4,w=(d+_)/4,V=(g+m)/4;return S>b&&S>I?S<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(S),r=A/n,s=w/n):b>I?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=A/r,s=V/r):I<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),n=w/s,r=V/s),this.set(n,r,s,e),this}let E=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(d-_)/E,this.z=(u-h)/E,this.w=Math.acos((c+p+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class rh extends li{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new qt(0,0,t,e),this.scissorTest=!1,this.viewport=new qt(0,0,t,e);const r={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:xe,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new ce(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=t,this.textures[r].image.height=e,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let n=0,r=t.textures.length;n<r;n++)this.textures[n]=t.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new rl(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class xn extends rh{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class Ds extends ce{constructor(t=null,e=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=Me,this.minFilter=Me,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class jm extends xn{constructor(t=1,e=1,n=1,r={}){super(t,e,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ds(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class sh extends ce{constructor(t=null,e=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:r},this.magFilter=Me,this.minFilter=Me,this.wrapR=tn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ci{constructor(t=0,e=0,n=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=r}static slerpFlat(t,e,n,r,s,a,o){let l=n[r+0],c=n[r+1],h=n[r+2],d=n[r+3];const u=s[a+0],p=s[a+1],g=s[a+2],_=s[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=h,t[e+3]=d;return}if(o===1){t[e+0]=u,t[e+1]=p,t[e+2]=g,t[e+3]=_;return}if(d!==_||l!==u||c!==p||h!==g){let m=1-o;const f=l*u+c*p+h*g+d*_,E=f>=0?1:-1,S=1-f*f;if(S>Number.EPSILON){const I=Math.sqrt(S),A=Math.atan2(I,f*E);m=Math.sin(m*A)/I,o=Math.sin(o*A)/I}const b=o*E;if(l=l*m+u*b,c=c*m+p*b,h=h*m+g*b,d=d*m+_*b,m===1-o){const I=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=I,c*=I,h*=I,d*=I}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=d}static multiplyQuaternionsFlat(t,e,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],u=s[a+1],p=s[a+2],g=s[a+3];return t[e]=o*g+h*d+l*p-c*u,t[e+1]=l*g+h*u+c*d-o*p,t[e+2]=c*g+h*p+o*u-l*d,t[e+3]=h*g-o*d-l*u-c*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,r=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),d=o(s/2),u=l(n/2),p=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"YXZ":this._x=u*h*d+c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"ZXY":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d-u*p*g;break;case"ZYX":this._x=u*h*d-c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d+u*p*g;break;case"YZX":this._x=u*h*d+c*p*g,this._y=c*p*d+u*h*g,this._z=c*h*g-u*p*d,this._w=c*h*d-u*p*g;break;case"XZY":this._x=u*h*d-c*p*g,this._y=c*p*d-u*h*g,this._z=c*h*g+u*p*d,this._w=c*h*d+u*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],d=e[10],u=n+o+d;if(u>0){const p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>d){const p=2*Math.sqrt(1+n-o-d);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-n-d);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+d-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ne(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-e;return this._w=p*a+e*this._w,this._x=p*n+e*this._x,this._y=p*r+e*this._y,this._z=p*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-e)*h)/c,u=Math.sin(e*h)/c;return this._w=a*d+this._w*u,this._x=n*d+this._x*u,this._y=r*d+this._y*u,this._z=s*d+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(t=0,e=0,n=0){R.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Na.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Na.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*r-o*n),h=2*(o*e-s*r),d=2*(s*n-a*e);return this.x=e+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Xr.copy(this).projectOnVector(t),this.sub(Xr)}reflect(t){return this.sub(Xr.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ne(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xr=new R,Na=new ci;class Sn{constructor(t=new R(1/0,1/0,1/0),e=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Le.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Le.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Le.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(n!==void 0){const s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,Le):Le.fromBufferAttribute(s,a),Le.applyMatrix4(t.matrixWorld),this.expandByPoint(Le);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Fi.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Fi.copy(n.boundingBox)),Fi.applyMatrix4(t.matrixWorld),this.union(Fi)}const r=t.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Le),Le.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(gi),Oi.subVectors(this.max,gi),Fn.subVectors(t.a,gi),On.subVectors(t.b,gi),Bn.subVectors(t.c,gi),an.subVectors(On,Fn),on.subVectors(Bn,On),En.subVectors(Fn,Bn);let e=[0,-an.z,an.y,0,-on.z,on.y,0,-En.z,En.y,an.z,0,-an.x,on.z,0,-on.x,En.z,0,-En.x,-an.y,an.x,0,-on.y,on.x,0,-En.y,En.x,0];return!qr(e,Fn,On,Bn,Oi)||(e=[1,0,0,0,1,0,0,0,1],!qr(e,Fn,On,Bn,Oi))?!1:(Bi.crossVectors(an,on),e=[Bi.x,Bi.y,Bi.z],qr(e,Fn,On,Bn,Oi))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Le).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Le).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Xe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xe),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Xe=[new R,new R,new R,new R,new R,new R,new R,new R],Le=new R,Fi=new Sn,Fn=new R,On=new R,Bn=new R,an=new R,on=new R,En=new R,gi=new R,Oi=new R,Bi=new R,Tn=new R;function qr(i,t,e,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Tn.fromArray(i,s);const o=r.x*Math.abs(Tn.x)+r.y*Math.abs(Tn.y)+r.z*Math.abs(Tn.z),l=t.dot(Tn),c=e.dot(Tn),h=n.dot(Tn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const ah=new Sn,_i=new R,Yr=new R;class rn{constructor(t=new R,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):ah.setFromPoints(t).getCenter(n);let r=0;for(let s=0,a=t.length;s<a;s++)r=Math.max(r,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;_i.subVectors(t,this.center);const e=_i.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),r=(n-this.radius)*.5;this.center.addScaledVector(_i,r/n),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Yr.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(_i.copy(t.center).add(Yr)),this.expandByPoint(_i.copy(t.center).sub(Yr))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qe=new R,$r=new R,zi=new R,ln=new R,Kr=new R,Vi=new R,jr=new R;class Ci{constructor(t=new R,e=new R(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,qe)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=qe.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(qe.copy(this.origin).addScaledVector(this.direction,e),qe.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){$r.copy(t).add(e).multiplyScalar(.5),zi.copy(e).sub(t).normalize(),ln.copy(this.origin).sub($r);const s=t.distanceTo(e)*.5,a=-this.direction.dot(zi),o=ln.dot(this.direction),l=-ln.dot(zi),c=ln.lengthSq(),h=Math.abs(1-a*a);let d,u,p,g;if(h>0)if(d=a*l-o,u=a*o-l,g=s*h,d>=0)if(u>=-g)if(u<=g){const _=1/h;d*=_,u*=_,p=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u<=-g?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c):u<=g?(d=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy($r).addScaledVector(zi,u),p}intersectSphere(t,e){qe.subVectors(t.center,this.origin);const n=qe.dot(this.direction),r=qe.dot(qe)-n*n,s=t.radius*t.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,r=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,r=(t.min.x-u.x)*c),h>=0?(s=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(s=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(t.min.z-u.z)*d,l=(t.max.z-u.z)*d):(o=(t.max.z-u.z)*d,l=(t.min.z-u.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,e)}intersectsBox(t){return this.intersectBox(t,qe)!==null}intersectTriangle(t,e,n,r,s){Kr.subVectors(e,t),Vi.subVectors(n,t),jr.crossVectors(Kr,Vi);let a=this.direction.dot(jr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ln.subVectors(this.origin,t);const l=o*this.direction.dot(Vi.crossVectors(ln,Vi));if(l<0)return null;const c=o*this.direction.dot(Kr.cross(ln));if(c<0||l+c>a)return null;const h=-o*ln.dot(jr);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Dt{constructor(t,e,n,r,s,a,o,l,c,h,d,u,p,g,_,m){Dt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c,h,d,u,p,g,_,m)}set(t,e,n,r,s,a,o,l,c,h,d,u,p,g,_,m){const f=this.elements;return f[0]=t,f[4]=e,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=u,f[3]=p,f[7]=g,f[11]=_,f[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Dt().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/zn.setFromMatrixColumn(t,0).length(),s=1/zn.setFromMatrixColumn(t,1).length(),a=1/zn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,r=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(t.order==="XYZ"){const u=a*h,p=a*d,g=o*h,_=o*d;e[0]=l*h,e[4]=-l*d,e[8]=c,e[1]=p+g*c,e[5]=u-_*c,e[9]=-o*l,e[2]=_-u*c,e[6]=g+p*c,e[10]=a*l}else if(t.order==="YXZ"){const u=l*h,p=l*d,g=c*h,_=c*d;e[0]=u+_*o,e[4]=g*o-p,e[8]=a*c,e[1]=a*d,e[5]=a*h,e[9]=-o,e[2]=p*o-g,e[6]=_+u*o,e[10]=a*l}else if(t.order==="ZXY"){const u=l*h,p=l*d,g=c*h,_=c*d;e[0]=u-_*o,e[4]=-a*d,e[8]=g+p*o,e[1]=p+g*o,e[5]=a*h,e[9]=_-u*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const u=a*h,p=a*d,g=o*h,_=o*d;e[0]=l*h,e[4]=g*c-p,e[8]=u*c+_,e[1]=l*d,e[5]=_*c+u,e[9]=p*c-g,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const u=a*l,p=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=_-u*d,e[8]=g*d+p,e[1]=d,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=p*d+g,e[10]=u-_*d}else if(t.order==="XZY"){const u=a*l,p=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=-d,e[8]=c*h,e[1]=u*d+_,e[5]=a*h,e[9]=p*d-g,e[2]=g*d-p,e[6]=o*h,e[10]=_*d+u}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(oh,t,lh)}lookAt(t,e,n){const r=this.elements;return Ee.subVectors(t,e),Ee.lengthSq()===0&&(Ee.z=1),Ee.normalize(),cn.crossVectors(n,Ee),cn.lengthSq()===0&&(Math.abs(n.z)===1?Ee.x+=1e-4:Ee.z+=1e-4,Ee.normalize(),cn.crossVectors(n,Ee)),cn.normalize(),Hi.crossVectors(Ee,cn),r[0]=cn.x,r[4]=Hi.x,r[8]=Ee.x,r[1]=cn.y,r[5]=Hi.y,r[9]=Ee.y,r[2]=cn.z,r[6]=Hi.z,r[10]=Ee.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],d=n[5],u=n[9],p=n[13],g=n[2],_=n[6],m=n[10],f=n[14],E=n[3],S=n[7],b=n[11],I=n[15],A=r[0],w=r[4],V=r[8],y=r[12],x=r[1],F=r[5],W=r[9],P=r[13],k=r[2],q=r[6],j=r[10],st=r[14],z=r[3],J=r[7],Z=r[11],ft=r[15];return s[0]=a*A+o*x+l*k+c*z,s[4]=a*w+o*F+l*q+c*J,s[8]=a*V+o*W+l*j+c*Z,s[12]=a*y+o*P+l*st+c*ft,s[1]=h*A+d*x+u*k+p*z,s[5]=h*w+d*F+u*q+p*J,s[9]=h*V+d*W+u*j+p*Z,s[13]=h*y+d*P+u*st+p*ft,s[2]=g*A+_*x+m*k+f*z,s[6]=g*w+_*F+m*q+f*J,s[10]=g*V+_*W+m*j+f*Z,s[14]=g*y+_*P+m*st+f*ft,s[3]=E*A+S*x+b*k+I*z,s[7]=E*w+S*F+b*q+I*J,s[11]=E*V+S*W+b*j+I*Z,s[15]=E*y+S*P+b*st+I*ft,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],d=t[6],u=t[10],p=t[14],g=t[3],_=t[7],m=t[11],f=t[15];return g*(+s*l*d-r*c*d-s*o*u+n*c*u+r*o*p-n*l*p)+_*(+e*l*p-e*c*u+s*a*u-r*a*p+r*c*h-s*l*h)+m*(+e*c*d-e*o*p-s*a*d+n*a*p+s*o*h-n*c*h)+f*(-r*o*h-e*l*d+e*o*u+r*a*d-n*a*u+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=t[9],u=t[10],p=t[11],g=t[12],_=t[13],m=t[14],f=t[15],E=d*m*c-_*u*c+_*l*p-o*m*p-d*l*f+o*u*f,S=g*u*c-h*m*c-g*l*p+a*m*p+h*l*f-a*u*f,b=h*_*c-g*d*c+g*o*p-a*_*p-h*o*f+a*d*f,I=g*d*l-h*_*l-g*o*u+a*_*u+h*o*m-a*d*m,A=e*E+n*S+r*b+s*I;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/A;return t[0]=E*w,t[1]=(_*u*s-d*m*s-_*r*p+n*m*p+d*r*f-n*u*f)*w,t[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*f+n*l*f)*w,t[3]=(d*l*s-o*u*s-d*r*c+n*u*c+o*r*p-n*l*p)*w,t[4]=S*w,t[5]=(h*m*s-g*u*s+g*r*p-e*m*p-h*r*f+e*u*f)*w,t[6]=(g*l*s-a*m*s-g*r*c+e*m*c+a*r*f-e*l*f)*w,t[7]=(a*u*s-h*l*s+h*r*c-e*u*c-a*r*p+e*l*p)*w,t[8]=b*w,t[9]=(g*d*s-h*_*s-g*n*p+e*_*p+h*n*f-e*d*f)*w,t[10]=(a*_*s-g*o*s+g*n*c-e*_*c-a*n*f+e*o*f)*w,t[11]=(h*o*s-a*d*s-h*n*c+e*d*c+a*n*p-e*o*p)*w,t[12]=I*w,t[13]=(h*_*r-g*d*r+g*n*u-e*_*u-h*n*m+e*d*m)*w,t[14]=(g*o*r-a*_*r-g*n*l+e*_*l+a*n*m-e*o*m)*w,t[15]=(a*d*r-h*o*r+h*n*l-e*d*l-a*n*u+e*o*u)*w,this}scale(t){const e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,s,a){return this.set(1,n,s,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,d=o+o,u=s*c,p=s*h,g=s*d,_=a*h,m=a*d,f=o*d,E=l*c,S=l*h,b=l*d,I=n.x,A=n.y,w=n.z;return r[0]=(1-(_+f))*I,r[1]=(p+b)*I,r[2]=(g-S)*I,r[3]=0,r[4]=(p-b)*A,r[5]=(1-(u+f))*A,r[6]=(m+E)*A,r[7]=0,r[8]=(g+S)*w,r[9]=(m-E)*w,r[10]=(1-(u+_))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let s=zn.set(r[0],r[1],r[2]).length();const a=zn.set(r[4],r[5],r[6]).length(),o=zn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],De.copy(this);const c=1/s,h=1/a,d=1/o;return De.elements[0]*=c,De.elements[1]*=c,De.elements[2]*=c,De.elements[4]*=h,De.elements[5]*=h,De.elements[6]*=h,De.elements[8]*=d,De.elements[9]*=d,De.elements[10]*=d,e.setFromRotationMatrix(De),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,r,s,a,o=en){const l=this.elements,c=2*s/(e-t),h=2*s/(n-r),d=(e+t)/(e-t),u=(n+r)/(n-r);let p,g;if(o===en)p=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Sr)p=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=u,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,r,s,a,o=en){const l=this.elements,c=1/(e-t),h=1/(n-r),d=1/(a-s),u=(e+t)*c,p=(n+r)*h;let g,_;if(o===en)g=(a+s)*d,_=-2*d;else if(o===Sr)g=s*d,_=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-u,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const zn=new R,De=new Dt,oh=new R(0,0,0),lh=new R(1,1,1),cn=new R,Hi=new R,Ee=new R,Fa=new Dt,Oa=new ci;class ke{constructor(t=0,e=0,n=0,r=ke.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],u=r[6],p=r[10];switch(e){case"XYZ":this._y=Math.asin(ne(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ne(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ne(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ne(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ne(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-ne(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Fa.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Fa,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Oa.setFromEuler(this),this.setFromQuaternion(Oa,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ke.DEFAULT_ORDER="XYZ";class Is{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let ch=0;const Ba=new R,Vn=new ci,Ye=new Dt,ki=new R,vi=new R,hh=new R,uh=new ci,za=new R(1,0,0),Va=new R(0,1,0),Ha=new R(0,0,1),ka={type:"added"},dh={type:"removed"},Hn={type:"childadded",child:null},Zr={type:"childremoved",child:null};class ie extends li{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ch++}),this.uuid=Oe(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ie.DEFAULT_UP.clone();const t=new R,e=new ke,n=new ci,r=new R(1,1,1);function s(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Dt},normalMatrix:{value:new Tt}}),this.matrix=new Dt,this.matrixWorld=new Dt,this.matrixAutoUpdate=ie.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ie.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Is,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Vn.setFromAxisAngle(t,e),this.quaternion.multiply(Vn),this}rotateOnWorldAxis(t,e){return Vn.setFromAxisAngle(t,e),this.quaternion.premultiply(Vn),this}rotateX(t){return this.rotateOnAxis(za,t)}rotateY(t){return this.rotateOnAxis(Va,t)}rotateZ(t){return this.rotateOnAxis(Ha,t)}translateOnAxis(t,e){return Ba.copy(t).applyQuaternion(this.quaternion),this.position.add(Ba.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(za,t)}translateY(t){return this.translateOnAxis(Va,t)}translateZ(t){return this.translateOnAxis(Ha,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ye.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?ki.copy(t):ki.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),vi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ye.lookAt(vi,ki,this.up):Ye.lookAt(ki,vi,this.up),this.quaternion.setFromRotationMatrix(Ye),r&&(Ye.extractRotation(r.matrixWorld),Vn.setFromRotationMatrix(Ye),this.quaternion.premultiply(Vn.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ka),Hn.child=t,this.dispatchEvent(Hn),Hn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(dh),Zr.child=t,this.dispatchEvent(Zr),Zr.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ye.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ye.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ye),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ka),Hn.child=t,this.dispatchEvent(Hn),Hn.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vi,t,hh),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vi,uh,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,r=e.length;n<r;n++){const s=e[n];(s.matrixWorldAutoUpdate===!0||t===!0)&&s.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const n=this.parent;if(t===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const d=l[c];s(t.shapes,d)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(t.materials,this.material[l]));r.material=o}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(t.animations,l))}}if(e){const o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),d=a(t.shapes),u=a(t.skeletons),p=a(t.animations),g=a(t.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),p.length>0&&(n.animations=p),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const r=t.children[n];this.add(r.clone())}return this}}ie.DEFAULT_UP=new R(0,1,0);ie.DEFAULT_MATRIX_AUTO_UPDATE=!0;ie.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ie=new R,$e=new R,Jr=new R,Ke=new R,kn=new R,Gn=new R,Ga=new R,Qr=new R,ts=new R,es=new R;class Ne{constructor(t=new R,e=new R,n=new R){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),Ie.subVectors(t,e),r.cross(Ie);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,n,r,s){Ie.subVectors(r,e),$e.subVectors(n,e),Jr.subVectors(t,e);const a=Ie.dot(Ie),o=Ie.dot($e),l=Ie.dot(Jr),c=$e.dot($e),h=$e.dot(Jr),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const u=1/d,p=(c*l-o*h)*u,g=(a*h-o*l)*u;return s.set(1-p-g,g,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,Ke)===null?!1:Ke.x>=0&&Ke.y>=0&&Ke.x+Ke.y<=1}static getInterpolation(t,e,n,r,s,a,o,l){return this.getBarycoord(t,e,n,r,Ke)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ke.x),l.addScaledVector(a,Ke.y),l.addScaledVector(o,Ke.z),l)}static isFrontFacing(t,e,n,r){return Ie.subVectors(n,e),$e.subVectors(t,e),Ie.cross($e).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ie.subVectors(this.c,this.b),$e.subVectors(this.a,this.b),Ie.cross($e).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ne.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ne.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,r,s){return Ne.getInterpolation(t,this.a,this.b,this.c,e,n,r,s)}containsPoint(t){return Ne.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ne.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,s=this.c;let a,o;kn.subVectors(r,n),Gn.subVectors(s,n),Qr.subVectors(t,n);const l=kn.dot(Qr),c=Gn.dot(Qr);if(l<=0&&c<=0)return e.copy(n);ts.subVectors(t,r);const h=kn.dot(ts),d=Gn.dot(ts);if(h>=0&&d<=h)return e.copy(r);const u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(kn,a);es.subVectors(t,s);const p=kn.dot(es),g=Gn.dot(es);if(g>=0&&p<=g)return e.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),e.copy(n).addScaledVector(Gn,o);const m=h*g-p*d;if(m<=0&&d-h>=0&&p-g>=0)return Ga.subVectors(s,r),o=(d-h)/(d-h+(p-g)),e.copy(r).addScaledVector(Ga,o);const f=1/(m+_+u);return a=_*f,o=u*f,e.copy(n).addScaledVector(kn,a).addScaledVector(Gn,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const sl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},hn={h:0,s:0,l:0},Gi={h:0,s:0,l:0};function ns(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}class Pt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ze){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Xt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r=Xt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Xt.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r=Xt.workingColorSpace){if(t=Ls(t,1),e=ne(e,0,1),n=ne(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=ns(a,s,t+1/3),this.g=ns(a,s,t),this.b=ns(a,s,t-1/3)}return Xt.toWorkingColorSpace(this,r),this}setStyle(t,e=ze){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ze){const n=sl[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ni(t.r),this.g=ni(t.g),this.b=ni(t.b),this}copyLinearToSRGB(t){return this.r=Gr(t.r),this.g=Gr(t.g),this.b=Gr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ze){return Xt.fromWorkingColorSpace(pe.copy(this),t),Math.round(ne(pe.r*255,0,255))*65536+Math.round(ne(pe.g*255,0,255))*256+Math.round(ne(pe.b*255,0,255))}getHexString(t=ze){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Xt.workingColorSpace){Xt.fromWorkingColorSpace(pe.copy(this),e);const n=pe.r,r=pe.g,s=pe.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Xt.workingColorSpace){return Xt.fromWorkingColorSpace(pe.copy(this),e),t.r=pe.r,t.g=pe.g,t.b=pe.b,t}getStyle(t=ze){Xt.fromWorkingColorSpace(pe.copy(this),t);const e=pe.r,n=pe.g,r=pe.b;return t!==ze?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(t,e,n){return this.getHSL(hn),this.setHSL(hn.h+t,hn.s+e,hn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(hn),t.getHSL(Gi);const n=bi(hn.h,Gi.h,e),r=bi(hn.s,Gi.s,e),s=bi(hn.l,Gi.l,e);return this.setHSL(n,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*r,this.g=s[1]*e+s[4]*n+s[7]*r,this.b=s[2]*e+s[5]*n+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const pe=new Pt;Pt.NAMES=sl;let fh=0;class In extends li{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fh++}),this.uuid=Oe(),this.name="",this.type="Material",this.blending=Qn,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=xs,this.blendDst=Ms,this.blendEquation=Ln,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Pt(0,0,0),this.blendAlpha=0,this.depthFunc=mr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ca,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Un,this.stencilZFail=Un,this.stencilZPass=Un,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const r=this[e];if(r===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qn&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==xs&&(n.blendSrc=this.blendSrc),this.blendDst!==Ms&&(n.blendDst=this.blendDst),this.blendEquation!==Ln&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==mr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ca&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Un&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Un&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Un&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=r(t.textures),a=r(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const r=e.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class al extends In{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ke,this.combine=Wo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Qe=ph();function ph(){const i=new ArrayBuffer(4),t=new Float32Array(i),e=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(c&8388608);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function mh(i){Math.abs(i)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),i=ne(i,-65504,65504),Qe.floatView[0]=i;const t=Qe.uint32View[0],e=t>>23&511;return Qe.baseTable[e]+((t&8388607)>>Qe.shiftTable[e])}function gh(i){const t=i>>10;return Qe.uint32View[0]=Qe.mantissaTable[Qe.offsetTable[t]+(i&1023)]+Qe.exponentTable[t],Qe.floatView[0]}const Zm={toHalfFloat:mh,fromHalfFloat:gh},se=new R,Wi=new Lt;class Ce{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=bs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=He,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return il("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)Wi.fromBufferAttribute(this,e),Wi.applyMatrix3(t),this.setXY(e,Wi.x,Wi.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)se.fromBufferAttribute(this,e),se.applyMatrix3(t),this.setXYZ(e,se.x,se.y,se.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)se.fromBufferAttribute(this,e),se.applyMatrix4(t),this.setXYZ(e,se.x,se.y,se.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)se.fromBufferAttribute(this,e),se.applyNormalMatrix(t),this.setXYZ(e,se.x,se.y,se.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)se.fromBufferAttribute(this,e),se.transformDirection(t),this.setXYZ(e,se.x,se.y,se.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ue(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Gt(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ue(e,this.array)),e}setX(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ue(e,this.array)),e}setY(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ue(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ue(e,this.array)),e}setW(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,r){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array),r=Gt(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,s){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==bs&&(t.usage=this.usage),t}}class ol extends Ce{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class ll extends Ce{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class ve extends Ce{constructor(t,e,n){super(new Float32Array(t),e,n)}}let _h=0;const we=new Dt,is=new ie,Wn=new R,Te=new Sn,xi=new Sn,le=new R;class Pe extends li{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_h++}),this.uuid=Oe(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(nl(t)?ll:ol)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Tt().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(t),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return we.makeRotationFromQuaternion(t),this.applyMatrix4(we),this}rotateX(t){return we.makeRotationX(t),this.applyMatrix4(we),this}rotateY(t){return we.makeRotationY(t),this.applyMatrix4(we),this}rotateZ(t){return we.makeRotationZ(t),this.applyMatrix4(we),this}translate(t,e,n){return we.makeTranslation(t,e,n),this.applyMatrix4(we),this}scale(t,e,n){return we.makeScale(t,e,n),this.applyMatrix4(we),this}lookAt(t){return is.lookAt(t),is.updateMatrix(),this.applyMatrix4(is.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wn).negate(),this.translate(Wn.x,Wn.y,Wn.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const s=t[n];e.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ve(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Sn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const s=e[n];Te.setFromBufferAttribute(s),this.morphTargetsRelative?(le.addVectors(this.boundingBox.min,Te.min),this.boundingBox.expandByPoint(le),le.addVectors(this.boundingBox.max,Te.max),this.boundingBox.expandByPoint(le)):(this.boundingBox.expandByPoint(Te.min),this.boundingBox.expandByPoint(Te.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(t){const n=this.boundingSphere.center;if(Te.setFromBufferAttribute(t),e)for(let s=0,a=e.length;s<a;s++){const o=e[s];xi.setFromBufferAttribute(o),this.morphTargetsRelative?(le.addVectors(Te.min,xi.min),Te.expandByPoint(le),le.addVectors(Te.max,xi.max),Te.expandByPoint(le)):(Te.expandByPoint(xi.min),Te.expandByPoint(xi.max))}Te.getCenter(n);let r=0;for(let s=0,a=t.count;s<a;s++)le.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(le));if(e)for(let s=0,a=e.length;s<a;s++){const o=e[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)le.fromBufferAttribute(o,c),l&&(Wn.fromBufferAttribute(t,c),le.add(Wn)),r=Math.max(r,n.distanceToSquared(le))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.position,r=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ce(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let V=0;V<n.count;V++)o[V]=new R,l[V]=new R;const c=new R,h=new R,d=new R,u=new Lt,p=new Lt,g=new Lt,_=new R,m=new R;function f(V,y,x){c.fromBufferAttribute(n,V),h.fromBufferAttribute(n,y),d.fromBufferAttribute(n,x),u.fromBufferAttribute(s,V),p.fromBufferAttribute(s,y),g.fromBufferAttribute(s,x),h.sub(c),d.sub(c),p.sub(u),g.sub(u);const F=1/(p.x*g.y-g.x*p.y);isFinite(F)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(d,-p.y).multiplyScalar(F),m.copy(d).multiplyScalar(p.x).addScaledVector(h,-g.x).multiplyScalar(F),o[V].add(_),o[y].add(_),o[x].add(_),l[V].add(m),l[y].add(m),l[x].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:t.count}]);for(let V=0,y=E.length;V<y;++V){const x=E[V],F=x.start,W=x.count;for(let P=F,k=F+W;P<k;P+=3)f(t.getX(P+0),t.getX(P+1),t.getX(P+2))}const S=new R,b=new R,I=new R,A=new R;function w(V){I.fromBufferAttribute(r,V),A.copy(I);const y=o[V];S.copy(y),S.sub(I.multiplyScalar(I.dot(y))).normalize(),b.crossVectors(A,y);const F=b.dot(l[V])<0?-1:1;a.setXYZW(V,S.x,S.y,S.z,F)}for(let V=0,y=E.length;V<y;++V){const x=E[V],F=x.start,W=x.count;for(let P=F,k=F+W;P<k;P+=3)w(t.getX(P+0)),w(t.getX(P+1)),w(t.getX(P+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ce(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let u=0,p=n.count;u<p;u++)n.setXYZ(u,0,0,0);const r=new R,s=new R,a=new R,o=new R,l=new R,c=new R,h=new R,d=new R;if(t)for(let u=0,p=t.count;u<p;u+=3){const g=t.getX(u+0),_=t.getX(u+1),m=t.getX(u+2);r.fromBufferAttribute(e,g),s.fromBufferAttribute(e,_),a.fromBufferAttribute(e,m),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(h),l.add(h),c.add(h),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let u=0,p=e.count;u<p;u+=3)r.fromBufferAttribute(e,u+0),s.fromBufferAttribute(e,u+1),a.fromBufferAttribute(e,u+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)le.fromBufferAttribute(t,e),le.normalize(),t.setXYZ(e,le.x,le.y,le.z)}toNonIndexed(){function t(o,l){const c=o.array,h=o.itemSize,d=o.normalized,u=new c.constructor(l.length*h);let p=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?p=l[_]*o.data.stride+o.offset:p=l[_]*h;for(let f=0;f<h;f++)u[g++]=c[p++]}return new Ce(u,h,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Pe,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=t(l,n);e.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){const u=c[h],p=t(u,n);l.push(p)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d<u;d++){const p=c[d];h.push(p.toJSON(t.data))}h.length>0&&(r[l]=h,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const r=t.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],d=s[c];for(let u=0,p=d.length;u<p;u++)h.push(d[u].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let c=0,h=a.length;c<h;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Wa=new Dt,bn=new Ci,Xi=new rn,Xa=new R,Xn=new R,qn=new R,Yn=new R,rs=new R,qi=new R,Yi=new Lt,$i=new Lt,Ki=new Lt,qa=new R,Ya=new R,$a=new R,ji=new R,Zi=new R;class Re extends ie{constructor(t=new Pe,e=new al){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(t,e){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(r,t);const o=this.morphTargetInfluences;if(s&&o){qi.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(rs.fromBufferAttribute(d,t),a?qi.addScaledVector(rs,h):qi.addScaledVector(rs.sub(e),h))}e.add(qi)}return e}raycast(t,e){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Xi.copy(n.boundingSphere),Xi.applyMatrix4(s),bn.copy(t.ray).recast(t.near),!(Xi.containsPoint(bn.origin)===!1&&(bn.intersectSphere(Xi,Xa)===null||bn.origin.distanceToSquared(Xa)>(t.far-t.near)**2))&&(Wa.copy(s).invert(),bn.copy(t.ray).applyMatrix4(Wa),!(n.boundingBox!==null&&bn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,bn)))}_computeIntersections(t,e,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=u.length;g<_;g++){const m=u[g],f=a[m.materialIndex],E=Math.max(m.start,p.start),S=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let b=E,I=S;b<I;b+=3){const A=o.getX(b),w=o.getX(b+1),V=o.getX(b+2);r=Ji(this,f,t,n,c,h,d,A,w,V),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,e.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const E=o.getX(m),S=o.getX(m+1),b=o.getX(m+2);r=Ji(this,a,t,n,c,h,d,E,S,b),r&&(r.faceIndex=Math.floor(m/3),e.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=u.length;g<_;g++){const m=u[g],f=a[m.materialIndex],E=Math.max(m.start,p.start),S=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let b=E,I=S;b<I;b+=3){const A=b,w=b+1,V=b+2;r=Ji(this,f,t,n,c,h,d,A,w,V),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,e.push(r))}}else{const g=Math.max(0,p.start),_=Math.min(l.count,p.start+p.count);for(let m=g,f=_;m<f;m+=3){const E=m,S=m+1,b=m+2;r=Ji(this,a,t,n,c,h,d,E,S,b),r&&(r.faceIndex=Math.floor(m/3),e.push(r))}}}}function vh(i,t,e,n,r,s,a,o){let l;if(t.side===Se?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,t.side===_n,o),l===null)return null;Zi.copy(o),Zi.applyMatrix4(i.matrixWorld);const c=e.ray.origin.distanceTo(Zi);return c<e.near||c>e.far?null:{distance:c,point:Zi.clone(),object:i}}function Ji(i,t,e,n,r,s,a,o,l,c){i.getVertexPosition(o,Xn),i.getVertexPosition(l,qn),i.getVertexPosition(c,Yn);const h=vh(i,t,e,n,Xn,qn,Yn,ji);if(h){r&&(Yi.fromBufferAttribute(r,o),$i.fromBufferAttribute(r,l),Ki.fromBufferAttribute(r,c),h.uv=Ne.getInterpolation(ji,Xn,qn,Yn,Yi,$i,Ki,new Lt)),s&&(Yi.fromBufferAttribute(s,o),$i.fromBufferAttribute(s,l),Ki.fromBufferAttribute(s,c),h.uv1=Ne.getInterpolation(ji,Xn,qn,Yn,Yi,$i,Ki,new Lt)),a&&(qa.fromBufferAttribute(a,o),Ya.fromBufferAttribute(a,l),$a.fromBufferAttribute(a,c),h.normal=Ne.getInterpolation(ji,Xn,qn,Yn,qa,Ya,$a,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new R,materialIndex:0};Ne.getNormal(Xn,qn,Yn,d.normal),h.face=d}return h}class Pi extends Pe{constructor(t=1,e=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],d=[];let u=0,p=0;g("z","y","x",-1,-1,n,e,t,a,s,0),g("z","y","x",1,-1,n,e,-t,a,s,1),g("x","z","y",1,1,t,n,e,r,a,2),g("x","z","y",1,-1,t,n,-e,r,a,3),g("x","y","z",1,-1,t,e,n,r,s,4),g("x","y","z",-1,-1,t,e,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new ve(c,3)),this.setAttribute("normal",new ve(h,3)),this.setAttribute("uv",new ve(d,2));function g(_,m,f,E,S,b,I,A,w,V,y){const x=b/w,F=I/V,W=b/2,P=I/2,k=A/2,q=w+1,j=V+1;let st=0,z=0;const J=new R;for(let Z=0;Z<j;Z++){const ft=Z*F-P;for(let It=0;It<q;It++){const Yt=It*x-W;J[_]=Yt*E,J[m]=ft*S,J[f]=k,c.push(J.x,J.y,J.z),J[_]=0,J[m]=0,J[f]=A>0?1:-1,h.push(J.x,J.y,J.z),d.push(It/w),d.push(1-Z/V),st+=1}}for(let Z=0;Z<V;Z++)for(let ft=0;ft<w;ft++){const It=u+ft+q*Z,Yt=u+ft+q*(Z+1),H=u+(ft+1)+q*(Z+1),Q=u+(ft+1)+q*Z;l.push(It,Yt,Q),l.push(Yt,H,Q),z+=6}o.addGroup(p,z,y),p+=z,u+=st}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Pi(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function oi(i){const t={};for(const e in i){t[e]={};for(const n in i[e]){const r=i[e][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=r.clone():Array.isArray(r)?t[e][n]=r.slice():t[e][n]=r}}return t}function _e(i){const t={};for(let e=0;e<i.length;e++){const n=oi(i[e]);for(const r in n)t[r]=n[r]}return t}function xh(i){const t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function cl(i){const t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Xt.workingColorSpace}const Mh={clone:oi,merge:_e};var Sh=`void main() {
|
|
6
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,yh=`void main() {
|
|
8
|
-
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class nn extends In{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Sh,this.fragmentShader=yh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=oi(t.uniforms),this.uniformsGroups=xh(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?e.uniforms[r]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[r]={type:"m4",value:a.toArray()}:e.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class hl extends ie{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Dt,this.projectionMatrix=new Dt,this.projectionMatrixInverse=new Dt,this.coordinateSystem=en}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const un=new R,Ka=new Lt,ja=new Lt;class be extends hl{constructor(t=50,e=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=ai*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(ei*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ai*2*Math.atan(Math.tan(ei*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){un.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(un.x,un.y).multiplyScalar(-t/un.z),un.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(un.x,un.y).multiplyScalar(-t/un.z)}getViewSize(t,e){return this.getViewBounds(t,Ka,ja),e.subVectors(ja,Ka)}setViewOffset(t,e,n,r,s,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(ei*.5*this.fov)/this.zoom,n=2*e,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,e-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const $n=-90,Kn=1;class Eh extends ie{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new be($n,Kn,t,e);r.layers=this.layers,this.add(r);const s=new be($n,Kn,t,e);s.layers=this.layers,this.add(s);const a=new be($n,Kn,t,e);a.layers=this.layers,this.add(a);const o=new be($n,Kn,t,e);o.layers=this.layers,this.add(o);const l=new be($n,Kn,t,e);l.layers=this.layers,this.add(l);const c=new be($n,Kn,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,r,s,a,o,l]=e;for(const c of e)this.remove(c);if(t===en)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Sr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,d=t.getRenderTarget(),u=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),g=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,r),t.render(e,s),t.setRenderTarget(n,1,r),t.render(e,a),t.setRenderTarget(n,2,r),t.render(e,o),t.setRenderTarget(n,3,r),t.render(e,l),t.setRenderTarget(n,4,r),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,r),t.render(e,h),t.setRenderTarget(d,u,p),t.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class ul extends ce{constructor(t,e,n,r,s,a,o,l,c,h){t=t!==void 0?t:[],e=e!==void 0?e:ii,super(t,e,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Th extends xn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},r=[n,n,n,n,n,n];this.texture=new ul(r,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:xe}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
10
|
-
|
|
11
|
-
varying vec3 vWorldDirection;
|
|
12
|
-
|
|
13
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
14
|
-
|
|
15
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
void main() {
|
|
20
|
-
|
|
21
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
22
|
-
|
|
23
|
-
#include <begin_vertex>
|
|
24
|
-
#include <project_vertex>
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
`,fragmentShader:`
|
|
28
|
-
|
|
29
|
-
uniform sampler2D tEquirect;
|
|
30
|
-
|
|
31
|
-
varying vec3 vWorldDirection;
|
|
32
|
-
|
|
33
|
-
#include <common>
|
|
34
|
-
|
|
35
|
-
void main() {
|
|
36
|
-
|
|
37
|
-
vec3 direction = normalize( vWorldDirection );
|
|
38
|
-
|
|
39
|
-
vec2 sampleUV = equirectUv( direction );
|
|
40
|
-
|
|
41
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
`},r=new Pi(5,5,5),s=new nn({name:"CubemapFromEquirect",uniforms:oi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Se,blending:mn});s.uniforms.tEquirect.value=e;const a=new Re(r,s),o=e.minFilter;return e.minFilter===fn&&(e.minFilter=xe),new Eh(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,r){const s=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,r);t.setRenderTarget(s)}}const ss=new R,bh=new R,Ah=new Tt;class Cn{constructor(t=new R(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=ss.subVectors(n,e).cross(bh.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(ss),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const s=-(t.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ah.getNormalMatrix(t),r=this.coplanarPoint(ss).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const An=new rn,Qi=new R;class Us{constructor(t=new Cn,e=new Cn,n=new Cn,r=new Cn,s=new Cn,a=new Cn){this.planes=[t,e,n,r,s,a]}set(t,e,n,r,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=en){const n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],d=r[6],u=r[7],p=r[8],g=r[9],_=r[10],m=r[11],f=r[12],E=r[13],S=r[14],b=r[15];if(n[0].setComponents(l-s,u-c,m-p,b-f).normalize(),n[1].setComponents(l+s,u+c,m+p,b+f).normalize(),n[2].setComponents(l+a,u+h,m+g,b+E).normalize(),n[3].setComponents(l-a,u-h,m-g,b-E).normalize(),n[4].setComponents(l-o,u-d,m-_,b-S).normalize(),e===en)n[5].setComponents(l+o,u+d,m+_,b+S).normalize();else if(e===Sr)n[5].setComponents(o,d,_,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),An.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),An.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(An)}intersectsSprite(t){return An.center.set(0,0,0),An.radius=.7071067811865476,An.applyMatrix4(t.matrixWorld),this.intersectsSphere(An)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(Qi.x=r.normal.x>0?t.max.x:t.min.x,Qi.y=r.normal.y>0?t.max.y:t.min.y,Qi.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Qi)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function dl(){let i=null,t=!1,e=null,n=null;function r(s,a){e(s,a),n=i.requestAnimationFrame(r)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(r),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){i=s}}}function wh(i){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,d=c.byteLength,u=i.createBuffer();i.bindBuffer(l,u),i.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l._updateRange,u=l.updateRanges;if(i.bindBuffer(c,o),d.count===-1&&u.length===0&&i.bufferSubData(c,0,h),u.length!==0){for(let p=0,g=u.length;p<g;p++){const _=u[p];i.bufferSubData(c,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}l.clearUpdateRanges()}d.count!==-1&&(i.bufferSubData(c,d.offset*h.BYTES_PER_ELEMENT,h,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=t.get(o);l&&(i.deleteBuffer(l.buffer),t.delete(o))}function a(o,l){if(o.isGLBufferAttribute){const h=t.get(o);(!h||h.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}o.isInterleavedBufferAttribute&&(o=o.data);const c=t.get(o);if(c===void 0)t.set(o,e(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class Cr extends Pe{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const s=t/2,a=e/2,o=Math.floor(n),l=Math.floor(r),c=o+1,h=l+1,d=t/o,u=e/l,p=[],g=[],_=[],m=[];for(let f=0;f<h;f++){const E=f*u-a;for(let S=0;S<c;S++){const b=S*d-s;g.push(b,-E,0),_.push(0,0,1),m.push(S/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let E=0;E<o;E++){const S=E+c*f,b=E+c*(f+1),I=E+1+c*(f+1),A=E+1+c*f;p.push(S,b,A),p.push(b,I,A)}this.setIndex(p),this.setAttribute("position",new ve(g,3)),this.setAttribute("normal",new ve(_,3)),this.setAttribute("uv",new ve(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Cr(t.width,t.height,t.widthSegments,t.heightSegments)}}var Rh=`#ifdef USE_ALPHAHASH
|
|
45
|
-
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
46
|
-
#endif`,Ch=`#ifdef USE_ALPHAHASH
|
|
47
|
-
const float ALPHA_HASH_SCALE = 0.05;
|
|
48
|
-
float hash2D( vec2 value ) {
|
|
49
|
-
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
50
|
-
}
|
|
51
|
-
float hash3D( vec3 value ) {
|
|
52
|
-
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
|
53
|
-
}
|
|
54
|
-
float getAlphaHashThreshold( vec3 position ) {
|
|
55
|
-
float maxDeriv = max(
|
|
56
|
-
length( dFdx( position.xyz ) ),
|
|
57
|
-
length( dFdy( position.xyz ) )
|
|
58
|
-
);
|
|
59
|
-
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
|
60
|
-
vec2 pixScales = vec2(
|
|
61
|
-
exp2( floor( log2( pixScale ) ) ),
|
|
62
|
-
exp2( ceil( log2( pixScale ) ) )
|
|
63
|
-
);
|
|
64
|
-
vec2 alpha = vec2(
|
|
65
|
-
hash3D( floor( pixScales.x * position.xyz ) ),
|
|
66
|
-
hash3D( floor( pixScales.y * position.xyz ) )
|
|
67
|
-
);
|
|
68
|
-
float lerpFactor = fract( log2( pixScale ) );
|
|
69
|
-
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
|
70
|
-
float a = min( lerpFactor, 1.0 - lerpFactor );
|
|
71
|
-
vec3 cases = vec3(
|
|
72
|
-
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
|
73
|
-
( x - 0.5 * a ) / ( 1.0 - a ),
|
|
74
|
-
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
|
75
|
-
);
|
|
76
|
-
float threshold = ( x < ( 1.0 - a ) )
|
|
77
|
-
? ( ( x < a ) ? cases.x : cases.y )
|
|
78
|
-
: cases.z;
|
|
79
|
-
return clamp( threshold , 1.0e-6, 1.0 );
|
|
80
|
-
}
|
|
81
|
-
#endif`,Ph=`#ifdef USE_ALPHAMAP
|
|
82
|
-
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
83
|
-
#endif`,Lh=`#ifdef USE_ALPHAMAP
|
|
84
|
-
uniform sampler2D alphaMap;
|
|
85
|
-
#endif`,Dh=`#ifdef USE_ALPHATEST
|
|
86
|
-
#ifdef ALPHA_TO_COVERAGE
|
|
87
|
-
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
88
|
-
if ( diffuseColor.a == 0.0 ) discard;
|
|
89
|
-
#else
|
|
90
|
-
if ( diffuseColor.a < alphaTest ) discard;
|
|
91
|
-
#endif
|
|
92
|
-
#endif`,Ih=`#ifdef USE_ALPHATEST
|
|
93
|
-
uniform float alphaTest;
|
|
94
|
-
#endif`,Uh=`#ifdef USE_AOMAP
|
|
95
|
-
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
96
|
-
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
97
|
-
#if defined( USE_CLEARCOAT )
|
|
98
|
-
clearcoatSpecularIndirect *= ambientOcclusion;
|
|
99
|
-
#endif
|
|
100
|
-
#if defined( USE_SHEEN )
|
|
101
|
-
sheenSpecularIndirect *= ambientOcclusion;
|
|
102
|
-
#endif
|
|
103
|
-
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
104
|
-
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
105
|
-
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
106
|
-
#endif
|
|
107
|
-
#endif`,Nh=`#ifdef USE_AOMAP
|
|
108
|
-
uniform sampler2D aoMap;
|
|
109
|
-
uniform float aoMapIntensity;
|
|
110
|
-
#endif`,Fh=`#ifdef USE_BATCHING
|
|
111
|
-
attribute float batchId;
|
|
112
|
-
uniform highp sampler2D batchingTexture;
|
|
113
|
-
mat4 getBatchingMatrix( const in float i ) {
|
|
114
|
-
int size = textureSize( batchingTexture, 0 ).x;
|
|
115
|
-
int j = int( i ) * 4;
|
|
116
|
-
int x = j % size;
|
|
117
|
-
int y = j / size;
|
|
118
|
-
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
|
119
|
-
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
|
120
|
-
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
|
121
|
-
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
122
|
-
return mat4( v1, v2, v3, v4 );
|
|
123
|
-
}
|
|
124
|
-
#endif`,Oh=`#ifdef USE_BATCHING
|
|
125
|
-
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|
126
|
-
#endif`,Bh=`vec3 transformed = vec3( position );
|
|
127
|
-
#ifdef USE_ALPHAHASH
|
|
128
|
-
vPosition = vec3( position );
|
|
129
|
-
#endif`,zh=`vec3 objectNormal = vec3( normal );
|
|
130
|
-
#ifdef USE_TANGENT
|
|
131
|
-
vec3 objectTangent = vec3( tangent.xyz );
|
|
132
|
-
#endif`,Vh=`float G_BlinnPhong_Implicit( ) {
|
|
133
|
-
return 0.25;
|
|
134
|
-
}
|
|
135
|
-
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
136
|
-
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
137
|
-
}
|
|
138
|
-
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
139
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
140
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
141
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
142
|
-
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
143
|
-
float G = G_BlinnPhong_Implicit( );
|
|
144
|
-
float D = D_BlinnPhong( shininess, dotNH );
|
|
145
|
-
return F * ( G * D );
|
|
146
|
-
} // validated`,Hh=`#ifdef USE_IRIDESCENCE
|
|
147
|
-
const mat3 XYZ_TO_REC709 = mat3(
|
|
148
|
-
3.2404542, -0.9692660, 0.0556434,
|
|
149
|
-
-1.5371385, 1.8760108, -0.2040259,
|
|
150
|
-
-0.4985314, 0.0415560, 1.0572252
|
|
151
|
-
);
|
|
152
|
-
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
|
153
|
-
vec3 sqrtF0 = sqrt( fresnel0 );
|
|
154
|
-
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
|
155
|
-
}
|
|
156
|
-
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
|
157
|
-
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
|
158
|
-
}
|
|
159
|
-
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
|
160
|
-
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
|
161
|
-
}
|
|
162
|
-
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
|
163
|
-
float phase = 2.0 * PI * OPD * 1.0e-9;
|
|
164
|
-
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
|
165
|
-
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
|
166
|
-
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
|
167
|
-
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
|
168
|
-
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
|
169
|
-
xyz /= 1.0685e-7;
|
|
170
|
-
vec3 rgb = XYZ_TO_REC709 * xyz;
|
|
171
|
-
return rgb;
|
|
172
|
-
}
|
|
173
|
-
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
|
174
|
-
vec3 I;
|
|
175
|
-
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|
176
|
-
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
|
177
|
-
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
|
178
|
-
if ( cosTheta2Sq < 0.0 ) {
|
|
179
|
-
return vec3( 1.0 );
|
|
180
|
-
}
|
|
181
|
-
float cosTheta2 = sqrt( cosTheta2Sq );
|
|
182
|
-
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
|
183
|
-
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
|
184
|
-
float T121 = 1.0 - R12;
|
|
185
|
-
float phi12 = 0.0;
|
|
186
|
-
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
|
187
|
-
float phi21 = PI - phi12;
|
|
188
|
-
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
|
189
|
-
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
|
190
|
-
vec3 phi23 = vec3( 0.0 );
|
|
191
|
-
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
|
192
|
-
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
|
193
|
-
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
|
194
|
-
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
|
195
|
-
vec3 phi = vec3( phi21 ) + phi23;
|
|
196
|
-
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
|
197
|
-
vec3 r123 = sqrt( R123 );
|
|
198
|
-
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
|
199
|
-
vec3 C0 = R12 + Rs;
|
|
200
|
-
I = C0;
|
|
201
|
-
vec3 Cm = Rs - T121;
|
|
202
|
-
for ( int m = 1; m <= 2; ++ m ) {
|
|
203
|
-
Cm *= r123;
|
|
204
|
-
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
|
205
|
-
I += Cm * Sm;
|
|
206
|
-
}
|
|
207
|
-
return max( I, vec3( 0.0 ) );
|
|
208
|
-
}
|
|
209
|
-
#endif`,kh=`#ifdef USE_BUMPMAP
|
|
210
|
-
uniform sampler2D bumpMap;
|
|
211
|
-
uniform float bumpScale;
|
|
212
|
-
vec2 dHdxy_fwd() {
|
|
213
|
-
vec2 dSTdx = dFdx( vBumpMapUv );
|
|
214
|
-
vec2 dSTdy = dFdy( vBumpMapUv );
|
|
215
|
-
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
|
216
|
-
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
|
217
|
-
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
|
218
|
-
return vec2( dBx, dBy );
|
|
219
|
-
}
|
|
220
|
-
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
221
|
-
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
|
222
|
-
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
|
223
|
-
vec3 vN = surf_norm;
|
|
224
|
-
vec3 R1 = cross( vSigmaY, vN );
|
|
225
|
-
vec3 R2 = cross( vN, vSigmaX );
|
|
226
|
-
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
227
|
-
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
228
|
-
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
229
|
-
}
|
|
230
|
-
#endif`,Gh=`#if NUM_CLIPPING_PLANES > 0
|
|
231
|
-
vec4 plane;
|
|
232
|
-
#ifdef ALPHA_TO_COVERAGE
|
|
233
|
-
float distanceToPlane, distanceGradient;
|
|
234
|
-
float clipOpacity = 1.0;
|
|
235
|
-
#pragma unroll_loop_start
|
|
236
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
237
|
-
plane = clippingPlanes[ i ];
|
|
238
|
-
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
239
|
-
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
240
|
-
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
241
|
-
if ( clipOpacity == 0.0 ) discard;
|
|
242
|
-
}
|
|
243
|
-
#pragma unroll_loop_end
|
|
244
|
-
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
245
|
-
float unionClipOpacity = 1.0;
|
|
246
|
-
#pragma unroll_loop_start
|
|
247
|
-
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
248
|
-
plane = clippingPlanes[ i ];
|
|
249
|
-
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
250
|
-
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
251
|
-
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
252
|
-
}
|
|
253
|
-
#pragma unroll_loop_end
|
|
254
|
-
clipOpacity *= 1.0 - unionClipOpacity;
|
|
255
|
-
#endif
|
|
256
|
-
diffuseColor.a *= clipOpacity;
|
|
257
|
-
if ( diffuseColor.a == 0.0 ) discard;
|
|
258
|
-
#else
|
|
259
|
-
#pragma unroll_loop_start
|
|
260
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
261
|
-
plane = clippingPlanes[ i ];
|
|
262
|
-
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
263
|
-
}
|
|
264
|
-
#pragma unroll_loop_end
|
|
265
|
-
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
266
|
-
bool clipped = true;
|
|
267
|
-
#pragma unroll_loop_start
|
|
268
|
-
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
269
|
-
plane = clippingPlanes[ i ];
|
|
270
|
-
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
271
|
-
}
|
|
272
|
-
#pragma unroll_loop_end
|
|
273
|
-
if ( clipped ) discard;
|
|
274
|
-
#endif
|
|
275
|
-
#endif
|
|
276
|
-
#endif`,Wh=`#if NUM_CLIPPING_PLANES > 0
|
|
277
|
-
varying vec3 vClipPosition;
|
|
278
|
-
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
279
|
-
#endif`,Xh=`#if NUM_CLIPPING_PLANES > 0
|
|
280
|
-
varying vec3 vClipPosition;
|
|
281
|
-
#endif`,qh=`#if NUM_CLIPPING_PLANES > 0
|
|
282
|
-
vClipPosition = - mvPosition.xyz;
|
|
283
|
-
#endif`,Yh=`#if defined( USE_COLOR_ALPHA )
|
|
284
|
-
diffuseColor *= vColor;
|
|
285
|
-
#elif defined( USE_COLOR )
|
|
286
|
-
diffuseColor.rgb *= vColor;
|
|
287
|
-
#endif`,$h=`#if defined( USE_COLOR_ALPHA )
|
|
288
|
-
varying vec4 vColor;
|
|
289
|
-
#elif defined( USE_COLOR )
|
|
290
|
-
varying vec3 vColor;
|
|
291
|
-
#endif`,Kh=`#if defined( USE_COLOR_ALPHA )
|
|
292
|
-
varying vec4 vColor;
|
|
293
|
-
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
294
|
-
varying vec3 vColor;
|
|
295
|
-
#endif`,jh=`#if defined( USE_COLOR_ALPHA )
|
|
296
|
-
vColor = vec4( 1.0 );
|
|
297
|
-
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
298
|
-
vColor = vec3( 1.0 );
|
|
299
|
-
#endif
|
|
300
|
-
#ifdef USE_COLOR
|
|
301
|
-
vColor *= color;
|
|
302
|
-
#endif
|
|
303
|
-
#ifdef USE_INSTANCING_COLOR
|
|
304
|
-
vColor.xyz *= instanceColor.xyz;
|
|
305
|
-
#endif`,Zh=`#define PI 3.141592653589793
|
|
306
|
-
#define PI2 6.283185307179586
|
|
307
|
-
#define PI_HALF 1.5707963267948966
|
|
308
|
-
#define RECIPROCAL_PI 0.3183098861837907
|
|
309
|
-
#define RECIPROCAL_PI2 0.15915494309189535
|
|
310
|
-
#define EPSILON 1e-6
|
|
311
|
-
#ifndef saturate
|
|
312
|
-
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
313
|
-
#endif
|
|
314
|
-
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
315
|
-
float pow2( const in float x ) { return x*x; }
|
|
316
|
-
vec3 pow2( const in vec3 x ) { return x*x; }
|
|
317
|
-
float pow3( const in float x ) { return x*x*x; }
|
|
318
|
-
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
319
|
-
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
320
|
-
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
|
321
|
-
highp float rand( const in vec2 uv ) {
|
|
322
|
-
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
323
|
-
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
324
|
-
return fract( sin( sn ) * c );
|
|
325
|
-
}
|
|
326
|
-
#ifdef HIGH_PRECISION
|
|
327
|
-
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
328
|
-
#else
|
|
329
|
-
float precisionSafeLength( vec3 v ) {
|
|
330
|
-
float maxComponent = max3( abs( v ) );
|
|
331
|
-
return length( v / maxComponent ) * maxComponent;
|
|
332
|
-
}
|
|
333
|
-
#endif
|
|
334
|
-
struct IncidentLight {
|
|
335
|
-
vec3 color;
|
|
336
|
-
vec3 direction;
|
|
337
|
-
bool visible;
|
|
338
|
-
};
|
|
339
|
-
struct ReflectedLight {
|
|
340
|
-
vec3 directDiffuse;
|
|
341
|
-
vec3 directSpecular;
|
|
342
|
-
vec3 indirectDiffuse;
|
|
343
|
-
vec3 indirectSpecular;
|
|
344
|
-
};
|
|
345
|
-
#ifdef USE_ALPHAHASH
|
|
346
|
-
varying vec3 vPosition;
|
|
347
|
-
#endif
|
|
348
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
349
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
350
|
-
}
|
|
351
|
-
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
352
|
-
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
353
|
-
}
|
|
354
|
-
mat3 transposeMat3( const in mat3 m ) {
|
|
355
|
-
mat3 tmp;
|
|
356
|
-
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
357
|
-
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
358
|
-
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
359
|
-
return tmp;
|
|
360
|
-
}
|
|
361
|
-
float luminance( const in vec3 rgb ) {
|
|
362
|
-
const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
|
|
363
|
-
return dot( weights, rgb );
|
|
364
|
-
}
|
|
365
|
-
bool isPerspectiveMatrix( mat4 m ) {
|
|
366
|
-
return m[ 2 ][ 3 ] == - 1.0;
|
|
367
|
-
}
|
|
368
|
-
vec2 equirectUv( in vec3 dir ) {
|
|
369
|
-
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
370
|
-
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
371
|
-
return vec2( u, v );
|
|
372
|
-
}
|
|
373
|
-
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
374
|
-
return RECIPROCAL_PI * diffuseColor;
|
|
375
|
-
}
|
|
376
|
-
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
377
|
-
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
378
|
-
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
379
|
-
}
|
|
380
|
-
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
381
|
-
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
382
|
-
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
383
|
-
} // validated`,Jh=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
384
|
-
#define cubeUV_minMipLevel 4.0
|
|
385
|
-
#define cubeUV_minTileSize 16.0
|
|
386
|
-
float getFace( vec3 direction ) {
|
|
387
|
-
vec3 absDirection = abs( direction );
|
|
388
|
-
float face = - 1.0;
|
|
389
|
-
if ( absDirection.x > absDirection.z ) {
|
|
390
|
-
if ( absDirection.x > absDirection.y )
|
|
391
|
-
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
392
|
-
else
|
|
393
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
394
|
-
} else {
|
|
395
|
-
if ( absDirection.z > absDirection.y )
|
|
396
|
-
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
397
|
-
else
|
|
398
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
399
|
-
}
|
|
400
|
-
return face;
|
|
401
|
-
}
|
|
402
|
-
vec2 getUV( vec3 direction, float face ) {
|
|
403
|
-
vec2 uv;
|
|
404
|
-
if ( face == 0.0 ) {
|
|
405
|
-
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
406
|
-
} else if ( face == 1.0 ) {
|
|
407
|
-
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
408
|
-
} else if ( face == 2.0 ) {
|
|
409
|
-
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
410
|
-
} else if ( face == 3.0 ) {
|
|
411
|
-
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
412
|
-
} else if ( face == 4.0 ) {
|
|
413
|
-
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
414
|
-
} else {
|
|
415
|
-
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
416
|
-
}
|
|
417
|
-
return 0.5 * ( uv + 1.0 );
|
|
418
|
-
}
|
|
419
|
-
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
420
|
-
float face = getFace( direction );
|
|
421
|
-
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
422
|
-
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
423
|
-
float faceSize = exp2( mipInt );
|
|
424
|
-
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
|
425
|
-
if ( face > 2.0 ) {
|
|
426
|
-
uv.y += faceSize;
|
|
427
|
-
face -= 3.0;
|
|
428
|
-
}
|
|
429
|
-
uv.x += face * faceSize;
|
|
430
|
-
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|
431
|
-
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|
432
|
-
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|
433
|
-
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|
434
|
-
#ifdef texture2DGradEXT
|
|
435
|
-
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|
436
|
-
#else
|
|
437
|
-
return texture2D( envMap, uv ).rgb;
|
|
438
|
-
#endif
|
|
439
|
-
}
|
|
440
|
-
#define cubeUV_r0 1.0
|
|
441
|
-
#define cubeUV_m0 - 2.0
|
|
442
|
-
#define cubeUV_r1 0.8
|
|
443
|
-
#define cubeUV_m1 - 1.0
|
|
444
|
-
#define cubeUV_r4 0.4
|
|
445
|
-
#define cubeUV_m4 2.0
|
|
446
|
-
#define cubeUV_r5 0.305
|
|
447
|
-
#define cubeUV_m5 3.0
|
|
448
|
-
#define cubeUV_r6 0.21
|
|
449
|
-
#define cubeUV_m6 4.0
|
|
450
|
-
float roughnessToMip( float roughness ) {
|
|
451
|
-
float mip = 0.0;
|
|
452
|
-
if ( roughness >= cubeUV_r1 ) {
|
|
453
|
-
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
|
454
|
-
} else if ( roughness >= cubeUV_r4 ) {
|
|
455
|
-
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
|
456
|
-
} else if ( roughness >= cubeUV_r5 ) {
|
|
457
|
-
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
|
458
|
-
} else if ( roughness >= cubeUV_r6 ) {
|
|
459
|
-
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
|
460
|
-
} else {
|
|
461
|
-
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
462
|
-
return mip;
|
|
463
|
-
}
|
|
464
|
-
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
465
|
-
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
|
466
|
-
float mipF = fract( mip );
|
|
467
|
-
float mipInt = floor( mip );
|
|
468
|
-
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
469
|
-
if ( mipF == 0.0 ) {
|
|
470
|
-
return vec4( color0, 1.0 );
|
|
471
|
-
} else {
|
|
472
|
-
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
473
|
-
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
#endif`,Qh=`vec3 transformedNormal = objectNormal;
|
|
477
|
-
#ifdef USE_TANGENT
|
|
478
|
-
vec3 transformedTangent = objectTangent;
|
|
479
|
-
#endif
|
|
480
|
-
#ifdef USE_BATCHING
|
|
481
|
-
mat3 bm = mat3( batchingMatrix );
|
|
482
|
-
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
|
483
|
-
transformedNormal = bm * transformedNormal;
|
|
484
|
-
#ifdef USE_TANGENT
|
|
485
|
-
transformedTangent = bm * transformedTangent;
|
|
486
|
-
#endif
|
|
487
|
-
#endif
|
|
488
|
-
#ifdef USE_INSTANCING
|
|
489
|
-
mat3 im = mat3( instanceMatrix );
|
|
490
|
-
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
|
491
|
-
transformedNormal = im * transformedNormal;
|
|
492
|
-
#ifdef USE_TANGENT
|
|
493
|
-
transformedTangent = im * transformedTangent;
|
|
494
|
-
#endif
|
|
495
|
-
#endif
|
|
496
|
-
transformedNormal = normalMatrix * transformedNormal;
|
|
497
|
-
#ifdef FLIP_SIDED
|
|
498
|
-
transformedNormal = - transformedNormal;
|
|
499
|
-
#endif
|
|
500
|
-
#ifdef USE_TANGENT
|
|
501
|
-
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|
502
|
-
#ifdef FLIP_SIDED
|
|
503
|
-
transformedTangent = - transformedTangent;
|
|
504
|
-
#endif
|
|
505
|
-
#endif`,tu=`#ifdef USE_DISPLACEMENTMAP
|
|
506
|
-
uniform sampler2D displacementMap;
|
|
507
|
-
uniform float displacementScale;
|
|
508
|
-
uniform float displacementBias;
|
|
509
|
-
#endif`,eu=`#ifdef USE_DISPLACEMENTMAP
|
|
510
|
-
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
511
|
-
#endif`,nu=`#ifdef USE_EMISSIVEMAP
|
|
512
|
-
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
513
|
-
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
514
|
-
#endif`,iu=`#ifdef USE_EMISSIVEMAP
|
|
515
|
-
uniform sampler2D emissiveMap;
|
|
516
|
-
#endif`,ru="gl_FragColor = linearToOutputTexel( gl_FragColor );",su=`
|
|
517
|
-
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|
518
|
-
vec3( 0.8224621, 0.177538, 0.0 ),
|
|
519
|
-
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|
520
|
-
vec3( 0.0170827, 0.0723974, 0.9105199 )
|
|
521
|
-
);
|
|
522
|
-
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
|
|
523
|
-
vec3( 1.2249401, - 0.2249404, 0.0 ),
|
|
524
|
-
vec3( - 0.0420569, 1.0420571, 0.0 ),
|
|
525
|
-
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
|
|
526
|
-
);
|
|
527
|
-
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
|
|
528
|
-
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
|
|
529
|
-
}
|
|
530
|
-
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
|
|
531
|
-
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
|
|
532
|
-
}
|
|
533
|
-
vec4 LinearTransferOETF( in vec4 value ) {
|
|
534
|
-
return value;
|
|
535
|
-
}
|
|
536
|
-
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
537
|
-
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
538
|
-
}
|
|
539
|
-
vec4 LinearToLinear( in vec4 value ) {
|
|
540
|
-
return value;
|
|
541
|
-
}
|
|
542
|
-
vec4 LinearTosRGB( in vec4 value ) {
|
|
543
|
-
return sRGBTransferOETF( value );
|
|
544
|
-
}`,au=`#ifdef USE_ENVMAP
|
|
545
|
-
#ifdef ENV_WORLDPOS
|
|
546
|
-
vec3 cameraToFrag;
|
|
547
|
-
if ( isOrthographic ) {
|
|
548
|
-
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
549
|
-
} else {
|
|
550
|
-
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
551
|
-
}
|
|
552
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
553
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
554
|
-
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
555
|
-
#else
|
|
556
|
-
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
557
|
-
#endif
|
|
558
|
-
#else
|
|
559
|
-
vec3 reflectVec = vReflect;
|
|
560
|
-
#endif
|
|
561
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
562
|
-
vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
563
|
-
#else
|
|
564
|
-
vec4 envColor = vec4( 0.0 );
|
|
565
|
-
#endif
|
|
566
|
-
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
567
|
-
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
568
|
-
#elif defined( ENVMAP_BLENDING_MIX )
|
|
569
|
-
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
570
|
-
#elif defined( ENVMAP_BLENDING_ADD )
|
|
571
|
-
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
572
|
-
#endif
|
|
573
|
-
#endif`,ou=`#ifdef USE_ENVMAP
|
|
574
|
-
uniform float envMapIntensity;
|
|
575
|
-
uniform float flipEnvMap;
|
|
576
|
-
uniform mat3 envMapRotation;
|
|
577
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
578
|
-
uniform samplerCube envMap;
|
|
579
|
-
#else
|
|
580
|
-
uniform sampler2D envMap;
|
|
581
|
-
#endif
|
|
582
|
-
|
|
583
|
-
#endif`,lu=`#ifdef USE_ENVMAP
|
|
584
|
-
uniform float reflectivity;
|
|
585
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
586
|
-
#define ENV_WORLDPOS
|
|
587
|
-
#endif
|
|
588
|
-
#ifdef ENV_WORLDPOS
|
|
589
|
-
varying vec3 vWorldPosition;
|
|
590
|
-
uniform float refractionRatio;
|
|
591
|
-
#else
|
|
592
|
-
varying vec3 vReflect;
|
|
593
|
-
#endif
|
|
594
|
-
#endif`,cu=`#ifdef USE_ENVMAP
|
|
595
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
596
|
-
#define ENV_WORLDPOS
|
|
597
|
-
#endif
|
|
598
|
-
#ifdef ENV_WORLDPOS
|
|
599
|
-
|
|
600
|
-
varying vec3 vWorldPosition;
|
|
601
|
-
#else
|
|
602
|
-
varying vec3 vReflect;
|
|
603
|
-
uniform float refractionRatio;
|
|
604
|
-
#endif
|
|
605
|
-
#endif`,hu=`#ifdef USE_ENVMAP
|
|
606
|
-
#ifdef ENV_WORLDPOS
|
|
607
|
-
vWorldPosition = worldPosition.xyz;
|
|
608
|
-
#else
|
|
609
|
-
vec3 cameraToVertex;
|
|
610
|
-
if ( isOrthographic ) {
|
|
611
|
-
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
612
|
-
} else {
|
|
613
|
-
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
614
|
-
}
|
|
615
|
-
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
616
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
617
|
-
vReflect = reflect( cameraToVertex, worldNormal );
|
|
618
|
-
#else
|
|
619
|
-
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
620
|
-
#endif
|
|
621
|
-
#endif
|
|
622
|
-
#endif`,uu=`#ifdef USE_FOG
|
|
623
|
-
vFogDepth = - mvPosition.z;
|
|
624
|
-
#endif`,du=`#ifdef USE_FOG
|
|
625
|
-
varying float vFogDepth;
|
|
626
|
-
#endif`,fu=`#ifdef USE_FOG
|
|
627
|
-
#ifdef FOG_EXP2
|
|
628
|
-
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
629
|
-
#else
|
|
630
|
-
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
631
|
-
#endif
|
|
632
|
-
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
633
|
-
#endif`,pu=`#ifdef USE_FOG
|
|
634
|
-
uniform vec3 fogColor;
|
|
635
|
-
varying float vFogDepth;
|
|
636
|
-
#ifdef FOG_EXP2
|
|
637
|
-
uniform float fogDensity;
|
|
638
|
-
#else
|
|
639
|
-
uniform float fogNear;
|
|
640
|
-
uniform float fogFar;
|
|
641
|
-
#endif
|
|
642
|
-
#endif`,mu=`#ifdef USE_GRADIENTMAP
|
|
643
|
-
uniform sampler2D gradientMap;
|
|
644
|
-
#endif
|
|
645
|
-
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
646
|
-
float dotNL = dot( normal, lightDirection );
|
|
647
|
-
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
648
|
-
#ifdef USE_GRADIENTMAP
|
|
649
|
-
return vec3( texture2D( gradientMap, coord ).r );
|
|
650
|
-
#else
|
|
651
|
-
vec2 fw = fwidth( coord ) * 0.5;
|
|
652
|
-
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
653
|
-
#endif
|
|
654
|
-
}`,gu=`#ifdef USE_LIGHTMAP
|
|
655
|
-
uniform sampler2D lightMap;
|
|
656
|
-
uniform float lightMapIntensity;
|
|
657
|
-
#endif`,_u=`LambertMaterial material;
|
|
658
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
659
|
-
material.specularStrength = specularStrength;`,vu=`varying vec3 vViewPosition;
|
|
660
|
-
struct LambertMaterial {
|
|
661
|
-
vec3 diffuseColor;
|
|
662
|
-
float specularStrength;
|
|
663
|
-
};
|
|
664
|
-
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|
665
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
666
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
667
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
668
|
-
}
|
|
669
|
-
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|
670
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
671
|
-
}
|
|
672
|
-
#define RE_Direct RE_Direct_Lambert
|
|
673
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,xu=`uniform bool receiveShadow;
|
|
674
|
-
uniform vec3 ambientLightColor;
|
|
675
|
-
#if defined( USE_LIGHT_PROBES )
|
|
676
|
-
uniform vec3 lightProbe[ 9 ];
|
|
677
|
-
#endif
|
|
678
|
-
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
679
|
-
float x = normal.x, y = normal.y, z = normal.z;
|
|
680
|
-
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
681
|
-
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
682
|
-
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
683
|
-
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
684
|
-
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
685
|
-
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
686
|
-
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
687
|
-
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
688
|
-
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
689
|
-
return result;
|
|
690
|
-
}
|
|
691
|
-
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
692
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
693
|
-
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
694
|
-
return irradiance;
|
|
695
|
-
}
|
|
696
|
-
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
697
|
-
vec3 irradiance = ambientLightColor;
|
|
698
|
-
return irradiance;
|
|
699
|
-
}
|
|
700
|
-
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
701
|
-
#if defined ( LEGACY_LIGHTS )
|
|
702
|
-
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
703
|
-
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
704
|
-
}
|
|
705
|
-
return 1.0;
|
|
706
|
-
#else
|
|
707
|
-
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
708
|
-
if ( cutoffDistance > 0.0 ) {
|
|
709
|
-
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
710
|
-
}
|
|
711
|
-
return distanceFalloff;
|
|
712
|
-
#endif
|
|
713
|
-
}
|
|
714
|
-
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
715
|
-
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
716
|
-
}
|
|
717
|
-
#if NUM_DIR_LIGHTS > 0
|
|
718
|
-
struct DirectionalLight {
|
|
719
|
-
vec3 direction;
|
|
720
|
-
vec3 color;
|
|
721
|
-
};
|
|
722
|
-
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
723
|
-
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
|
724
|
-
light.color = directionalLight.color;
|
|
725
|
-
light.direction = directionalLight.direction;
|
|
726
|
-
light.visible = true;
|
|
727
|
-
}
|
|
728
|
-
#endif
|
|
729
|
-
#if NUM_POINT_LIGHTS > 0
|
|
730
|
-
struct PointLight {
|
|
731
|
-
vec3 position;
|
|
732
|
-
vec3 color;
|
|
733
|
-
float distance;
|
|
734
|
-
float decay;
|
|
735
|
-
};
|
|
736
|
-
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
737
|
-
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
738
|
-
vec3 lVector = pointLight.position - geometryPosition;
|
|
739
|
-
light.direction = normalize( lVector );
|
|
740
|
-
float lightDistance = length( lVector );
|
|
741
|
-
light.color = pointLight.color;
|
|
742
|
-
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
743
|
-
light.visible = ( light.color != vec3( 0.0 ) );
|
|
744
|
-
}
|
|
745
|
-
#endif
|
|
746
|
-
#if NUM_SPOT_LIGHTS > 0
|
|
747
|
-
struct SpotLight {
|
|
748
|
-
vec3 position;
|
|
749
|
-
vec3 direction;
|
|
750
|
-
vec3 color;
|
|
751
|
-
float distance;
|
|
752
|
-
float decay;
|
|
753
|
-
float coneCos;
|
|
754
|
-
float penumbraCos;
|
|
755
|
-
};
|
|
756
|
-
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
757
|
-
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
758
|
-
vec3 lVector = spotLight.position - geometryPosition;
|
|
759
|
-
light.direction = normalize( lVector );
|
|
760
|
-
float angleCos = dot( light.direction, spotLight.direction );
|
|
761
|
-
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
762
|
-
if ( spotAttenuation > 0.0 ) {
|
|
763
|
-
float lightDistance = length( lVector );
|
|
764
|
-
light.color = spotLight.color * spotAttenuation;
|
|
765
|
-
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
766
|
-
light.visible = ( light.color != vec3( 0.0 ) );
|
|
767
|
-
} else {
|
|
768
|
-
light.color = vec3( 0.0 );
|
|
769
|
-
light.visible = false;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
#endif
|
|
773
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
774
|
-
struct RectAreaLight {
|
|
775
|
-
vec3 color;
|
|
776
|
-
vec3 position;
|
|
777
|
-
vec3 halfWidth;
|
|
778
|
-
vec3 halfHeight;
|
|
779
|
-
};
|
|
780
|
-
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
781
|
-
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
782
|
-
#endif
|
|
783
|
-
#if NUM_HEMI_LIGHTS > 0
|
|
784
|
-
struct HemisphereLight {
|
|
785
|
-
vec3 direction;
|
|
786
|
-
vec3 skyColor;
|
|
787
|
-
vec3 groundColor;
|
|
788
|
-
};
|
|
789
|
-
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
790
|
-
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
791
|
-
float dotNL = dot( normal, hemiLight.direction );
|
|
792
|
-
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
793
|
-
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
794
|
-
return irradiance;
|
|
795
|
-
}
|
|
796
|
-
#endif`,Mu=`#ifdef USE_ENVMAP
|
|
797
|
-
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
798
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
799
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
800
|
-
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
|
|
801
|
-
return PI * envMapColor.rgb * envMapIntensity;
|
|
802
|
-
#else
|
|
803
|
-
return vec3( 0.0 );
|
|
804
|
-
#endif
|
|
805
|
-
}
|
|
806
|
-
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
807
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
808
|
-
vec3 reflectVec = reflect( - viewDir, normal );
|
|
809
|
-
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
810
|
-
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
811
|
-
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
|
|
812
|
-
return envMapColor.rgb * envMapIntensity;
|
|
813
|
-
#else
|
|
814
|
-
return vec3( 0.0 );
|
|
815
|
-
#endif
|
|
816
|
-
}
|
|
817
|
-
#ifdef USE_ANISOTROPY
|
|
818
|
-
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
|
819
|
-
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
820
|
-
vec3 bentNormal = cross( bitangent, viewDir );
|
|
821
|
-
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
|
822
|
-
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
|
823
|
-
return getIBLRadiance( viewDir, bentNormal, roughness );
|
|
824
|
-
#else
|
|
825
|
-
return vec3( 0.0 );
|
|
826
|
-
#endif
|
|
827
|
-
}
|
|
828
|
-
#endif
|
|
829
|
-
#endif`,Su=`ToonMaterial material;
|
|
830
|
-
material.diffuseColor = diffuseColor.rgb;`,yu=`varying vec3 vViewPosition;
|
|
831
|
-
struct ToonMaterial {
|
|
832
|
-
vec3 diffuseColor;
|
|
833
|
-
};
|
|
834
|
-
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
835
|
-
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
|
836
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
837
|
-
}
|
|
838
|
-
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
839
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
840
|
-
}
|
|
841
|
-
#define RE_Direct RE_Direct_Toon
|
|
842
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Eu=`BlinnPhongMaterial material;
|
|
843
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
844
|
-
material.specularColor = specular;
|
|
845
|
-
material.specularShininess = shininess;
|
|
846
|
-
material.specularStrength = specularStrength;`,Tu=`varying vec3 vViewPosition;
|
|
847
|
-
struct BlinnPhongMaterial {
|
|
848
|
-
vec3 diffuseColor;
|
|
849
|
-
vec3 specularColor;
|
|
850
|
-
float specularShininess;
|
|
851
|
-
float specularStrength;
|
|
852
|
-
};
|
|
853
|
-
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
854
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
855
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
856
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
857
|
-
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
858
|
-
}
|
|
859
|
-
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
860
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
861
|
-
}
|
|
862
|
-
#define RE_Direct RE_Direct_BlinnPhong
|
|
863
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bu=`PhysicalMaterial material;
|
|
864
|
-
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
865
|
-
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
866
|
-
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
867
|
-
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
868
|
-
material.roughness = min( material.roughness, 1.0 );
|
|
869
|
-
#ifdef IOR
|
|
870
|
-
material.ior = ior;
|
|
871
|
-
#ifdef USE_SPECULAR
|
|
872
|
-
float specularIntensityFactor = specularIntensity;
|
|
873
|
-
vec3 specularColorFactor = specularColor;
|
|
874
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
875
|
-
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
|
876
|
-
#endif
|
|
877
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
878
|
-
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
|
879
|
-
#endif
|
|
880
|
-
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
881
|
-
#else
|
|
882
|
-
float specularIntensityFactor = 1.0;
|
|
883
|
-
vec3 specularColorFactor = vec3( 1.0 );
|
|
884
|
-
material.specularF90 = 1.0;
|
|
885
|
-
#endif
|
|
886
|
-
material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|
887
|
-
#else
|
|
888
|
-
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|
889
|
-
material.specularF90 = 1.0;
|
|
890
|
-
#endif
|
|
891
|
-
#ifdef USE_CLEARCOAT
|
|
892
|
-
material.clearcoat = clearcoat;
|
|
893
|
-
material.clearcoatRoughness = clearcoatRoughness;
|
|
894
|
-
material.clearcoatF0 = vec3( 0.04 );
|
|
895
|
-
material.clearcoatF90 = 1.0;
|
|
896
|
-
#ifdef USE_CLEARCOATMAP
|
|
897
|
-
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
|
898
|
-
#endif
|
|
899
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
900
|
-
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
|
901
|
-
#endif
|
|
902
|
-
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
903
|
-
material.clearcoatRoughness += geometryRoughness;
|
|
904
|
-
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
905
|
-
#endif
|
|
906
|
-
#ifdef USE_DISPERSION
|
|
907
|
-
material.dispersion = dispersion;
|
|
908
|
-
#endif
|
|
909
|
-
#ifdef USE_IRIDESCENCE
|
|
910
|
-
material.iridescence = iridescence;
|
|
911
|
-
material.iridescenceIOR = iridescenceIOR;
|
|
912
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
913
|
-
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
|
914
|
-
#endif
|
|
915
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
916
|
-
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
|
917
|
-
#else
|
|
918
|
-
material.iridescenceThickness = iridescenceThicknessMaximum;
|
|
919
|
-
#endif
|
|
920
|
-
#endif
|
|
921
|
-
#ifdef USE_SHEEN
|
|
922
|
-
material.sheenColor = sheenColor;
|
|
923
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
924
|
-
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
|
925
|
-
#endif
|
|
926
|
-
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|
927
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
928
|
-
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
|
929
|
-
#endif
|
|
930
|
-
#endif
|
|
931
|
-
#ifdef USE_ANISOTROPY
|
|
932
|
-
#ifdef USE_ANISOTROPYMAP
|
|
933
|
-
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
|
934
|
-
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
|
935
|
-
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
|
936
|
-
#else
|
|
937
|
-
vec2 anisotropyV = anisotropyVector;
|
|
938
|
-
#endif
|
|
939
|
-
material.anisotropy = length( anisotropyV );
|
|
940
|
-
if( material.anisotropy == 0.0 ) {
|
|
941
|
-
anisotropyV = vec2( 1.0, 0.0 );
|
|
942
|
-
} else {
|
|
943
|
-
anisotropyV /= material.anisotropy;
|
|
944
|
-
material.anisotropy = saturate( material.anisotropy );
|
|
945
|
-
}
|
|
946
|
-
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
947
|
-
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
948
|
-
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
949
|
-
#endif`,Au=`struct PhysicalMaterial {
|
|
950
|
-
vec3 diffuseColor;
|
|
951
|
-
float roughness;
|
|
952
|
-
vec3 specularColor;
|
|
953
|
-
float specularF90;
|
|
954
|
-
float dispersion;
|
|
955
|
-
#ifdef USE_CLEARCOAT
|
|
956
|
-
float clearcoat;
|
|
957
|
-
float clearcoatRoughness;
|
|
958
|
-
vec3 clearcoatF0;
|
|
959
|
-
float clearcoatF90;
|
|
960
|
-
#endif
|
|
961
|
-
#ifdef USE_IRIDESCENCE
|
|
962
|
-
float iridescence;
|
|
963
|
-
float iridescenceIOR;
|
|
964
|
-
float iridescenceThickness;
|
|
965
|
-
vec3 iridescenceFresnel;
|
|
966
|
-
vec3 iridescenceF0;
|
|
967
|
-
#endif
|
|
968
|
-
#ifdef USE_SHEEN
|
|
969
|
-
vec3 sheenColor;
|
|
970
|
-
float sheenRoughness;
|
|
971
|
-
#endif
|
|
972
|
-
#ifdef IOR
|
|
973
|
-
float ior;
|
|
974
|
-
#endif
|
|
975
|
-
#ifdef USE_TRANSMISSION
|
|
976
|
-
float transmission;
|
|
977
|
-
float transmissionAlpha;
|
|
978
|
-
float thickness;
|
|
979
|
-
float attenuationDistance;
|
|
980
|
-
vec3 attenuationColor;
|
|
981
|
-
#endif
|
|
982
|
-
#ifdef USE_ANISOTROPY
|
|
983
|
-
float anisotropy;
|
|
984
|
-
float alphaT;
|
|
985
|
-
vec3 anisotropyT;
|
|
986
|
-
vec3 anisotropyB;
|
|
987
|
-
#endif
|
|
988
|
-
};
|
|
989
|
-
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
|
990
|
-
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
|
991
|
-
vec3 sheenSpecularDirect = vec3( 0.0 );
|
|
992
|
-
vec3 sheenSpecularIndirect = vec3(0.0 );
|
|
993
|
-
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
|
994
|
-
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
|
995
|
-
float x2 = x * x;
|
|
996
|
-
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
|
997
|
-
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
|
998
|
-
}
|
|
999
|
-
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
1000
|
-
float a2 = pow2( alpha );
|
|
1001
|
-
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
1002
|
-
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
1003
|
-
return 0.5 / max( gv + gl, EPSILON );
|
|
1004
|
-
}
|
|
1005
|
-
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
1006
|
-
float a2 = pow2( alpha );
|
|
1007
|
-
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
1008
|
-
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
1009
|
-
}
|
|
1010
|
-
#ifdef USE_ANISOTROPY
|
|
1011
|
-
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
|
|
1012
|
-
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
|
1013
|
-
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
|
1014
|
-
float v = 0.5 / ( gv + gl );
|
|
1015
|
-
return saturate(v);
|
|
1016
|
-
}
|
|
1017
|
-
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
|
1018
|
-
float a2 = alphaT * alphaB;
|
|
1019
|
-
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
|
1020
|
-
highp float v2 = dot( v, v );
|
|
1021
|
-
float w2 = a2 / v2;
|
|
1022
|
-
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
|
1023
|
-
}
|
|
1024
|
-
#endif
|
|
1025
|
-
#ifdef USE_CLEARCOAT
|
|
1026
|
-
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
|
1027
|
-
vec3 f0 = material.clearcoatF0;
|
|
1028
|
-
float f90 = material.clearcoatF90;
|
|
1029
|
-
float roughness = material.clearcoatRoughness;
|
|
1030
|
-
float alpha = pow2( roughness );
|
|
1031
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1032
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1033
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1034
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1035
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
1036
|
-
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
1037
|
-
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
1038
|
-
float D = D_GGX( alpha, dotNH );
|
|
1039
|
-
return F * ( V * D );
|
|
1040
|
-
}
|
|
1041
|
-
#endif
|
|
1042
|
-
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
|
1043
|
-
vec3 f0 = material.specularColor;
|
|
1044
|
-
float f90 = material.specularF90;
|
|
1045
|
-
float roughness = material.roughness;
|
|
1046
|
-
float alpha = pow2( roughness );
|
|
1047
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1048
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1049
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1050
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1051
|
-
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
1052
|
-
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
1053
|
-
#ifdef USE_IRIDESCENCE
|
|
1054
|
-
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
|
1055
|
-
#endif
|
|
1056
|
-
#ifdef USE_ANISOTROPY
|
|
1057
|
-
float dotTL = dot( material.anisotropyT, lightDir );
|
|
1058
|
-
float dotTV = dot( material.anisotropyT, viewDir );
|
|
1059
|
-
float dotTH = dot( material.anisotropyT, halfDir );
|
|
1060
|
-
float dotBL = dot( material.anisotropyB, lightDir );
|
|
1061
|
-
float dotBV = dot( material.anisotropyB, viewDir );
|
|
1062
|
-
float dotBH = dot( material.anisotropyB, halfDir );
|
|
1063
|
-
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
|
1064
|
-
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
|
1065
|
-
#else
|
|
1066
|
-
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
1067
|
-
float D = D_GGX( alpha, dotNH );
|
|
1068
|
-
#endif
|
|
1069
|
-
return F * ( V * D );
|
|
1070
|
-
}
|
|
1071
|
-
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
1072
|
-
const float LUT_SIZE = 64.0;
|
|
1073
|
-
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
1074
|
-
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
1075
|
-
float dotNV = saturate( dot( N, V ) );
|
|
1076
|
-
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
1077
|
-
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
1078
|
-
return uv;
|
|
1079
|
-
}
|
|
1080
|
-
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
1081
|
-
float l = length( f );
|
|
1082
|
-
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
1083
|
-
}
|
|
1084
|
-
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
1085
|
-
float x = dot( v1, v2 );
|
|
1086
|
-
float y = abs( x );
|
|
1087
|
-
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
1088
|
-
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
1089
|
-
float v = a / b;
|
|
1090
|
-
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
1091
|
-
return cross( v1, v2 ) * theta_sintheta;
|
|
1092
|
-
}
|
|
1093
|
-
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
1094
|
-
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
1095
|
-
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
1096
|
-
vec3 lightNormal = cross( v1, v2 );
|
|
1097
|
-
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
1098
|
-
vec3 T1, T2;
|
|
1099
|
-
T1 = normalize( V - N * dot( V, N ) );
|
|
1100
|
-
T2 = - cross( N, T1 );
|
|
1101
|
-
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
1102
|
-
vec3 coords[ 4 ];
|
|
1103
|
-
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
1104
|
-
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
1105
|
-
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
1106
|
-
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
1107
|
-
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
1108
|
-
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
1109
|
-
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
1110
|
-
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
1111
|
-
vec3 vectorFormFactor = vec3( 0.0 );
|
|
1112
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
1113
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
1114
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
1115
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
1116
|
-
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
1117
|
-
return vec3( result );
|
|
1118
|
-
}
|
|
1119
|
-
#if defined( USE_SHEEN )
|
|
1120
|
-
float D_Charlie( float roughness, float dotNH ) {
|
|
1121
|
-
float alpha = pow2( roughness );
|
|
1122
|
-
float invAlpha = 1.0 / alpha;
|
|
1123
|
-
float cos2h = dotNH * dotNH;
|
|
1124
|
-
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
1125
|
-
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
1126
|
-
}
|
|
1127
|
-
float V_Neubelt( float dotNV, float dotNL ) {
|
|
1128
|
-
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
1129
|
-
}
|
|
1130
|
-
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
1131
|
-
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1132
|
-
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1133
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1134
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1135
|
-
float D = D_Charlie( sheenRoughness, dotNH );
|
|
1136
|
-
float V = V_Neubelt( dotNV, dotNL );
|
|
1137
|
-
return sheenColor * ( D * V );
|
|
1138
|
-
}
|
|
1139
|
-
#endif
|
|
1140
|
-
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
1141
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1142
|
-
float r2 = roughness * roughness;
|
|
1143
|
-
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
|
1144
|
-
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
|
1145
|
-
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
|
1146
|
-
return saturate( DG * RECIPROCAL_PI );
|
|
1147
|
-
}
|
|
1148
|
-
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
1149
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1150
|
-
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
1151
|
-
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
1152
|
-
vec4 r = roughness * c0 + c1;
|
|
1153
|
-
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
1154
|
-
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
|
1155
|
-
return fab;
|
|
1156
|
-
}
|
|
1157
|
-
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
1158
|
-
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
1159
|
-
return specularColor * fab.x + specularF90 * fab.y;
|
|
1160
|
-
}
|
|
1161
|
-
#ifdef USE_IRIDESCENCE
|
|
1162
|
-
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
1163
|
-
#else
|
|
1164
|
-
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
1165
|
-
#endif
|
|
1166
|
-
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
1167
|
-
#ifdef USE_IRIDESCENCE
|
|
1168
|
-
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
|
1169
|
-
#else
|
|
1170
|
-
vec3 Fr = specularColor;
|
|
1171
|
-
#endif
|
|
1172
|
-
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
|
1173
|
-
float Ess = fab.x + fab.y;
|
|
1174
|
-
float Ems = 1.0 - Ess;
|
|
1175
|
-
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
1176
|
-
singleScatter += FssEss;
|
|
1177
|
-
multiScatter += Fms * Ems;
|
|
1178
|
-
}
|
|
1179
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1180
|
-
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1181
|
-
vec3 normal = geometryNormal;
|
|
1182
|
-
vec3 viewDir = geometryViewDir;
|
|
1183
|
-
vec3 position = geometryPosition;
|
|
1184
|
-
vec3 lightPos = rectAreaLight.position;
|
|
1185
|
-
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
1186
|
-
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
1187
|
-
vec3 lightColor = rectAreaLight.color;
|
|
1188
|
-
float roughness = material.roughness;
|
|
1189
|
-
vec3 rectCoords[ 4 ];
|
|
1190
|
-
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
1191
|
-
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
1192
|
-
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
1193
|
-
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
1194
|
-
vec4 t1 = texture2D( ltc_1, uv );
|
|
1195
|
-
vec4 t2 = texture2D( ltc_2, uv );
|
|
1196
|
-
mat3 mInv = mat3(
|
|
1197
|
-
vec3( t1.x, 0, t1.y ),
|
|
1198
|
-
vec3( 0, 1, 0 ),
|
|
1199
|
-
vec3( t1.z, 0, t1.w )
|
|
1200
|
-
);
|
|
1201
|
-
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
1202
|
-
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
1203
|
-
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
1204
|
-
}
|
|
1205
|
-
#endif
|
|
1206
|
-
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1207
|
-
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
1208
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
1209
|
-
#ifdef USE_CLEARCOAT
|
|
1210
|
-
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
|
1211
|
-
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
1212
|
-
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
|
1213
|
-
#endif
|
|
1214
|
-
#ifdef USE_SHEEN
|
|
1215
|
-
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
|
1216
|
-
#endif
|
|
1217
|
-
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
|
|
1218
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
1219
|
-
}
|
|
1220
|
-
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1221
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
1222
|
-
}
|
|
1223
|
-
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
1224
|
-
#ifdef USE_CLEARCOAT
|
|
1225
|
-
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
1226
|
-
#endif
|
|
1227
|
-
#ifdef USE_SHEEN
|
|
1228
|
-
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1229
|
-
#endif
|
|
1230
|
-
vec3 singleScattering = vec3( 0.0 );
|
|
1231
|
-
vec3 multiScattering = vec3( 0.0 );
|
|
1232
|
-
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
1233
|
-
#ifdef USE_IRIDESCENCE
|
|
1234
|
-
computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
|
|
1235
|
-
#else
|
|
1236
|
-
computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
|
1237
|
-
#endif
|
|
1238
|
-
vec3 totalScattering = singleScattering + multiScattering;
|
|
1239
|
-
vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
|
|
1240
|
-
reflectedLight.indirectSpecular += radiance * singleScattering;
|
|
1241
|
-
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
1242
|
-
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
1243
|
-
}
|
|
1244
|
-
#define RE_Direct RE_Direct_Physical
|
|
1245
|
-
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
1246
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
1247
|
-
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1248
|
-
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1249
|
-
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1250
|
-
}`,wu=`
|
|
1251
|
-
vec3 geometryPosition = - vViewPosition;
|
|
1252
|
-
vec3 geometryNormal = normal;
|
|
1253
|
-
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1254
|
-
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
|
1255
|
-
#ifdef USE_CLEARCOAT
|
|
1256
|
-
geometryClearcoatNormal = clearcoatNormal;
|
|
1257
|
-
#endif
|
|
1258
|
-
#ifdef USE_IRIDESCENCE
|
|
1259
|
-
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
|
1260
|
-
if ( material.iridescenceThickness == 0.0 ) {
|
|
1261
|
-
material.iridescence = 0.0;
|
|
1262
|
-
} else {
|
|
1263
|
-
material.iridescence = saturate( material.iridescence );
|
|
1264
|
-
}
|
|
1265
|
-
if ( material.iridescence > 0.0 ) {
|
|
1266
|
-
material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
|
1267
|
-
material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
|
|
1268
|
-
}
|
|
1269
|
-
#endif
|
|
1270
|
-
IncidentLight directLight;
|
|
1271
|
-
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1272
|
-
PointLight pointLight;
|
|
1273
|
-
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1274
|
-
PointLightShadow pointLightShadow;
|
|
1275
|
-
#endif
|
|
1276
|
-
#pragma unroll_loop_start
|
|
1277
|
-
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1278
|
-
pointLight = pointLights[ i ];
|
|
1279
|
-
getPointLightInfo( pointLight, geometryPosition, directLight );
|
|
1280
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
1281
|
-
pointLightShadow = pointLightShadows[ i ];
|
|
1282
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1283
|
-
#endif
|
|
1284
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1285
|
-
}
|
|
1286
|
-
#pragma unroll_loop_end
|
|
1287
|
-
#endif
|
|
1288
|
-
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1289
|
-
SpotLight spotLight;
|
|
1290
|
-
vec4 spotColor;
|
|
1291
|
-
vec3 spotLightCoord;
|
|
1292
|
-
bool inSpotLightMap;
|
|
1293
|
-
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1294
|
-
SpotLightShadow spotLightShadow;
|
|
1295
|
-
#endif
|
|
1296
|
-
#pragma unroll_loop_start
|
|
1297
|
-
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1298
|
-
spotLight = spotLights[ i ];
|
|
1299
|
-
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
|
1300
|
-
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1301
|
-
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
|
1302
|
-
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1303
|
-
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
|
1304
|
-
#else
|
|
1305
|
-
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1306
|
-
#endif
|
|
1307
|
-
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
|
1308
|
-
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
|
1309
|
-
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
|
1310
|
-
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
|
1311
|
-
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
|
1312
|
-
#endif
|
|
1313
|
-
#undef SPOT_LIGHT_MAP_INDEX
|
|
1314
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1315
|
-
spotLightShadow = spotLightShadows[ i ];
|
|
1316
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
1317
|
-
#endif
|
|
1318
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1319
|
-
}
|
|
1320
|
-
#pragma unroll_loop_end
|
|
1321
|
-
#endif
|
|
1322
|
-
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1323
|
-
DirectionalLight directionalLight;
|
|
1324
|
-
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1325
|
-
DirectionalLightShadow directionalLightShadow;
|
|
1326
|
-
#endif
|
|
1327
|
-
#pragma unroll_loop_start
|
|
1328
|
-
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1329
|
-
directionalLight = directionalLights[ i ];
|
|
1330
|
-
getDirectionalLightInfo( directionalLight, directLight );
|
|
1331
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1332
|
-
directionalLightShadow = directionalLightShadows[ i ];
|
|
1333
|
-
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1334
|
-
#endif
|
|
1335
|
-
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1336
|
-
}
|
|
1337
|
-
#pragma unroll_loop_end
|
|
1338
|
-
#endif
|
|
1339
|
-
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1340
|
-
RectAreaLight rectAreaLight;
|
|
1341
|
-
#pragma unroll_loop_start
|
|
1342
|
-
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1343
|
-
rectAreaLight = rectAreaLights[ i ];
|
|
1344
|
-
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1345
|
-
}
|
|
1346
|
-
#pragma unroll_loop_end
|
|
1347
|
-
#endif
|
|
1348
|
-
#if defined( RE_IndirectDiffuse )
|
|
1349
|
-
vec3 iblIrradiance = vec3( 0.0 );
|
|
1350
|
-
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1351
|
-
#if defined( USE_LIGHT_PROBES )
|
|
1352
|
-
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|
1353
|
-
#endif
|
|
1354
|
-
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1355
|
-
#pragma unroll_loop_start
|
|
1356
|
-
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1357
|
-
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|
1358
|
-
}
|
|
1359
|
-
#pragma unroll_loop_end
|
|
1360
|
-
#endif
|
|
1361
|
-
#endif
|
|
1362
|
-
#if defined( RE_IndirectSpecular )
|
|
1363
|
-
vec3 radiance = vec3( 0.0 );
|
|
1364
|
-
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1365
|
-
#endif`,Ru=`#if defined( RE_IndirectDiffuse )
|
|
1366
|
-
#ifdef USE_LIGHTMAP
|
|
1367
|
-
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1368
|
-
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
1369
|
-
irradiance += lightMapIrradiance;
|
|
1370
|
-
#endif
|
|
1371
|
-
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1372
|
-
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|
1373
|
-
#endif
|
|
1374
|
-
#endif
|
|
1375
|
-
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1376
|
-
#ifdef USE_ANISOTROPY
|
|
1377
|
-
radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|
1378
|
-
#else
|
|
1379
|
-
radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|
1380
|
-
#endif
|
|
1381
|
-
#ifdef USE_CLEARCOAT
|
|
1382
|
-
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1383
|
-
#endif
|
|
1384
|
-
#endif`,Cu=`#if defined( RE_IndirectDiffuse )
|
|
1385
|
-
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1386
|
-
#endif
|
|
1387
|
-
#if defined( RE_IndirectSpecular )
|
|
1388
|
-
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1389
|
-
#endif`,Pu=`#if defined( USE_LOGDEPTHBUF )
|
|
1390
|
-
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1391
|
-
#endif`,Lu=`#if defined( USE_LOGDEPTHBUF )
|
|
1392
|
-
uniform float logDepthBufFC;
|
|
1393
|
-
varying float vFragDepth;
|
|
1394
|
-
varying float vIsPerspective;
|
|
1395
|
-
#endif`,Du=`#ifdef USE_LOGDEPTHBUF
|
|
1396
|
-
varying float vFragDepth;
|
|
1397
|
-
varying float vIsPerspective;
|
|
1398
|
-
#endif`,Iu=`#ifdef USE_LOGDEPTHBUF
|
|
1399
|
-
vFragDepth = 1.0 + gl_Position.w;
|
|
1400
|
-
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1401
|
-
#endif`,Uu=`#ifdef USE_MAP
|
|
1402
|
-
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1403
|
-
#ifdef DECODE_VIDEO_TEXTURE
|
|
1404
|
-
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
1405
|
-
|
|
1406
|
-
#endif
|
|
1407
|
-
diffuseColor *= sampledDiffuseColor;
|
|
1408
|
-
#endif`,Nu=`#ifdef USE_MAP
|
|
1409
|
-
uniform sampler2D map;
|
|
1410
|
-
#endif`,Fu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1411
|
-
#if defined( USE_POINTS_UV )
|
|
1412
|
-
vec2 uv = vUv;
|
|
1413
|
-
#else
|
|
1414
|
-
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1415
|
-
#endif
|
|
1416
|
-
#endif
|
|
1417
|
-
#ifdef USE_MAP
|
|
1418
|
-
diffuseColor *= texture2D( map, uv );
|
|
1419
|
-
#endif
|
|
1420
|
-
#ifdef USE_ALPHAMAP
|
|
1421
|
-
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1422
|
-
#endif`,Ou=`#if defined( USE_POINTS_UV )
|
|
1423
|
-
varying vec2 vUv;
|
|
1424
|
-
#else
|
|
1425
|
-
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1426
|
-
uniform mat3 uvTransform;
|
|
1427
|
-
#endif
|
|
1428
|
-
#endif
|
|
1429
|
-
#ifdef USE_MAP
|
|
1430
|
-
uniform sampler2D map;
|
|
1431
|
-
#endif
|
|
1432
|
-
#ifdef USE_ALPHAMAP
|
|
1433
|
-
uniform sampler2D alphaMap;
|
|
1434
|
-
#endif`,Bu=`float metalnessFactor = metalness;
|
|
1435
|
-
#ifdef USE_METALNESSMAP
|
|
1436
|
-
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1437
|
-
metalnessFactor *= texelMetalness.b;
|
|
1438
|
-
#endif`,zu=`#ifdef USE_METALNESSMAP
|
|
1439
|
-
uniform sampler2D metalnessMap;
|
|
1440
|
-
#endif`,Vu=`#ifdef USE_INSTANCING_MORPH
|
|
1441
|
-
float morphTargetInfluences[MORPHTARGETS_COUNT];
|
|
1442
|
-
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1443
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1444
|
-
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1445
|
-
}
|
|
1446
|
-
#endif`,Hu=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|
1447
|
-
vColor *= morphTargetBaseInfluence;
|
|
1448
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1449
|
-
#if defined( USE_COLOR_ALPHA )
|
|
1450
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|
1451
|
-
#elif defined( USE_COLOR )
|
|
1452
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1453
|
-
#endif
|
|
1454
|
-
}
|
|
1455
|
-
#endif`,ku=`#ifdef USE_MORPHNORMALS
|
|
1456
|
-
objectNormal *= morphTargetBaseInfluence;
|
|
1457
|
-
#ifdef MORPHTARGETS_TEXTURE
|
|
1458
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1459
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1460
|
-
}
|
|
1461
|
-
#else
|
|
1462
|
-
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
1463
|
-
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
1464
|
-
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1465
|
-
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1466
|
-
#endif
|
|
1467
|
-
#endif`,Gu=`#ifdef USE_MORPHTARGETS
|
|
1468
|
-
#ifndef USE_INSTANCING_MORPH
|
|
1469
|
-
uniform float morphTargetBaseInfluence;
|
|
1470
|
-
#endif
|
|
1471
|
-
#ifdef MORPHTARGETS_TEXTURE
|
|
1472
|
-
#ifndef USE_INSTANCING_MORPH
|
|
1473
|
-
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1474
|
-
#endif
|
|
1475
|
-
uniform sampler2DArray morphTargetsTexture;
|
|
1476
|
-
uniform ivec2 morphTargetsTextureSize;
|
|
1477
|
-
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
|
1478
|
-
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
|
1479
|
-
int y = texelIndex / morphTargetsTextureSize.x;
|
|
1480
|
-
int x = texelIndex - y * morphTargetsTextureSize.x;
|
|
1481
|
-
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1482
|
-
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1483
|
-
}
|
|
1484
|
-
#else
|
|
1485
|
-
#ifndef USE_MORPHNORMALS
|
|
1486
|
-
uniform float morphTargetInfluences[ 8 ];
|
|
1487
|
-
#else
|
|
1488
|
-
uniform float morphTargetInfluences[ 4 ];
|
|
1489
|
-
#endif
|
|
1490
|
-
#endif
|
|
1491
|
-
#endif`,Wu=`#ifdef USE_MORPHTARGETS
|
|
1492
|
-
transformed *= morphTargetBaseInfluence;
|
|
1493
|
-
#ifdef MORPHTARGETS_TEXTURE
|
|
1494
|
-
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1495
|
-
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1496
|
-
}
|
|
1497
|
-
#else
|
|
1498
|
-
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
1499
|
-
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
1500
|
-
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
1501
|
-
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
1502
|
-
#ifndef USE_MORPHNORMALS
|
|
1503
|
-
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
1504
|
-
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
1505
|
-
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
1506
|
-
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1507
|
-
#endif
|
|
1508
|
-
#endif
|
|
1509
|
-
#endif`,Xu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1510
|
-
#ifdef FLAT_SHADED
|
|
1511
|
-
vec3 fdx = dFdx( vViewPosition );
|
|
1512
|
-
vec3 fdy = dFdy( vViewPosition );
|
|
1513
|
-
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1514
|
-
#else
|
|
1515
|
-
vec3 normal = normalize( vNormal );
|
|
1516
|
-
#ifdef DOUBLE_SIDED
|
|
1517
|
-
normal *= faceDirection;
|
|
1518
|
-
#endif
|
|
1519
|
-
#endif
|
|
1520
|
-
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
|
1521
|
-
#ifdef USE_TANGENT
|
|
1522
|
-
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1523
|
-
#else
|
|
1524
|
-
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
|
1525
|
-
#if defined( USE_NORMALMAP )
|
|
1526
|
-
vNormalMapUv
|
|
1527
|
-
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
|
1528
|
-
vClearcoatNormalMapUv
|
|
1529
|
-
#else
|
|
1530
|
-
vUv
|
|
1531
|
-
#endif
|
|
1532
|
-
);
|
|
1533
|
-
#endif
|
|
1534
|
-
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|
1535
|
-
tbn[0] *= faceDirection;
|
|
1536
|
-
tbn[1] *= faceDirection;
|
|
1537
|
-
#endif
|
|
1538
|
-
#endif
|
|
1539
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1540
|
-
#ifdef USE_TANGENT
|
|
1541
|
-
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1542
|
-
#else
|
|
1543
|
-
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
|
1544
|
-
#endif
|
|
1545
|
-
#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
|
|
1546
|
-
tbn2[0] *= faceDirection;
|
|
1547
|
-
tbn2[1] *= faceDirection;
|
|
1548
|
-
#endif
|
|
1549
|
-
#endif
|
|
1550
|
-
vec3 nonPerturbedNormal = normal;`,qu=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1551
|
-
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1552
|
-
#ifdef FLIP_SIDED
|
|
1553
|
-
normal = - normal;
|
|
1554
|
-
#endif
|
|
1555
|
-
#ifdef DOUBLE_SIDED
|
|
1556
|
-
normal = normal * faceDirection;
|
|
1557
|
-
#endif
|
|
1558
|
-
normal = normalize( normalMatrix * normal );
|
|
1559
|
-
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
|
1560
|
-
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1561
|
-
mapN.xy *= normalScale;
|
|
1562
|
-
normal = normalize( tbn * mapN );
|
|
1563
|
-
#elif defined( USE_BUMPMAP )
|
|
1564
|
-
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1565
|
-
#endif`,Yu=`#ifndef FLAT_SHADED
|
|
1566
|
-
varying vec3 vNormal;
|
|
1567
|
-
#ifdef USE_TANGENT
|
|
1568
|
-
varying vec3 vTangent;
|
|
1569
|
-
varying vec3 vBitangent;
|
|
1570
|
-
#endif
|
|
1571
|
-
#endif`,$u=`#ifndef FLAT_SHADED
|
|
1572
|
-
varying vec3 vNormal;
|
|
1573
|
-
#ifdef USE_TANGENT
|
|
1574
|
-
varying vec3 vTangent;
|
|
1575
|
-
varying vec3 vBitangent;
|
|
1576
|
-
#endif
|
|
1577
|
-
#endif`,Ku=`#ifndef FLAT_SHADED
|
|
1578
|
-
vNormal = normalize( transformedNormal );
|
|
1579
|
-
#ifdef USE_TANGENT
|
|
1580
|
-
vTangent = normalize( transformedTangent );
|
|
1581
|
-
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1582
|
-
#endif
|
|
1583
|
-
#endif`,ju=`#ifdef USE_NORMALMAP
|
|
1584
|
-
uniform sampler2D normalMap;
|
|
1585
|
-
uniform vec2 normalScale;
|
|
1586
|
-
#endif
|
|
1587
|
-
#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1588
|
-
uniform mat3 normalMatrix;
|
|
1589
|
-
#endif
|
|
1590
|
-
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
|
1591
|
-
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
|
1592
|
-
vec3 q0 = dFdx( eye_pos.xyz );
|
|
1593
|
-
vec3 q1 = dFdy( eye_pos.xyz );
|
|
1594
|
-
vec2 st0 = dFdx( uv.st );
|
|
1595
|
-
vec2 st1 = dFdy( uv.st );
|
|
1596
|
-
vec3 N = surf_norm;
|
|
1597
|
-
vec3 q1perp = cross( q1, N );
|
|
1598
|
-
vec3 q0perp = cross( N, q0 );
|
|
1599
|
-
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1600
|
-
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1601
|
-
float det = max( dot( T, T ), dot( B, B ) );
|
|
1602
|
-
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1603
|
-
return mat3( T * scale, B * scale, N );
|
|
1604
|
-
}
|
|
1605
|
-
#endif`,Zu=`#ifdef USE_CLEARCOAT
|
|
1606
|
-
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1607
|
-
#endif`,Ju=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1608
|
-
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1609
|
-
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1610
|
-
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1611
|
-
#endif`,Qu=`#ifdef USE_CLEARCOATMAP
|
|
1612
|
-
uniform sampler2D clearcoatMap;
|
|
1613
|
-
#endif
|
|
1614
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1615
|
-
uniform sampler2D clearcoatNormalMap;
|
|
1616
|
-
uniform vec2 clearcoatNormalScale;
|
|
1617
|
-
#endif
|
|
1618
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1619
|
-
uniform sampler2D clearcoatRoughnessMap;
|
|
1620
|
-
#endif`,td=`#ifdef USE_IRIDESCENCEMAP
|
|
1621
|
-
uniform sampler2D iridescenceMap;
|
|
1622
|
-
#endif
|
|
1623
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1624
|
-
uniform sampler2D iridescenceThicknessMap;
|
|
1625
|
-
#endif`,ed=`#ifdef OPAQUE
|
|
1626
|
-
diffuseColor.a = 1.0;
|
|
1627
|
-
#endif
|
|
1628
|
-
#ifdef USE_TRANSMISSION
|
|
1629
|
-
diffuseColor.a *= material.transmissionAlpha;
|
|
1630
|
-
#endif
|
|
1631
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,nd=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1632
|
-
return normalize( normal ) * 0.5 + 0.5;
|
|
1633
|
-
}
|
|
1634
|
-
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1635
|
-
return 2.0 * rgb.xyz - 1.0;
|
|
1636
|
-
}
|
|
1637
|
-
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
1638
|
-
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
1639
|
-
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
1640
|
-
const float ShiftRight8 = 1. / 256.;
|
|
1641
|
-
vec4 packDepthToRGBA( const in float v ) {
|
|
1642
|
-
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
1643
|
-
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
1644
|
-
}
|
|
1645
|
-
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1646
|
-
return dot( v, UnpackFactors );
|
|
1647
|
-
}
|
|
1648
|
-
vec2 packDepthToRG( in highp float v ) {
|
|
1649
|
-
return packDepthToRGBA( v ).yx;
|
|
1650
|
-
}
|
|
1651
|
-
float unpackRGToDepth( const in highp vec2 v ) {
|
|
1652
|
-
return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
|
|
1653
|
-
}
|
|
1654
|
-
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
1655
|
-
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
1656
|
-
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
1657
|
-
}
|
|
1658
|
-
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
1659
|
-
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1660
|
-
}
|
|
1661
|
-
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1662
|
-
return ( viewZ + near ) / ( near - far );
|
|
1663
|
-
}
|
|
1664
|
-
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1665
|
-
return depth * ( near - far ) - near;
|
|
1666
|
-
}
|
|
1667
|
-
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1668
|
-
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
1669
|
-
}
|
|
1670
|
-
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1671
|
-
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1672
|
-
}`,id=`#ifdef PREMULTIPLIED_ALPHA
|
|
1673
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1674
|
-
#endif`,rd=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1675
|
-
#ifdef USE_BATCHING
|
|
1676
|
-
mvPosition = batchingMatrix * mvPosition;
|
|
1677
|
-
#endif
|
|
1678
|
-
#ifdef USE_INSTANCING
|
|
1679
|
-
mvPosition = instanceMatrix * mvPosition;
|
|
1680
|
-
#endif
|
|
1681
|
-
mvPosition = modelViewMatrix * mvPosition;
|
|
1682
|
-
gl_Position = projectionMatrix * mvPosition;`,sd=`#ifdef DITHERING
|
|
1683
|
-
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1684
|
-
#endif`,ad=`#ifdef DITHERING
|
|
1685
|
-
vec3 dithering( vec3 color ) {
|
|
1686
|
-
float grid_position = rand( gl_FragCoord.xy );
|
|
1687
|
-
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1688
|
-
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1689
|
-
return color + dither_shift_RGB;
|
|
1690
|
-
}
|
|
1691
|
-
#endif`,od=`float roughnessFactor = roughness;
|
|
1692
|
-
#ifdef USE_ROUGHNESSMAP
|
|
1693
|
-
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1694
|
-
roughnessFactor *= texelRoughness.g;
|
|
1695
|
-
#endif`,ld=`#ifdef USE_ROUGHNESSMAP
|
|
1696
|
-
uniform sampler2D roughnessMap;
|
|
1697
|
-
#endif`,cd=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1698
|
-
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1699
|
-
#endif
|
|
1700
|
-
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
1701
|
-
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
|
1702
|
-
#endif
|
|
1703
|
-
#ifdef USE_SHADOWMAP
|
|
1704
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1705
|
-
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1706
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1707
|
-
struct DirectionalLightShadow {
|
|
1708
|
-
float shadowBias;
|
|
1709
|
-
float shadowNormalBias;
|
|
1710
|
-
float shadowRadius;
|
|
1711
|
-
vec2 shadowMapSize;
|
|
1712
|
-
};
|
|
1713
|
-
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1714
|
-
#endif
|
|
1715
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1716
|
-
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1717
|
-
struct SpotLightShadow {
|
|
1718
|
-
float shadowBias;
|
|
1719
|
-
float shadowNormalBias;
|
|
1720
|
-
float shadowRadius;
|
|
1721
|
-
vec2 shadowMapSize;
|
|
1722
|
-
};
|
|
1723
|
-
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1724
|
-
#endif
|
|
1725
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1726
|
-
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1727
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1728
|
-
struct PointLightShadow {
|
|
1729
|
-
float shadowBias;
|
|
1730
|
-
float shadowNormalBias;
|
|
1731
|
-
float shadowRadius;
|
|
1732
|
-
vec2 shadowMapSize;
|
|
1733
|
-
float shadowCameraNear;
|
|
1734
|
-
float shadowCameraFar;
|
|
1735
|
-
};
|
|
1736
|
-
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1737
|
-
#endif
|
|
1738
|
-
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
1739
|
-
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
1740
|
-
}
|
|
1741
|
-
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
1742
|
-
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
1743
|
-
}
|
|
1744
|
-
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
1745
|
-
float occlusion = 1.0;
|
|
1746
|
-
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
1747
|
-
float hard_shadow = step( compare , distribution.x );
|
|
1748
|
-
if (hard_shadow != 1.0 ) {
|
|
1749
|
-
float distance = compare - distribution.x ;
|
|
1750
|
-
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
1751
|
-
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
|
|
1752
|
-
}
|
|
1753
|
-
return occlusion;
|
|
1754
|
-
}
|
|
1755
|
-
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1756
|
-
float shadow = 1.0;
|
|
1757
|
-
shadowCoord.xyz /= shadowCoord.w;
|
|
1758
|
-
shadowCoord.z += shadowBias;
|
|
1759
|
-
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1760
|
-
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1761
|
-
if ( frustumTest ) {
|
|
1762
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1763
|
-
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1764
|
-
float dx0 = - texelSize.x * shadowRadius;
|
|
1765
|
-
float dy0 = - texelSize.y * shadowRadius;
|
|
1766
|
-
float dx1 = + texelSize.x * shadowRadius;
|
|
1767
|
-
float dy1 = + texelSize.y * shadowRadius;
|
|
1768
|
-
float dx2 = dx0 / 2.0;
|
|
1769
|
-
float dy2 = dy0 / 2.0;
|
|
1770
|
-
float dx3 = dx1 / 2.0;
|
|
1771
|
-
float dy3 = dy1 / 2.0;
|
|
1772
|
-
shadow = (
|
|
1773
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
1774
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
1775
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
1776
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
1777
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
1778
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
1779
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
1780
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
1781
|
-
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
1782
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
1783
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
1784
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
1785
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
1786
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
1787
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
1788
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
1789
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
1790
|
-
) * ( 1.0 / 17.0 );
|
|
1791
|
-
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
1792
|
-
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1793
|
-
float dx = texelSize.x;
|
|
1794
|
-
float dy = texelSize.y;
|
|
1795
|
-
vec2 uv = shadowCoord.xy;
|
|
1796
|
-
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
1797
|
-
uv -= f * texelSize;
|
|
1798
|
-
shadow = (
|
|
1799
|
-
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
1800
|
-
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
1801
|
-
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
1802
|
-
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
1803
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
1804
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
1805
|
-
f.x ) +
|
|
1806
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
1807
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
1808
|
-
f.x ) +
|
|
1809
|
-
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
1810
|
-
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
1811
|
-
f.y ) +
|
|
1812
|
-
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
1813
|
-
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
1814
|
-
f.y ) +
|
|
1815
|
-
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
1816
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
1817
|
-
f.x ),
|
|
1818
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
1819
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
1820
|
-
f.x ),
|
|
1821
|
-
f.y )
|
|
1822
|
-
) * ( 1.0 / 9.0 );
|
|
1823
|
-
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1824
|
-
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1825
|
-
#else
|
|
1826
|
-
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1827
|
-
#endif
|
|
1828
|
-
}
|
|
1829
|
-
return shadow;
|
|
1830
|
-
}
|
|
1831
|
-
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
1832
|
-
vec3 absV = abs( v );
|
|
1833
|
-
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
1834
|
-
absV *= scaleToCube;
|
|
1835
|
-
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
1836
|
-
vec2 planar = v.xy;
|
|
1837
|
-
float almostATexel = 1.5 * texelSizeY;
|
|
1838
|
-
float almostOne = 1.0 - almostATexel;
|
|
1839
|
-
if ( absV.z >= almostOne ) {
|
|
1840
|
-
if ( v.z > 0.0 )
|
|
1841
|
-
planar.x = 4.0 - v.x;
|
|
1842
|
-
} else if ( absV.x >= almostOne ) {
|
|
1843
|
-
float signX = sign( v.x );
|
|
1844
|
-
planar.x = v.z * signX + 2.0 * signX;
|
|
1845
|
-
} else if ( absV.y >= almostOne ) {
|
|
1846
|
-
float signY = sign( v.y );
|
|
1847
|
-
planar.x = v.x + 2.0 * signY + 2.0;
|
|
1848
|
-
planar.y = v.z * signY - 2.0;
|
|
1849
|
-
}
|
|
1850
|
-
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
1851
|
-
}
|
|
1852
|
-
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1853
|
-
float shadow = 1.0;
|
|
1854
|
-
vec3 lightToPosition = shadowCoord.xyz;
|
|
1855
|
-
|
|
1856
|
-
float lightToPositionLength = length( lightToPosition );
|
|
1857
|
-
if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
|
|
1858
|
-
float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
1859
|
-
vec3 bd3D = normalize( lightToPosition );
|
|
1860
|
-
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
1861
|
-
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
1862
|
-
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
1863
|
-
shadow = (
|
|
1864
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
1865
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
1866
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
1867
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
1868
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
1869
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
1870
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
1871
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
1872
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
1873
|
-
) * ( 1.0 / 9.0 );
|
|
1874
|
-
#else
|
|
1875
|
-
shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
1876
|
-
#endif
|
|
1877
|
-
}
|
|
1878
|
-
return shadow;
|
|
1879
|
-
}
|
|
1880
|
-
#endif`,hd=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1881
|
-
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1882
|
-
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1883
|
-
#endif
|
|
1884
|
-
#ifdef USE_SHADOWMAP
|
|
1885
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1886
|
-
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1887
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1888
|
-
struct DirectionalLightShadow {
|
|
1889
|
-
float shadowBias;
|
|
1890
|
-
float shadowNormalBias;
|
|
1891
|
-
float shadowRadius;
|
|
1892
|
-
vec2 shadowMapSize;
|
|
1893
|
-
};
|
|
1894
|
-
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1895
|
-
#endif
|
|
1896
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1897
|
-
struct SpotLightShadow {
|
|
1898
|
-
float shadowBias;
|
|
1899
|
-
float shadowNormalBias;
|
|
1900
|
-
float shadowRadius;
|
|
1901
|
-
vec2 shadowMapSize;
|
|
1902
|
-
};
|
|
1903
|
-
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1904
|
-
#endif
|
|
1905
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1906
|
-
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1907
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1908
|
-
struct PointLightShadow {
|
|
1909
|
-
float shadowBias;
|
|
1910
|
-
float shadowNormalBias;
|
|
1911
|
-
float shadowRadius;
|
|
1912
|
-
vec2 shadowMapSize;
|
|
1913
|
-
float shadowCameraNear;
|
|
1914
|
-
float shadowCameraFar;
|
|
1915
|
-
};
|
|
1916
|
-
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1917
|
-
#endif
|
|
1918
|
-
#endif`,ud=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1919
|
-
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1920
|
-
vec4 shadowWorldPosition;
|
|
1921
|
-
#endif
|
|
1922
|
-
#if defined( USE_SHADOWMAP )
|
|
1923
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1924
|
-
#pragma unroll_loop_start
|
|
1925
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1926
|
-
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
1927
|
-
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
1928
|
-
}
|
|
1929
|
-
#pragma unroll_loop_end
|
|
1930
|
-
#endif
|
|
1931
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1932
|
-
#pragma unroll_loop_start
|
|
1933
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1934
|
-
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
1935
|
-
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
1936
|
-
}
|
|
1937
|
-
#pragma unroll_loop_end
|
|
1938
|
-
#endif
|
|
1939
|
-
#endif
|
|
1940
|
-
#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1941
|
-
#pragma unroll_loop_start
|
|
1942
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
|
1943
|
-
shadowWorldPosition = worldPosition;
|
|
1944
|
-
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1945
|
-
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
|
1946
|
-
#endif
|
|
1947
|
-
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1948
|
-
}
|
|
1949
|
-
#pragma unroll_loop_end
|
|
1950
|
-
#endif`,dd=`float getShadowMask() {
|
|
1951
|
-
float shadow = 1.0;
|
|
1952
|
-
#ifdef USE_SHADOWMAP
|
|
1953
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1954
|
-
DirectionalLightShadow directionalLight;
|
|
1955
|
-
#pragma unroll_loop_start
|
|
1956
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1957
|
-
directionalLight = directionalLightShadows[ i ];
|
|
1958
|
-
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1959
|
-
}
|
|
1960
|
-
#pragma unroll_loop_end
|
|
1961
|
-
#endif
|
|
1962
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1963
|
-
SpotLightShadow spotLight;
|
|
1964
|
-
#pragma unroll_loop_start
|
|
1965
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1966
|
-
spotLight = spotLightShadows[ i ];
|
|
1967
|
-
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
1968
|
-
}
|
|
1969
|
-
#pragma unroll_loop_end
|
|
1970
|
-
#endif
|
|
1971
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1972
|
-
PointLightShadow pointLight;
|
|
1973
|
-
#pragma unroll_loop_start
|
|
1974
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1975
|
-
pointLight = pointLightShadows[ i ];
|
|
1976
|
-
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
1977
|
-
}
|
|
1978
|
-
#pragma unroll_loop_end
|
|
1979
|
-
#endif
|
|
1980
|
-
#endif
|
|
1981
|
-
return shadow;
|
|
1982
|
-
}`,fd=`#ifdef USE_SKINNING
|
|
1983
|
-
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1984
|
-
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1985
|
-
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1986
|
-
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1987
|
-
#endif`,pd=`#ifdef USE_SKINNING
|
|
1988
|
-
uniform mat4 bindMatrix;
|
|
1989
|
-
uniform mat4 bindMatrixInverse;
|
|
1990
|
-
uniform highp sampler2D boneTexture;
|
|
1991
|
-
mat4 getBoneMatrix( const in float i ) {
|
|
1992
|
-
int size = textureSize( boneTexture, 0 ).x;
|
|
1993
|
-
int j = int( i ) * 4;
|
|
1994
|
-
int x = j % size;
|
|
1995
|
-
int y = j / size;
|
|
1996
|
-
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
|
1997
|
-
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
|
1998
|
-
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
|
1999
|
-
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2000
|
-
return mat4( v1, v2, v3, v4 );
|
|
2001
|
-
}
|
|
2002
|
-
#endif`,md=`#ifdef USE_SKINNING
|
|
2003
|
-
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2004
|
-
vec4 skinned = vec4( 0.0 );
|
|
2005
|
-
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
2006
|
-
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
2007
|
-
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2008
|
-
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2009
|
-
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2010
|
-
#endif`,gd=`#ifdef USE_SKINNING
|
|
2011
|
-
mat4 skinMatrix = mat4( 0.0 );
|
|
2012
|
-
skinMatrix += skinWeight.x * boneMatX;
|
|
2013
|
-
skinMatrix += skinWeight.y * boneMatY;
|
|
2014
|
-
skinMatrix += skinWeight.z * boneMatZ;
|
|
2015
|
-
skinMatrix += skinWeight.w * boneMatW;
|
|
2016
|
-
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
2017
|
-
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
2018
|
-
#ifdef USE_TANGENT
|
|
2019
|
-
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2020
|
-
#endif
|
|
2021
|
-
#endif`,_d=`float specularStrength;
|
|
2022
|
-
#ifdef USE_SPECULARMAP
|
|
2023
|
-
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2024
|
-
specularStrength = texelSpecular.r;
|
|
2025
|
-
#else
|
|
2026
|
-
specularStrength = 1.0;
|
|
2027
|
-
#endif`,vd=`#ifdef USE_SPECULARMAP
|
|
2028
|
-
uniform sampler2D specularMap;
|
|
2029
|
-
#endif`,xd=`#if defined( TONE_MAPPING )
|
|
2030
|
-
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2031
|
-
#endif`,Md=`#ifndef saturate
|
|
2032
|
-
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2033
|
-
#endif
|
|
2034
|
-
uniform float toneMappingExposure;
|
|
2035
|
-
vec3 LinearToneMapping( vec3 color ) {
|
|
2036
|
-
return saturate( toneMappingExposure * color );
|
|
2037
|
-
}
|
|
2038
|
-
vec3 ReinhardToneMapping( vec3 color ) {
|
|
2039
|
-
color *= toneMappingExposure;
|
|
2040
|
-
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
2041
|
-
}
|
|
2042
|
-
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
2043
|
-
color *= toneMappingExposure;
|
|
2044
|
-
color = max( vec3( 0.0 ), color - 0.004 );
|
|
2045
|
-
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
2046
|
-
}
|
|
2047
|
-
vec3 RRTAndODTFit( vec3 v ) {
|
|
2048
|
-
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
2049
|
-
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
2050
|
-
return a / b;
|
|
2051
|
-
}
|
|
2052
|
-
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
2053
|
-
const mat3 ACESInputMat = mat3(
|
|
2054
|
-
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
2055
|
-
vec3( 0.04823, 0.01566, 0.83777 )
|
|
2056
|
-
);
|
|
2057
|
-
const mat3 ACESOutputMat = mat3(
|
|
2058
|
-
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
2059
|
-
vec3( -0.07367, -0.00605, 1.07602 )
|
|
2060
|
-
);
|
|
2061
|
-
color *= toneMappingExposure / 0.6;
|
|
2062
|
-
color = ACESInputMat * color;
|
|
2063
|
-
color = RRTAndODTFit( color );
|
|
2064
|
-
color = ACESOutputMat * color;
|
|
2065
|
-
return saturate( color );
|
|
2066
|
-
}
|
|
2067
|
-
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
|
2068
|
-
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
|
2069
|
-
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
|
2070
|
-
vec3( - 0.0728, - 0.0083, 1.1187 )
|
|
2071
|
-
);
|
|
2072
|
-
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
|
2073
|
-
vec3( 0.6274, 0.0691, 0.0164 ),
|
|
2074
|
-
vec3( 0.3293, 0.9195, 0.0880 ),
|
|
2075
|
-
vec3( 0.0433, 0.0113, 0.8956 )
|
|
2076
|
-
);
|
|
2077
|
-
vec3 agxDefaultContrastApprox( vec3 x ) {
|
|
2078
|
-
vec3 x2 = x * x;
|
|
2079
|
-
vec3 x4 = x2 * x2;
|
|
2080
|
-
return + 15.5 * x4 * x2
|
|
2081
|
-
- 40.14 * x4 * x
|
|
2082
|
-
+ 31.96 * x4
|
|
2083
|
-
- 6.868 * x2 * x
|
|
2084
|
-
+ 0.4298 * x2
|
|
2085
|
-
+ 0.1191 * x
|
|
2086
|
-
- 0.00232;
|
|
2087
|
-
}
|
|
2088
|
-
vec3 AgXToneMapping( vec3 color ) {
|
|
2089
|
-
const mat3 AgXInsetMatrix = mat3(
|
|
2090
|
-
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
|
2091
|
-
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
|
2092
|
-
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
|
2093
|
-
);
|
|
2094
|
-
const mat3 AgXOutsetMatrix = mat3(
|
|
2095
|
-
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
|
2096
|
-
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
|
2097
|
-
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
|
2098
|
-
);
|
|
2099
|
-
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
|
2100
|
-
color *= toneMappingExposure;
|
|
2101
|
-
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
|
2102
|
-
color = AgXInsetMatrix * color;
|
|
2103
|
-
color = max( color, 1e-10 ); color = log2( color );
|
|
2104
|
-
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
|
2105
|
-
color = clamp( color, 0.0, 1.0 );
|
|
2106
|
-
color = agxDefaultContrastApprox( color );
|
|
2107
|
-
color = AgXOutsetMatrix * color;
|
|
2108
|
-
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
|
2109
|
-
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
|
2110
|
-
color = clamp( color, 0.0, 1.0 );
|
|
2111
|
-
return color;
|
|
2112
|
-
}
|
|
2113
|
-
vec3 NeutralToneMapping( vec3 color ) {
|
|
2114
|
-
const float StartCompression = 0.8 - 0.04;
|
|
2115
|
-
const float Desaturation = 0.15;
|
|
2116
|
-
color *= toneMappingExposure;
|
|
2117
|
-
float x = min( color.r, min( color.g, color.b ) );
|
|
2118
|
-
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
|
2119
|
-
color -= offset;
|
|
2120
|
-
float peak = max( color.r, max( color.g, color.b ) );
|
|
2121
|
-
if ( peak < StartCompression ) return color;
|
|
2122
|
-
float d = 1. - StartCompression;
|
|
2123
|
-
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
|
2124
|
-
color *= newPeak / peak;
|
|
2125
|
-
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2126
|
-
return mix( color, vec3( newPeak ), g );
|
|
2127
|
-
}
|
|
2128
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,Sd=`#ifdef USE_TRANSMISSION
|
|
2129
|
-
material.transmission = transmission;
|
|
2130
|
-
material.transmissionAlpha = 1.0;
|
|
2131
|
-
material.thickness = thickness;
|
|
2132
|
-
material.attenuationDistance = attenuationDistance;
|
|
2133
|
-
material.attenuationColor = attenuationColor;
|
|
2134
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2135
|
-
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
|
2136
|
-
#endif
|
|
2137
|
-
#ifdef USE_THICKNESSMAP
|
|
2138
|
-
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
|
2139
|
-
#endif
|
|
2140
|
-
vec3 pos = vWorldPosition;
|
|
2141
|
-
vec3 v = normalize( cameraPosition - pos );
|
|
2142
|
-
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
2143
|
-
vec4 transmitted = getIBLVolumeRefraction(
|
|
2144
|
-
n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
|
|
2145
|
-
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
|
|
2146
|
-
material.attenuationColor, material.attenuationDistance );
|
|
2147
|
-
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2148
|
-
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2149
|
-
#endif`,yd=`#ifdef USE_TRANSMISSION
|
|
2150
|
-
uniform float transmission;
|
|
2151
|
-
uniform float thickness;
|
|
2152
|
-
uniform float attenuationDistance;
|
|
2153
|
-
uniform vec3 attenuationColor;
|
|
2154
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2155
|
-
uniform sampler2D transmissionMap;
|
|
2156
|
-
#endif
|
|
2157
|
-
#ifdef USE_THICKNESSMAP
|
|
2158
|
-
uniform sampler2D thicknessMap;
|
|
2159
|
-
#endif
|
|
2160
|
-
uniform vec2 transmissionSamplerSize;
|
|
2161
|
-
uniform sampler2D transmissionSamplerMap;
|
|
2162
|
-
uniform mat4 modelMatrix;
|
|
2163
|
-
uniform mat4 projectionMatrix;
|
|
2164
|
-
varying vec3 vWorldPosition;
|
|
2165
|
-
float w0( float a ) {
|
|
2166
|
-
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
|
2167
|
-
}
|
|
2168
|
-
float w1( float a ) {
|
|
2169
|
-
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
|
2170
|
-
}
|
|
2171
|
-
float w2( float a ){
|
|
2172
|
-
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
|
2173
|
-
}
|
|
2174
|
-
float w3( float a ) {
|
|
2175
|
-
return ( 1.0 / 6.0 ) * ( a * a * a );
|
|
2176
|
-
}
|
|
2177
|
-
float g0( float a ) {
|
|
2178
|
-
return w0( a ) + w1( a );
|
|
2179
|
-
}
|
|
2180
|
-
float g1( float a ) {
|
|
2181
|
-
return w2( a ) + w3( a );
|
|
2182
|
-
}
|
|
2183
|
-
float h0( float a ) {
|
|
2184
|
-
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
|
2185
|
-
}
|
|
2186
|
-
float h1( float a ) {
|
|
2187
|
-
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
|
2188
|
-
}
|
|
2189
|
-
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
|
2190
|
-
uv = uv * texelSize.zw + 0.5;
|
|
2191
|
-
vec2 iuv = floor( uv );
|
|
2192
|
-
vec2 fuv = fract( uv );
|
|
2193
|
-
float g0x = g0( fuv.x );
|
|
2194
|
-
float g1x = g1( fuv.x );
|
|
2195
|
-
float h0x = h0( fuv.x );
|
|
2196
|
-
float h1x = h1( fuv.x );
|
|
2197
|
-
float h0y = h0( fuv.y );
|
|
2198
|
-
float h1y = h1( fuv.y );
|
|
2199
|
-
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2200
|
-
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2201
|
-
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2202
|
-
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2203
|
-
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
|
2204
|
-
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
|
2205
|
-
}
|
|
2206
|
-
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
|
2207
|
-
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
|
2208
|
-
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
|
2209
|
-
vec2 fLodSizeInv = 1.0 / fLodSize;
|
|
2210
|
-
vec2 cLodSizeInv = 1.0 / cLodSize;
|
|
2211
|
-
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
|
2212
|
-
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
|
2213
|
-
return mix( fSample, cSample, fract( lod ) );
|
|
2214
|
-
}
|
|
2215
|
-
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
2216
|
-
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
2217
|
-
vec3 modelScale;
|
|
2218
|
-
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
2219
|
-
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
2220
|
-
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
2221
|
-
return normalize( refractionVector ) * thickness * modelScale;
|
|
2222
|
-
}
|
|
2223
|
-
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
2224
|
-
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
2225
|
-
}
|
|
2226
|
-
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
2227
|
-
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
2228
|
-
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
|
2229
|
-
}
|
|
2230
|
-
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2231
|
-
if ( isinf( attenuationDistance ) ) {
|
|
2232
|
-
return vec3( 1.0 );
|
|
2233
|
-
} else {
|
|
2234
|
-
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
2235
|
-
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
2239
|
-
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
2240
|
-
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
|
|
2241
|
-
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2242
|
-
vec4 transmittedLight;
|
|
2243
|
-
vec3 transmittance;
|
|
2244
|
-
#ifdef USE_DISPERSION
|
|
2245
|
-
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
|
2246
|
-
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
|
2247
|
-
for ( int i = 0; i < 3; i ++ ) {
|
|
2248
|
-
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
|
|
2249
|
-
vec3 refractedRayExit = position + transmissionRay;
|
|
2250
|
-
|
|
2251
|
-
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2252
|
-
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2253
|
-
refractionCoords += 1.0;
|
|
2254
|
-
refractionCoords /= 2.0;
|
|
2255
|
-
|
|
2256
|
-
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
|
2257
|
-
transmittedLight[ i ] = transmissionSample[ i ];
|
|
2258
|
-
transmittedLight.a += transmissionSample.a;
|
|
2259
|
-
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
|
2260
|
-
}
|
|
2261
|
-
transmittedLight.a /= 3.0;
|
|
2262
|
-
|
|
2263
|
-
#else
|
|
2264
|
-
|
|
2265
|
-
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
2266
|
-
vec3 refractedRayExit = position + transmissionRay;
|
|
2267
|
-
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2268
|
-
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2269
|
-
refractionCoords += 1.0;
|
|
2270
|
-
refractionCoords /= 2.0;
|
|
2271
|
-
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
2272
|
-
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
2273
|
-
|
|
2274
|
-
#endif
|
|
2275
|
-
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
|
2276
|
-
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
2277
|
-
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2278
|
-
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2279
|
-
}
|
|
2280
|
-
#endif`,Ed=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2281
|
-
varying vec2 vUv;
|
|
2282
|
-
#endif
|
|
2283
|
-
#ifdef USE_MAP
|
|
2284
|
-
varying vec2 vMapUv;
|
|
2285
|
-
#endif
|
|
2286
|
-
#ifdef USE_ALPHAMAP
|
|
2287
|
-
varying vec2 vAlphaMapUv;
|
|
2288
|
-
#endif
|
|
2289
|
-
#ifdef USE_LIGHTMAP
|
|
2290
|
-
varying vec2 vLightMapUv;
|
|
2291
|
-
#endif
|
|
2292
|
-
#ifdef USE_AOMAP
|
|
2293
|
-
varying vec2 vAoMapUv;
|
|
2294
|
-
#endif
|
|
2295
|
-
#ifdef USE_BUMPMAP
|
|
2296
|
-
varying vec2 vBumpMapUv;
|
|
2297
|
-
#endif
|
|
2298
|
-
#ifdef USE_NORMALMAP
|
|
2299
|
-
varying vec2 vNormalMapUv;
|
|
2300
|
-
#endif
|
|
2301
|
-
#ifdef USE_EMISSIVEMAP
|
|
2302
|
-
varying vec2 vEmissiveMapUv;
|
|
2303
|
-
#endif
|
|
2304
|
-
#ifdef USE_METALNESSMAP
|
|
2305
|
-
varying vec2 vMetalnessMapUv;
|
|
2306
|
-
#endif
|
|
2307
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2308
|
-
varying vec2 vRoughnessMapUv;
|
|
2309
|
-
#endif
|
|
2310
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2311
|
-
varying vec2 vAnisotropyMapUv;
|
|
2312
|
-
#endif
|
|
2313
|
-
#ifdef USE_CLEARCOATMAP
|
|
2314
|
-
varying vec2 vClearcoatMapUv;
|
|
2315
|
-
#endif
|
|
2316
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2317
|
-
varying vec2 vClearcoatNormalMapUv;
|
|
2318
|
-
#endif
|
|
2319
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2320
|
-
varying vec2 vClearcoatRoughnessMapUv;
|
|
2321
|
-
#endif
|
|
2322
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2323
|
-
varying vec2 vIridescenceMapUv;
|
|
2324
|
-
#endif
|
|
2325
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2326
|
-
varying vec2 vIridescenceThicknessMapUv;
|
|
2327
|
-
#endif
|
|
2328
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2329
|
-
varying vec2 vSheenColorMapUv;
|
|
2330
|
-
#endif
|
|
2331
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2332
|
-
varying vec2 vSheenRoughnessMapUv;
|
|
2333
|
-
#endif
|
|
2334
|
-
#ifdef USE_SPECULARMAP
|
|
2335
|
-
varying vec2 vSpecularMapUv;
|
|
2336
|
-
#endif
|
|
2337
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2338
|
-
varying vec2 vSpecularColorMapUv;
|
|
2339
|
-
#endif
|
|
2340
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2341
|
-
varying vec2 vSpecularIntensityMapUv;
|
|
2342
|
-
#endif
|
|
2343
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2344
|
-
uniform mat3 transmissionMapTransform;
|
|
2345
|
-
varying vec2 vTransmissionMapUv;
|
|
2346
|
-
#endif
|
|
2347
|
-
#ifdef USE_THICKNESSMAP
|
|
2348
|
-
uniform mat3 thicknessMapTransform;
|
|
2349
|
-
varying vec2 vThicknessMapUv;
|
|
2350
|
-
#endif`,Td=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2351
|
-
varying vec2 vUv;
|
|
2352
|
-
#endif
|
|
2353
|
-
#ifdef USE_MAP
|
|
2354
|
-
uniform mat3 mapTransform;
|
|
2355
|
-
varying vec2 vMapUv;
|
|
2356
|
-
#endif
|
|
2357
|
-
#ifdef USE_ALPHAMAP
|
|
2358
|
-
uniform mat3 alphaMapTransform;
|
|
2359
|
-
varying vec2 vAlphaMapUv;
|
|
2360
|
-
#endif
|
|
2361
|
-
#ifdef USE_LIGHTMAP
|
|
2362
|
-
uniform mat3 lightMapTransform;
|
|
2363
|
-
varying vec2 vLightMapUv;
|
|
2364
|
-
#endif
|
|
2365
|
-
#ifdef USE_AOMAP
|
|
2366
|
-
uniform mat3 aoMapTransform;
|
|
2367
|
-
varying vec2 vAoMapUv;
|
|
2368
|
-
#endif
|
|
2369
|
-
#ifdef USE_BUMPMAP
|
|
2370
|
-
uniform mat3 bumpMapTransform;
|
|
2371
|
-
varying vec2 vBumpMapUv;
|
|
2372
|
-
#endif
|
|
2373
|
-
#ifdef USE_NORMALMAP
|
|
2374
|
-
uniform mat3 normalMapTransform;
|
|
2375
|
-
varying vec2 vNormalMapUv;
|
|
2376
|
-
#endif
|
|
2377
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2378
|
-
uniform mat3 displacementMapTransform;
|
|
2379
|
-
varying vec2 vDisplacementMapUv;
|
|
2380
|
-
#endif
|
|
2381
|
-
#ifdef USE_EMISSIVEMAP
|
|
2382
|
-
uniform mat3 emissiveMapTransform;
|
|
2383
|
-
varying vec2 vEmissiveMapUv;
|
|
2384
|
-
#endif
|
|
2385
|
-
#ifdef USE_METALNESSMAP
|
|
2386
|
-
uniform mat3 metalnessMapTransform;
|
|
2387
|
-
varying vec2 vMetalnessMapUv;
|
|
2388
|
-
#endif
|
|
2389
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2390
|
-
uniform mat3 roughnessMapTransform;
|
|
2391
|
-
varying vec2 vRoughnessMapUv;
|
|
2392
|
-
#endif
|
|
2393
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2394
|
-
uniform mat3 anisotropyMapTransform;
|
|
2395
|
-
varying vec2 vAnisotropyMapUv;
|
|
2396
|
-
#endif
|
|
2397
|
-
#ifdef USE_CLEARCOATMAP
|
|
2398
|
-
uniform mat3 clearcoatMapTransform;
|
|
2399
|
-
varying vec2 vClearcoatMapUv;
|
|
2400
|
-
#endif
|
|
2401
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2402
|
-
uniform mat3 clearcoatNormalMapTransform;
|
|
2403
|
-
varying vec2 vClearcoatNormalMapUv;
|
|
2404
|
-
#endif
|
|
2405
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2406
|
-
uniform mat3 clearcoatRoughnessMapTransform;
|
|
2407
|
-
varying vec2 vClearcoatRoughnessMapUv;
|
|
2408
|
-
#endif
|
|
2409
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2410
|
-
uniform mat3 sheenColorMapTransform;
|
|
2411
|
-
varying vec2 vSheenColorMapUv;
|
|
2412
|
-
#endif
|
|
2413
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2414
|
-
uniform mat3 sheenRoughnessMapTransform;
|
|
2415
|
-
varying vec2 vSheenRoughnessMapUv;
|
|
2416
|
-
#endif
|
|
2417
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2418
|
-
uniform mat3 iridescenceMapTransform;
|
|
2419
|
-
varying vec2 vIridescenceMapUv;
|
|
2420
|
-
#endif
|
|
2421
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2422
|
-
uniform mat3 iridescenceThicknessMapTransform;
|
|
2423
|
-
varying vec2 vIridescenceThicknessMapUv;
|
|
2424
|
-
#endif
|
|
2425
|
-
#ifdef USE_SPECULARMAP
|
|
2426
|
-
uniform mat3 specularMapTransform;
|
|
2427
|
-
varying vec2 vSpecularMapUv;
|
|
2428
|
-
#endif
|
|
2429
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2430
|
-
uniform mat3 specularColorMapTransform;
|
|
2431
|
-
varying vec2 vSpecularColorMapUv;
|
|
2432
|
-
#endif
|
|
2433
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2434
|
-
uniform mat3 specularIntensityMapTransform;
|
|
2435
|
-
varying vec2 vSpecularIntensityMapUv;
|
|
2436
|
-
#endif
|
|
2437
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2438
|
-
uniform mat3 transmissionMapTransform;
|
|
2439
|
-
varying vec2 vTransmissionMapUv;
|
|
2440
|
-
#endif
|
|
2441
|
-
#ifdef USE_THICKNESSMAP
|
|
2442
|
-
uniform mat3 thicknessMapTransform;
|
|
2443
|
-
varying vec2 vThicknessMapUv;
|
|
2444
|
-
#endif`,bd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2445
|
-
vUv = vec3( uv, 1 ).xy;
|
|
2446
|
-
#endif
|
|
2447
|
-
#ifdef USE_MAP
|
|
2448
|
-
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
|
2449
|
-
#endif
|
|
2450
|
-
#ifdef USE_ALPHAMAP
|
|
2451
|
-
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
|
2452
|
-
#endif
|
|
2453
|
-
#ifdef USE_LIGHTMAP
|
|
2454
|
-
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
|
2455
|
-
#endif
|
|
2456
|
-
#ifdef USE_AOMAP
|
|
2457
|
-
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
|
2458
|
-
#endif
|
|
2459
|
-
#ifdef USE_BUMPMAP
|
|
2460
|
-
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
|
2461
|
-
#endif
|
|
2462
|
-
#ifdef USE_NORMALMAP
|
|
2463
|
-
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
|
2464
|
-
#endif
|
|
2465
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2466
|
-
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
|
2467
|
-
#endif
|
|
2468
|
-
#ifdef USE_EMISSIVEMAP
|
|
2469
|
-
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
|
2470
|
-
#endif
|
|
2471
|
-
#ifdef USE_METALNESSMAP
|
|
2472
|
-
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
|
2473
|
-
#endif
|
|
2474
|
-
#ifdef USE_ROUGHNESSMAP
|
|
2475
|
-
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2476
|
-
#endif
|
|
2477
|
-
#ifdef USE_ANISOTROPYMAP
|
|
2478
|
-
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
|
2479
|
-
#endif
|
|
2480
|
-
#ifdef USE_CLEARCOATMAP
|
|
2481
|
-
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
|
2482
|
-
#endif
|
|
2483
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2484
|
-
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
|
2485
|
-
#endif
|
|
2486
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2487
|
-
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2488
|
-
#endif
|
|
2489
|
-
#ifdef USE_IRIDESCENCEMAP
|
|
2490
|
-
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
|
2491
|
-
#endif
|
|
2492
|
-
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2493
|
-
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
|
2494
|
-
#endif
|
|
2495
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
2496
|
-
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
|
2497
|
-
#endif
|
|
2498
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2499
|
-
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2500
|
-
#endif
|
|
2501
|
-
#ifdef USE_SPECULARMAP
|
|
2502
|
-
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
|
2503
|
-
#endif
|
|
2504
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
2505
|
-
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
|
2506
|
-
#endif
|
|
2507
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2508
|
-
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
|
2509
|
-
#endif
|
|
2510
|
-
#ifdef USE_TRANSMISSIONMAP
|
|
2511
|
-
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
|
2512
|
-
#endif
|
|
2513
|
-
#ifdef USE_THICKNESSMAP
|
|
2514
|
-
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2515
|
-
#endif`,Ad=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2516
|
-
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2517
|
-
#ifdef USE_BATCHING
|
|
2518
|
-
worldPosition = batchingMatrix * worldPosition;
|
|
2519
|
-
#endif
|
|
2520
|
-
#ifdef USE_INSTANCING
|
|
2521
|
-
worldPosition = instanceMatrix * worldPosition;
|
|
2522
|
-
#endif
|
|
2523
|
-
worldPosition = modelMatrix * worldPosition;
|
|
2524
|
-
#endif`;const wd=`varying vec2 vUv;
|
|
2525
|
-
uniform mat3 uvTransform;
|
|
2526
|
-
void main() {
|
|
2527
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2528
|
-
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2529
|
-
}`,Rd=`uniform sampler2D t2D;
|
|
2530
|
-
uniform float backgroundIntensity;
|
|
2531
|
-
varying vec2 vUv;
|
|
2532
|
-
void main() {
|
|
2533
|
-
vec4 texColor = texture2D( t2D, vUv );
|
|
2534
|
-
#ifdef DECODE_VIDEO_TEXTURE
|
|
2535
|
-
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|
2536
|
-
#endif
|
|
2537
|
-
texColor.rgb *= backgroundIntensity;
|
|
2538
|
-
gl_FragColor = texColor;
|
|
2539
|
-
#include <tonemapping_fragment>
|
|
2540
|
-
#include <colorspace_fragment>
|
|
2541
|
-
}`,Cd=`varying vec3 vWorldDirection;
|
|
2542
|
-
#include <common>
|
|
2543
|
-
void main() {
|
|
2544
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2545
|
-
#include <begin_vertex>
|
|
2546
|
-
#include <project_vertex>
|
|
2547
|
-
gl_Position.z = gl_Position.w;
|
|
2548
|
-
}`,Pd=`#ifdef ENVMAP_TYPE_CUBE
|
|
2549
|
-
uniform samplerCube envMap;
|
|
2550
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2551
|
-
uniform sampler2D envMap;
|
|
2552
|
-
#endif
|
|
2553
|
-
uniform float flipEnvMap;
|
|
2554
|
-
uniform float backgroundBlurriness;
|
|
2555
|
-
uniform float backgroundIntensity;
|
|
2556
|
-
uniform mat3 backgroundRotation;
|
|
2557
|
-
varying vec3 vWorldDirection;
|
|
2558
|
-
#include <cube_uv_reflection_fragment>
|
|
2559
|
-
void main() {
|
|
2560
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
2561
|
-
vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
|
|
2562
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2563
|
-
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
|
2564
|
-
#else
|
|
2565
|
-
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2566
|
-
#endif
|
|
2567
|
-
texColor.rgb *= backgroundIntensity;
|
|
2568
|
-
gl_FragColor = texColor;
|
|
2569
|
-
#include <tonemapping_fragment>
|
|
2570
|
-
#include <colorspace_fragment>
|
|
2571
|
-
}`,Ld=`varying vec3 vWorldDirection;
|
|
2572
|
-
#include <common>
|
|
2573
|
-
void main() {
|
|
2574
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2575
|
-
#include <begin_vertex>
|
|
2576
|
-
#include <project_vertex>
|
|
2577
|
-
gl_Position.z = gl_Position.w;
|
|
2578
|
-
}`,Dd=`uniform samplerCube tCube;
|
|
2579
|
-
uniform float tFlip;
|
|
2580
|
-
uniform float opacity;
|
|
2581
|
-
varying vec3 vWorldDirection;
|
|
2582
|
-
void main() {
|
|
2583
|
-
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
|
2584
|
-
gl_FragColor = texColor;
|
|
2585
|
-
gl_FragColor.a *= opacity;
|
|
2586
|
-
#include <tonemapping_fragment>
|
|
2587
|
-
#include <colorspace_fragment>
|
|
2588
|
-
}`,Id=`#include <common>
|
|
2589
|
-
#include <batching_pars_vertex>
|
|
2590
|
-
#include <uv_pars_vertex>
|
|
2591
|
-
#include <displacementmap_pars_vertex>
|
|
2592
|
-
#include <morphtarget_pars_vertex>
|
|
2593
|
-
#include <skinning_pars_vertex>
|
|
2594
|
-
#include <logdepthbuf_pars_vertex>
|
|
2595
|
-
#include <clipping_planes_pars_vertex>
|
|
2596
|
-
varying vec2 vHighPrecisionZW;
|
|
2597
|
-
void main() {
|
|
2598
|
-
#include <uv_vertex>
|
|
2599
|
-
#include <batching_vertex>
|
|
2600
|
-
#include <skinbase_vertex>
|
|
2601
|
-
#include <morphinstance_vertex>
|
|
2602
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2603
|
-
#include <beginnormal_vertex>
|
|
2604
|
-
#include <morphnormal_vertex>
|
|
2605
|
-
#include <skinnormal_vertex>
|
|
2606
|
-
#endif
|
|
2607
|
-
#include <begin_vertex>
|
|
2608
|
-
#include <morphtarget_vertex>
|
|
2609
|
-
#include <skinning_vertex>
|
|
2610
|
-
#include <displacementmap_vertex>
|
|
2611
|
-
#include <project_vertex>
|
|
2612
|
-
#include <logdepthbuf_vertex>
|
|
2613
|
-
#include <clipping_planes_vertex>
|
|
2614
|
-
vHighPrecisionZW = gl_Position.zw;
|
|
2615
|
-
}`,Ud=`#if DEPTH_PACKING == 3200
|
|
2616
|
-
uniform float opacity;
|
|
2617
|
-
#endif
|
|
2618
|
-
#include <common>
|
|
2619
|
-
#include <packing>
|
|
2620
|
-
#include <uv_pars_fragment>
|
|
2621
|
-
#include <map_pars_fragment>
|
|
2622
|
-
#include <alphamap_pars_fragment>
|
|
2623
|
-
#include <alphatest_pars_fragment>
|
|
2624
|
-
#include <alphahash_pars_fragment>
|
|
2625
|
-
#include <logdepthbuf_pars_fragment>
|
|
2626
|
-
#include <clipping_planes_pars_fragment>
|
|
2627
|
-
varying vec2 vHighPrecisionZW;
|
|
2628
|
-
void main() {
|
|
2629
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2630
|
-
#include <clipping_planes_fragment>
|
|
2631
|
-
#if DEPTH_PACKING == 3200
|
|
2632
|
-
diffuseColor.a = opacity;
|
|
2633
|
-
#endif
|
|
2634
|
-
#include <map_fragment>
|
|
2635
|
-
#include <alphamap_fragment>
|
|
2636
|
-
#include <alphatest_fragment>
|
|
2637
|
-
#include <alphahash_fragment>
|
|
2638
|
-
#include <logdepthbuf_fragment>
|
|
2639
|
-
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
2640
|
-
#if DEPTH_PACKING == 3200
|
|
2641
|
-
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
2642
|
-
#elif DEPTH_PACKING == 3201
|
|
2643
|
-
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2644
|
-
#endif
|
|
2645
|
-
}`,Nd=`#define DISTANCE
|
|
2646
|
-
varying vec3 vWorldPosition;
|
|
2647
|
-
#include <common>
|
|
2648
|
-
#include <batching_pars_vertex>
|
|
2649
|
-
#include <uv_pars_vertex>
|
|
2650
|
-
#include <displacementmap_pars_vertex>
|
|
2651
|
-
#include <morphtarget_pars_vertex>
|
|
2652
|
-
#include <skinning_pars_vertex>
|
|
2653
|
-
#include <clipping_planes_pars_vertex>
|
|
2654
|
-
void main() {
|
|
2655
|
-
#include <uv_vertex>
|
|
2656
|
-
#include <batching_vertex>
|
|
2657
|
-
#include <skinbase_vertex>
|
|
2658
|
-
#include <morphinstance_vertex>
|
|
2659
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2660
|
-
#include <beginnormal_vertex>
|
|
2661
|
-
#include <morphnormal_vertex>
|
|
2662
|
-
#include <skinnormal_vertex>
|
|
2663
|
-
#endif
|
|
2664
|
-
#include <begin_vertex>
|
|
2665
|
-
#include <morphtarget_vertex>
|
|
2666
|
-
#include <skinning_vertex>
|
|
2667
|
-
#include <displacementmap_vertex>
|
|
2668
|
-
#include <project_vertex>
|
|
2669
|
-
#include <worldpos_vertex>
|
|
2670
|
-
#include <clipping_planes_vertex>
|
|
2671
|
-
vWorldPosition = worldPosition.xyz;
|
|
2672
|
-
}`,Fd=`#define DISTANCE
|
|
2673
|
-
uniform vec3 referencePosition;
|
|
2674
|
-
uniform float nearDistance;
|
|
2675
|
-
uniform float farDistance;
|
|
2676
|
-
varying vec3 vWorldPosition;
|
|
2677
|
-
#include <common>
|
|
2678
|
-
#include <packing>
|
|
2679
|
-
#include <uv_pars_fragment>
|
|
2680
|
-
#include <map_pars_fragment>
|
|
2681
|
-
#include <alphamap_pars_fragment>
|
|
2682
|
-
#include <alphatest_pars_fragment>
|
|
2683
|
-
#include <alphahash_pars_fragment>
|
|
2684
|
-
#include <clipping_planes_pars_fragment>
|
|
2685
|
-
void main () {
|
|
2686
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2687
|
-
#include <clipping_planes_fragment>
|
|
2688
|
-
#include <map_fragment>
|
|
2689
|
-
#include <alphamap_fragment>
|
|
2690
|
-
#include <alphatest_fragment>
|
|
2691
|
-
#include <alphahash_fragment>
|
|
2692
|
-
float dist = length( vWorldPosition - referencePosition );
|
|
2693
|
-
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2694
|
-
dist = saturate( dist );
|
|
2695
|
-
gl_FragColor = packDepthToRGBA( dist );
|
|
2696
|
-
}`,Od=`varying vec3 vWorldDirection;
|
|
2697
|
-
#include <common>
|
|
2698
|
-
void main() {
|
|
2699
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2700
|
-
#include <begin_vertex>
|
|
2701
|
-
#include <project_vertex>
|
|
2702
|
-
}`,Bd=`uniform sampler2D tEquirect;
|
|
2703
|
-
varying vec3 vWorldDirection;
|
|
2704
|
-
#include <common>
|
|
2705
|
-
void main() {
|
|
2706
|
-
vec3 direction = normalize( vWorldDirection );
|
|
2707
|
-
vec2 sampleUV = equirectUv( direction );
|
|
2708
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2709
|
-
#include <tonemapping_fragment>
|
|
2710
|
-
#include <colorspace_fragment>
|
|
2711
|
-
}`,zd=`uniform float scale;
|
|
2712
|
-
attribute float lineDistance;
|
|
2713
|
-
varying float vLineDistance;
|
|
2714
|
-
#include <common>
|
|
2715
|
-
#include <uv_pars_vertex>
|
|
2716
|
-
#include <color_pars_vertex>
|
|
2717
|
-
#include <fog_pars_vertex>
|
|
2718
|
-
#include <morphtarget_pars_vertex>
|
|
2719
|
-
#include <logdepthbuf_pars_vertex>
|
|
2720
|
-
#include <clipping_planes_pars_vertex>
|
|
2721
|
-
void main() {
|
|
2722
|
-
vLineDistance = scale * lineDistance;
|
|
2723
|
-
#include <uv_vertex>
|
|
2724
|
-
#include <color_vertex>
|
|
2725
|
-
#include <morphinstance_vertex>
|
|
2726
|
-
#include <morphcolor_vertex>
|
|
2727
|
-
#include <begin_vertex>
|
|
2728
|
-
#include <morphtarget_vertex>
|
|
2729
|
-
#include <project_vertex>
|
|
2730
|
-
#include <logdepthbuf_vertex>
|
|
2731
|
-
#include <clipping_planes_vertex>
|
|
2732
|
-
#include <fog_vertex>
|
|
2733
|
-
}`,Vd=`uniform vec3 diffuse;
|
|
2734
|
-
uniform float opacity;
|
|
2735
|
-
uniform float dashSize;
|
|
2736
|
-
uniform float totalSize;
|
|
2737
|
-
varying float vLineDistance;
|
|
2738
|
-
#include <common>
|
|
2739
|
-
#include <color_pars_fragment>
|
|
2740
|
-
#include <uv_pars_fragment>
|
|
2741
|
-
#include <map_pars_fragment>
|
|
2742
|
-
#include <fog_pars_fragment>
|
|
2743
|
-
#include <logdepthbuf_pars_fragment>
|
|
2744
|
-
#include <clipping_planes_pars_fragment>
|
|
2745
|
-
void main() {
|
|
2746
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2747
|
-
#include <clipping_planes_fragment>
|
|
2748
|
-
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2749
|
-
discard;
|
|
2750
|
-
}
|
|
2751
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
2752
|
-
#include <logdepthbuf_fragment>
|
|
2753
|
-
#include <map_fragment>
|
|
2754
|
-
#include <color_fragment>
|
|
2755
|
-
outgoingLight = diffuseColor.rgb;
|
|
2756
|
-
#include <opaque_fragment>
|
|
2757
|
-
#include <tonemapping_fragment>
|
|
2758
|
-
#include <colorspace_fragment>
|
|
2759
|
-
#include <fog_fragment>
|
|
2760
|
-
#include <premultiplied_alpha_fragment>
|
|
2761
|
-
}`,Hd=`#include <common>
|
|
2762
|
-
#include <batching_pars_vertex>
|
|
2763
|
-
#include <uv_pars_vertex>
|
|
2764
|
-
#include <envmap_pars_vertex>
|
|
2765
|
-
#include <color_pars_vertex>
|
|
2766
|
-
#include <fog_pars_vertex>
|
|
2767
|
-
#include <morphtarget_pars_vertex>
|
|
2768
|
-
#include <skinning_pars_vertex>
|
|
2769
|
-
#include <logdepthbuf_pars_vertex>
|
|
2770
|
-
#include <clipping_planes_pars_vertex>
|
|
2771
|
-
void main() {
|
|
2772
|
-
#include <uv_vertex>
|
|
2773
|
-
#include <color_vertex>
|
|
2774
|
-
#include <morphinstance_vertex>
|
|
2775
|
-
#include <morphcolor_vertex>
|
|
2776
|
-
#include <batching_vertex>
|
|
2777
|
-
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
2778
|
-
#include <beginnormal_vertex>
|
|
2779
|
-
#include <morphnormal_vertex>
|
|
2780
|
-
#include <skinbase_vertex>
|
|
2781
|
-
#include <skinnormal_vertex>
|
|
2782
|
-
#include <defaultnormal_vertex>
|
|
2783
|
-
#endif
|
|
2784
|
-
#include <begin_vertex>
|
|
2785
|
-
#include <morphtarget_vertex>
|
|
2786
|
-
#include <skinning_vertex>
|
|
2787
|
-
#include <project_vertex>
|
|
2788
|
-
#include <logdepthbuf_vertex>
|
|
2789
|
-
#include <clipping_planes_vertex>
|
|
2790
|
-
#include <worldpos_vertex>
|
|
2791
|
-
#include <envmap_vertex>
|
|
2792
|
-
#include <fog_vertex>
|
|
2793
|
-
}`,kd=`uniform vec3 diffuse;
|
|
2794
|
-
uniform float opacity;
|
|
2795
|
-
#ifndef FLAT_SHADED
|
|
2796
|
-
varying vec3 vNormal;
|
|
2797
|
-
#endif
|
|
2798
|
-
#include <common>
|
|
2799
|
-
#include <dithering_pars_fragment>
|
|
2800
|
-
#include <color_pars_fragment>
|
|
2801
|
-
#include <uv_pars_fragment>
|
|
2802
|
-
#include <map_pars_fragment>
|
|
2803
|
-
#include <alphamap_pars_fragment>
|
|
2804
|
-
#include <alphatest_pars_fragment>
|
|
2805
|
-
#include <alphahash_pars_fragment>
|
|
2806
|
-
#include <aomap_pars_fragment>
|
|
2807
|
-
#include <lightmap_pars_fragment>
|
|
2808
|
-
#include <envmap_common_pars_fragment>
|
|
2809
|
-
#include <envmap_pars_fragment>
|
|
2810
|
-
#include <fog_pars_fragment>
|
|
2811
|
-
#include <specularmap_pars_fragment>
|
|
2812
|
-
#include <logdepthbuf_pars_fragment>
|
|
2813
|
-
#include <clipping_planes_pars_fragment>
|
|
2814
|
-
void main() {
|
|
2815
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2816
|
-
#include <clipping_planes_fragment>
|
|
2817
|
-
#include <logdepthbuf_fragment>
|
|
2818
|
-
#include <map_fragment>
|
|
2819
|
-
#include <color_fragment>
|
|
2820
|
-
#include <alphamap_fragment>
|
|
2821
|
-
#include <alphatest_fragment>
|
|
2822
|
-
#include <alphahash_fragment>
|
|
2823
|
-
#include <specularmap_fragment>
|
|
2824
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2825
|
-
#ifdef USE_LIGHTMAP
|
|
2826
|
-
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
2827
|
-
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
|
2828
|
-
#else
|
|
2829
|
-
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2830
|
-
#endif
|
|
2831
|
-
#include <aomap_fragment>
|
|
2832
|
-
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2833
|
-
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2834
|
-
#include <envmap_fragment>
|
|
2835
|
-
#include <opaque_fragment>
|
|
2836
|
-
#include <tonemapping_fragment>
|
|
2837
|
-
#include <colorspace_fragment>
|
|
2838
|
-
#include <fog_fragment>
|
|
2839
|
-
#include <premultiplied_alpha_fragment>
|
|
2840
|
-
#include <dithering_fragment>
|
|
2841
|
-
}`,Gd=`#define LAMBERT
|
|
2842
|
-
varying vec3 vViewPosition;
|
|
2843
|
-
#include <common>
|
|
2844
|
-
#include <batching_pars_vertex>
|
|
2845
|
-
#include <uv_pars_vertex>
|
|
2846
|
-
#include <displacementmap_pars_vertex>
|
|
2847
|
-
#include <envmap_pars_vertex>
|
|
2848
|
-
#include <color_pars_vertex>
|
|
2849
|
-
#include <fog_pars_vertex>
|
|
2850
|
-
#include <normal_pars_vertex>
|
|
2851
|
-
#include <morphtarget_pars_vertex>
|
|
2852
|
-
#include <skinning_pars_vertex>
|
|
2853
|
-
#include <shadowmap_pars_vertex>
|
|
2854
|
-
#include <logdepthbuf_pars_vertex>
|
|
2855
|
-
#include <clipping_planes_pars_vertex>
|
|
2856
|
-
void main() {
|
|
2857
|
-
#include <uv_vertex>
|
|
2858
|
-
#include <color_vertex>
|
|
2859
|
-
#include <morphinstance_vertex>
|
|
2860
|
-
#include <morphcolor_vertex>
|
|
2861
|
-
#include <batching_vertex>
|
|
2862
|
-
#include <beginnormal_vertex>
|
|
2863
|
-
#include <morphnormal_vertex>
|
|
2864
|
-
#include <skinbase_vertex>
|
|
2865
|
-
#include <skinnormal_vertex>
|
|
2866
|
-
#include <defaultnormal_vertex>
|
|
2867
|
-
#include <normal_vertex>
|
|
2868
|
-
#include <begin_vertex>
|
|
2869
|
-
#include <morphtarget_vertex>
|
|
2870
|
-
#include <skinning_vertex>
|
|
2871
|
-
#include <displacementmap_vertex>
|
|
2872
|
-
#include <project_vertex>
|
|
2873
|
-
#include <logdepthbuf_vertex>
|
|
2874
|
-
#include <clipping_planes_vertex>
|
|
2875
|
-
vViewPosition = - mvPosition.xyz;
|
|
2876
|
-
#include <worldpos_vertex>
|
|
2877
|
-
#include <envmap_vertex>
|
|
2878
|
-
#include <shadowmap_vertex>
|
|
2879
|
-
#include <fog_vertex>
|
|
2880
|
-
}`,Wd=`#define LAMBERT
|
|
2881
|
-
uniform vec3 diffuse;
|
|
2882
|
-
uniform vec3 emissive;
|
|
2883
|
-
uniform float opacity;
|
|
2884
|
-
#include <common>
|
|
2885
|
-
#include <packing>
|
|
2886
|
-
#include <dithering_pars_fragment>
|
|
2887
|
-
#include <color_pars_fragment>
|
|
2888
|
-
#include <uv_pars_fragment>
|
|
2889
|
-
#include <map_pars_fragment>
|
|
2890
|
-
#include <alphamap_pars_fragment>
|
|
2891
|
-
#include <alphatest_pars_fragment>
|
|
2892
|
-
#include <alphahash_pars_fragment>
|
|
2893
|
-
#include <aomap_pars_fragment>
|
|
2894
|
-
#include <lightmap_pars_fragment>
|
|
2895
|
-
#include <emissivemap_pars_fragment>
|
|
2896
|
-
#include <envmap_common_pars_fragment>
|
|
2897
|
-
#include <envmap_pars_fragment>
|
|
2898
|
-
#include <fog_pars_fragment>
|
|
2899
|
-
#include <bsdfs>
|
|
2900
|
-
#include <lights_pars_begin>
|
|
2901
|
-
#include <normal_pars_fragment>
|
|
2902
|
-
#include <lights_lambert_pars_fragment>
|
|
2903
|
-
#include <shadowmap_pars_fragment>
|
|
2904
|
-
#include <bumpmap_pars_fragment>
|
|
2905
|
-
#include <normalmap_pars_fragment>
|
|
2906
|
-
#include <specularmap_pars_fragment>
|
|
2907
|
-
#include <logdepthbuf_pars_fragment>
|
|
2908
|
-
#include <clipping_planes_pars_fragment>
|
|
2909
|
-
void main() {
|
|
2910
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2911
|
-
#include <clipping_planes_fragment>
|
|
2912
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2913
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2914
|
-
#include <logdepthbuf_fragment>
|
|
2915
|
-
#include <map_fragment>
|
|
2916
|
-
#include <color_fragment>
|
|
2917
|
-
#include <alphamap_fragment>
|
|
2918
|
-
#include <alphatest_fragment>
|
|
2919
|
-
#include <alphahash_fragment>
|
|
2920
|
-
#include <specularmap_fragment>
|
|
2921
|
-
#include <normal_fragment_begin>
|
|
2922
|
-
#include <normal_fragment_maps>
|
|
2923
|
-
#include <emissivemap_fragment>
|
|
2924
|
-
#include <lights_lambert_fragment>
|
|
2925
|
-
#include <lights_fragment_begin>
|
|
2926
|
-
#include <lights_fragment_maps>
|
|
2927
|
-
#include <lights_fragment_end>
|
|
2928
|
-
#include <aomap_fragment>
|
|
2929
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2930
|
-
#include <envmap_fragment>
|
|
2931
|
-
#include <opaque_fragment>
|
|
2932
|
-
#include <tonemapping_fragment>
|
|
2933
|
-
#include <colorspace_fragment>
|
|
2934
|
-
#include <fog_fragment>
|
|
2935
|
-
#include <premultiplied_alpha_fragment>
|
|
2936
|
-
#include <dithering_fragment>
|
|
2937
|
-
}`,Xd=`#define MATCAP
|
|
2938
|
-
varying vec3 vViewPosition;
|
|
2939
|
-
#include <common>
|
|
2940
|
-
#include <batching_pars_vertex>
|
|
2941
|
-
#include <uv_pars_vertex>
|
|
2942
|
-
#include <color_pars_vertex>
|
|
2943
|
-
#include <displacementmap_pars_vertex>
|
|
2944
|
-
#include <fog_pars_vertex>
|
|
2945
|
-
#include <normal_pars_vertex>
|
|
2946
|
-
#include <morphtarget_pars_vertex>
|
|
2947
|
-
#include <skinning_pars_vertex>
|
|
2948
|
-
#include <logdepthbuf_pars_vertex>
|
|
2949
|
-
#include <clipping_planes_pars_vertex>
|
|
2950
|
-
void main() {
|
|
2951
|
-
#include <uv_vertex>
|
|
2952
|
-
#include <color_vertex>
|
|
2953
|
-
#include <morphinstance_vertex>
|
|
2954
|
-
#include <morphcolor_vertex>
|
|
2955
|
-
#include <batching_vertex>
|
|
2956
|
-
#include <beginnormal_vertex>
|
|
2957
|
-
#include <morphnormal_vertex>
|
|
2958
|
-
#include <skinbase_vertex>
|
|
2959
|
-
#include <skinnormal_vertex>
|
|
2960
|
-
#include <defaultnormal_vertex>
|
|
2961
|
-
#include <normal_vertex>
|
|
2962
|
-
#include <begin_vertex>
|
|
2963
|
-
#include <morphtarget_vertex>
|
|
2964
|
-
#include <skinning_vertex>
|
|
2965
|
-
#include <displacementmap_vertex>
|
|
2966
|
-
#include <project_vertex>
|
|
2967
|
-
#include <logdepthbuf_vertex>
|
|
2968
|
-
#include <clipping_planes_vertex>
|
|
2969
|
-
#include <fog_vertex>
|
|
2970
|
-
vViewPosition = - mvPosition.xyz;
|
|
2971
|
-
}`,qd=`#define MATCAP
|
|
2972
|
-
uniform vec3 diffuse;
|
|
2973
|
-
uniform float opacity;
|
|
2974
|
-
uniform sampler2D matcap;
|
|
2975
|
-
varying vec3 vViewPosition;
|
|
2976
|
-
#include <common>
|
|
2977
|
-
#include <dithering_pars_fragment>
|
|
2978
|
-
#include <color_pars_fragment>
|
|
2979
|
-
#include <uv_pars_fragment>
|
|
2980
|
-
#include <map_pars_fragment>
|
|
2981
|
-
#include <alphamap_pars_fragment>
|
|
2982
|
-
#include <alphatest_pars_fragment>
|
|
2983
|
-
#include <alphahash_pars_fragment>
|
|
2984
|
-
#include <fog_pars_fragment>
|
|
2985
|
-
#include <normal_pars_fragment>
|
|
2986
|
-
#include <bumpmap_pars_fragment>
|
|
2987
|
-
#include <normalmap_pars_fragment>
|
|
2988
|
-
#include <logdepthbuf_pars_fragment>
|
|
2989
|
-
#include <clipping_planes_pars_fragment>
|
|
2990
|
-
void main() {
|
|
2991
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2992
|
-
#include <clipping_planes_fragment>
|
|
2993
|
-
#include <logdepthbuf_fragment>
|
|
2994
|
-
#include <map_fragment>
|
|
2995
|
-
#include <color_fragment>
|
|
2996
|
-
#include <alphamap_fragment>
|
|
2997
|
-
#include <alphatest_fragment>
|
|
2998
|
-
#include <alphahash_fragment>
|
|
2999
|
-
#include <normal_fragment_begin>
|
|
3000
|
-
#include <normal_fragment_maps>
|
|
3001
|
-
vec3 viewDir = normalize( vViewPosition );
|
|
3002
|
-
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
3003
|
-
vec3 y = cross( viewDir, x );
|
|
3004
|
-
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
3005
|
-
#ifdef USE_MATCAP
|
|
3006
|
-
vec4 matcapColor = texture2D( matcap, uv );
|
|
3007
|
-
#else
|
|
3008
|
-
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|
3009
|
-
#endif
|
|
3010
|
-
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
3011
|
-
#include <opaque_fragment>
|
|
3012
|
-
#include <tonemapping_fragment>
|
|
3013
|
-
#include <colorspace_fragment>
|
|
3014
|
-
#include <fog_fragment>
|
|
3015
|
-
#include <premultiplied_alpha_fragment>
|
|
3016
|
-
#include <dithering_fragment>
|
|
3017
|
-
}`,Yd=`#define NORMAL
|
|
3018
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3019
|
-
varying vec3 vViewPosition;
|
|
3020
|
-
#endif
|
|
3021
|
-
#include <common>
|
|
3022
|
-
#include <batching_pars_vertex>
|
|
3023
|
-
#include <uv_pars_vertex>
|
|
3024
|
-
#include <displacementmap_pars_vertex>
|
|
3025
|
-
#include <normal_pars_vertex>
|
|
3026
|
-
#include <morphtarget_pars_vertex>
|
|
3027
|
-
#include <skinning_pars_vertex>
|
|
3028
|
-
#include <logdepthbuf_pars_vertex>
|
|
3029
|
-
#include <clipping_planes_pars_vertex>
|
|
3030
|
-
void main() {
|
|
3031
|
-
#include <uv_vertex>
|
|
3032
|
-
#include <batching_vertex>
|
|
3033
|
-
#include <beginnormal_vertex>
|
|
3034
|
-
#include <morphinstance_vertex>
|
|
3035
|
-
#include <morphnormal_vertex>
|
|
3036
|
-
#include <skinbase_vertex>
|
|
3037
|
-
#include <skinnormal_vertex>
|
|
3038
|
-
#include <defaultnormal_vertex>
|
|
3039
|
-
#include <normal_vertex>
|
|
3040
|
-
#include <begin_vertex>
|
|
3041
|
-
#include <morphtarget_vertex>
|
|
3042
|
-
#include <skinning_vertex>
|
|
3043
|
-
#include <displacementmap_vertex>
|
|
3044
|
-
#include <project_vertex>
|
|
3045
|
-
#include <logdepthbuf_vertex>
|
|
3046
|
-
#include <clipping_planes_vertex>
|
|
3047
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3048
|
-
vViewPosition = - mvPosition.xyz;
|
|
3049
|
-
#endif
|
|
3050
|
-
}`,$d=`#define NORMAL
|
|
3051
|
-
uniform float opacity;
|
|
3052
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3053
|
-
varying vec3 vViewPosition;
|
|
3054
|
-
#endif
|
|
3055
|
-
#include <packing>
|
|
3056
|
-
#include <uv_pars_fragment>
|
|
3057
|
-
#include <normal_pars_fragment>
|
|
3058
|
-
#include <bumpmap_pars_fragment>
|
|
3059
|
-
#include <normalmap_pars_fragment>
|
|
3060
|
-
#include <logdepthbuf_pars_fragment>
|
|
3061
|
-
#include <clipping_planes_pars_fragment>
|
|
3062
|
-
void main() {
|
|
3063
|
-
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
|
3064
|
-
#include <clipping_planes_fragment>
|
|
3065
|
-
#include <logdepthbuf_fragment>
|
|
3066
|
-
#include <normal_fragment_begin>
|
|
3067
|
-
#include <normal_fragment_maps>
|
|
3068
|
-
gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
|
|
3069
|
-
#ifdef OPAQUE
|
|
3070
|
-
gl_FragColor.a = 1.0;
|
|
3071
|
-
#endif
|
|
3072
|
-
}`,Kd=`#define PHONG
|
|
3073
|
-
varying vec3 vViewPosition;
|
|
3074
|
-
#include <common>
|
|
3075
|
-
#include <batching_pars_vertex>
|
|
3076
|
-
#include <uv_pars_vertex>
|
|
3077
|
-
#include <displacementmap_pars_vertex>
|
|
3078
|
-
#include <envmap_pars_vertex>
|
|
3079
|
-
#include <color_pars_vertex>
|
|
3080
|
-
#include <fog_pars_vertex>
|
|
3081
|
-
#include <normal_pars_vertex>
|
|
3082
|
-
#include <morphtarget_pars_vertex>
|
|
3083
|
-
#include <skinning_pars_vertex>
|
|
3084
|
-
#include <shadowmap_pars_vertex>
|
|
3085
|
-
#include <logdepthbuf_pars_vertex>
|
|
3086
|
-
#include <clipping_planes_pars_vertex>
|
|
3087
|
-
void main() {
|
|
3088
|
-
#include <uv_vertex>
|
|
3089
|
-
#include <color_vertex>
|
|
3090
|
-
#include <morphcolor_vertex>
|
|
3091
|
-
#include <batching_vertex>
|
|
3092
|
-
#include <beginnormal_vertex>
|
|
3093
|
-
#include <morphinstance_vertex>
|
|
3094
|
-
#include <morphnormal_vertex>
|
|
3095
|
-
#include <skinbase_vertex>
|
|
3096
|
-
#include <skinnormal_vertex>
|
|
3097
|
-
#include <defaultnormal_vertex>
|
|
3098
|
-
#include <normal_vertex>
|
|
3099
|
-
#include <begin_vertex>
|
|
3100
|
-
#include <morphtarget_vertex>
|
|
3101
|
-
#include <skinning_vertex>
|
|
3102
|
-
#include <displacementmap_vertex>
|
|
3103
|
-
#include <project_vertex>
|
|
3104
|
-
#include <logdepthbuf_vertex>
|
|
3105
|
-
#include <clipping_planes_vertex>
|
|
3106
|
-
vViewPosition = - mvPosition.xyz;
|
|
3107
|
-
#include <worldpos_vertex>
|
|
3108
|
-
#include <envmap_vertex>
|
|
3109
|
-
#include <shadowmap_vertex>
|
|
3110
|
-
#include <fog_vertex>
|
|
3111
|
-
}`,jd=`#define PHONG
|
|
3112
|
-
uniform vec3 diffuse;
|
|
3113
|
-
uniform vec3 emissive;
|
|
3114
|
-
uniform vec3 specular;
|
|
3115
|
-
uniform float shininess;
|
|
3116
|
-
uniform float opacity;
|
|
3117
|
-
#include <common>
|
|
3118
|
-
#include <packing>
|
|
3119
|
-
#include <dithering_pars_fragment>
|
|
3120
|
-
#include <color_pars_fragment>
|
|
3121
|
-
#include <uv_pars_fragment>
|
|
3122
|
-
#include <map_pars_fragment>
|
|
3123
|
-
#include <alphamap_pars_fragment>
|
|
3124
|
-
#include <alphatest_pars_fragment>
|
|
3125
|
-
#include <alphahash_pars_fragment>
|
|
3126
|
-
#include <aomap_pars_fragment>
|
|
3127
|
-
#include <lightmap_pars_fragment>
|
|
3128
|
-
#include <emissivemap_pars_fragment>
|
|
3129
|
-
#include <envmap_common_pars_fragment>
|
|
3130
|
-
#include <envmap_pars_fragment>
|
|
3131
|
-
#include <fog_pars_fragment>
|
|
3132
|
-
#include <bsdfs>
|
|
3133
|
-
#include <lights_pars_begin>
|
|
3134
|
-
#include <normal_pars_fragment>
|
|
3135
|
-
#include <lights_phong_pars_fragment>
|
|
3136
|
-
#include <shadowmap_pars_fragment>
|
|
3137
|
-
#include <bumpmap_pars_fragment>
|
|
3138
|
-
#include <normalmap_pars_fragment>
|
|
3139
|
-
#include <specularmap_pars_fragment>
|
|
3140
|
-
#include <logdepthbuf_pars_fragment>
|
|
3141
|
-
#include <clipping_planes_pars_fragment>
|
|
3142
|
-
void main() {
|
|
3143
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3144
|
-
#include <clipping_planes_fragment>
|
|
3145
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3146
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3147
|
-
#include <logdepthbuf_fragment>
|
|
3148
|
-
#include <map_fragment>
|
|
3149
|
-
#include <color_fragment>
|
|
3150
|
-
#include <alphamap_fragment>
|
|
3151
|
-
#include <alphatest_fragment>
|
|
3152
|
-
#include <alphahash_fragment>
|
|
3153
|
-
#include <specularmap_fragment>
|
|
3154
|
-
#include <normal_fragment_begin>
|
|
3155
|
-
#include <normal_fragment_maps>
|
|
3156
|
-
#include <emissivemap_fragment>
|
|
3157
|
-
#include <lights_phong_fragment>
|
|
3158
|
-
#include <lights_fragment_begin>
|
|
3159
|
-
#include <lights_fragment_maps>
|
|
3160
|
-
#include <lights_fragment_end>
|
|
3161
|
-
#include <aomap_fragment>
|
|
3162
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
3163
|
-
#include <envmap_fragment>
|
|
3164
|
-
#include <opaque_fragment>
|
|
3165
|
-
#include <tonemapping_fragment>
|
|
3166
|
-
#include <colorspace_fragment>
|
|
3167
|
-
#include <fog_fragment>
|
|
3168
|
-
#include <premultiplied_alpha_fragment>
|
|
3169
|
-
#include <dithering_fragment>
|
|
3170
|
-
}`,Zd=`#define STANDARD
|
|
3171
|
-
varying vec3 vViewPosition;
|
|
3172
|
-
#ifdef USE_TRANSMISSION
|
|
3173
|
-
varying vec3 vWorldPosition;
|
|
3174
|
-
#endif
|
|
3175
|
-
#include <common>
|
|
3176
|
-
#include <batching_pars_vertex>
|
|
3177
|
-
#include <uv_pars_vertex>
|
|
3178
|
-
#include <displacementmap_pars_vertex>
|
|
3179
|
-
#include <color_pars_vertex>
|
|
3180
|
-
#include <fog_pars_vertex>
|
|
3181
|
-
#include <normal_pars_vertex>
|
|
3182
|
-
#include <morphtarget_pars_vertex>
|
|
3183
|
-
#include <skinning_pars_vertex>
|
|
3184
|
-
#include <shadowmap_pars_vertex>
|
|
3185
|
-
#include <logdepthbuf_pars_vertex>
|
|
3186
|
-
#include <clipping_planes_pars_vertex>
|
|
3187
|
-
void main() {
|
|
3188
|
-
#include <uv_vertex>
|
|
3189
|
-
#include <color_vertex>
|
|
3190
|
-
#include <morphinstance_vertex>
|
|
3191
|
-
#include <morphcolor_vertex>
|
|
3192
|
-
#include <batching_vertex>
|
|
3193
|
-
#include <beginnormal_vertex>
|
|
3194
|
-
#include <morphnormal_vertex>
|
|
3195
|
-
#include <skinbase_vertex>
|
|
3196
|
-
#include <skinnormal_vertex>
|
|
3197
|
-
#include <defaultnormal_vertex>
|
|
3198
|
-
#include <normal_vertex>
|
|
3199
|
-
#include <begin_vertex>
|
|
3200
|
-
#include <morphtarget_vertex>
|
|
3201
|
-
#include <skinning_vertex>
|
|
3202
|
-
#include <displacementmap_vertex>
|
|
3203
|
-
#include <project_vertex>
|
|
3204
|
-
#include <logdepthbuf_vertex>
|
|
3205
|
-
#include <clipping_planes_vertex>
|
|
3206
|
-
vViewPosition = - mvPosition.xyz;
|
|
3207
|
-
#include <worldpos_vertex>
|
|
3208
|
-
#include <shadowmap_vertex>
|
|
3209
|
-
#include <fog_vertex>
|
|
3210
|
-
#ifdef USE_TRANSMISSION
|
|
3211
|
-
vWorldPosition = worldPosition.xyz;
|
|
3212
|
-
#endif
|
|
3213
|
-
}`,Jd=`#define STANDARD
|
|
3214
|
-
#ifdef PHYSICAL
|
|
3215
|
-
#define IOR
|
|
3216
|
-
#define USE_SPECULAR
|
|
3217
|
-
#endif
|
|
3218
|
-
uniform vec3 diffuse;
|
|
3219
|
-
uniform vec3 emissive;
|
|
3220
|
-
uniform float roughness;
|
|
3221
|
-
uniform float metalness;
|
|
3222
|
-
uniform float opacity;
|
|
3223
|
-
#ifdef IOR
|
|
3224
|
-
uniform float ior;
|
|
3225
|
-
#endif
|
|
3226
|
-
#ifdef USE_SPECULAR
|
|
3227
|
-
uniform float specularIntensity;
|
|
3228
|
-
uniform vec3 specularColor;
|
|
3229
|
-
#ifdef USE_SPECULAR_COLORMAP
|
|
3230
|
-
uniform sampler2D specularColorMap;
|
|
3231
|
-
#endif
|
|
3232
|
-
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
3233
|
-
uniform sampler2D specularIntensityMap;
|
|
3234
|
-
#endif
|
|
3235
|
-
#endif
|
|
3236
|
-
#ifdef USE_CLEARCOAT
|
|
3237
|
-
uniform float clearcoat;
|
|
3238
|
-
uniform float clearcoatRoughness;
|
|
3239
|
-
#endif
|
|
3240
|
-
#ifdef USE_DISPERSION
|
|
3241
|
-
uniform float dispersion;
|
|
3242
|
-
#endif
|
|
3243
|
-
#ifdef USE_IRIDESCENCE
|
|
3244
|
-
uniform float iridescence;
|
|
3245
|
-
uniform float iridescenceIOR;
|
|
3246
|
-
uniform float iridescenceThicknessMinimum;
|
|
3247
|
-
uniform float iridescenceThicknessMaximum;
|
|
3248
|
-
#endif
|
|
3249
|
-
#ifdef USE_SHEEN
|
|
3250
|
-
uniform vec3 sheenColor;
|
|
3251
|
-
uniform float sheenRoughness;
|
|
3252
|
-
#ifdef USE_SHEEN_COLORMAP
|
|
3253
|
-
uniform sampler2D sheenColorMap;
|
|
3254
|
-
#endif
|
|
3255
|
-
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
3256
|
-
uniform sampler2D sheenRoughnessMap;
|
|
3257
|
-
#endif
|
|
3258
|
-
#endif
|
|
3259
|
-
#ifdef USE_ANISOTROPY
|
|
3260
|
-
uniform vec2 anisotropyVector;
|
|
3261
|
-
#ifdef USE_ANISOTROPYMAP
|
|
3262
|
-
uniform sampler2D anisotropyMap;
|
|
3263
|
-
#endif
|
|
3264
|
-
#endif
|
|
3265
|
-
varying vec3 vViewPosition;
|
|
3266
|
-
#include <common>
|
|
3267
|
-
#include <packing>
|
|
3268
|
-
#include <dithering_pars_fragment>
|
|
3269
|
-
#include <color_pars_fragment>
|
|
3270
|
-
#include <uv_pars_fragment>
|
|
3271
|
-
#include <map_pars_fragment>
|
|
3272
|
-
#include <alphamap_pars_fragment>
|
|
3273
|
-
#include <alphatest_pars_fragment>
|
|
3274
|
-
#include <alphahash_pars_fragment>
|
|
3275
|
-
#include <aomap_pars_fragment>
|
|
3276
|
-
#include <lightmap_pars_fragment>
|
|
3277
|
-
#include <emissivemap_pars_fragment>
|
|
3278
|
-
#include <iridescence_fragment>
|
|
3279
|
-
#include <cube_uv_reflection_fragment>
|
|
3280
|
-
#include <envmap_common_pars_fragment>
|
|
3281
|
-
#include <envmap_physical_pars_fragment>
|
|
3282
|
-
#include <fog_pars_fragment>
|
|
3283
|
-
#include <lights_pars_begin>
|
|
3284
|
-
#include <normal_pars_fragment>
|
|
3285
|
-
#include <lights_physical_pars_fragment>
|
|
3286
|
-
#include <transmission_pars_fragment>
|
|
3287
|
-
#include <shadowmap_pars_fragment>
|
|
3288
|
-
#include <bumpmap_pars_fragment>
|
|
3289
|
-
#include <normalmap_pars_fragment>
|
|
3290
|
-
#include <clearcoat_pars_fragment>
|
|
3291
|
-
#include <iridescence_pars_fragment>
|
|
3292
|
-
#include <roughnessmap_pars_fragment>
|
|
3293
|
-
#include <metalnessmap_pars_fragment>
|
|
3294
|
-
#include <logdepthbuf_pars_fragment>
|
|
3295
|
-
#include <clipping_planes_pars_fragment>
|
|
3296
|
-
void main() {
|
|
3297
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3298
|
-
#include <clipping_planes_fragment>
|
|
3299
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3300
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3301
|
-
#include <logdepthbuf_fragment>
|
|
3302
|
-
#include <map_fragment>
|
|
3303
|
-
#include <color_fragment>
|
|
3304
|
-
#include <alphamap_fragment>
|
|
3305
|
-
#include <alphatest_fragment>
|
|
3306
|
-
#include <alphahash_fragment>
|
|
3307
|
-
#include <roughnessmap_fragment>
|
|
3308
|
-
#include <metalnessmap_fragment>
|
|
3309
|
-
#include <normal_fragment_begin>
|
|
3310
|
-
#include <normal_fragment_maps>
|
|
3311
|
-
#include <clearcoat_normal_fragment_begin>
|
|
3312
|
-
#include <clearcoat_normal_fragment_maps>
|
|
3313
|
-
#include <emissivemap_fragment>
|
|
3314
|
-
#include <lights_physical_fragment>
|
|
3315
|
-
#include <lights_fragment_begin>
|
|
3316
|
-
#include <lights_fragment_maps>
|
|
3317
|
-
#include <lights_fragment_end>
|
|
3318
|
-
#include <aomap_fragment>
|
|
3319
|
-
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
3320
|
-
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
3321
|
-
#include <transmission_fragment>
|
|
3322
|
-
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
3323
|
-
#ifdef USE_SHEEN
|
|
3324
|
-
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|
3325
|
-
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
|
|
3326
|
-
#endif
|
|
3327
|
-
#ifdef USE_CLEARCOAT
|
|
3328
|
-
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
|
3329
|
-
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
3330
|
-
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
|
3331
|
-
#endif
|
|
3332
|
-
#include <opaque_fragment>
|
|
3333
|
-
#include <tonemapping_fragment>
|
|
3334
|
-
#include <colorspace_fragment>
|
|
3335
|
-
#include <fog_fragment>
|
|
3336
|
-
#include <premultiplied_alpha_fragment>
|
|
3337
|
-
#include <dithering_fragment>
|
|
3338
|
-
}`,Qd=`#define TOON
|
|
3339
|
-
varying vec3 vViewPosition;
|
|
3340
|
-
#include <common>
|
|
3341
|
-
#include <batching_pars_vertex>
|
|
3342
|
-
#include <uv_pars_vertex>
|
|
3343
|
-
#include <displacementmap_pars_vertex>
|
|
3344
|
-
#include <color_pars_vertex>
|
|
3345
|
-
#include <fog_pars_vertex>
|
|
3346
|
-
#include <normal_pars_vertex>
|
|
3347
|
-
#include <morphtarget_pars_vertex>
|
|
3348
|
-
#include <skinning_pars_vertex>
|
|
3349
|
-
#include <shadowmap_pars_vertex>
|
|
3350
|
-
#include <logdepthbuf_pars_vertex>
|
|
3351
|
-
#include <clipping_planes_pars_vertex>
|
|
3352
|
-
void main() {
|
|
3353
|
-
#include <uv_vertex>
|
|
3354
|
-
#include <color_vertex>
|
|
3355
|
-
#include <morphinstance_vertex>
|
|
3356
|
-
#include <morphcolor_vertex>
|
|
3357
|
-
#include <batching_vertex>
|
|
3358
|
-
#include <beginnormal_vertex>
|
|
3359
|
-
#include <morphnormal_vertex>
|
|
3360
|
-
#include <skinbase_vertex>
|
|
3361
|
-
#include <skinnormal_vertex>
|
|
3362
|
-
#include <defaultnormal_vertex>
|
|
3363
|
-
#include <normal_vertex>
|
|
3364
|
-
#include <begin_vertex>
|
|
3365
|
-
#include <morphtarget_vertex>
|
|
3366
|
-
#include <skinning_vertex>
|
|
3367
|
-
#include <displacementmap_vertex>
|
|
3368
|
-
#include <project_vertex>
|
|
3369
|
-
#include <logdepthbuf_vertex>
|
|
3370
|
-
#include <clipping_planes_vertex>
|
|
3371
|
-
vViewPosition = - mvPosition.xyz;
|
|
3372
|
-
#include <worldpos_vertex>
|
|
3373
|
-
#include <shadowmap_vertex>
|
|
3374
|
-
#include <fog_vertex>
|
|
3375
|
-
}`,tf=`#define TOON
|
|
3376
|
-
uniform vec3 diffuse;
|
|
3377
|
-
uniform vec3 emissive;
|
|
3378
|
-
uniform float opacity;
|
|
3379
|
-
#include <common>
|
|
3380
|
-
#include <packing>
|
|
3381
|
-
#include <dithering_pars_fragment>
|
|
3382
|
-
#include <color_pars_fragment>
|
|
3383
|
-
#include <uv_pars_fragment>
|
|
3384
|
-
#include <map_pars_fragment>
|
|
3385
|
-
#include <alphamap_pars_fragment>
|
|
3386
|
-
#include <alphatest_pars_fragment>
|
|
3387
|
-
#include <alphahash_pars_fragment>
|
|
3388
|
-
#include <aomap_pars_fragment>
|
|
3389
|
-
#include <lightmap_pars_fragment>
|
|
3390
|
-
#include <emissivemap_pars_fragment>
|
|
3391
|
-
#include <gradientmap_pars_fragment>
|
|
3392
|
-
#include <fog_pars_fragment>
|
|
3393
|
-
#include <bsdfs>
|
|
3394
|
-
#include <lights_pars_begin>
|
|
3395
|
-
#include <normal_pars_fragment>
|
|
3396
|
-
#include <lights_toon_pars_fragment>
|
|
3397
|
-
#include <shadowmap_pars_fragment>
|
|
3398
|
-
#include <bumpmap_pars_fragment>
|
|
3399
|
-
#include <normalmap_pars_fragment>
|
|
3400
|
-
#include <logdepthbuf_pars_fragment>
|
|
3401
|
-
#include <clipping_planes_pars_fragment>
|
|
3402
|
-
void main() {
|
|
3403
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3404
|
-
#include <clipping_planes_fragment>
|
|
3405
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3406
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
3407
|
-
#include <logdepthbuf_fragment>
|
|
3408
|
-
#include <map_fragment>
|
|
3409
|
-
#include <color_fragment>
|
|
3410
|
-
#include <alphamap_fragment>
|
|
3411
|
-
#include <alphatest_fragment>
|
|
3412
|
-
#include <alphahash_fragment>
|
|
3413
|
-
#include <normal_fragment_begin>
|
|
3414
|
-
#include <normal_fragment_maps>
|
|
3415
|
-
#include <emissivemap_fragment>
|
|
3416
|
-
#include <lights_toon_fragment>
|
|
3417
|
-
#include <lights_fragment_begin>
|
|
3418
|
-
#include <lights_fragment_maps>
|
|
3419
|
-
#include <lights_fragment_end>
|
|
3420
|
-
#include <aomap_fragment>
|
|
3421
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
3422
|
-
#include <opaque_fragment>
|
|
3423
|
-
#include <tonemapping_fragment>
|
|
3424
|
-
#include <colorspace_fragment>
|
|
3425
|
-
#include <fog_fragment>
|
|
3426
|
-
#include <premultiplied_alpha_fragment>
|
|
3427
|
-
#include <dithering_fragment>
|
|
3428
|
-
}`,ef=`uniform float size;
|
|
3429
|
-
uniform float scale;
|
|
3430
|
-
#include <common>
|
|
3431
|
-
#include <color_pars_vertex>
|
|
3432
|
-
#include <fog_pars_vertex>
|
|
3433
|
-
#include <morphtarget_pars_vertex>
|
|
3434
|
-
#include <logdepthbuf_pars_vertex>
|
|
3435
|
-
#include <clipping_planes_pars_vertex>
|
|
3436
|
-
#ifdef USE_POINTS_UV
|
|
3437
|
-
varying vec2 vUv;
|
|
3438
|
-
uniform mat3 uvTransform;
|
|
3439
|
-
#endif
|
|
3440
|
-
void main() {
|
|
3441
|
-
#ifdef USE_POINTS_UV
|
|
3442
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
3443
|
-
#endif
|
|
3444
|
-
#include <color_vertex>
|
|
3445
|
-
#include <morphinstance_vertex>
|
|
3446
|
-
#include <morphcolor_vertex>
|
|
3447
|
-
#include <begin_vertex>
|
|
3448
|
-
#include <morphtarget_vertex>
|
|
3449
|
-
#include <project_vertex>
|
|
3450
|
-
gl_PointSize = size;
|
|
3451
|
-
#ifdef USE_SIZEATTENUATION
|
|
3452
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3453
|
-
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
3454
|
-
#endif
|
|
3455
|
-
#include <logdepthbuf_vertex>
|
|
3456
|
-
#include <clipping_planes_vertex>
|
|
3457
|
-
#include <worldpos_vertex>
|
|
3458
|
-
#include <fog_vertex>
|
|
3459
|
-
}`,nf=`uniform vec3 diffuse;
|
|
3460
|
-
uniform float opacity;
|
|
3461
|
-
#include <common>
|
|
3462
|
-
#include <color_pars_fragment>
|
|
3463
|
-
#include <map_particle_pars_fragment>
|
|
3464
|
-
#include <alphatest_pars_fragment>
|
|
3465
|
-
#include <alphahash_pars_fragment>
|
|
3466
|
-
#include <fog_pars_fragment>
|
|
3467
|
-
#include <logdepthbuf_pars_fragment>
|
|
3468
|
-
#include <clipping_planes_pars_fragment>
|
|
3469
|
-
void main() {
|
|
3470
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3471
|
-
#include <clipping_planes_fragment>
|
|
3472
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
3473
|
-
#include <logdepthbuf_fragment>
|
|
3474
|
-
#include <map_particle_fragment>
|
|
3475
|
-
#include <color_fragment>
|
|
3476
|
-
#include <alphatest_fragment>
|
|
3477
|
-
#include <alphahash_fragment>
|
|
3478
|
-
outgoingLight = diffuseColor.rgb;
|
|
3479
|
-
#include <opaque_fragment>
|
|
3480
|
-
#include <tonemapping_fragment>
|
|
3481
|
-
#include <colorspace_fragment>
|
|
3482
|
-
#include <fog_fragment>
|
|
3483
|
-
#include <premultiplied_alpha_fragment>
|
|
3484
|
-
}`,rf=`#include <common>
|
|
3485
|
-
#include <batching_pars_vertex>
|
|
3486
|
-
#include <fog_pars_vertex>
|
|
3487
|
-
#include <morphtarget_pars_vertex>
|
|
3488
|
-
#include <skinning_pars_vertex>
|
|
3489
|
-
#include <logdepthbuf_pars_vertex>
|
|
3490
|
-
#include <shadowmap_pars_vertex>
|
|
3491
|
-
void main() {
|
|
3492
|
-
#include <batching_vertex>
|
|
3493
|
-
#include <beginnormal_vertex>
|
|
3494
|
-
#include <morphinstance_vertex>
|
|
3495
|
-
#include <morphnormal_vertex>
|
|
3496
|
-
#include <skinbase_vertex>
|
|
3497
|
-
#include <skinnormal_vertex>
|
|
3498
|
-
#include <defaultnormal_vertex>
|
|
3499
|
-
#include <begin_vertex>
|
|
3500
|
-
#include <morphtarget_vertex>
|
|
3501
|
-
#include <skinning_vertex>
|
|
3502
|
-
#include <project_vertex>
|
|
3503
|
-
#include <logdepthbuf_vertex>
|
|
3504
|
-
#include <worldpos_vertex>
|
|
3505
|
-
#include <shadowmap_vertex>
|
|
3506
|
-
#include <fog_vertex>
|
|
3507
|
-
}`,sf=`uniform vec3 color;
|
|
3508
|
-
uniform float opacity;
|
|
3509
|
-
#include <common>
|
|
3510
|
-
#include <packing>
|
|
3511
|
-
#include <fog_pars_fragment>
|
|
3512
|
-
#include <bsdfs>
|
|
3513
|
-
#include <lights_pars_begin>
|
|
3514
|
-
#include <logdepthbuf_pars_fragment>
|
|
3515
|
-
#include <shadowmap_pars_fragment>
|
|
3516
|
-
#include <shadowmask_pars_fragment>
|
|
3517
|
-
void main() {
|
|
3518
|
-
#include <logdepthbuf_fragment>
|
|
3519
|
-
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
3520
|
-
#include <tonemapping_fragment>
|
|
3521
|
-
#include <colorspace_fragment>
|
|
3522
|
-
#include <fog_fragment>
|
|
3523
|
-
}`,af=`uniform float rotation;
|
|
3524
|
-
uniform vec2 center;
|
|
3525
|
-
#include <common>
|
|
3526
|
-
#include <uv_pars_vertex>
|
|
3527
|
-
#include <fog_pars_vertex>
|
|
3528
|
-
#include <logdepthbuf_pars_vertex>
|
|
3529
|
-
#include <clipping_planes_pars_vertex>
|
|
3530
|
-
void main() {
|
|
3531
|
-
#include <uv_vertex>
|
|
3532
|
-
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
3533
|
-
vec2 scale;
|
|
3534
|
-
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
3535
|
-
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
3536
|
-
#ifndef USE_SIZEATTENUATION
|
|
3537
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3538
|
-
if ( isPerspective ) scale *= - mvPosition.z;
|
|
3539
|
-
#endif
|
|
3540
|
-
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
3541
|
-
vec2 rotatedPosition;
|
|
3542
|
-
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
3543
|
-
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
3544
|
-
mvPosition.xy += rotatedPosition;
|
|
3545
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
3546
|
-
#include <logdepthbuf_vertex>
|
|
3547
|
-
#include <clipping_planes_vertex>
|
|
3548
|
-
#include <fog_vertex>
|
|
3549
|
-
}`,of=`uniform vec3 diffuse;
|
|
3550
|
-
uniform float opacity;
|
|
3551
|
-
#include <common>
|
|
3552
|
-
#include <uv_pars_fragment>
|
|
3553
|
-
#include <map_pars_fragment>
|
|
3554
|
-
#include <alphamap_pars_fragment>
|
|
3555
|
-
#include <alphatest_pars_fragment>
|
|
3556
|
-
#include <alphahash_pars_fragment>
|
|
3557
|
-
#include <fog_pars_fragment>
|
|
3558
|
-
#include <logdepthbuf_pars_fragment>
|
|
3559
|
-
#include <clipping_planes_pars_fragment>
|
|
3560
|
-
void main() {
|
|
3561
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3562
|
-
#include <clipping_planes_fragment>
|
|
3563
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
3564
|
-
#include <logdepthbuf_fragment>
|
|
3565
|
-
#include <map_fragment>
|
|
3566
|
-
#include <alphamap_fragment>
|
|
3567
|
-
#include <alphatest_fragment>
|
|
3568
|
-
#include <alphahash_fragment>
|
|
3569
|
-
outgoingLight = diffuseColor.rgb;
|
|
3570
|
-
#include <opaque_fragment>
|
|
3571
|
-
#include <tonemapping_fragment>
|
|
3572
|
-
#include <colorspace_fragment>
|
|
3573
|
-
#include <fog_fragment>
|
|
3574
|
-
}`,Et={alphahash_fragment:Rh,alphahash_pars_fragment:Ch,alphamap_fragment:Ph,alphamap_pars_fragment:Lh,alphatest_fragment:Dh,alphatest_pars_fragment:Ih,aomap_fragment:Uh,aomap_pars_fragment:Nh,batching_pars_vertex:Fh,batching_vertex:Oh,begin_vertex:Bh,beginnormal_vertex:zh,bsdfs:Vh,iridescence_fragment:Hh,bumpmap_pars_fragment:kh,clipping_planes_fragment:Gh,clipping_planes_pars_fragment:Wh,clipping_planes_pars_vertex:Xh,clipping_planes_vertex:qh,color_fragment:Yh,color_pars_fragment:$h,color_pars_vertex:Kh,color_vertex:jh,common:Zh,cube_uv_reflection_fragment:Jh,defaultnormal_vertex:Qh,displacementmap_pars_vertex:tu,displacementmap_vertex:eu,emissivemap_fragment:nu,emissivemap_pars_fragment:iu,colorspace_fragment:ru,colorspace_pars_fragment:su,envmap_fragment:au,envmap_common_pars_fragment:ou,envmap_pars_fragment:lu,envmap_pars_vertex:cu,envmap_physical_pars_fragment:Mu,envmap_vertex:hu,fog_vertex:uu,fog_pars_vertex:du,fog_fragment:fu,fog_pars_fragment:pu,gradientmap_pars_fragment:mu,lightmap_pars_fragment:gu,lights_lambert_fragment:_u,lights_lambert_pars_fragment:vu,lights_pars_begin:xu,lights_toon_fragment:Su,lights_toon_pars_fragment:yu,lights_phong_fragment:Eu,lights_phong_pars_fragment:Tu,lights_physical_fragment:bu,lights_physical_pars_fragment:Au,lights_fragment_begin:wu,lights_fragment_maps:Ru,lights_fragment_end:Cu,logdepthbuf_fragment:Pu,logdepthbuf_pars_fragment:Lu,logdepthbuf_pars_vertex:Du,logdepthbuf_vertex:Iu,map_fragment:Uu,map_pars_fragment:Nu,map_particle_fragment:Fu,map_particle_pars_fragment:Ou,metalnessmap_fragment:Bu,metalnessmap_pars_fragment:zu,morphinstance_vertex:Vu,morphcolor_vertex:Hu,morphnormal_vertex:ku,morphtarget_pars_vertex:Gu,morphtarget_vertex:Wu,normal_fragment_begin:Xu,normal_fragment_maps:qu,normal_pars_fragment:Yu,normal_pars_vertex:$u,normal_vertex:Ku,normalmap_pars_fragment:ju,clearcoat_normal_fragment_begin:Zu,clearcoat_normal_fragment_maps:Ju,clearcoat_pars_fragment:Qu,iridescence_pars_fragment:td,opaque_fragment:ed,packing:nd,premultiplied_alpha_fragment:id,project_vertex:rd,dithering_fragment:sd,dithering_pars_fragment:ad,roughnessmap_fragment:od,roughnessmap_pars_fragment:ld,shadowmap_pars_fragment:cd,shadowmap_pars_vertex:hd,shadowmap_vertex:ud,shadowmask_pars_fragment:dd,skinbase_vertex:fd,skinning_pars_vertex:pd,skinning_vertex:md,skinnormal_vertex:gd,specularmap_fragment:_d,specularmap_pars_fragment:vd,tonemapping_fragment:xd,tonemapping_pars_fragment:Md,transmission_fragment:Sd,transmission_pars_fragment:yd,uv_pars_fragment:Ed,uv_pars_vertex:Td,uv_vertex:bd,worldpos_vertex:Ad,background_vert:wd,background_frag:Rd,backgroundCube_vert:Cd,backgroundCube_frag:Pd,cube_vert:Ld,cube_frag:Dd,depth_vert:Id,depth_frag:Ud,distanceRGBA_vert:Nd,distanceRGBA_frag:Fd,equirect_vert:Od,equirect_frag:Bd,linedashed_vert:zd,linedashed_frag:Vd,meshbasic_vert:Hd,meshbasic_frag:kd,meshlambert_vert:Gd,meshlambert_frag:Wd,meshmatcap_vert:Xd,meshmatcap_frag:qd,meshnormal_vert:Yd,meshnormal_frag:$d,meshphong_vert:Kd,meshphong_frag:jd,meshphysical_vert:Zd,meshphysical_frag:Jd,meshtoon_vert:Qd,meshtoon_frag:tf,points_vert:ef,points_frag:nf,shadow_vert:rf,shadow_frag:sf,sprite_vert:af,sprite_frag:of},et={common:{diffuse:{value:new Pt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Tt},alphaMap:{value:null},alphaMapTransform:{value:new Tt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Tt}},envmap:{envMap:{value:null},envMapRotation:{value:new Tt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Tt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Tt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Tt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Tt},normalScale:{value:new Lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Tt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Tt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Tt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Tt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Tt},alphaTest:{value:0},uvTransform:{value:new Tt}},sprite:{diffuse:{value:new Pt(16777215)},opacity:{value:1},center:{value:new Lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Tt},alphaMap:{value:null},alphaMapTransform:{value:new Tt},alphaTest:{value:0}}},Ve={basic:{uniforms:_e([et.common,et.specularmap,et.envmap,et.aomap,et.lightmap,et.fog]),vertexShader:Et.meshbasic_vert,fragmentShader:Et.meshbasic_frag},lambert:{uniforms:_e([et.common,et.specularmap,et.envmap,et.aomap,et.lightmap,et.emissivemap,et.bumpmap,et.normalmap,et.displacementmap,et.fog,et.lights,{emissive:{value:new Pt(0)}}]),vertexShader:Et.meshlambert_vert,fragmentShader:Et.meshlambert_frag},phong:{uniforms:_e([et.common,et.specularmap,et.envmap,et.aomap,et.lightmap,et.emissivemap,et.bumpmap,et.normalmap,et.displacementmap,et.fog,et.lights,{emissive:{value:new Pt(0)},specular:{value:new Pt(1118481)},shininess:{value:30}}]),vertexShader:Et.meshphong_vert,fragmentShader:Et.meshphong_frag},standard:{uniforms:_e([et.common,et.envmap,et.aomap,et.lightmap,et.emissivemap,et.bumpmap,et.normalmap,et.displacementmap,et.roughnessmap,et.metalnessmap,et.fog,et.lights,{emissive:{value:new Pt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag},toon:{uniforms:_e([et.common,et.aomap,et.lightmap,et.emissivemap,et.bumpmap,et.normalmap,et.displacementmap,et.gradientmap,et.fog,et.lights,{emissive:{value:new Pt(0)}}]),vertexShader:Et.meshtoon_vert,fragmentShader:Et.meshtoon_frag},matcap:{uniforms:_e([et.common,et.bumpmap,et.normalmap,et.displacementmap,et.fog,{matcap:{value:null}}]),vertexShader:Et.meshmatcap_vert,fragmentShader:Et.meshmatcap_frag},points:{uniforms:_e([et.points,et.fog]),vertexShader:Et.points_vert,fragmentShader:Et.points_frag},dashed:{uniforms:_e([et.common,et.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Et.linedashed_vert,fragmentShader:Et.linedashed_frag},depth:{uniforms:_e([et.common,et.displacementmap]),vertexShader:Et.depth_vert,fragmentShader:Et.depth_frag},normal:{uniforms:_e([et.common,et.bumpmap,et.normalmap,et.displacementmap,{opacity:{value:1}}]),vertexShader:Et.meshnormal_vert,fragmentShader:Et.meshnormal_frag},sprite:{uniforms:_e([et.sprite,et.fog]),vertexShader:Et.sprite_vert,fragmentShader:Et.sprite_frag},background:{uniforms:{uvTransform:{value:new Tt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Et.background_vert,fragmentShader:Et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Tt}},vertexShader:Et.backgroundCube_vert,fragmentShader:Et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Et.cube_vert,fragmentShader:Et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Et.equirect_vert,fragmentShader:Et.equirect_frag},distanceRGBA:{uniforms:_e([et.common,et.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Et.distanceRGBA_vert,fragmentShader:Et.distanceRGBA_frag},shadow:{uniforms:_e([et.lights,et.fog,{color:{value:new Pt(0)},opacity:{value:1}}]),vertexShader:Et.shadow_vert,fragmentShader:Et.shadow_frag}};Ve.physical={uniforms:_e([Ve.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Tt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Tt},clearcoatNormalScale:{value:new Lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Tt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Tt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Tt},sheen:{value:0},sheenColor:{value:new Pt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Tt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Tt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Tt},transmissionSamplerSize:{value:new Lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Tt},attenuationDistance:{value:0},attenuationColor:{value:new Pt(0)},specularColor:{value:new Pt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Tt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Tt},anisotropyVector:{value:new Lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Tt}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag};const tr={r:0,b:0,g:0},wn=new ke,lf=new Dt;function cf(i,t,e,n,r,s,a){const o=new Pt(0);let l=s===!0?0:1,c,h,d=null,u=0,p=null;function g(E){let S=E.isScene===!0?E.background:null;return S&&S.isTexture&&(S=(E.backgroundBlurriness>0?e:t).get(S)),S}function _(E){let S=!1;const b=g(E);b===null?f(o,l):b&&b.isColor&&(f(b,1),S=!0);const I=i.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,a):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||S)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil)}function m(E,S){const b=g(S);b&&(b.isCubeTexture||b.mapping===Ar)?(h===void 0&&(h=new Re(new Pi(1,1,1),new nn({name:"BackgroundCubeMaterial",uniforms:oi(Ve.backgroundCube.uniforms),vertexShader:Ve.backgroundCube.vertexShader,fragmentShader:Ve.backgroundCube.fragmentShader,side:Se,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(I,A,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),wn.copy(S.backgroundRotation),wn.x*=-1,wn.y*=-1,wn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(wn.y*=-1,wn.z*=-1),h.material.uniforms.envMap.value=b,h.material.uniforms.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(lf.makeRotationFromEuler(wn)),h.material.toneMapped=Xt.getTransfer(b.colorSpace)!==Zt,(d!==b||u!==b.version||p!==i.toneMapping)&&(h.material.needsUpdate=!0,d=b,u=b.version,p=i.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null)):b&&b.isTexture&&(c===void 0&&(c=new Re(new Cr(2,2),new nn({name:"BackgroundMaterial",uniforms:oi(Ve.background.uniforms),vertexShader:Ve.background.vertexShader,fragmentShader:Ve.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=b,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=Xt.getTransfer(b.colorSpace)!==Zt,b.matrixAutoUpdate===!0&&b.updateMatrix(),c.material.uniforms.uvTransform.value.copy(b.matrix),(d!==b||u!==b.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,d=b,u=b.version,p=i.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function f(E,S){E.getRGB(tr,cl(i)),n.buffers.color.setClear(tr.r,tr.g,tr.b,S,a)}return{getClearColor:function(){return o},setClearColor:function(E,S=1){o.set(E),l=S,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,f(o,l)},render:_,addToRenderList:m}}function hf(i,t){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(x,F,W,P,k){let q=!1;const j=d(P,W,F);s!==j&&(s=j,c(s.object)),q=p(x,P,W,k),q&&g(x,P,W,k),k!==null&&t.update(k,i.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,b(x,F,W,P),k!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(k).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function d(x,F,W){const P=W.wireframe===!0;let k=n[x.id];k===void 0&&(k={},n[x.id]=k);let q=k[F.id];q===void 0&&(q={},k[F.id]=q);let j=q[P];return j===void 0&&(j=u(l()),q[P]=j),j}function u(x){const F=[],W=[],P=[];for(let k=0;k<e;k++)F[k]=0,W[k]=0,P[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:W,attributeDivisors:P,object:x,attributes:{},index:null}}function p(x,F,W,P){const k=s.attributes,q=F.attributes;let j=0;const st=W.getAttributes();for(const z in st)if(st[z].location>=0){const Z=k[z];let ft=q[z];if(ft===void 0&&(z==="instanceMatrix"&&x.instanceMatrix&&(ft=x.instanceMatrix),z==="instanceColor"&&x.instanceColor&&(ft=x.instanceColor)),Z===void 0||Z.attribute!==ft||ft&&Z.data!==ft.data)return!0;j++}return s.attributesNum!==j||s.index!==P}function g(x,F,W,P){const k={},q=F.attributes;let j=0;const st=W.getAttributes();for(const z in st)if(st[z].location>=0){let Z=q[z];Z===void 0&&(z==="instanceMatrix"&&x.instanceMatrix&&(Z=x.instanceMatrix),z==="instanceColor"&&x.instanceColor&&(Z=x.instanceColor));const ft={};ft.attribute=Z,Z&&Z.data&&(ft.data=Z.data),k[z]=ft,j++}s.attributes=k,s.attributesNum=j,s.index=P}function _(){const x=s.newAttributes;for(let F=0,W=x.length;F<W;F++)x[F]=0}function m(x){f(x,0)}function f(x,F){const W=s.newAttributes,P=s.enabledAttributes,k=s.attributeDivisors;W[x]=1,P[x]===0&&(i.enableVertexAttribArray(x),P[x]=1),k[x]!==F&&(i.vertexAttribDivisor(x,F),k[x]=F)}function E(){const x=s.newAttributes,F=s.enabledAttributes;for(let W=0,P=F.length;W<P;W++)F[W]!==x[W]&&(i.disableVertexAttribArray(W),F[W]=0)}function S(x,F,W,P,k,q,j){j===!0?i.vertexAttribIPointer(x,F,W,k,q):i.vertexAttribPointer(x,F,W,P,k,q)}function b(x,F,W,P){_();const k=P.attributes,q=W.getAttributes(),j=F.defaultAttributeValues;for(const st in q){const z=q[st];if(z.location>=0){let J=k[st];if(J===void 0&&(st==="instanceMatrix"&&x.instanceMatrix&&(J=x.instanceMatrix),st==="instanceColor"&&x.instanceColor&&(J=x.instanceColor)),J!==void 0){const Z=J.normalized,ft=J.itemSize,It=t.get(J);if(It===void 0)continue;const Yt=It.buffer,H=It.type,Q=It.bytesPerElement,ht=H===i.INT||H===i.UNSIGNED_INT||J.gpuType===Yo;if(J.isInterleavedBufferAttribute){const nt=J.data,Ut=nt.stride,Nt=J.offset;if(nt.isInstancedInterleavedBuffer){for(let D=0;D<z.locationSize;D++)f(z.location+D,nt.meshPerAttribute);x.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=nt.meshPerAttribute*nt.count)}else for(let D=0;D<z.locationSize;D++)m(z.location+D);i.bindBuffer(i.ARRAY_BUFFER,Yt);for(let D=0;D<z.locationSize;D++)S(z.location+D,ft/z.locationSize,H,Z,Ut*Q,(Nt+ft/z.locationSize*D)*Q,ht)}else{if(J.isInstancedBufferAttribute){for(let nt=0;nt<z.locationSize;nt++)f(z.location+nt,J.meshPerAttribute);x.isInstancedMesh!==!0&&P._maxInstanceCount===void 0&&(P._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let nt=0;nt<z.locationSize;nt++)m(z.location+nt);i.bindBuffer(i.ARRAY_BUFFER,Yt);for(let nt=0;nt<z.locationSize;nt++)S(z.location+nt,ft/z.locationSize,H,Z,ft*Q,ft/z.locationSize*nt*Q,ht)}}else if(j!==void 0){const Z=j[st];if(Z!==void 0)switch(Z.length){case 2:i.vertexAttrib2fv(z.location,Z);break;case 3:i.vertexAttrib3fv(z.location,Z);break;case 4:i.vertexAttrib4fv(z.location,Z);break;default:i.vertexAttrib1fv(z.location,Z)}}}}E()}function I(){V();for(const x in n){const F=n[x];for(const W in F){const P=F[W];for(const k in P)h(P[k].object),delete P[k];delete F[W]}delete n[x]}}function A(x){if(n[x.id]===void 0)return;const F=n[x.id];for(const W in F){const P=F[W];for(const k in P)h(P[k].object),delete P[k];delete F[W]}delete n[x.id]}function w(x){for(const F in n){const W=n[F];if(W[x.id]===void 0)continue;const P=W[x.id];for(const k in P)h(P[k].object),delete P[k];delete W[x.id]}}function V(){y(),a=!0,s!==r&&(s=r,c(s.object))}function y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:V,resetDefaultState:y,dispose:I,releaseStatesOfGeometry:A,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function uf(i,t,e){let n;function r(c){n=c}function s(c,h){i.drawArrays(n,c,h),e.update(h,n,1)}function a(c,h,d){d!==0&&(i.drawArraysInstanced(n,c,h,d),e.update(h,n,d))}function o(c,h,d){if(d===0)return;const u=t.get("WEBGL_multi_draw");if(u===null)for(let p=0;p<d;p++)this.render(c[p],h[p]);else{u.multiDrawArraysWEBGL(n,c,0,h,0,d);let p=0;for(let g=0;g<d;g++)p+=h[g];e.update(p,n,1)}}function l(c,h,d,u){if(d===0)return;const p=t.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<c.length;g++)a(c[g],h[g],u[g]);else{p.multiDrawArraysInstancedWEBGL(n,c,0,h,0,u,0,d);let g=0;for(let _=0;_<d;_++)g+=h[_];for(let _=0;_<u.length;_++)e.update(g,n,u[_])}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function df(i,t,e,n){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){const A=t.get("EXT_texture_filter_anisotropic");r=i.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){return!(A!==Fe&&n.convert(A)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const w=A===wr&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(A!==vn&&n.convert(A)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==He&&!w)}function l(A){if(A==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const d=e.logarithmicDepthBuffer===!0,u=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),m=i.getParameter(i.MAX_VERTEX_ATTRIBS),f=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),E=i.getParameter(i.MAX_VARYING_VECTORS),S=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),b=p>0,I=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,maxTextures:u,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:_,maxAttributes:m,maxVertexUniforms:f,maxVaryings:E,maxFragmentUniforms:S,vertexTextures:b,maxSamples:I}}function ff(i){const t=this;let e=null,n=0,r=!1,s=!1;const a=new Cn,o=new Tt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){const p=d.length!==0||u||n!==0||r;return r=u,n=d.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){e=h(d,u,0)},this.setState=function(d,u,p){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!r||g===null||g.length===0||s&&!m)s?h(null):c();else{const E=s?0:n,S=E*4;let b=f.clippingState||null;l.value=b,b=h(g,u,S,p);for(let I=0;I!==S;++I)b[I]=e[I];f.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,u,p,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const f=p+_*4,E=u.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<f)&&(m=new Float32Array(f));for(let S=0,b=p;S!==_;++S,b+=4)a.copy(d[S]).applyMatrix4(E,o),a.normal.toArray(m,b),m[b+3]=a.constant}l.value=m,l.needsUpdate=!0}return t.numPlanes=_,t.numIntersection=0,m}}function pf(i){let t=new WeakMap;function e(a,o){return o===Ss?a.mapping=ii:o===ys&&(a.mapping=ri),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ss||o===ys)if(t.has(a)){const l=t.get(a).texture;return e(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new Th(l.height);return c.fromEquirectangularTexture(i,a),t.set(a,c),a.addEventListener("dispose",r),e(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}class fl extends hl{constructor(t=-1,e=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=r+e,l=r-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const Jn=4,Za=[.125,.215,.35,.446,.526,.582],Dn=20,as=new fl,Ja=new Pt;let os=null,ls=0,cs=0,hs=!1;const Pn=(1+Math.sqrt(5))/2,jn=1/Pn,Qa=[new R(-Pn,jn,0),new R(Pn,jn,0),new R(-jn,0,Pn),new R(jn,0,Pn),new R(0,Pn,-jn),new R(0,Pn,jn),new R(-1,1,-1),new R(1,1,-1),new R(-1,1,1),new R(1,1,1)];class to{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){os=this._renderer.getRenderTarget(),ls=this._renderer.getActiveCubeFace(),cs=this._renderer.getActiveMipmapLevel(),hs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,n,r,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=io(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=no(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(os,ls,cs),this._renderer.xr.enabled=hs,t.scissorTest=!1,er(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ii||t.mapping===ri?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),os=this._renderer.getRenderTarget(),ls=this._renderer.getActiveCubeFace(),cs=this._renderer.getActiveMipmapLevel(),hs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:xe,minFilter:xe,generateMipmaps:!1,type:wr,format:Fe,colorSpace:Mn,depthBuffer:!1},r=eo(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=eo(t,e,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=mf(s)),this._blurMaterial=gf(s,t,e)}return r}_compileMaterial(t){const e=new Re(this._lodPlanes[0],t);this._renderer.compile(e,as)}_sceneToCubeUV(t,e,n,r){const o=new be(90,1,e,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],h=this._renderer,d=h.autoClear,u=h.toneMapping;h.getClearColor(Ja),h.toneMapping=gn,h.autoClear=!1;const p=new al({name:"PMREM.Background",side:Se,depthWrite:!1,depthTest:!1}),g=new Re(new Pi,p);let _=!1;const m=t.background;m?m.isColor&&(p.color.copy(m),t.background=null,_=!0):(p.color.copy(Ja),_=!0);for(let f=0;f<6;f++){const E=f%3;E===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):E===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));const S=this._cubeSize;er(r,E*S,f>2?S:0,S,S),h.setRenderTarget(r),_&&h.render(g,o),h.render(t,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=u,h.autoClear=d,t.background=m}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===ii||t.mapping===ri;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=io()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=no());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Re(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;er(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,as)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Qa[(r-s-1)%Qa.length];this._blur(t,s-1,s,a,o)}e.autoClear=n}_blur(t,e,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",s),this._halfBlur(a,t,n,n,r,"longitudinal",s)}_halfBlur(t,e,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,d=new Re(this._lodPlanes[r],c),u=c.uniforms,p=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Dn-1),_=s/g,m=isFinite(s)?1+Math.floor(h*_):Dn;m>Dn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Dn}`);const f=[];let E=0;for(let w=0;w<Dn;++w){const V=w/_,y=Math.exp(-V*V/2);f.push(y),w===0?E+=y:w<m&&(E+=2*y)}for(let w=0;w<f.length;w++)f[w]=f[w]/E;u.envMap.value=t.texture,u.samples.value=m,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:S}=this;u.dTheta.value=g,u.mipInt.value=S-n;const b=this._sizeLods[r],I=3*b*(r>S-Jn?r-S+Jn:0),A=4*(this._cubeSize-b);er(e,I,A,3*b,2*b),l.setRenderTarget(e),l.render(d,as)}}function mf(i){const t=[],e=[],n=[];let r=i;const s=i-Jn+1+Za.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>i-Jn?l=Za[a-i+Jn-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,g=6,_=3,m=2,f=1,E=new Float32Array(_*g*p),S=new Float32Array(m*g*p),b=new Float32Array(f*g*p);for(let A=0;A<p;A++){const w=A%3*2/3-1,V=A>2?0:-1,y=[w,V,0,w+2/3,V,0,w+2/3,V+1,0,w,V,0,w+2/3,V+1,0,w,V+1,0];E.set(y,_*g*A),S.set(u,m*g*A);const x=[A,A,A,A,A,A];b.set(x,f*g*A)}const I=new Pe;I.setAttribute("position",new Ce(E,_)),I.setAttribute("uv",new Ce(S,m)),I.setAttribute("faceIndex",new Ce(b,f)),t.push(I),r>Jn&&r--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function eo(i,t,e){const n=new xn(i,t,e);return n.texture.mapping=Ar,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function er(i,t,e,n,r){i.viewport.set(t,e,n,r),i.scissor.set(t,e,n,r)}function gf(i,t,e){const n=new Float32Array(Dn),r=new R(0,1,0);return new nn({name:"SphericalGaussianBlur",defines:{n:Dn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ns(),fragmentShader:`
|
|
3575
|
-
|
|
3576
|
-
precision mediump float;
|
|
3577
|
-
precision mediump int;
|
|
3578
|
-
|
|
3579
|
-
varying vec3 vOutputDirection;
|
|
3580
|
-
|
|
3581
|
-
uniform sampler2D envMap;
|
|
3582
|
-
uniform int samples;
|
|
3583
|
-
uniform float weights[ n ];
|
|
3584
|
-
uniform bool latitudinal;
|
|
3585
|
-
uniform float dTheta;
|
|
3586
|
-
uniform float mipInt;
|
|
3587
|
-
uniform vec3 poleAxis;
|
|
3588
|
-
|
|
3589
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
3590
|
-
#include <cube_uv_reflection_fragment>
|
|
3591
|
-
|
|
3592
|
-
vec3 getSample( float theta, vec3 axis ) {
|
|
3593
|
-
|
|
3594
|
-
float cosTheta = cos( theta );
|
|
3595
|
-
// Rodrigues' axis-angle rotation
|
|
3596
|
-
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
3597
|
-
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
3598
|
-
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
3599
|
-
|
|
3600
|
-
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
3601
|
-
|
|
3602
|
-
}
|
|
3603
|
-
|
|
3604
|
-
void main() {
|
|
3605
|
-
|
|
3606
|
-
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
3607
|
-
|
|
3608
|
-
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
3609
|
-
|
|
3610
|
-
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
3611
|
-
|
|
3612
|
-
}
|
|
3613
|
-
|
|
3614
|
-
axis = normalize( axis );
|
|
3615
|
-
|
|
3616
|
-
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
3617
|
-
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
3618
|
-
|
|
3619
|
-
for ( int i = 1; i < n; i++ ) {
|
|
3620
|
-
|
|
3621
|
-
if ( i >= samples ) {
|
|
3622
|
-
|
|
3623
|
-
break;
|
|
3624
|
-
|
|
3625
|
-
}
|
|
3626
|
-
|
|
3627
|
-
float theta = dTheta * float( i );
|
|
3628
|
-
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
3629
|
-
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
3630
|
-
|
|
3631
|
-
}
|
|
3632
|
-
|
|
3633
|
-
}
|
|
3634
|
-
`,blending:mn,depthTest:!1,depthWrite:!1})}function no(){return new nn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ns(),fragmentShader:`
|
|
3635
|
-
|
|
3636
|
-
precision mediump float;
|
|
3637
|
-
precision mediump int;
|
|
3638
|
-
|
|
3639
|
-
varying vec3 vOutputDirection;
|
|
3640
|
-
|
|
3641
|
-
uniform sampler2D envMap;
|
|
3642
|
-
|
|
3643
|
-
#include <common>
|
|
3644
|
-
|
|
3645
|
-
void main() {
|
|
3646
|
-
|
|
3647
|
-
vec3 outputDirection = normalize( vOutputDirection );
|
|
3648
|
-
vec2 uv = equirectUv( outputDirection );
|
|
3649
|
-
|
|
3650
|
-
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3651
|
-
|
|
3652
|
-
}
|
|
3653
|
-
`,blending:mn,depthTest:!1,depthWrite:!1})}function io(){return new nn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ns(),fragmentShader:`
|
|
3654
|
-
|
|
3655
|
-
precision mediump float;
|
|
3656
|
-
precision mediump int;
|
|
3657
|
-
|
|
3658
|
-
uniform float flipEnvMap;
|
|
3659
|
-
|
|
3660
|
-
varying vec3 vOutputDirection;
|
|
3661
|
-
|
|
3662
|
-
uniform samplerCube envMap;
|
|
3663
|
-
|
|
3664
|
-
void main() {
|
|
3665
|
-
|
|
3666
|
-
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3667
|
-
|
|
3668
|
-
}
|
|
3669
|
-
`,blending:mn,depthTest:!1,depthWrite:!1})}function Ns(){return`
|
|
3670
|
-
|
|
3671
|
-
precision mediump float;
|
|
3672
|
-
precision mediump int;
|
|
3673
|
-
|
|
3674
|
-
attribute float faceIndex;
|
|
3675
|
-
|
|
3676
|
-
varying vec3 vOutputDirection;
|
|
3677
|
-
|
|
3678
|
-
// RH coordinate system; PMREM face-indexing convention
|
|
3679
|
-
vec3 getDirection( vec2 uv, float face ) {
|
|
3680
|
-
|
|
3681
|
-
uv = 2.0 * uv - 1.0;
|
|
3682
|
-
|
|
3683
|
-
vec3 direction = vec3( uv, 1.0 );
|
|
3684
|
-
|
|
3685
|
-
if ( face == 0.0 ) {
|
|
3686
|
-
|
|
3687
|
-
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
3688
|
-
|
|
3689
|
-
} else if ( face == 1.0 ) {
|
|
3690
|
-
|
|
3691
|
-
direction = direction.xzy;
|
|
3692
|
-
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
3693
|
-
|
|
3694
|
-
} else if ( face == 2.0 ) {
|
|
3695
|
-
|
|
3696
|
-
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
3697
|
-
|
|
3698
|
-
} else if ( face == 3.0 ) {
|
|
3699
|
-
|
|
3700
|
-
direction = direction.zyx;
|
|
3701
|
-
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
3702
|
-
|
|
3703
|
-
} else if ( face == 4.0 ) {
|
|
3704
|
-
|
|
3705
|
-
direction = direction.xzy;
|
|
3706
|
-
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
3707
|
-
|
|
3708
|
-
} else if ( face == 5.0 ) {
|
|
3709
|
-
|
|
3710
|
-
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
3711
|
-
|
|
3712
|
-
}
|
|
3713
|
-
|
|
3714
|
-
return direction;
|
|
3715
|
-
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
|
-
void main() {
|
|
3719
|
-
|
|
3720
|
-
vOutputDirection = getDirection( uv, faceIndex );
|
|
3721
|
-
gl_Position = vec4( position, 1.0 );
|
|
3722
|
-
|
|
3723
|
-
}
|
|
3724
|
-
`}function _f(i){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ss||l===ys,h=l===ii||l===ri;if(c||h){let d=t.get(o);const u=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==u)return e===null&&(e=new to(i)),d=c?e.fromEquirectangular(o,d):e.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,t.set(o,d),d.texture;if(d!==void 0)return d.texture;{const p=o.image;return c&&p&&p.height>0||h&&p&&r(p)?(e===null&&(e=new to(i)),d=c?e.fromEquirectangular(o):e.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,t.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function a(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:a}}function vf(i){const t={};function e(n){if(t[n]!==void 0)return t[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return t[n]=r,r}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){const r=e(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function xf(i,t,e,n){const r={},s=new WeakMap;function a(d){const u=d.target;u.index!==null&&t.remove(u.index);for(const g in u.attributes)t.remove(u.attributes[g]);for(const g in u.morphAttributes){const _=u.morphAttributes[g];for(let m=0,f=_.length;m<f;m++)t.remove(_[m])}u.removeEventListener("dispose",a),delete r[u.id];const p=s.get(u);p&&(t.remove(p),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,e.memory.geometries--}function o(d,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,e.memory.geometries++),u}function l(d){const u=d.attributes;for(const g in u)t.update(u[g],i.ARRAY_BUFFER);const p=d.morphAttributes;for(const g in p){const _=p[g];for(let m=0,f=_.length;m<f;m++)t.update(_[m],i.ARRAY_BUFFER)}}function c(d){const u=[],p=d.index,g=d.attributes.position;let _=0;if(p!==null){const E=p.array;_=p.version;for(let S=0,b=E.length;S<b;S+=3){const I=E[S+0],A=E[S+1],w=E[S+2];u.push(I,A,A,w,w,I)}}else if(g!==void 0){const E=g.array;_=g.version;for(let S=0,b=E.length/3-1;S<b;S+=3){const I=S+0,A=S+1,w=S+2;u.push(I,A,A,w,w,I)}}else return;const m=new(nl(u)?ll:ol)(u,1);m.version=_;const f=s.get(d);f&&t.remove(f),s.set(d,m)}function h(d){const u=s.get(d);if(u){const p=d.index;p!==null&&u.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function Mf(i,t,e){let n;function r(u){n=u}let s,a;function o(u){s=u.type,a=u.bytesPerElement}function l(u,p){i.drawElements(n,p,s,u*a),e.update(p,n,1)}function c(u,p,g){g!==0&&(i.drawElementsInstanced(n,p,s,u*a,g),e.update(p,n,g))}function h(u,p,g){if(g===0)return;const _=t.get("WEBGL_multi_draw");if(_===null)for(let m=0;m<g;m++)this.render(u[m]/a,p[m]);else{_.multiDrawElementsWEBGL(n,p,0,s,u,0,g);let m=0;for(let f=0;f<g;f++)m+=p[f];e.update(m,n,1)}}function d(u,p,g,_){if(g===0)return;const m=t.get("WEBGL_multi_draw");if(m===null)for(let f=0;f<u.length;f++)c(u[f]/a,p[f],_[f]);else{m.multiDrawElementsInstancedWEBGL(n,p,0,s,u,0,_,0,g);let f=0;for(let E=0;E<g;E++)f+=p[E];for(let E=0;E<_.length;E++)e.update(f,n,_[E])}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function Sf(i){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(e.calls++,a){case i.TRIANGLES:e.triangles+=o*(s/3);break;case i.LINES:e.lines+=o*(s/2);break;case i.LINE_STRIP:e.lines+=o*(s-1);break;case i.LINE_LOOP:e.lines+=o*s;break;case i.POINTS:e.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:r,update:n}}function yf(i,t,e){const n=new WeakMap,r=new qt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0;let u=n.get(o);if(u===void 0||u.count!==d){let y=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",y)};u!==void 0&&u.texture.dispose();const p=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let S=0;p===!0&&(S=1),g===!0&&(S=2),_===!0&&(S=3);let b=o.attributes.position.count*S,I=1;b>t.maxTextureSize&&(I=Math.ceil(b/t.maxTextureSize),b=t.maxTextureSize);const A=new Float32Array(b*I*4*d),w=new Ds(A,b,I,d);w.type=He,w.needsUpdate=!0;const V=S*4;for(let x=0;x<d;x++){const F=m[x],W=f[x],P=E[x],k=b*I*4*x;for(let q=0;q<F.count;q++){const j=q*V;p===!0&&(r.fromBufferAttribute(F,q),A[k+j+0]=r.x,A[k+j+1]=r.y,A[k+j+2]=r.z,A[k+j+3]=0),g===!0&&(r.fromBufferAttribute(W,q),A[k+j+4]=r.x,A[k+j+5]=r.y,A[k+j+6]=r.z,A[k+j+7]=0),_===!0&&(r.fromBufferAttribute(P,q),A[k+j+8]=r.x,A[k+j+9]=r.y,A[k+j+10]=r.z,A[k+j+11]=P.itemSize===4?r.w:1)}}u={count:d,texture:w,size:new Lt(b,I)},n.set(o,u),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,e);else{let p=0;for(let _=0;_<c.length;_++)p+=c[_];const g=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",u.texture,e),l.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function Ef(i,t,e,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,d=t.get(l,h);if(r.get(d)!==c&&(t.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(e.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const u=l.skeleton;r.get(u)!==c&&(u.update(),r.set(u,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:s,dispose:a}}class pl extends ce{constructor(t,e,n,r,s,a,o,l,c,h){if(h=h!==void 0?h:ti,h!==ti&&h!==Ai)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===ti&&(n=si),n===void 0&&h===Ai&&(n=Ri),super(null,r,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=o!==void 0?o:Me,this.minFilter=l!==void 0?l:Me,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}const ml=new ce,gl=new pl(1,1);gl.compareFunction=el;const _l=new Ds,vl=new sh,xl=new ul,ro=[],so=[],ao=new Float32Array(16),oo=new Float32Array(9),lo=new Float32Array(4);function hi(i,t,e){const n=i[0];if(n<=0||n>0)return i;const r=t*e;let s=ro[r];if(s===void 0&&(s=new Float32Array(r),ro[r]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(s,o)}return s}function ae(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function oe(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function Pr(i,t){let e=so[t];e===void 0&&(e=new Int32Array(t),so[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function Tf(i,t){const e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function bf(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ae(e,t))return;i.uniform2fv(this.addr,t),oe(e,t)}}function Af(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(ae(e,t))return;i.uniform3fv(this.addr,t),oe(e,t)}}function wf(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ae(e,t))return;i.uniform4fv(this.addr,t),oe(e,t)}}function Rf(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ae(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),oe(e,t)}else{if(ae(e,n))return;lo.set(n),i.uniformMatrix2fv(this.addr,!1,lo),oe(e,n)}}function Cf(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ae(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),oe(e,t)}else{if(ae(e,n))return;oo.set(n),i.uniformMatrix3fv(this.addr,!1,oo),oe(e,n)}}function Pf(i,t){const e=this.cache,n=t.elements;if(n===void 0){if(ae(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),oe(e,t)}else{if(ae(e,n))return;ao.set(n),i.uniformMatrix4fv(this.addr,!1,ao),oe(e,n)}}function Lf(i,t){const e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function Df(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ae(e,t))return;i.uniform2iv(this.addr,t),oe(e,t)}}function If(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ae(e,t))return;i.uniform3iv(this.addr,t),oe(e,t)}}function Uf(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ae(e,t))return;i.uniform4iv(this.addr,t),oe(e,t)}}function Nf(i,t){const e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function Ff(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(ae(e,t))return;i.uniform2uiv(this.addr,t),oe(e,t)}}function Of(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(ae(e,t))return;i.uniform3uiv(this.addr,t),oe(e,t)}}function Bf(i,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(ae(e,t))return;i.uniform4uiv(this.addr,t),oe(e,t)}}function zf(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const s=this.type===i.SAMPLER_2D_SHADOW?gl:ml;e.setTexture2D(t||s,r)}function Vf(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTexture3D(t||vl,r)}function Hf(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTextureCube(t||xl,r)}function kf(i,t,e){const n=this.cache,r=e.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),e.setTexture2DArray(t||_l,r)}function Gf(i){switch(i){case 5126:return Tf;case 35664:return bf;case 35665:return Af;case 35666:return wf;case 35674:return Rf;case 35675:return Cf;case 35676:return Pf;case 5124:case 35670:return Lf;case 35667:case 35671:return Df;case 35668:case 35672:return If;case 35669:case 35673:return Uf;case 5125:return Nf;case 36294:return Ff;case 36295:return Of;case 36296:return Bf;case 35678:case 36198:case 36298:case 36306:case 35682:return zf;case 35679:case 36299:case 36307:return Vf;case 35680:case 36300:case 36308:case 36293:return Hf;case 36289:case 36303:case 36311:case 36292:return kf}}function Wf(i,t){i.uniform1fv(this.addr,t)}function Xf(i,t){const e=hi(t,this.size,2);i.uniform2fv(this.addr,e)}function qf(i,t){const e=hi(t,this.size,3);i.uniform3fv(this.addr,e)}function Yf(i,t){const e=hi(t,this.size,4);i.uniform4fv(this.addr,e)}function $f(i,t){const e=hi(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function Kf(i,t){const e=hi(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function jf(i,t){const e=hi(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Zf(i,t){i.uniform1iv(this.addr,t)}function Jf(i,t){i.uniform2iv(this.addr,t)}function Qf(i,t){i.uniform3iv(this.addr,t)}function tp(i,t){i.uniform4iv(this.addr,t)}function ep(i,t){i.uniform1uiv(this.addr,t)}function np(i,t){i.uniform2uiv(this.addr,t)}function ip(i,t){i.uniform3uiv(this.addr,t)}function rp(i,t){i.uniform4uiv(this.addr,t)}function sp(i,t,e){const n=this.cache,r=t.length,s=Pr(e,r);ae(n,s)||(i.uniform1iv(this.addr,s),oe(n,s));for(let a=0;a!==r;++a)e.setTexture2D(t[a]||ml,s[a])}function ap(i,t,e){const n=this.cache,r=t.length,s=Pr(e,r);ae(n,s)||(i.uniform1iv(this.addr,s),oe(n,s));for(let a=0;a!==r;++a)e.setTexture3D(t[a]||vl,s[a])}function op(i,t,e){const n=this.cache,r=t.length,s=Pr(e,r);ae(n,s)||(i.uniform1iv(this.addr,s),oe(n,s));for(let a=0;a!==r;++a)e.setTextureCube(t[a]||xl,s[a])}function lp(i,t,e){const n=this.cache,r=t.length,s=Pr(e,r);ae(n,s)||(i.uniform1iv(this.addr,s),oe(n,s));for(let a=0;a!==r;++a)e.setTexture2DArray(t[a]||_l,s[a])}function cp(i){switch(i){case 5126:return Wf;case 35664:return Xf;case 35665:return qf;case 35666:return Yf;case 35674:return $f;case 35675:return Kf;case 35676:return jf;case 5124:case 35670:return Zf;case 35667:case 35671:return Jf;case 35668:case 35672:return Qf;case 35669:case 35673:return tp;case 5125:return ep;case 36294:return np;case 36295:return ip;case 36296:return rp;case 35678:case 36198:case 36298:case 36306:case 35682:return sp;case 35679:case 36299:case 36307:return ap;case 35680:case 36300:case 36308:case 36293:return op;case 36289:case 36303:case 36311:case 36292:return lp}}class hp{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=Gf(e.type)}}class up{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=cp(e.type)}}class dp{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(t,e[o.id],n)}}}const us=/(\w+)(\])?(\[|\.)?/g;function co(i,t){i.seq.push(t),i.map[t.id]=t}function fp(i,t,e){const n=i.name,r=n.length;for(us.lastIndex=0;;){const s=us.exec(n),a=us.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){co(e,c===void 0?new hp(o,i,t):new up(o,i,t));break}else{let d=e.map[o];d===void 0&&(d=new dp(o),co(e,d)),e=d}}}class pr{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=t.getActiveUniform(e,r),a=t.getUniformLocation(e,s.name);fp(s,a,this)}}setValue(t,e,n,r){const s=this.map[e];s!==void 0&&s.setValue(t,n,r)}setOptional(t,e,n){const r=e[n];r!==void 0&&this.setValue(t,n,r)}static upload(t,e,n,r){for(let s=0,a=e.length;s!==a;++s){const o=e[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(t,l.value,r)}}static seqWithValue(t,e){const n=[];for(let r=0,s=t.length;r!==s;++r){const a=t[r];a.id in e&&n.push(a)}return n}}function ho(i,t,e){const n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}const pp=37297;let mp=0;function gp(i,t){const e=i.split(`
|
|
3725
|
-
`),n=[],r=Math.max(t-6,0),s=Math.min(t+6,e.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(`
|
|
3726
|
-
`)}function _p(i){const t=Xt.getPrimaries(Xt.workingColorSpace),e=Xt.getPrimaries(i);let n;switch(t===e?n="":t===Mr&&e===xr?n="LinearDisplayP3ToLinearSRGB":t===xr&&e===Mr&&(n="LinearSRGBToLinearDisplayP3"),i){case Mn:case Rr:return[n,"LinearTransferOETF"];case ze:case Ps:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function uo(i,t,e){const n=i.getShaderParameter(t,i.COMPILE_STATUS),r=i.getShaderInfoLog(t).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return e.toUpperCase()+`
|
|
3727
|
-
|
|
3728
|
-
`+r+`
|
|
3729
|
-
|
|
3730
|
-
`+gp(i.getShaderSource(t),a)}else return r}function vp(i,t){const e=_p(t);return`vec4 ${i}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function xp(i,t){let e;switch(t){case lc:e="Linear";break;case cc:e="Reinhard";break;case hc:e="OptimizedCineon";break;case uc:e="ACESFilmic";break;case fc:e="AgX";break;case pc:e="Neutral";break;case dc:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function Mp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ti).join(`
|
|
3731
|
-
`)}function Sp(i){const t=[];for(const e in i){const n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
|
|
3732
|
-
`)}function yp(i,t){const e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(t,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),e[a]={type:s.type,location:i.getAttribLocation(t,a),locationSize:o}}return e}function Ti(i){return i!==""}function fo(i,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function po(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Ep=/^[ \t]*#include +<([\w\d./]+)>/gm;function As(i){return i.replace(Ep,bp)}const Tp=new Map;function bp(i,t){let e=Et[t];if(e===void 0){const n=Tp.get(t);if(n!==void 0)e=Et[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return As(e)}const Ap=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function mo(i){return i.replace(Ap,wp)}function wp(i,t,e,n){let r="";for(let s=parseInt(t);s<parseInt(e);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function go(i){let t=`precision ${i.precision} float;
|
|
3733
|
-
precision ${i.precision} int;
|
|
3734
|
-
precision ${i.precision} sampler2D;
|
|
3735
|
-
precision ${i.precision} samplerCube;
|
|
3736
|
-
precision ${i.precision} sampler3D;
|
|
3737
|
-
precision ${i.precision} sampler2DArray;
|
|
3738
|
-
precision ${i.precision} sampler2DShadow;
|
|
3739
|
-
precision ${i.precision} samplerCubeShadow;
|
|
3740
|
-
precision ${i.precision} sampler2DArrayShadow;
|
|
3741
|
-
precision ${i.precision} isampler2D;
|
|
3742
|
-
precision ${i.precision} isampler3D;
|
|
3743
|
-
precision ${i.precision} isamplerCube;
|
|
3744
|
-
precision ${i.precision} isampler2DArray;
|
|
3745
|
-
precision ${i.precision} usampler2D;
|
|
3746
|
-
precision ${i.precision} usampler3D;
|
|
3747
|
-
precision ${i.precision} usamplerCube;
|
|
3748
|
-
precision ${i.precision} usampler2DArray;
|
|
3749
|
-
`;return i.precision==="highp"?t+=`
|
|
3750
|
-
#define HIGH_PRECISION`:i.precision==="mediump"?t+=`
|
|
3751
|
-
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=`
|
|
3752
|
-
#define LOW_PRECISION`),t}function Rp(i){let t="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Go?t="SHADOWMAP_TYPE_PCF":i.shadowMapType===Ul?t="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Ze&&(t="SHADOWMAP_TYPE_VSM"),t}function Cp(i){let t="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case ii:case ri:t="ENVMAP_TYPE_CUBE";break;case Ar:t="ENVMAP_TYPE_CUBE_UV";break}return t}function Pp(i){let t="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case ri:t="ENVMAP_MODE_REFRACTION";break}return t}function Lp(i){let t="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Wo:t="ENVMAP_BLENDING_MULTIPLY";break;case ac:t="ENVMAP_BLENDING_MIX";break;case oc:t="ENVMAP_BLENDING_ADD";break}return t}function Dp(i){const t=i.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function Ip(i,t,e,n){const r=i.getContext(),s=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=Rp(e),c=Cp(e),h=Pp(e),d=Lp(e),u=Dp(e),p=Mp(e),g=Sp(s),_=r.createProgram();let m,f,E=e.glslVersion?"#version "+e.glslVersion+`
|
|
3753
|
-
`:"";e.isRawShaderMaterial?(m=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(`
|
|
3754
|
-
`),m.length>0&&(m+=`
|
|
3755
|
-
`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(`
|
|
3756
|
-
`),f.length>0&&(f+=`
|
|
3757
|
-
`)):(m=[go(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
3758
|
-
`].filter(Ti).join(`
|
|
3759
|
-
`),f=[go(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==gn?"#define TONE_MAPPING":"",e.toneMapping!==gn?Et.tonemapping_pars_fragment:"",e.toneMapping!==gn?xp("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Et.colorspace_pars_fragment,vp("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
|
|
3760
|
-
`].filter(Ti).join(`
|
|
3761
|
-
`)),a=As(a),a=fo(a,e),a=po(a,e),o=As(o),o=fo(o,e),o=po(o,e),a=mo(a),o=mo(o),e.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
|
3762
|
-
`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3763
|
-
`)+`
|
|
3764
|
-
`+m,f=["#define varying in",e.glslVersion===Pa?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Pa?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
3765
|
-
`)+`
|
|
3766
|
-
`+f);const S=E+m+a,b=E+f+o,I=ho(r,r.VERTEX_SHADER,S),A=ho(r,r.FRAGMENT_SHADER,b);r.attachShader(_,I),r.attachShader(_,A),e.index0AttributeName!==void 0?r.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function w(F){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(_).trim(),P=r.getShaderInfoLog(I).trim(),k=r.getShaderInfoLog(A).trim();let q=!0,j=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,I,A);else{const st=uo(r,I,"vertex"),z=uo(r,A,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
|
|
3767
|
-
|
|
3768
|
-
Material Name: `+F.name+`
|
|
3769
|
-
Material Type: `+F.type+`
|
|
3770
|
-
|
|
3771
|
-
Program Info Log: `+W+`
|
|
3772
|
-
`+st+`
|
|
3773
|
-
`+z)}else W!==""?console.warn("THREE.WebGLProgram: Program Info Log:",W):(P===""||k==="")&&(j=!1);j&&(F.diagnostics={runnable:q,programLog:W,vertexShader:{log:P,prefix:m},fragmentShader:{log:k,prefix:f}})}r.deleteShader(I),r.deleteShader(A),V=new pr(r,_),y=yp(r,_)}let V;this.getUniforms=function(){return V===void 0&&w(this),V};let y;this.getAttributes=function(){return y===void 0&&w(this),y};let x=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,pp)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=mp++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=A,this}let Up=0;class Np{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Fp(t),e.set(t,n)),n}}class Fp{constructor(t){this.id=Up++,this.code=t,this.usedTimes=0}}function Op(i,t,e,n,r,s,a){const o=new Is,l=new Np,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(y){return c.add(y),y===0?"uv":`uv${y}`}function m(y,x,F,W,P){const k=W.fog,q=P.geometry,j=y.isMeshStandardMaterial?W.environment:null,st=(y.isMeshStandardMaterial?e:t).get(y.envMap||j),z=st&&st.mapping===Ar?st.image.height:null,J=g[y.type];y.precision!==null&&(p=r.getMaxPrecision(y.precision),p!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",p,"instead."));const Z=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,ft=Z!==void 0?Z.length:0;let It=0;q.morphAttributes.position!==void 0&&(It=1),q.morphAttributes.normal!==void 0&&(It=2),q.morphAttributes.color!==void 0&&(It=3);let Yt,H,Q,ht;if(J){const kt=Ve[J];Yt=kt.vertexShader,H=kt.fragmentShader}else Yt=y.vertexShader,H=y.fragmentShader,l.update(y),Q=l.getVertexShaderID(y),ht=l.getFragmentShaderID(y);const nt=i.getRenderTarget(),Ut=P.isInstancedMesh===!0,Nt=P.isBatchedMesh===!0,D=!!y.map,Kt=!!y.matcap,gt=!!st,$t=!!y.aoMap,xt=!!y.lightMap,Ot=!!y.bumpMap,Rt=!!y.normalMap,Bt=!!y.displacementMap,Qt=!!y.emissiveMap,T=!!y.metalnessMap,v=!!y.roughnessMap,B=y.anisotropy>0,X=y.clearcoat>0,$=y.dispersion>0,K=y.iridescence>0,mt=y.sheen>0,ot=y.transmission>0,at=B&&!!y.anisotropyMap,bt=X&&!!y.clearcoatMap,tt=X&&!!y.clearcoatNormalMap,pt=X&&!!y.clearcoatRoughnessMap,zt=K&&!!y.iridescenceMap,_t=K&&!!y.iridescenceThicknessMap,ct=mt&&!!y.sheenColorMap,At=mt&&!!y.sheenRoughnessMap,Ft=!!y.specularMap,ee=!!y.specularColorMap,wt=!!y.specularIntensityMap,C=ot&&!!y.transmissionMap,Y=ot&&!!y.thicknessMap,G=!!y.gradientMap,it=!!y.alphaMap,lt=y.alphaTest>0,Vt=!!y.alphaHash,jt=!!y.extensions;let te=gn;y.toneMapped&&(nt===null||nt.isXRRenderTarget===!0)&&(te=i.toneMapping);const he={shaderID:J,shaderType:y.type,shaderName:y.name,vertexShader:Yt,fragmentShader:H,defines:y.defines,customVertexShaderID:Q,customFragmentShaderID:ht,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:p,batching:Nt,instancing:Ut,instancingColor:Ut&&P.instanceColor!==null,instancingMorph:Ut&&P.morphTexture!==null,supportsVertexTextures:u,outputColorSpace:nt===null?i.outputColorSpace:nt.isXRRenderTarget===!0?nt.texture.colorSpace:Mn,alphaToCoverage:!!y.alphaToCoverage,map:D,matcap:Kt,envMap:gt,envMapMode:gt&&st.mapping,envMapCubeUVHeight:z,aoMap:$t,lightMap:xt,bumpMap:Ot,normalMap:Rt,displacementMap:u&&Bt,emissiveMap:Qt,normalMapObjectSpace:Rt&&y.normalMapType===Cc,normalMapTangentSpace:Rt&&y.normalMapType===tl,metalnessMap:T,roughnessMap:v,anisotropy:B,anisotropyMap:at,clearcoat:X,clearcoatMap:bt,clearcoatNormalMap:tt,clearcoatRoughnessMap:pt,dispersion:$,iridescence:K,iridescenceMap:zt,iridescenceThicknessMap:_t,sheen:mt,sheenColorMap:ct,sheenRoughnessMap:At,specularMap:Ft,specularColorMap:ee,specularIntensityMap:wt,transmission:ot,transmissionMap:C,thicknessMap:Y,gradientMap:G,opaque:y.transparent===!1&&y.blending===Qn&&y.alphaToCoverage===!1,alphaMap:it,alphaTest:lt,alphaHash:Vt,combine:y.combine,mapUv:D&&_(y.map.channel),aoMapUv:$t&&_(y.aoMap.channel),lightMapUv:xt&&_(y.lightMap.channel),bumpMapUv:Ot&&_(y.bumpMap.channel),normalMapUv:Rt&&_(y.normalMap.channel),displacementMapUv:Bt&&_(y.displacementMap.channel),emissiveMapUv:Qt&&_(y.emissiveMap.channel),metalnessMapUv:T&&_(y.metalnessMap.channel),roughnessMapUv:v&&_(y.roughnessMap.channel),anisotropyMapUv:at&&_(y.anisotropyMap.channel),clearcoatMapUv:bt&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:tt&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pt&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:zt&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:_t&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:At&&_(y.sheenRoughnessMap.channel),specularMapUv:Ft&&_(y.specularMap.channel),specularColorMapUv:ee&&_(y.specularColorMap.channel),specularIntensityMapUv:wt&&_(y.specularIntensityMap.channel),transmissionMapUv:C&&_(y.transmissionMap.channel),thicknessMapUv:Y&&_(y.thicknessMap.channel),alphaMapUv:it&&_(y.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(Rt||B),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:P.isPoints===!0&&!!q.attributes.uv&&(D||it),fog:!!k,useFog:y.fog===!0,fogExp2:!!k&&k.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:P.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:ft,morphTextureStride:It,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:te,useLegacyLights:i._useLegacyLights,decodeVideoTexture:D&&y.map.isVideoTexture===!0&&Xt.getTransfer(y.map.colorSpace)===Zt,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Je,flipSided:y.side===Se,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:jt&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:jt&&y.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return he.vertexUv1s=c.has(1),he.vertexUv2s=c.has(2),he.vertexUv3s=c.has(3),c.clear(),he}function f(y){const x=[];if(y.shaderID?x.push(y.shaderID):(x.push(y.customVertexShaderID),x.push(y.customFragmentShaderID)),y.defines!==void 0)for(const F in y.defines)x.push(F),x.push(y.defines[F]);return y.isRawShaderMaterial===!1&&(E(x,y),S(x,y),x.push(i.outputColorSpace)),x.push(y.customProgramCacheKey),x.join()}function E(y,x){y.push(x.precision),y.push(x.outputColorSpace),y.push(x.envMapMode),y.push(x.envMapCubeUVHeight),y.push(x.mapUv),y.push(x.alphaMapUv),y.push(x.lightMapUv),y.push(x.aoMapUv),y.push(x.bumpMapUv),y.push(x.normalMapUv),y.push(x.displacementMapUv),y.push(x.emissiveMapUv),y.push(x.metalnessMapUv),y.push(x.roughnessMapUv),y.push(x.anisotropyMapUv),y.push(x.clearcoatMapUv),y.push(x.clearcoatNormalMapUv),y.push(x.clearcoatRoughnessMapUv),y.push(x.iridescenceMapUv),y.push(x.iridescenceThicknessMapUv),y.push(x.sheenColorMapUv),y.push(x.sheenRoughnessMapUv),y.push(x.specularMapUv),y.push(x.specularColorMapUv),y.push(x.specularIntensityMapUv),y.push(x.transmissionMapUv),y.push(x.thicknessMapUv),y.push(x.combine),y.push(x.fogExp2),y.push(x.sizeAttenuation),y.push(x.morphTargetsCount),y.push(x.morphAttributeCount),y.push(x.numDirLights),y.push(x.numPointLights),y.push(x.numSpotLights),y.push(x.numSpotLightMaps),y.push(x.numHemiLights),y.push(x.numRectAreaLights),y.push(x.numDirLightShadows),y.push(x.numPointLightShadows),y.push(x.numSpotLightShadows),y.push(x.numSpotLightShadowsWithMaps),y.push(x.numLightProbes),y.push(x.shadowMapType),y.push(x.toneMapping),y.push(x.numClippingPlanes),y.push(x.numClipIntersection),y.push(x.depthPacking)}function S(y,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),y.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.skinning&&o.enable(4),x.morphTargets&&o.enable(5),x.morphNormals&&o.enable(6),x.morphColors&&o.enable(7),x.premultipliedAlpha&&o.enable(8),x.shadowMapEnabled&&o.enable(9),x.useLegacyLights&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.alphaToCoverage&&o.enable(20),y.push(o.mask)}function b(y){const x=g[y.type];let F;if(x){const W=Ve[x];F=Mh.clone(W.uniforms)}else F=y.uniforms;return F}function I(y,x){let F;for(let W=0,P=h.length;W<P;W++){const k=h[W];if(k.cacheKey===x){F=k,++F.usedTimes;break}}return F===void 0&&(F=new Ip(i,x,y,s),h.push(F)),F}function A(y){if(--y.usedTimes===0){const x=h.indexOf(y);h[x]=h[h.length-1],h.pop(),y.destroy()}}function w(y){l.remove(y)}function V(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:b,acquireProgram:I,releaseProgram:A,releaseShaderCache:w,programs:h,dispose:V}}function Bp(){let i=new WeakMap;function t(s){let a=i.get(s);return a===void 0&&(a={},i.set(s,a)),a}function e(s){i.delete(s)}function n(s,a,o){i.get(s)[a]=o}function r(){i=new WeakMap}return{get:t,remove:e,update:n,dispose:r}}function zp(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.z!==t.z?i.z-t.z:i.id-t.id}function _o(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function vo(){const i=[];let t=0;const e=[],n=[],r=[];function s(){t=0,e.length=0,n.length=0,r.length=0}function a(d,u,p,g,_,m){let f=i[t];return f===void 0?(f={id:d.id,object:d,geometry:u,material:p,groupOrder:g,renderOrder:d.renderOrder,z:_,group:m},i[t]=f):(f.id=d.id,f.object=d,f.geometry=u,f.material=p,f.groupOrder=g,f.renderOrder=d.renderOrder,f.z=_,f.group=m),t++,f}function o(d,u,p,g,_,m){const f=a(d,u,p,g,_,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):e.push(f)}function l(d,u,p,g,_,m){const f=a(d,u,p,g,_,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):e.unshift(f)}function c(d,u){e.length>1&&e.sort(d||zp),n.length>1&&n.sort(u||_o),r.length>1&&r.sort(u||_o)}function h(){for(let d=t,u=i.length;d<u;d++){const p=i[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:e,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Vp(){let i=new WeakMap;function t(n,r){const s=i.get(n);let a;return s===void 0?(a=new vo,i.set(n,[a])):r>=s.length?(a=new vo,s.push(a)):a=s[r],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function Hp(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new R,color:new Pt};break;case"SpotLight":e={position:new R,direction:new R,color:new Pt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new R,color:new Pt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new R,skyColor:new Pt,groundColor:new Pt};break;case"RectAreaLight":e={color:new Pt,position:new R,halfWidth:new R,halfHeight:new R};break}return i[t.id]=e,e}}}function kp(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lt};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lt};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}let Gp=0;function Wp(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function Xp(i){const t=new Hp,e=kp(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new R);const r=new R,s=new Dt,a=new Dt;function o(c,h){let d=0,u=0,p=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let g=0,_=0,m=0,f=0,E=0,S=0,b=0,I=0,A=0,w=0,V=0;c.sort(Wp);const y=h===!0?Math.PI:1;for(let F=0,W=c.length;F<W;F++){const P=c[F],k=P.color,q=P.intensity,j=P.distance,st=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)d+=k.r*q*y,u+=k.g*q*y,p+=k.b*q*y;else if(P.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(P.sh.coefficients[z],q);V++}else if(P.isDirectionalLight){const z=t.get(P);if(z.color.copy(P.color).multiplyScalar(P.intensity*y),P.castShadow){const J=P.shadow,Z=e.get(P);Z.shadowBias=J.bias,Z.shadowNormalBias=J.normalBias,Z.shadowRadius=J.radius,Z.shadowMapSize=J.mapSize,n.directionalShadow[g]=Z,n.directionalShadowMap[g]=st,n.directionalShadowMatrix[g]=P.shadow.matrix,S++}n.directional[g]=z,g++}else if(P.isSpotLight){const z=t.get(P);z.position.setFromMatrixPosition(P.matrixWorld),z.color.copy(k).multiplyScalar(q*y),z.distance=j,z.coneCos=Math.cos(P.angle),z.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),z.decay=P.decay,n.spot[m]=z;const J=P.shadow;if(P.map&&(n.spotLightMap[A]=P.map,A++,J.updateMatrices(P),P.castShadow&&w++),n.spotLightMatrix[m]=J.matrix,P.castShadow){const Z=e.get(P);Z.shadowBias=J.bias,Z.shadowNormalBias=J.normalBias,Z.shadowRadius=J.radius,Z.shadowMapSize=J.mapSize,n.spotShadow[m]=Z,n.spotShadowMap[m]=st,I++}m++}else if(P.isRectAreaLight){const z=t.get(P);z.color.copy(k).multiplyScalar(q),z.halfWidth.set(P.width*.5,0,0),z.halfHeight.set(0,P.height*.5,0),n.rectArea[f]=z,f++}else if(P.isPointLight){const z=t.get(P);if(z.color.copy(P.color).multiplyScalar(P.intensity*y),z.distance=P.distance,z.decay=P.decay,P.castShadow){const J=P.shadow,Z=e.get(P);Z.shadowBias=J.bias,Z.shadowNormalBias=J.normalBias,Z.shadowRadius=J.radius,Z.shadowMapSize=J.mapSize,Z.shadowCameraNear=J.camera.near,Z.shadowCameraFar=J.camera.far,n.pointShadow[_]=Z,n.pointShadowMap[_]=st,n.pointShadowMatrix[_]=P.shadow.matrix,b++}n.point[_]=z,_++}else if(P.isHemisphereLight){const z=t.get(P);z.skyColor.copy(P.color).multiplyScalar(q*y),z.groundColor.copy(P.groundColor).multiplyScalar(q*y),n.hemi[E]=z,E++}}f>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=et.LTC_FLOAT_1,n.rectAreaLTC2=et.LTC_FLOAT_2):(n.rectAreaLTC1=et.LTC_HALF_1,n.rectAreaLTC2=et.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=u,n.ambient[2]=p;const x=n.hash;(x.directionalLength!==g||x.pointLength!==_||x.spotLength!==m||x.rectAreaLength!==f||x.hemiLength!==E||x.numDirectionalShadows!==S||x.numPointShadows!==b||x.numSpotShadows!==I||x.numSpotMaps!==A||x.numLightProbes!==V)&&(n.directional.length=g,n.spot.length=m,n.rectArea.length=f,n.point.length=_,n.hemi.length=E,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=I,n.spotShadowMap.length=I,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=I+A-w,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=V,x.directionalLength=g,x.pointLength=_,x.spotLength=m,x.rectAreaLength=f,x.hemiLength=E,x.numDirectionalShadows=S,x.numPointShadows=b,x.numSpotShadows=I,x.numSpotMaps=A,x.numLightProbes=V,n.version=Gp++)}function l(c,h){let d=0,u=0,p=0,g=0,_=0;const m=h.matrixWorldInverse;for(let f=0,E=c.length;f<E;f++){const S=c[f];if(S.isDirectionalLight){const b=n.directional[d];b.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),d++}else if(S.isSpotLight){const b=n.spot[p];b.position.setFromMatrixPosition(S.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),p++}else if(S.isRectAreaLight){const b=n.rectArea[g];b.position.setFromMatrixPosition(S.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(S.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(S.width*.5,0,0),b.halfHeight.set(0,S.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),g++}else if(S.isPointLight){const b=n.point[u];b.position.setFromMatrixPosition(S.matrixWorld),b.position.applyMatrix4(m),u++}else if(S.isHemisphereLight){const b=n.hemi[_];b.direction.setFromMatrixPosition(S.matrixWorld),b.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function xo(i){const t=new Xp(i),e=[],n=[];function r(h){c.camera=h,e.length=0,n.length=0}function s(h){e.push(h)}function a(h){n.push(h)}function o(h){t.setup(e,h)}function l(h){t.setupView(e,h)}const c={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function qp(i){let t=new WeakMap;function e(r,s=0){const a=t.get(r);let o;return a===void 0?(o=new xo(i),t.set(r,[o])):s>=a.length?(o=new xo(i),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}class Yp extends In{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=wc,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class $p extends In{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const Kp=`void main() {
|
|
3774
|
-
gl_Position = vec4( position, 1.0 );
|
|
3775
|
-
}`,jp=`uniform sampler2D shadow_pass;
|
|
3776
|
-
uniform vec2 resolution;
|
|
3777
|
-
uniform float radius;
|
|
3778
|
-
#include <packing>
|
|
3779
|
-
void main() {
|
|
3780
|
-
const float samples = float( VSM_SAMPLES );
|
|
3781
|
-
float mean = 0.0;
|
|
3782
|
-
float squared_mean = 0.0;
|
|
3783
|
-
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|
3784
|
-
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|
3785
|
-
for ( float i = 0.0; i < samples; i ++ ) {
|
|
3786
|
-
float uvOffset = uvStart + i * uvStride;
|
|
3787
|
-
#ifdef HORIZONTAL_PASS
|
|
3788
|
-
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|
3789
|
-
mean += distribution.x;
|
|
3790
|
-
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
3791
|
-
#else
|
|
3792
|
-
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|
3793
|
-
mean += depth;
|
|
3794
|
-
squared_mean += depth * depth;
|
|
3795
|
-
#endif
|
|
3796
|
-
}
|
|
3797
|
-
mean = mean / samples;
|
|
3798
|
-
squared_mean = squared_mean / samples;
|
|
3799
|
-
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3800
|
-
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3801
|
-
}`;function Zp(i,t,e){let n=new Us;const r=new Lt,s=new Lt,a=new qt,o=new Yp({depthPacking:Rc}),l=new $p,c={},h=e.maxTextureSize,d={[_n]:Se,[Se]:_n,[Je]:Je},u=new nn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Lt},radius:{value:4}},vertexShader:Kp,fragmentShader:jp}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const g=new Pe;g.setAttribute("position",new Ce(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Re(g,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Go;let f=this.type;this.render=function(A,w,V){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;const y=i.getRenderTarget(),x=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),W=i.state;W.setBlending(mn),W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const P=f!==Ze&&this.type===Ze,k=f===Ze&&this.type!==Ze;for(let q=0,j=A.length;q<j;q++){const st=A[q],z=st.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",st,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const J=z.getFrameExtents();if(r.multiply(J),s.copy(z.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/J.x),r.x=s.x*J.x,z.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/J.y),r.y=s.y*J.y,z.mapSize.y=s.y)),z.map===null||P===!0||k===!0){const ft=this.type!==Ze?{minFilter:Me,magFilter:Me}:{};z.map!==null&&z.map.dispose(),z.map=new xn(r.x,r.y,ft),z.map.texture.name=st.name+".shadowMap",z.camera.updateProjectionMatrix()}i.setRenderTarget(z.map),i.clear();const Z=z.getViewportCount();for(let ft=0;ft<Z;ft++){const It=z.getViewport(ft);a.set(s.x*It.x,s.y*It.y,s.x*It.z,s.y*It.w),W.viewport(a),z.updateMatrices(st,ft),n=z.getFrustum(),b(w,V,z.camera,st,this.type)}z.isPointLightShadow!==!0&&this.type===Ze&&E(z,V),z.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(y,x,F)};function E(A,w){const V=t.update(_);u.defines.VSM_SAMPLES!==A.blurSamples&&(u.defines.VSM_SAMPLES=A.blurSamples,p.defines.VSM_SAMPLES=A.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new xn(r.x,r.y)),u.uniforms.shadow_pass.value=A.map.texture,u.uniforms.resolution.value=A.mapSize,u.uniforms.radius.value=A.radius,i.setRenderTarget(A.mapPass),i.clear(),i.renderBufferDirect(w,null,V,u,_,null),p.uniforms.shadow_pass.value=A.mapPass.texture,p.uniforms.resolution.value=A.mapSize,p.uniforms.radius.value=A.radius,i.setRenderTarget(A.map),i.clear(),i.renderBufferDirect(w,null,V,p,_,null)}function S(A,w,V,y){let x=null;const F=V.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(F!==void 0)x=F;else if(x=V.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const W=x.uuid,P=w.uuid;let k=c[W];k===void 0&&(k={},c[W]=k);let q=k[P];q===void 0&&(q=x.clone(),k[P]=q,w.addEventListener("dispose",I)),x=q}if(x.visible=w.visible,x.wireframe=w.wireframe,y===Ze?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:d[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,V.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const W=i.properties.get(x);W.light=V}return x}function b(A,w,V,y,x){if(A.visible===!1)return;if(A.layers.test(w.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&x===Ze)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,A.matrixWorld);const P=t.update(A),k=A.material;if(Array.isArray(k)){const q=P.groups;for(let j=0,st=q.length;j<st;j++){const z=q[j],J=k[z.materialIndex];if(J&&J.visible){const Z=S(A,J,y,x);A.onBeforeShadow(i,A,w,V,P,Z,z),i.renderBufferDirect(V,null,P,Z,A,z),A.onAfterShadow(i,A,w,V,P,Z,z)}}}else if(k.visible){const q=S(A,k,y,x);A.onBeforeShadow(i,A,w,V,P,q,null),i.renderBufferDirect(V,null,P,q,A,null),A.onAfterShadow(i,A,w,V,P,q,null)}}const W=A.children;for(let P=0,k=W.length;P<k;P++)b(W[P],w,V,y,x)}function I(A){A.target.removeEventListener("dispose",I);for(const V in c){const y=c[V],x=A.target.uuid;x in y&&(y[x].dispose(),delete y[x])}}}function Jp(i){function t(){let C=!1;const Y=new qt;let G=null;const it=new qt(0,0,0,0);return{setMask:function(lt){G!==lt&&!C&&(i.colorMask(lt,lt,lt,lt),G=lt)},setLocked:function(lt){C=lt},setClear:function(lt,Vt,jt,te,he){he===!0&&(lt*=te,Vt*=te,jt*=te),Y.set(lt,Vt,jt,te),it.equals(Y)===!1&&(i.clearColor(lt,Vt,jt,te),it.copy(Y))},reset:function(){C=!1,G=null,it.set(-1,0,0,0)}}}function e(){let C=!1,Y=null,G=null,it=null;return{setTest:function(lt){lt?ht(i.DEPTH_TEST):nt(i.DEPTH_TEST)},setMask:function(lt){Y!==lt&&!C&&(i.depthMask(lt),Y=lt)},setFunc:function(lt){if(G!==lt){switch(lt){case Ql:i.depthFunc(i.NEVER);break;case tc:i.depthFunc(i.ALWAYS);break;case ec:i.depthFunc(i.LESS);break;case mr:i.depthFunc(i.LEQUAL);break;case nc:i.depthFunc(i.EQUAL);break;case ic:i.depthFunc(i.GEQUAL);break;case rc:i.depthFunc(i.GREATER);break;case sc:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}G=lt}},setLocked:function(lt){C=lt},setClear:function(lt){it!==lt&&(i.clearDepth(lt),it=lt)},reset:function(){C=!1,Y=null,G=null,it=null}}}function n(){let C=!1,Y=null,G=null,it=null,lt=null,Vt=null,jt=null,te=null,he=null;return{setTest:function(kt){C||(kt?ht(i.STENCIL_TEST):nt(i.STENCIL_TEST))},setMask:function(kt){Y!==kt&&!C&&(i.stencilMask(kt),Y=kt)},setFunc:function(kt,Be,me){(G!==kt||it!==Be||lt!==me)&&(i.stencilFunc(kt,Be,me),G=kt,it=Be,lt=me)},setOp:function(kt,Be,me){(Vt!==kt||jt!==Be||te!==me)&&(i.stencilOp(kt,Be,me),Vt=kt,jt=Be,te=me)},setLocked:function(kt){C=kt},setClear:function(kt){he!==kt&&(i.clearStencil(kt),he=kt)},reset:function(){C=!1,Y=null,G=null,it=null,lt=null,Vt=null,jt=null,te=null,he=null}}}const r=new t,s=new e,a=new n,o=new WeakMap,l=new WeakMap;let c={},h={},d=new WeakMap,u=[],p=null,g=!1,_=null,m=null,f=null,E=null,S=null,b=null,I=null,A=new Pt(0,0,0),w=0,V=!1,y=null,x=null,F=null,W=null,P=null;const k=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,j=0;const st=i.getParameter(i.VERSION);st.indexOf("WebGL")!==-1?(j=parseFloat(/^WebGL (\d)/.exec(st)[1]),q=j>=1):st.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(st)[1]),q=j>=2);let z=null,J={};const Z=i.getParameter(i.SCISSOR_BOX),ft=i.getParameter(i.VIEWPORT),It=new qt().fromArray(Z),Yt=new qt().fromArray(ft);function H(C,Y,G,it){const lt=new Uint8Array(4),Vt=i.createTexture();i.bindTexture(C,Vt),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let jt=0;jt<G;jt++)C===i.TEXTURE_3D||C===i.TEXTURE_2D_ARRAY?i.texImage3D(Y,0,i.RGBA,1,1,it,0,i.RGBA,i.UNSIGNED_BYTE,lt):i.texImage2D(Y+jt,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,lt);return Vt}const Q={};Q[i.TEXTURE_2D]=H(i.TEXTURE_2D,i.TEXTURE_2D,1),Q[i.TEXTURE_CUBE_MAP]=H(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[i.TEXTURE_2D_ARRAY]=H(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Q[i.TEXTURE_3D]=H(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ht(i.DEPTH_TEST),s.setFunc(mr),Ot(!1),Rt(Ks),ht(i.CULL_FACE),$t(mn);function ht(C){c[C]!==!0&&(i.enable(C),c[C]=!0)}function nt(C){c[C]!==!1&&(i.disable(C),c[C]=!1)}function Ut(C,Y){return h[C]!==Y?(i.bindFramebuffer(C,Y),h[C]=Y,C===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=Y),C===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=Y),!0):!1}function Nt(C,Y){let G=u,it=!1;if(C){G=d.get(Y),G===void 0&&(G=[],d.set(Y,G));const lt=C.textures;if(G.length!==lt.length||G[0]!==i.COLOR_ATTACHMENT0){for(let Vt=0,jt=lt.length;Vt<jt;Vt++)G[Vt]=i.COLOR_ATTACHMENT0+Vt;G.length=lt.length,it=!0}}else G[0]!==i.BACK&&(G[0]=i.BACK,it=!0);it&&i.drawBuffers(G)}function D(C){return p!==C?(i.useProgram(C),p=C,!0):!1}const Kt={[Ln]:i.FUNC_ADD,[Fl]:i.FUNC_SUBTRACT,[Ol]:i.FUNC_REVERSE_SUBTRACT};Kt[Bl]=i.MIN,Kt[zl]=i.MAX;const gt={[Vl]:i.ZERO,[Hl]:i.ONE,[kl]:i.SRC_COLOR,[xs]:i.SRC_ALPHA,[$l]:i.SRC_ALPHA_SATURATE,[ql]:i.DST_COLOR,[Wl]:i.DST_ALPHA,[Gl]:i.ONE_MINUS_SRC_COLOR,[Ms]:i.ONE_MINUS_SRC_ALPHA,[Yl]:i.ONE_MINUS_DST_COLOR,[Xl]:i.ONE_MINUS_DST_ALPHA,[Kl]:i.CONSTANT_COLOR,[jl]:i.ONE_MINUS_CONSTANT_COLOR,[Zl]:i.CONSTANT_ALPHA,[Jl]:i.ONE_MINUS_CONSTANT_ALPHA};function $t(C,Y,G,it,lt,Vt,jt,te,he,kt){if(C===mn){g===!0&&(nt(i.BLEND),g=!1);return}if(g===!1&&(ht(i.BLEND),g=!0),C!==Nl){if(C!==_||kt!==V){if((m!==Ln||S!==Ln)&&(i.blendEquation(i.FUNC_ADD),m=Ln,S=Ln),kt)switch(C){case Qn:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case js:i.blendFunc(i.ONE,i.ONE);break;case Zs:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Js:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}else switch(C){case Qn:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case js:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Zs:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Js:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}f=null,E=null,b=null,I=null,A.set(0,0,0),w=0,_=C,V=kt}return}lt=lt||Y,Vt=Vt||G,jt=jt||it,(Y!==m||lt!==S)&&(i.blendEquationSeparate(Kt[Y],Kt[lt]),m=Y,S=lt),(G!==f||it!==E||Vt!==b||jt!==I)&&(i.blendFuncSeparate(gt[G],gt[it],gt[Vt],gt[jt]),f=G,E=it,b=Vt,I=jt),(te.equals(A)===!1||he!==w)&&(i.blendColor(te.r,te.g,te.b,he),A.copy(te),w=he),_=C,V=!1}function xt(C,Y){C.side===Je?nt(i.CULL_FACE):ht(i.CULL_FACE);let G=C.side===Se;Y&&(G=!G),Ot(G),C.blending===Qn&&C.transparent===!1?$t(mn):$t(C.blending,C.blendEquation,C.blendSrc,C.blendDst,C.blendEquationAlpha,C.blendSrcAlpha,C.blendDstAlpha,C.blendColor,C.blendAlpha,C.premultipliedAlpha),s.setFunc(C.depthFunc),s.setTest(C.depthTest),s.setMask(C.depthWrite),r.setMask(C.colorWrite);const it=C.stencilWrite;a.setTest(it),it&&(a.setMask(C.stencilWriteMask),a.setFunc(C.stencilFunc,C.stencilRef,C.stencilFuncMask),a.setOp(C.stencilFail,C.stencilZFail,C.stencilZPass)),Qt(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),C.alphaToCoverage===!0?ht(i.SAMPLE_ALPHA_TO_COVERAGE):nt(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ot(C){y!==C&&(C?i.frontFace(i.CW):i.frontFace(i.CCW),y=C)}function Rt(C){C!==Dl?(ht(i.CULL_FACE),C!==x&&(C===Ks?i.cullFace(i.BACK):C===Il?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):nt(i.CULL_FACE),x=C}function Bt(C){C!==F&&(q&&i.lineWidth(C),F=C)}function Qt(C,Y,G){C?(ht(i.POLYGON_OFFSET_FILL),(W!==Y||P!==G)&&(i.polygonOffset(Y,G),W=Y,P=G)):nt(i.POLYGON_OFFSET_FILL)}function T(C){C?ht(i.SCISSOR_TEST):nt(i.SCISSOR_TEST)}function v(C){C===void 0&&(C=i.TEXTURE0+k-1),z!==C&&(i.activeTexture(C),z=C)}function B(C,Y,G){G===void 0&&(z===null?G=i.TEXTURE0+k-1:G=z);let it=J[G];it===void 0&&(it={type:void 0,texture:void 0},J[G]=it),(it.type!==C||it.texture!==Y)&&(z!==G&&(i.activeTexture(G),z=G),i.bindTexture(C,Y||Q[C]),it.type=C,it.texture=Y)}function X(){const C=J[z];C!==void 0&&C.type!==void 0&&(i.bindTexture(C.type,null),C.type=void 0,C.texture=void 0)}function $(){try{i.compressedTexImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function K(){try{i.compressedTexImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function mt(){try{i.texSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ot(){try{i.texSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function at(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function bt(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function tt(){try{i.texStorage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function pt(){try{i.texStorage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function zt(){try{i.texImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function _t(){try{i.texImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ct(C){It.equals(C)===!1&&(i.scissor(C.x,C.y,C.z,C.w),It.copy(C))}function At(C){Yt.equals(C)===!1&&(i.viewport(C.x,C.y,C.z,C.w),Yt.copy(C))}function Ft(C,Y){let G=l.get(Y);G===void 0&&(G=new WeakMap,l.set(Y,G));let it=G.get(C);it===void 0&&(it=i.getUniformBlockIndex(Y,C.name),G.set(C,it))}function ee(C,Y){const it=l.get(Y).get(C);o.get(Y)!==it&&(i.uniformBlockBinding(Y,it,C.__bindingPointIndex),o.set(Y,it))}function wt(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},z=null,J={},h={},d=new WeakMap,u=[],p=null,g=!1,_=null,m=null,f=null,E=null,S=null,b=null,I=null,A=new Pt(0,0,0),w=0,V=!1,y=null,x=null,F=null,W=null,P=null,It.set(0,0,i.canvas.width,i.canvas.height),Yt.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:ht,disable:nt,bindFramebuffer:Ut,drawBuffers:Nt,useProgram:D,setBlending:$t,setMaterial:xt,setFlipSided:Ot,setCullFace:Rt,setLineWidth:Bt,setPolygonOffset:Qt,setScissorTest:T,activeTexture:v,bindTexture:B,unbindTexture:X,compressedTexImage2D:$,compressedTexImage3D:K,texImage2D:zt,texImage3D:_t,updateUBOMapping:Ft,uniformBlockBinding:ee,texStorage2D:tt,texStorage3D:pt,texSubImage2D:mt,texSubImage3D:ot,compressedTexSubImage2D:at,compressedTexSubImage3D:bt,scissor:ct,viewport:At,reset:wt}}function Qp(i,t,e,n,r,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Lt,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(T,v){return p?new OffscreenCanvas(T,v):wi("canvas")}function _(T,v,B){let X=1;const $=Qt(T);if(($.width>B||$.height>B)&&(X=B/Math.max($.width,$.height)),X<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const K=Math.floor(X*$.width),mt=Math.floor(X*$.height);d===void 0&&(d=g(K,mt));const ot=v?g(K,mt):d;return ot.width=K,ot.height=mt,ot.getContext("2d").drawImage(T,0,0,K,mt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+$.width+"x"+$.height+") to ("+K+"x"+mt+")."),ot}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+$.width+"x"+$.height+")."),T;return T}function m(T){return T.generateMipmaps&&T.minFilter!==Me&&T.minFilter!==xe}function f(T){i.generateMipmap(T)}function E(T,v,B,X,$=!1){if(T!==null){if(i[T]!==void 0)return i[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let K=v;if(v===i.RED&&(B===i.FLOAT&&(K=i.R32F),B===i.HALF_FLOAT&&(K=i.R16F),B===i.UNSIGNED_BYTE&&(K=i.R8)),v===i.RED_INTEGER&&(B===i.UNSIGNED_BYTE&&(K=i.R8UI),B===i.UNSIGNED_SHORT&&(K=i.R16UI),B===i.UNSIGNED_INT&&(K=i.R32UI),B===i.BYTE&&(K=i.R8I),B===i.SHORT&&(K=i.R16I),B===i.INT&&(K=i.R32I)),v===i.RG&&(B===i.FLOAT&&(K=i.RG32F),B===i.HALF_FLOAT&&(K=i.RG16F),B===i.UNSIGNED_BYTE&&(K=i.RG8)),v===i.RG_INTEGER&&(B===i.UNSIGNED_BYTE&&(K=i.RG8UI),B===i.UNSIGNED_SHORT&&(K=i.RG16UI),B===i.UNSIGNED_INT&&(K=i.RG32UI),B===i.BYTE&&(K=i.RG8I),B===i.SHORT&&(K=i.RG16I),B===i.INT&&(K=i.RG32I)),v===i.RGB&&B===i.UNSIGNED_INT_5_9_9_9_REV&&(K=i.RGB9_E5),v===i.RGBA){const mt=$?vr:Xt.getTransfer(X);B===i.FLOAT&&(K=i.RGBA32F),B===i.HALF_FLOAT&&(K=i.RGBA16F),B===i.UNSIGNED_BYTE&&(K=mt===Zt?i.SRGB8_ALPHA8:i.RGBA8),B===i.UNSIGNED_SHORT_4_4_4_4&&(K=i.RGBA4),B===i.UNSIGNED_SHORT_5_5_5_1&&(K=i.RGB5_A1)}return(K===i.R16F||K===i.R32F||K===i.RG16F||K===i.RG32F||K===i.RGBA16F||K===i.RGBA32F)&&t.get("EXT_color_buffer_float"),K}function S(T,v){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==Me&&T.minFilter!==xe?Math.log2(Math.max(v.width,v.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?v.mipmaps.length:1}function b(T){const v=T.target;v.removeEventListener("dispose",b),A(v),v.isVideoTexture&&h.delete(v)}function I(T){const v=T.target;v.removeEventListener("dispose",I),V(v)}function A(T){const v=n.get(T);if(v.__webglInit===void 0)return;const B=T.source,X=u.get(B);if(X){const $=X[v.__cacheKey];$.usedTimes--,$.usedTimes===0&&w(T),Object.keys(X).length===0&&u.delete(B)}n.remove(T)}function w(T){const v=n.get(T);i.deleteTexture(v.__webglTexture);const B=T.source,X=u.get(B);delete X[v.__cacheKey],a.memory.textures--}function V(T){const v=n.get(T);if(T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(v.__webglFramebuffer[X]))for(let $=0;$<v.__webglFramebuffer[X].length;$++)i.deleteFramebuffer(v.__webglFramebuffer[X][$]);else i.deleteFramebuffer(v.__webglFramebuffer[X]);v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer[X])}else{if(Array.isArray(v.__webglFramebuffer))for(let X=0;X<v.__webglFramebuffer.length;X++)i.deleteFramebuffer(v.__webglFramebuffer[X]);else i.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&&i.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&&i.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let X=0;X<v.__webglColorRenderbuffer.length;X++)v.__webglColorRenderbuffer[X]&&i.deleteRenderbuffer(v.__webglColorRenderbuffer[X]);v.__webglDepthRenderbuffer&&i.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const B=T.textures;for(let X=0,$=B.length;X<$;X++){const K=n.get(B[X]);K.__webglTexture&&(i.deleteTexture(K.__webglTexture),a.memory.textures--),n.remove(B[X])}n.remove(T)}let y=0;function x(){y=0}function F(){const T=y;return T>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),y+=1,T}function W(T){const v=[];return v.push(T.wrapS),v.push(T.wrapT),v.push(T.wrapR||0),v.push(T.magFilter),v.push(T.minFilter),v.push(T.anisotropy),v.push(T.internalFormat),v.push(T.format),v.push(T.type),v.push(T.generateMipmaps),v.push(T.premultiplyAlpha),v.push(T.flipY),v.push(T.unpackAlignment),v.push(T.colorSpace),v.join()}function P(T,v){const B=n.get(T);if(T.isVideoTexture&&Rt(T),T.isRenderTargetTexture===!1&&T.version>0&&B.__version!==T.version){const X=T.image;if(X===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{It(B,T,v);return}}e.bindTexture(i.TEXTURE_2D,B.__webglTexture,i.TEXTURE0+v)}function k(T,v){const B=n.get(T);if(T.version>0&&B.__version!==T.version){It(B,T,v);return}e.bindTexture(i.TEXTURE_2D_ARRAY,B.__webglTexture,i.TEXTURE0+v)}function q(T,v){const B=n.get(T);if(T.version>0&&B.__version!==T.version){It(B,T,v);return}e.bindTexture(i.TEXTURE_3D,B.__webglTexture,i.TEXTURE0+v)}function j(T,v){const B=n.get(T);if(T.version>0&&B.__version!==T.version){Yt(B,T,v);return}e.bindTexture(i.TEXTURE_CUBE_MAP,B.__webglTexture,i.TEXTURE0+v)}const st={[Es]:i.REPEAT,[tn]:i.CLAMP_TO_EDGE,[Ts]:i.MIRRORED_REPEAT},z={[Me]:i.NEAREST,[gc]:i.NEAREST_MIPMAP_NEAREST,[Ui]:i.NEAREST_MIPMAP_LINEAR,[xe]:i.LINEAR,[Nr]:i.LINEAR_MIPMAP_NEAREST,[fn]:i.LINEAR_MIPMAP_LINEAR},J={[Pc]:i.NEVER,[Fc]:i.ALWAYS,[Lc]:i.LESS,[el]:i.LEQUAL,[Dc]:i.EQUAL,[Nc]:i.GEQUAL,[Ic]:i.GREATER,[Uc]:i.NOTEQUAL};function Z(T,v){if(v.type===He&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===xe||v.magFilter===Nr||v.magFilter===Ui||v.magFilter===fn||v.minFilter===xe||v.minFilter===Nr||v.minFilter===Ui||v.minFilter===fn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,st[v.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,st[v.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&&i.texParameteri(T,i.TEXTURE_WRAP_R,st[v.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,z[v.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,z[v.minFilter]),v.compareFunction&&(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,J[v.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Me||v.minFilter!==Ui&&v.minFilter!==fn||v.type===He&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const B=t.get("EXT_texture_filter_anisotropic");i.texParameterf(T,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function ft(T,v){let B=!1;T.__webglInit===void 0&&(T.__webglInit=!0,v.addEventListener("dispose",b));const X=v.source;let $=u.get(X);$===void 0&&($={},u.set(X,$));const K=W(v);if(K!==T.__cacheKey){$[K]===void 0&&($[K]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,B=!0),$[K].usedTimes++;const mt=$[T.__cacheKey];mt!==void 0&&($[T.__cacheKey].usedTimes--,mt.usedTimes===0&&w(v)),T.__cacheKey=K,T.__webglTexture=$[K].texture}return B}function It(T,v,B){let X=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(X=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(X=i.TEXTURE_3D);const $=ft(T,v),K=v.source;e.bindTexture(X,T.__webglTexture,i.TEXTURE0+B);const mt=n.get(K);if(K.version!==mt.__version||$===!0){e.activeTexture(i.TEXTURE0+B);const ot=Xt.getPrimaries(Xt.workingColorSpace),at=v.colorSpace===dn?null:Xt.getPrimaries(v.colorSpace),bt=v.colorSpace===dn||ot===at?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,bt);let tt=_(v.image,!1,r.maxTextureSize);tt=Bt(v,tt);const pt=s.convert(v.format,v.colorSpace),zt=s.convert(v.type);let _t=E(v.internalFormat,pt,zt,v.colorSpace,v.isVideoTexture);Z(X,v);let ct;const At=v.mipmaps,Ft=v.isVideoTexture!==!0,ee=mt.__version===void 0||$===!0,wt=K.dataReady,C=S(v,tt);if(v.isDepthTexture)_t=i.DEPTH_COMPONENT16,v.type===He?_t=i.DEPTH_COMPONENT32F:v.type===si?_t=i.DEPTH_COMPONENT24:v.type===Ri&&(_t=i.DEPTH24_STENCIL8),ee&&(Ft?e.texStorage2D(i.TEXTURE_2D,1,_t,tt.width,tt.height):e.texImage2D(i.TEXTURE_2D,0,_t,tt.width,tt.height,0,pt,zt,null));else if(v.isDataTexture)if(At.length>0){Ft&&ee&&e.texStorage2D(i.TEXTURE_2D,C,_t,At[0].width,At[0].height);for(let Y=0,G=At.length;Y<G;Y++)ct=At[Y],Ft?wt&&e.texSubImage2D(i.TEXTURE_2D,Y,0,0,ct.width,ct.height,pt,zt,ct.data):e.texImage2D(i.TEXTURE_2D,Y,_t,ct.width,ct.height,0,pt,zt,ct.data);v.generateMipmaps=!1}else Ft?(ee&&e.texStorage2D(i.TEXTURE_2D,C,_t,tt.width,tt.height),wt&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,tt.width,tt.height,pt,zt,tt.data)):e.texImage2D(i.TEXTURE_2D,0,_t,tt.width,tt.height,0,pt,zt,tt.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ft&&ee&&e.texStorage3D(i.TEXTURE_2D_ARRAY,C,_t,At[0].width,At[0].height,tt.depth);for(let Y=0,G=At.length;Y<G;Y++)ct=At[Y],v.format!==Fe?pt!==null?Ft?wt&&e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Y,0,0,0,ct.width,ct.height,tt.depth,pt,ct.data,0,0):e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Y,_t,ct.width,ct.height,tt.depth,0,ct.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ft?wt&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,Y,0,0,0,ct.width,ct.height,tt.depth,pt,zt,ct.data):e.texImage3D(i.TEXTURE_2D_ARRAY,Y,_t,ct.width,ct.height,tt.depth,0,pt,zt,ct.data)}else{Ft&&ee&&e.texStorage2D(i.TEXTURE_2D,C,_t,At[0].width,At[0].height);for(let Y=0,G=At.length;Y<G;Y++)ct=At[Y],v.format!==Fe?pt!==null?Ft?wt&&e.compressedTexSubImage2D(i.TEXTURE_2D,Y,0,0,ct.width,ct.height,pt,ct.data):e.compressedTexImage2D(i.TEXTURE_2D,Y,_t,ct.width,ct.height,0,ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ft?wt&&e.texSubImage2D(i.TEXTURE_2D,Y,0,0,ct.width,ct.height,pt,zt,ct.data):e.texImage2D(i.TEXTURE_2D,Y,_t,ct.width,ct.height,0,pt,zt,ct.data)}else if(v.isDataArrayTexture)Ft?(ee&&e.texStorage3D(i.TEXTURE_2D_ARRAY,C,_t,tt.width,tt.height,tt.depth),wt&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,tt.width,tt.height,tt.depth,pt,zt,tt.data)):e.texImage3D(i.TEXTURE_2D_ARRAY,0,_t,tt.width,tt.height,tt.depth,0,pt,zt,tt.data);else if(v.isData3DTexture)Ft?(ee&&e.texStorage3D(i.TEXTURE_3D,C,_t,tt.width,tt.height,tt.depth),wt&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,tt.width,tt.height,tt.depth,pt,zt,tt.data)):e.texImage3D(i.TEXTURE_3D,0,_t,tt.width,tt.height,tt.depth,0,pt,zt,tt.data);else if(v.isFramebufferTexture){if(ee)if(Ft)e.texStorage2D(i.TEXTURE_2D,C,_t,tt.width,tt.height);else{let Y=tt.width,G=tt.height;for(let it=0;it<C;it++)e.texImage2D(i.TEXTURE_2D,it,_t,Y,G,0,pt,zt,null),Y>>=1,G>>=1}}else if(At.length>0){if(Ft&&ee){const Y=Qt(At[0]);e.texStorage2D(i.TEXTURE_2D,C,_t,Y.width,Y.height)}for(let Y=0,G=At.length;Y<G;Y++)ct=At[Y],Ft?wt&&e.texSubImage2D(i.TEXTURE_2D,Y,0,0,pt,zt,ct):e.texImage2D(i.TEXTURE_2D,Y,_t,pt,zt,ct);v.generateMipmaps=!1}else if(Ft){if(ee){const Y=Qt(tt);e.texStorage2D(i.TEXTURE_2D,C,_t,Y.width,Y.height)}wt&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,pt,zt,tt)}else e.texImage2D(i.TEXTURE_2D,0,_t,pt,zt,tt);m(v)&&f(X),mt.__version=K.version,v.onUpdate&&v.onUpdate(v)}T.__version=v.version}function Yt(T,v,B){if(v.image.length!==6)return;const X=ft(T,v),$=v.source;e.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+B);const K=n.get($);if($.version!==K.__version||X===!0){e.activeTexture(i.TEXTURE0+B);const mt=Xt.getPrimaries(Xt.workingColorSpace),ot=v.colorSpace===dn?null:Xt.getPrimaries(v.colorSpace),at=v.colorSpace===dn||mt===ot?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,at);const bt=v.isCompressedTexture||v.image[0].isCompressedTexture,tt=v.image[0]&&v.image[0].isDataTexture,pt=[];for(let G=0;G<6;G++)!bt&&!tt?pt[G]=_(v.image[G],!0,r.maxCubemapSize):pt[G]=tt?v.image[G].image:v.image[G],pt[G]=Bt(v,pt[G]);const zt=pt[0],_t=s.convert(v.format,v.colorSpace),ct=s.convert(v.type),At=E(v.internalFormat,_t,ct,v.colorSpace),Ft=v.isVideoTexture!==!0,ee=K.__version===void 0||X===!0,wt=$.dataReady;let C=S(v,zt);Z(i.TEXTURE_CUBE_MAP,v);let Y;if(bt){Ft&&ee&&e.texStorage2D(i.TEXTURE_CUBE_MAP,C,At,zt.width,zt.height);for(let G=0;G<6;G++){Y=pt[G].mipmaps;for(let it=0;it<Y.length;it++){const lt=Y[it];v.format!==Fe?_t!==null?Ft?wt&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it,0,0,lt.width,lt.height,_t,lt.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it,At,lt.width,lt.height,0,lt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ft?wt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it,0,0,lt.width,lt.height,_t,ct,lt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it,At,lt.width,lt.height,0,_t,ct,lt.data)}}}else{if(Y=v.mipmaps,Ft&&ee){Y.length>0&&C++;const G=Qt(pt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,C,At,G.width,G.height)}for(let G=0;G<6;G++)if(tt){Ft?wt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,0,0,pt[G].width,pt[G].height,_t,ct,pt[G].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,At,pt[G].width,pt[G].height,0,_t,ct,pt[G].data);for(let it=0;it<Y.length;it++){const Vt=Y[it].image[G].image;Ft?wt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it+1,0,0,Vt.width,Vt.height,_t,ct,Vt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it+1,At,Vt.width,Vt.height,0,_t,ct,Vt.data)}}else{Ft?wt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,0,0,_t,ct,pt[G]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,At,_t,ct,pt[G]);for(let it=0;it<Y.length;it++){const lt=Y[it];Ft?wt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it+1,0,0,_t,ct,lt.image[G]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+G,it+1,At,_t,ct,lt.image[G])}}}m(v)&&f(i.TEXTURE_CUBE_MAP),K.__version=$.version,v.onUpdate&&v.onUpdate(v)}T.__version=v.version}function H(T,v,B,X,$,K){const mt=s.convert(B.format,B.colorSpace),ot=s.convert(B.type),at=E(B.internalFormat,mt,ot,B.colorSpace);if(!n.get(v).__hasExternalTextures){const tt=Math.max(1,v.width>>K),pt=Math.max(1,v.height>>K);$===i.TEXTURE_3D||$===i.TEXTURE_2D_ARRAY?e.texImage3D($,K,at,tt,pt,v.depth,0,mt,ot,null):e.texImage2D($,K,at,tt,pt,0,mt,ot,null)}e.bindFramebuffer(i.FRAMEBUFFER,T),Ot(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,X,$,n.get(B).__webglTexture,0,xt(v)):($===i.TEXTURE_2D||$>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&$<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,X,$,n.get(B).__webglTexture,K),e.bindFramebuffer(i.FRAMEBUFFER,null)}function Q(T,v,B){if(i.bindRenderbuffer(i.RENDERBUFFER,T),v.depthBuffer&&!v.stencilBuffer){let X=i.DEPTH_COMPONENT24;if(B||Ot(v)){const $=v.depthTexture;$&&$.isDepthTexture&&($.type===He?X=i.DEPTH_COMPONENT32F:$.type===si&&(X=i.DEPTH_COMPONENT24));const K=xt(v);Ot(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,K,X,v.width,v.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,K,X,v.width,v.height)}else i.renderbufferStorage(i.RENDERBUFFER,X,v.width,v.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,T)}else if(v.depthBuffer&&v.stencilBuffer){const X=xt(v);B&&Ot(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,X,i.DEPTH24_STENCIL8,v.width,v.height):Ot(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,X,i.DEPTH24_STENCIL8,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,T)}else{const X=v.textures;for(let $=0;$<X.length;$++){const K=X[$],mt=s.convert(K.format,K.colorSpace),ot=s.convert(K.type),at=E(K.internalFormat,mt,ot,K.colorSpace),bt=xt(v);B&&Ot(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,bt,at,v.width,v.height):Ot(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,bt,at,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,at,v.width,v.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ht(T,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(i.FRAMEBUFFER,T),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(v.depthTexture).__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),P(v.depthTexture,0);const X=n.get(v.depthTexture).__webglTexture,$=xt(v);if(v.depthTexture.format===ti)Ot(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,X,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,X,0);else if(v.depthTexture.format===Ai)Ot(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,X,0,$):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,X,0);else throw new Error("Unknown depthTexture format")}function nt(T){const v=n.get(T),B=T.isWebGLCubeRenderTarget===!0;if(T.depthTexture&&!v.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");ht(v.__webglFramebuffer,T)}else if(B){v.__webglDepthbuffer=[];for(let X=0;X<6;X++)e.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[X]),v.__webglDepthbuffer[X]=i.createRenderbuffer(),Q(v.__webglDepthbuffer[X],T,!1)}else e.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer=i.createRenderbuffer(),Q(v.__webglDepthbuffer,T,!1);e.bindFramebuffer(i.FRAMEBUFFER,null)}function Ut(T,v,B){const X=n.get(T);v!==void 0&&H(X.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),B!==void 0&&nt(T)}function Nt(T){const v=T.texture,B=n.get(T),X=n.get(v);T.addEventListener("dispose",I);const $=T.textures,K=T.isWebGLCubeRenderTarget===!0,mt=$.length>1;if(mt||(X.__webglTexture===void 0&&(X.__webglTexture=i.createTexture()),X.__version=v.version,a.memory.textures++),K){B.__webglFramebuffer=[];for(let ot=0;ot<6;ot++)if(v.mipmaps&&v.mipmaps.length>0){B.__webglFramebuffer[ot]=[];for(let at=0;at<v.mipmaps.length;at++)B.__webglFramebuffer[ot][at]=i.createFramebuffer()}else B.__webglFramebuffer[ot]=i.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){B.__webglFramebuffer=[];for(let ot=0;ot<v.mipmaps.length;ot++)B.__webglFramebuffer[ot]=i.createFramebuffer()}else B.__webglFramebuffer=i.createFramebuffer();if(mt)for(let ot=0,at=$.length;ot<at;ot++){const bt=n.get($[ot]);bt.__webglTexture===void 0&&(bt.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples>0&&Ot(T)===!1){B.__webglMultisampledFramebuffer=i.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let ot=0;ot<$.length;ot++){const at=$[ot];B.__webglColorRenderbuffer[ot]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,B.__webglColorRenderbuffer[ot]);const bt=s.convert(at.format,at.colorSpace),tt=s.convert(at.type),pt=E(at.internalFormat,bt,tt,at.colorSpace,T.isXRRenderTarget===!0),zt=xt(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,zt,pt,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.RENDERBUFFER,B.__webglColorRenderbuffer[ot])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&&(B.__webglDepthRenderbuffer=i.createRenderbuffer(),Q(B.__webglDepthRenderbuffer,T,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(K){e.bindTexture(i.TEXTURE_CUBE_MAP,X.__webglTexture),Z(i.TEXTURE_CUBE_MAP,v);for(let ot=0;ot<6;ot++)if(v.mipmaps&&v.mipmaps.length>0)for(let at=0;at<v.mipmaps.length;at++)H(B.__webglFramebuffer[ot][at],T,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ot,at);else H(B.__webglFramebuffer[ot],T,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ot,0);m(v)&&f(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(mt){for(let ot=0,at=$.length;ot<at;ot++){const bt=$[ot],tt=n.get(bt);e.bindTexture(i.TEXTURE_2D,tt.__webglTexture),Z(i.TEXTURE_2D,bt),H(B.__webglFramebuffer,T,bt,i.COLOR_ATTACHMENT0+ot,i.TEXTURE_2D,0),m(bt)&&f(i.TEXTURE_2D)}e.unbindTexture()}else{let ot=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ot=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(ot,X.__webglTexture),Z(ot,v),v.mipmaps&&v.mipmaps.length>0)for(let at=0;at<v.mipmaps.length;at++)H(B.__webglFramebuffer[at],T,v,i.COLOR_ATTACHMENT0,ot,at);else H(B.__webglFramebuffer,T,v,i.COLOR_ATTACHMENT0,ot,0);m(v)&&f(ot),e.unbindTexture()}T.depthBuffer&&nt(T)}function D(T){const v=T.textures;for(let B=0,X=v.length;B<X;B++){const $=v[B];if(m($)){const K=T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,mt=n.get($).__webglTexture;e.bindTexture(K,mt),f(K),e.unbindTexture()}}}const Kt=[],gt=[];function $t(T){if(T.samples>0){if(Ot(T)===!1){const v=T.textures,B=T.width,X=T.height;let $=i.COLOR_BUFFER_BIT;const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,mt=n.get(T),ot=v.length>1;if(ot)for(let at=0;at<v.length;at++)e.bindFramebuffer(i.FRAMEBUFFER,mt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+at,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,mt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+at,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,mt.__webglMultisampledFramebuffer),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,mt.__webglFramebuffer);for(let at=0;at<v.length;at++){if(T.resolveDepthBuffer&&(T.depthBuffer&&($|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&($|=i.STENCIL_BUFFER_BIT)),ot){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,mt.__webglColorRenderbuffer[at]);const bt=n.get(v[at]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,bt,0)}i.blitFramebuffer(0,0,B,X,0,0,B,X,$,i.NEAREST),l===!0&&(Kt.length=0,gt.length=0,Kt.push(i.COLOR_ATTACHMENT0+at),T.depthBuffer&&T.resolveDepthBuffer===!1&&(Kt.push(K),gt.push(K),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,gt)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,Kt))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ot)for(let at=0;at<v.length;at++){e.bindFramebuffer(i.FRAMEBUFFER,mt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+at,i.RENDERBUFFER,mt.__webglColorRenderbuffer[at]);const bt=n.get(v[at]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,mt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+at,i.TEXTURE_2D,bt,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,mt.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const v=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[v])}}}function xt(T){return Math.min(r.maxSamples,T.samples)}function Ot(T){const v=n.get(T);return T.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Rt(T){const v=a.render.frame;h.get(T)!==v&&(h.set(T,v),T.update())}function Bt(T,v){const B=T.colorSpace,X=T.format,$=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||B!==Mn&&B!==dn&&(Xt.getTransfer(B)===Zt?(X!==Fe||$!==vn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),v}function Qt(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=x,this.setTexture2D=P,this.setTexture2DArray=k,this.setTexture3D=q,this.setTextureCube=j,this.rebindTextures=Ut,this.setupRenderTarget=Nt,this.updateRenderTargetMipmap=D,this.updateMultisampleRenderTarget=$t,this.setupDepthRenderbuffer=nt,this.setupFrameBufferTexture=H,this.useMultisampledRTT=Ot}function tm(i,t){function e(n,r=dn){let s;const a=Xt.getTransfer(r);if(n===vn)return i.UNSIGNED_BYTE;if(n===$o)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ko)return i.UNSIGNED_SHORT_5_5_5_1;if(n===xc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===_c)return i.BYTE;if(n===vc)return i.SHORT;if(n===qo)return i.UNSIGNED_SHORT;if(n===Yo)return i.INT;if(n===si)return i.UNSIGNED_INT;if(n===He)return i.FLOAT;if(n===wr)return i.HALF_FLOAT;if(n===Mc)return i.ALPHA;if(n===Sc)return i.RGB;if(n===Fe)return i.RGBA;if(n===yc)return i.LUMINANCE;if(n===Ec)return i.LUMINANCE_ALPHA;if(n===ti)return i.DEPTH_COMPONENT;if(n===Ai)return i.DEPTH_STENCIL;if(n===jo)return i.RED;if(n===Zo)return i.RED_INTEGER;if(n===Tc)return i.RG;if(n===Jo)return i.RG_INTEGER;if(n===Qo)return i.RGBA_INTEGER;if(n===Fr||n===Or||n===Br||n===zr)if(a===Zt)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Fr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Fr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ta||n===ea||n===na||n===ia)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ta)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ea)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===na)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ia)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ra||n===sa||n===aa)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ra||n===sa)return a===Zt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===aa)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===oa||n===la||n===ca||n===ha||n===ua||n===da||n===fa||n===pa||n===ma||n===ga||n===_a||n===va||n===xa||n===Ma)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===oa)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===la)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ca)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ha)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ua)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===da)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===fa)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===pa)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ma)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ga)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===_a)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===va)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===xa)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ma)return a===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Vr||n===Sa||n===ya)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===Vr)return a===Zt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Sa)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ya)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===bc||n===Ea||n===Ta||n===ba)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Vr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ea)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ta)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ba)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ri?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}class em extends be{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class nr extends ie{constructor(){super(),this.isGroup=!0,this.type="Group"}}const nm={type:"move"};class ds{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new nr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new nr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new nr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const m=e.getJointPose(_,n),f=this._getHandJoint(c,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),p=.02,g=.005;c.inputState.pinching&&u>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&u<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=e.getPose(t.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(nm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new nr;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const im=`
|
|
3802
|
-
void main() {
|
|
3803
|
-
|
|
3804
|
-
gl_Position = vec4( position, 1.0 );
|
|
3805
|
-
|
|
3806
|
-
}`,rm=`
|
|
3807
|
-
uniform sampler2DArray depthColor;
|
|
3808
|
-
uniform float depthWidth;
|
|
3809
|
-
uniform float depthHeight;
|
|
3810
|
-
|
|
3811
|
-
void main() {
|
|
3812
|
-
|
|
3813
|
-
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
|
3814
|
-
|
|
3815
|
-
if ( coord.x >= 1.0 ) {
|
|
3816
|
-
|
|
3817
|
-
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
3818
|
-
|
|
3819
|
-
} else {
|
|
3820
|
-
|
|
3821
|
-
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
3822
|
-
|
|
3823
|
-
}
|
|
3824
|
-
|
|
3825
|
-
}`;class sm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const r=new ce,s=t.properties.get(r);s.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}render(t,e){if(this.texture!==null){if(this.mesh===null){const n=e.cameras[0].viewport,r=new nn({vertexShader:im,fragmentShader:rm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Re(new Cr(20,20),r)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}}class am extends li{constructor(t,e){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,u=null,p=null,g=null;const _=new sm,m=e.getContextAttributes();let f=null,E=null;const S=[],b=[],I=new Lt;let A=null;const w=new be;w.layers.enable(1),w.viewport=new qt;const V=new be;V.layers.enable(2),V.viewport=new qt;const y=[w,V],x=new em;x.layers.enable(1),x.layers.enable(2);let F=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(H){let Q=S[H];return Q===void 0&&(Q=new ds,S[H]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(H){let Q=S[H];return Q===void 0&&(Q=new ds,S[H]=Q),Q.getGripSpace()},this.getHand=function(H){let Q=S[H];return Q===void 0&&(Q=new ds,S[H]=Q),Q.getHandSpace()};function P(H){const Q=b.indexOf(H.inputSource);if(Q===-1)return;const ht=S[Q];ht!==void 0&&(ht.update(H.inputSource,H.frame,c||a),ht.dispatchEvent({type:H.type,data:H.inputSource}))}function k(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",k),r.removeEventListener("inputsourceschange",q);for(let H=0;H<S.length;H++){const Q=b[H];Q!==null&&(b[H]=null,S[H].disconnect(Q))}F=null,W=null,_.reset(),t.setRenderTarget(f),p=null,u=null,d=null,r=null,E=null,Yt.stop(),n.isPresenting=!1,t.setPixelRatio(A),t.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(H){s=H,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(H){o=H,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(H){c=H},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(H){if(r=H,r!==null){if(f=t.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",k),r.addEventListener("inputsourceschange",q),m.xrCompatible!==!0&&await e.makeXRCompatible(),A=t.getPixelRatio(),t.getSize(I),r.renderState.layers===void 0){const Q={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,e,Q),r.updateRenderState({baseLayer:p}),t.setPixelRatio(1),t.setSize(p.framebufferWidth,p.framebufferHeight,!1),E=new xn(p.framebufferWidth,p.framebufferHeight,{format:Fe,type:vn,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let Q=null,ht=null,nt=null;m.depth&&(nt=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Q=m.stencil?Ai:ti,ht=m.stencil?Ri:si);const Ut={colorFormat:e.RGBA8,depthFormat:nt,scaleFactor:s};d=new XRWebGLBinding(r,e),u=d.createProjectionLayer(Ut),r.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),E=new xn(u.textureWidth,u.textureHeight,{format:Fe,type:vn,depthTexture:new pl(u.textureWidth,u.textureHeight,ht,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Yt.setContext(r),Yt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function q(H){for(let Q=0;Q<H.removed.length;Q++){const ht=H.removed[Q],nt=b.indexOf(ht);nt>=0&&(b[nt]=null,S[nt].disconnect(ht))}for(let Q=0;Q<H.added.length;Q++){const ht=H.added[Q];let nt=b.indexOf(ht);if(nt===-1){for(let Nt=0;Nt<S.length;Nt++)if(Nt>=b.length){b.push(ht),nt=Nt;break}else if(b[Nt]===null){b[Nt]=ht,nt=Nt;break}if(nt===-1)break}const Ut=S[nt];Ut&&Ut.connect(ht)}}const j=new R,st=new R;function z(H,Q,ht){j.setFromMatrixPosition(Q.matrixWorld),st.setFromMatrixPosition(ht.matrixWorld);const nt=j.distanceTo(st),Ut=Q.projectionMatrix.elements,Nt=ht.projectionMatrix.elements,D=Ut[14]/(Ut[10]-1),Kt=Ut[14]/(Ut[10]+1),gt=(Ut[9]+1)/Ut[5],$t=(Ut[9]-1)/Ut[5],xt=(Ut[8]-1)/Ut[0],Ot=(Nt[8]+1)/Nt[0],Rt=D*xt,Bt=D*Ot,Qt=nt/(-xt+Ot),T=Qt*-xt;Q.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(T),H.translateZ(Qt),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert();const v=D+Qt,B=Kt+Qt,X=Rt-T,$=Bt+(nt-T),K=gt*Kt/B*v,mt=$t*Kt/B*v;H.projectionMatrix.makePerspective(X,$,K,mt,v,B),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}function J(H,Q){Q===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(Q.matrixWorld,H.matrix),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(r===null)return;_.texture!==null&&(H.near=_.depthNear,H.far=_.depthFar),x.near=V.near=w.near=H.near,x.far=V.far=w.far=H.far,(F!==x.near||W!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),F=x.near,W=x.far,w.near=F,w.far=W,V.near=F,V.far=W,w.updateProjectionMatrix(),V.updateProjectionMatrix(),H.updateProjectionMatrix());const Q=H.parent,ht=x.cameras;J(x,Q);for(let nt=0;nt<ht.length;nt++)J(ht[nt],Q);ht.length===2?z(x,w,V):x.projectionMatrix.copy(w.projectionMatrix),Z(H,x,Q)};function Z(H,Q,ht){ht===null?H.matrix.copy(Q.matrixWorld):(H.matrix.copy(ht.matrixWorld),H.matrix.invert(),H.matrix.multiply(Q.matrixWorld)),H.matrix.decompose(H.position,H.quaternion,H.scale),H.updateMatrixWorld(!0),H.projectionMatrix.copy(Q.projectionMatrix),H.projectionMatrixInverse.copy(Q.projectionMatrixInverse),H.isPerspectiveCamera&&(H.fov=ai*2*Math.atan(1/H.projectionMatrix.elements[5]),H.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(H){l=H,u!==null&&(u.fixedFoveation=H),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=H)},this.hasDepthSensing=function(){return _.texture!==null};let ft=null;function It(H,Q){if(h=Q.getViewerPose(c||a),g=Q,h!==null){const ht=h.views;p!==null&&(t.setRenderTargetFramebuffer(E,p.framebuffer),t.setRenderTarget(E));let nt=!1;ht.length!==x.cameras.length&&(x.cameras.length=0,nt=!0);for(let Nt=0;Nt<ht.length;Nt++){const D=ht[Nt];let Kt=null;if(p!==null)Kt=p.getViewport(D);else{const $t=d.getViewSubImage(u,D);Kt=$t.viewport,Nt===0&&(t.setRenderTargetTextures(E,$t.colorTexture,u.ignoreDepthValues?void 0:$t.depthStencilTexture),t.setRenderTarget(E))}let gt=y[Nt];gt===void 0&&(gt=new be,gt.layers.enable(Nt),gt.viewport=new qt,y[Nt]=gt),gt.matrix.fromArray(D.transform.matrix),gt.matrix.decompose(gt.position,gt.quaternion,gt.scale),gt.projectionMatrix.fromArray(D.projectionMatrix),gt.projectionMatrixInverse.copy(gt.projectionMatrix).invert(),gt.viewport.set(Kt.x,Kt.y,Kt.width,Kt.height),Nt===0&&(x.matrix.copy(gt.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),nt===!0&&x.cameras.push(gt)}const Ut=r.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){const Nt=d.getDepthInformation(ht[0]);Nt&&Nt.isValid&&Nt.texture&&_.init(t,Nt,r.renderState)}}for(let ht=0;ht<S.length;ht++){const nt=b[ht],Ut=S[ht];nt!==null&&Ut!==void 0&&Ut.update(nt,Q,c||a)}_.render(t,x),ft&&ft(H,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),g=null}const Yt=new dl;Yt.setAnimationLoop(It),this.setAnimationLoop=function(H){ft=H},this.dispose=function(){}}}const Rn=new ke,om=new Dt;function lm(i,t){function e(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,cl(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,E,S,b){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),d(m,f)):f.isMeshPhongMaterial?(s(m,f),h(m,f)):f.isMeshStandardMaterial?(s(m,f),u(m,f),f.isMeshPhysicalMaterial&&p(m,f,b)):f.isMeshMatcapMaterial?(s(m,f),g(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),_(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,E,S):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,e(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Se&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,e(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Se&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,e(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,e(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,e(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const E=t.get(f),S=E.envMap,b=E.envMapRotation;if(S&&(m.envMap.value=S,Rn.copy(b),Rn.x*=-1,Rn.y*=-1,Rn.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Rn.y*=-1,Rn.z*=-1),m.envMapRotation.value.setFromMatrix4(om.makeRotationFromEuler(Rn)),m.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const I=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*I,e(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,E,S){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*E,m.scale.value=S*.5,f.map&&(m.map.value=f.map,e(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,e(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,e(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,E){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Se&&m.clearcoatNormalScale.value.negate())),f.dispersion>0&&(m.dispersion.value=f.dispersion),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const E=t.get(f).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function cm(i,t,e,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,S){const b=S.program;n.uniformBlockBinding(E,b)}function c(E,S){let b=r[E.id];b===void 0&&(g(E),b=h(E),r[E.id]=b,E.addEventListener("dispose",m));const I=S.program;n.updateUBOMapping(E,I);const A=t.render.frame;s[E.id]!==A&&(u(E),s[E.id]=A)}function h(E){const S=d();E.__bindingPointIndex=S;const b=i.createBuffer(),I=E.__size,A=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,I,A),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,S,b),b}function d(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(E){const S=r[E.id],b=E.uniforms,I=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,S);for(let A=0,w=b.length;A<w;A++){const V=Array.isArray(b[A])?b[A]:[b[A]];for(let y=0,x=V.length;y<x;y++){const F=V[y];if(p(F,A,y,I)===!0){const W=F.__offset,P=Array.isArray(F.value)?F.value:[F.value];let k=0;for(let q=0;q<P.length;q++){const j=P[q],st=_(j);typeof j=="number"||typeof j=="boolean"?(F.__data[0]=j,i.bufferSubData(i.UNIFORM_BUFFER,W+k,F.__data)):j.isMatrix3?(F.__data[0]=j.elements[0],F.__data[1]=j.elements[1],F.__data[2]=j.elements[2],F.__data[3]=0,F.__data[4]=j.elements[3],F.__data[5]=j.elements[4],F.__data[6]=j.elements[5],F.__data[7]=0,F.__data[8]=j.elements[6],F.__data[9]=j.elements[7],F.__data[10]=j.elements[8],F.__data[11]=0):(j.toArray(F.__data,k),k+=st.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,W,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(E,S,b,I){const A=E.value,w=S+"_"+b;if(I[w]===void 0)return typeof A=="number"||typeof A=="boolean"?I[w]=A:I[w]=A.clone(),!0;{const V=I[w];if(typeof A=="number"||typeof A=="boolean"){if(V!==A)return I[w]=A,!0}else if(V.equals(A)===!1)return V.copy(A),!0}return!1}function g(E){const S=E.uniforms;let b=0;const I=16;for(let w=0,V=S.length;w<V;w++){const y=Array.isArray(S[w])?S[w]:[S[w]];for(let x=0,F=y.length;x<F;x++){const W=y[x],P=Array.isArray(W.value)?W.value:[W.value];for(let k=0,q=P.length;k<q;k++){const j=P[k],st=_(j),z=b%I;z!==0&&I-z<st.boundary&&(b+=I-z),W.__data=new Float32Array(st.storage/Float32Array.BYTES_PER_ELEMENT),W.__offset=b,b+=st.storage}}}const A=b%I;return A>0&&(b+=I-A),E.__size=b,E.__cache={},this}function _(E){const S={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(S.boundary=4,S.storage=4):E.isVector2?(S.boundary=8,S.storage=8):E.isVector3||E.isColor?(S.boundary=16,S.storage=12):E.isVector4?(S.boundary=16,S.storage=16):E.isMatrix3?(S.boundary=48,S.storage=48):E.isMatrix4?(S.boundary=64,S.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),S}function m(E){const S=E.target;S.removeEventListener("dispose",m);const b=a.indexOf(S.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[S.id]),delete r[S.id],delete s[S.id]}function f(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Jm{constructor(t={}){const{canvas:e=Qc(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=t;this.isWebGLRenderer=!0;let u;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=n.getContextAttributes().alpha}else u=a;const p=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const f=[],E=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ze,this._useLegacyLights=!1,this.toneMapping=gn,this.toneMappingExposure=1;const S=this;let b=!1,I=0,A=0,w=null,V=-1,y=null;const x=new qt,F=new qt;let W=null;const P=new Pt(0);let k=0,q=e.width,j=e.height,st=1,z=null,J=null;const Z=new qt(0,0,q,j),ft=new qt(0,0,q,j);let It=!1;const Yt=new Us;let H=!1,Q=!1;const ht=new Dt,nt=new R,Ut={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Nt(){return w===null?st:1}let D=n;function Kt(M,L){return e.getContext(M,L)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Cs}`),e.addEventListener("webglcontextlost",C,!1),e.addEventListener("webglcontextrestored",Y,!1),e.addEventListener("webglcontextcreationerror",G,!1),D===null){const L="webgl2";if(D=Kt(L,M),D===null)throw Kt(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let gt,$t,xt,Ot,Rt,Bt,Qt,T,v,B,X,$,K,mt,ot,at,bt,tt,pt,zt,_t,ct,At,Ft;function ee(){gt=new vf(D),gt.init(),ct=new tm(D,gt),$t=new df(D,gt,t,ct),xt=new Jp(D),Ot=new Sf(D),Rt=new Bp,Bt=new Qp(D,gt,xt,Rt,$t,ct,Ot),Qt=new pf(S),T=new _f(S),v=new wh(D),At=new hf(D,v),B=new xf(D,v,Ot,At),X=new Ef(D,B,v,Ot),pt=new yf(D,$t,Bt),at=new ff(Rt),$=new Op(S,Qt,T,gt,$t,At,at),K=new lm(S,Rt),mt=new Vp,ot=new qp(gt),tt=new cf(S,Qt,T,xt,X,u,l),bt=new Zp(S,X,$t),Ft=new cm(D,Ot,$t,xt),zt=new uf(D,gt,Ot),_t=new Mf(D,gt,Ot),Ot.programs=$.programs,S.capabilities=$t,S.extensions=gt,S.properties=Rt,S.renderLists=mt,S.shadowMap=bt,S.state=xt,S.info=Ot}ee();const wt=new am(S,D);this.xr=wt,this.getContext=function(){return D},this.getContextAttributes=function(){return D.getContextAttributes()},this.forceContextLoss=function(){const M=gt.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=gt.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return st},this.setPixelRatio=function(M){M!==void 0&&(st=M,this.setSize(q,j,!1))},this.getSize=function(M){return M.set(q,j)},this.setSize=function(M,L,O=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=M,j=L,e.width=Math.floor(M*st),e.height=Math.floor(L*st),O===!0&&(e.style.width=M+"px",e.style.height=L+"px"),this.setViewport(0,0,M,L)},this.getDrawingBufferSize=function(M){return M.set(q*st,j*st).floor()},this.setDrawingBufferSize=function(M,L,O){q=M,j=L,st=O,e.width=Math.floor(M*O),e.height=Math.floor(L*O),this.setViewport(0,0,M,L)},this.getCurrentViewport=function(M){return M.copy(x)},this.getViewport=function(M){return M.copy(Z)},this.setViewport=function(M,L,O,U){M.isVector4?Z.set(M.x,M.y,M.z,M.w):Z.set(M,L,O,U),xt.viewport(x.copy(Z).multiplyScalar(st).round())},this.getScissor=function(M){return M.copy(ft)},this.setScissor=function(M,L,O,U){M.isVector4?ft.set(M.x,M.y,M.z,M.w):ft.set(M,L,O,U),xt.scissor(F.copy(ft).multiplyScalar(st).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(M){xt.setScissorTest(It=M)},this.setOpaqueSort=function(M){z=M},this.setTransparentSort=function(M){J=M},this.getClearColor=function(M){return M.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(M=!0,L=!0,O=!0){let U=0;if(M){let N=!1;if(w!==null){const rt=w.texture.format;N=rt===Qo||rt===Jo||rt===Zo}if(N){const rt=w.texture.type,ut=rt===vn||rt===si||rt===qo||rt===Ri||rt===$o||rt===Ko,dt=tt.getClearColor(),vt=tt.getClearAlpha(),Mt=dt.r,yt=dt.g,Ct=dt.b;ut?(p[0]=Mt,p[1]=yt,p[2]=Ct,p[3]=vt,D.clearBufferuiv(D.COLOR,0,p)):(g[0]=Mt,g[1]=yt,g[2]=Ct,g[3]=vt,D.clearBufferiv(D.COLOR,0,g))}else U|=D.COLOR_BUFFER_BIT}L&&(U|=D.DEPTH_BUFFER_BIT),O&&(U|=D.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),D.clear(U)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",C,!1),e.removeEventListener("webglcontextrestored",Y,!1),e.removeEventListener("webglcontextcreationerror",G,!1),mt.dispose(),ot.dispose(),Rt.dispose(),Qt.dispose(),T.dispose(),X.dispose(),At.dispose(),Ft.dispose(),$.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",kt),wt.removeEventListener("sessionend",Be),me.stop()};function C(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function Y(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const M=Ot.autoReset,L=bt.enabled,O=bt.autoUpdate,U=bt.needsUpdate,N=bt.type;ee(),Ot.autoReset=M,bt.enabled=L,bt.autoUpdate=O,bt.needsUpdate=U,bt.type=N}function G(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function it(M){const L=M.target;L.removeEventListener("dispose",it),lt(L)}function lt(M){Vt(M),Rt.remove(M)}function Vt(M){const L=Rt.get(M).programs;L!==void 0&&(L.forEach(function(O){$.releaseProgram(O)}),M.isShaderMaterial&&$.releaseShaderCache(M))}this.renderBufferDirect=function(M,L,O,U,N,rt){L===null&&(L=Ut);const ut=N.isMesh&&N.matrixWorld.determinant()<0,dt=Rl(M,L,O,U,N);xt.setMaterial(U,ut);let vt=O.index,Mt=1;if(U.wireframe===!0){if(vt=B.getWireframeAttribute(O),vt===void 0)return;Mt=2}const yt=O.drawRange,Ct=O.attributes.position;let re=yt.start*Mt,ue=(yt.start+yt.count)*Mt;rt!==null&&(re=Math.max(re,rt.start*Mt),ue=Math.min(ue,(rt.start+rt.count)*Mt)),vt!==null?(re=Math.max(re,0),ue=Math.min(ue,vt.count)):Ct!=null&&(re=Math.max(re,0),ue=Math.min(ue,Ct.count));const ye=ue-re;if(ye<0||ye===1/0)return;At.setup(N,U,dt,O,vt);let We,Ht=zt;if(vt!==null&&(We=v.get(vt),Ht=_t,Ht.setIndex(We)),N.isMesh)U.wireframe===!0?(xt.setLineWidth(U.wireframeLinewidth*Nt()),Ht.setMode(D.LINES)):Ht.setMode(D.TRIANGLES);else if(N.isLine){let St=U.linewidth;St===void 0&&(St=1),xt.setLineWidth(St*Nt()),N.isLineSegments?Ht.setMode(D.LINES):N.isLineLoop?Ht.setMode(D.LINE_LOOP):Ht.setMode(D.LINE_STRIP)}else N.isPoints?Ht.setMode(D.POINTS):N.isSprite&&Ht.setMode(D.TRIANGLES);if(N.isBatchedMesh)N._multiDrawInstances!==null?Ht.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances):Ht.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else if(N.isInstancedMesh)Ht.renderInstances(re,ye,N.count);else if(O.isInstancedBufferGeometry){const St=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,pi=Math.min(O.instanceCount,St);Ht.renderInstances(re,ye,pi)}else Ht.render(re,ye)};function jt(M,L,O){M.transparent===!0&&M.side===Je&&M.forceSinglePass===!1?(M.side=Se,M.needsUpdate=!0,Ii(M,L,O),M.side=_n,M.needsUpdate=!0,Ii(M,L,O),M.side=Je):Ii(M,L,O)}this.compile=function(M,L,O=null){O===null&&(O=M),m=ot.get(O),m.init(L),E.push(m),O.traverseVisible(function(N){N.isLight&&N.layers.test(L.layers)&&(m.pushLight(N),N.castShadow&&m.pushShadow(N))}),M!==O&&M.traverseVisible(function(N){N.isLight&&N.layers.test(L.layers)&&(m.pushLight(N),N.castShadow&&m.pushShadow(N))}),m.setupLights(S._useLegacyLights);const U=new Set;return M.traverse(function(N){const rt=N.material;if(rt)if(Array.isArray(rt))for(let ut=0;ut<rt.length;ut++){const dt=rt[ut];jt(dt,O,N),U.add(dt)}else jt(rt,O,N),U.add(rt)}),E.pop(),m=null,U},this.compileAsync=function(M,L,O=null){const U=this.compile(M,L,O);return new Promise(N=>{function rt(){if(U.forEach(function(ut){Rt.get(ut).currentProgram.isReady()&&U.delete(ut)}),U.size===0){N(M);return}setTimeout(rt,10)}gt.get("KHR_parallel_shader_compile")!==null?rt():setTimeout(rt,10)})};let te=null;function he(M){te&&te(M)}function kt(){me.stop()}function Be(){me.start()}const me=new dl;me.setAnimationLoop(he),typeof self<"u"&&me.setContext(self),this.setAnimationLoop=function(M){te=M,wt.setAnimationLoop(M),M===null?me.stop():me.start()},wt.addEventListener("sessionstart",kt),wt.addEventListener("sessionend",Be),this.render=function(M,L){if(L!==void 0&&L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(L),L=wt.getCamera()),M.isScene===!0&&M.onBeforeRender(S,M,L,w),m=ot.get(M,E.length),m.init(L),E.push(m),ht.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),Yt.setFromProjectionMatrix(ht),Q=this.localClippingEnabled,H=at.init(this.clippingPlanes,Q),_=mt.get(M,f.length),_.init(),f.push(_),Hs(M,L,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(z,J);const O=wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1;O&&tt.addToRenderList(_,M),this.info.render.frame++,H===!0&&at.beginShadows();const U=m.state.shadowsArray;bt.render(U,M,L),H===!0&&at.endShadows(),this.info.autoReset===!0&&this.info.reset();const N=_.opaque,rt=_.transmissive;if(m.setupLights(S._useLegacyLights),L.isArrayCamera){const ut=L.cameras;if(rt.length>0)for(let dt=0,vt=ut.length;dt<vt;dt++){const Mt=ut[dt];Gs(N,rt,M,Mt)}O&&tt.render(M);for(let dt=0,vt=ut.length;dt<vt;dt++){const Mt=ut[dt];ks(_,M,Mt,Mt.viewport)}}else rt.length>0&&Gs(N,rt,M,L),O&&tt.render(M),ks(_,M,L);w!==null&&(Bt.updateMultisampleRenderTarget(w),Bt.updateRenderTargetMipmap(w)),M.isScene===!0&&M.onAfterRender(S,M,L),At.resetDefaultState(),V=-1,y=null,E.pop(),E.length>0?(m=E[E.length-1],H===!0&&at.setGlobalState(S.clippingPlanes,m.state.camera)):m=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function Hs(M,L,O,U){if(M.visible===!1)return;if(M.layers.test(L.layers)){if(M.isGroup)O=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(L);else if(M.isLight)m.pushLight(M),M.castShadow&&m.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Yt.intersectsSprite(M)){U&&nt.setFromMatrixPosition(M.matrixWorld).applyMatrix4(ht);const ut=X.update(M),dt=M.material;dt.visible&&_.push(M,ut,dt,O,nt.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Yt.intersectsObject(M))){const ut=X.update(M),dt=M.material;if(U&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),nt.copy(M.boundingSphere.center)):(ut.boundingSphere===null&&ut.computeBoundingSphere(),nt.copy(ut.boundingSphere.center)),nt.applyMatrix4(M.matrixWorld).applyMatrix4(ht)),Array.isArray(dt)){const vt=ut.groups;for(let Mt=0,yt=vt.length;Mt<yt;Mt++){const Ct=vt[Mt],re=dt[Ct.materialIndex];re&&re.visible&&_.push(M,ut,re,O,nt.z,Ct)}}else dt.visible&&_.push(M,ut,dt,O,nt.z,null)}}const rt=M.children;for(let ut=0,dt=rt.length;ut<dt;ut++)Hs(rt[ut],L,O,U)}function ks(M,L,O,U){const N=M.opaque,rt=M.transmissive,ut=M.transparent;m.setupLightsView(O),H===!0&&at.setGlobalState(S.clippingPlanes,O),U&&xt.viewport(x.copy(U)),N.length>0&&Di(N,L,O),rt.length>0&&Di(rt,L,O),ut.length>0&&Di(ut,L,O),xt.buffers.depth.setTest(!0),xt.buffers.depth.setMask(!0),xt.buffers.color.setMask(!0),xt.setPolygonOffset(!1)}function Gs(M,L,O,U){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[U.id]===void 0&&(m.state.transmissionRenderTarget[U.id]=new xn(1,1,{generateMipmaps:!0,type:gt.has("EXT_color_buffer_half_float")||gt.has("EXT_color_buffer_float")?wr:vn,minFilter:fn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1}));const rt=m.state.transmissionRenderTarget[U.id],ut=U.viewport||x;rt.setSize(ut.z,ut.w);const dt=S.getRenderTarget();S.setRenderTarget(rt),S.getClearColor(P),k=S.getClearAlpha(),k<1&&S.setClearColor(16777215,.5),S.clear();const vt=S.toneMapping;S.toneMapping=gn;const Mt=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),m.setupLightsView(U),H===!0&&at.setGlobalState(S.clippingPlanes,U),Di(M,O,U),Bt.updateMultisampleRenderTarget(rt),Bt.updateRenderTargetMipmap(rt),gt.has("WEBGL_multisampled_render_to_texture")===!1){let yt=!1;for(let Ct=0,re=L.length;Ct<re;Ct++){const ue=L[Ct],ye=ue.object,We=ue.geometry,Ht=ue.material,St=ue.group;if(Ht.side===Je&&ye.layers.test(U.layers)){const pi=Ht.side;Ht.side=Se,Ht.needsUpdate=!0,Ws(ye,O,U,We,Ht,St),Ht.side=pi,Ht.needsUpdate=!0,yt=!0}}yt===!0&&(Bt.updateMultisampleRenderTarget(rt),Bt.updateRenderTargetMipmap(rt))}S.setRenderTarget(dt),S.setClearColor(P,k),Mt!==void 0&&(U.viewport=Mt),S.toneMapping=vt}function Di(M,L,O){const U=L.isScene===!0?L.overrideMaterial:null;for(let N=0,rt=M.length;N<rt;N++){const ut=M[N],dt=ut.object,vt=ut.geometry,Mt=U===null?ut.material:U,yt=ut.group;dt.layers.test(O.layers)&&Ws(dt,L,O,vt,Mt,yt)}}function Ws(M,L,O,U,N,rt){M.onBeforeRender(S,L,O,U,N,rt),M.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),N.onBeforeRender(S,L,O,U,M,rt),N.transparent===!0&&N.side===Je&&N.forceSinglePass===!1?(N.side=Se,N.needsUpdate=!0,S.renderBufferDirect(O,L,U,N,M,rt),N.side=_n,N.needsUpdate=!0,S.renderBufferDirect(O,L,U,N,M,rt),N.side=Je):S.renderBufferDirect(O,L,U,N,M,rt),M.onAfterRender(S,L,O,U,N,rt)}function Ii(M,L,O){L.isScene!==!0&&(L=Ut);const U=Rt.get(M),N=m.state.lights,rt=m.state.shadowsArray,ut=N.state.version,dt=$.getParameters(M,N.state,rt,L,O),vt=$.getProgramCacheKey(dt);let Mt=U.programs;U.environment=M.isMeshStandardMaterial?L.environment:null,U.fog=L.fog,U.envMap=(M.isMeshStandardMaterial?T:Qt).get(M.envMap||U.environment),U.envMapRotation=U.environment!==null&&M.envMap===null?L.environmentRotation:M.envMapRotation,Mt===void 0&&(M.addEventListener("dispose",it),Mt=new Map,U.programs=Mt);let yt=Mt.get(vt);if(yt!==void 0){if(U.currentProgram===yt&&U.lightsStateVersion===ut)return qs(M,dt),yt}else dt.uniforms=$.getUniforms(M),M.onBuild(O,dt,S),M.onBeforeCompile(dt,S),yt=$.acquireProgram(dt,vt),Mt.set(vt,yt),U.uniforms=dt.uniforms;const Ct=U.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Ct.clippingPlanes=at.uniform),qs(M,dt),U.needsLights=Pl(M),U.lightsStateVersion=ut,U.needsLights&&(Ct.ambientLightColor.value=N.state.ambient,Ct.lightProbe.value=N.state.probe,Ct.directionalLights.value=N.state.directional,Ct.directionalLightShadows.value=N.state.directionalShadow,Ct.spotLights.value=N.state.spot,Ct.spotLightShadows.value=N.state.spotShadow,Ct.rectAreaLights.value=N.state.rectArea,Ct.ltc_1.value=N.state.rectAreaLTC1,Ct.ltc_2.value=N.state.rectAreaLTC2,Ct.pointLights.value=N.state.point,Ct.pointLightShadows.value=N.state.pointShadow,Ct.hemisphereLights.value=N.state.hemi,Ct.directionalShadowMap.value=N.state.directionalShadowMap,Ct.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Ct.spotShadowMap.value=N.state.spotShadowMap,Ct.spotLightMatrix.value=N.state.spotLightMatrix,Ct.spotLightMap.value=N.state.spotLightMap,Ct.pointShadowMap.value=N.state.pointShadowMap,Ct.pointShadowMatrix.value=N.state.pointShadowMatrix),U.currentProgram=yt,U.uniformsList=null,yt}function Xs(M){if(M.uniformsList===null){const L=M.currentProgram.getUniforms();M.uniformsList=pr.seqWithValue(L.seq,M.uniforms)}return M.uniformsList}function qs(M,L){const O=Rt.get(M);O.outputColorSpace=L.outputColorSpace,O.batching=L.batching,O.instancing=L.instancing,O.instancingColor=L.instancingColor,O.instancingMorph=L.instancingMorph,O.skinning=L.skinning,O.morphTargets=L.morphTargets,O.morphNormals=L.morphNormals,O.morphColors=L.morphColors,O.morphTargetsCount=L.morphTargetsCount,O.numClippingPlanes=L.numClippingPlanes,O.numIntersection=L.numClipIntersection,O.vertexAlphas=L.vertexAlphas,O.vertexTangents=L.vertexTangents,O.toneMapping=L.toneMapping}function Rl(M,L,O,U,N){L.isScene!==!0&&(L=Ut),Bt.resetTextureUnits();const rt=L.fog,ut=U.isMeshStandardMaterial?L.environment:null,dt=w===null?S.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Mn,vt=(U.isMeshStandardMaterial?T:Qt).get(U.envMap||ut),Mt=U.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,yt=!!O.attributes.tangent&&(!!U.normalMap||U.anisotropy>0),Ct=!!O.morphAttributes.position,re=!!O.morphAttributes.normal,ue=!!O.morphAttributes.color;let ye=gn;U.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(ye=S.toneMapping);const We=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,Ht=We!==void 0?We.length:0,St=Rt.get(U),pi=m.state.lights;if(H===!0&&(Q===!0||M!==y)){const Ae=M===y&&U.id===V;at.setState(U,M,Ae)}let Jt=!1;U.version===St.__version?(St.needsLights&&St.lightsStateVersion!==pi.state.version||St.outputColorSpace!==dt||N.isBatchedMesh&&St.batching===!1||!N.isBatchedMesh&&St.batching===!0||N.isInstancedMesh&&St.instancing===!1||!N.isInstancedMesh&&St.instancing===!0||N.isSkinnedMesh&&St.skinning===!1||!N.isSkinnedMesh&&St.skinning===!0||N.isInstancedMesh&&St.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&St.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&St.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&St.instancingMorph===!1&&N.morphTexture!==null||St.envMap!==vt||U.fog===!0&&St.fog!==rt||St.numClippingPlanes!==void 0&&(St.numClippingPlanes!==at.numPlanes||St.numIntersection!==at.numIntersection)||St.vertexAlphas!==Mt||St.vertexTangents!==yt||St.morphTargets!==Ct||St.morphNormals!==re||St.morphColors!==ue||St.toneMapping!==ye||St.morphTargetsCount!==Ht)&&(Jt=!0):(Jt=!0,St.__version=U.version);let yn=St.currentProgram;Jt===!0&&(yn=Ii(U,L,N));let Ys=!1,mi=!1,Dr=!1;const de=yn.getUniforms(),sn=St.uniforms;if(xt.useProgram(yn.program)&&(Ys=!0,mi=!0,Dr=!0),U.id!==V&&(V=U.id,mi=!0),Ys||y!==M){de.setValue(D,"projectionMatrix",M.projectionMatrix),de.setValue(D,"viewMatrix",M.matrixWorldInverse);const Ae=de.map.cameraPosition;Ae!==void 0&&Ae.setValue(D,nt.setFromMatrixPosition(M.matrixWorld)),$t.logarithmicDepthBuffer&&de.setValue(D,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&de.setValue(D,"isOrthographic",M.isOrthographicCamera===!0),y!==M&&(y=M,mi=!0,Dr=!0)}if(N.isSkinnedMesh){de.setOptional(D,N,"bindMatrix"),de.setOptional(D,N,"bindMatrixInverse");const Ae=N.skeleton;Ae&&(Ae.boneTexture===null&&Ae.computeBoneTexture(),de.setValue(D,"boneTexture",Ae.boneTexture,Bt))}N.isBatchedMesh&&(de.setOptional(D,N,"batchingTexture"),de.setValue(D,"batchingTexture",N._matricesTexture,Bt));const Ir=O.morphAttributes;if((Ir.position!==void 0||Ir.normal!==void 0||Ir.color!==void 0)&&pt.update(N,O,yn),(mi||St.receiveShadow!==N.receiveShadow)&&(St.receiveShadow=N.receiveShadow,de.setValue(D,"receiveShadow",N.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(sn.envMap.value=vt,sn.flipEnvMap.value=vt.isCubeTexture&&vt.isRenderTargetTexture===!1?-1:1),U.isMeshStandardMaterial&&U.envMap===null&&L.environment!==null&&(sn.envMapIntensity.value=L.environmentIntensity),mi&&(de.setValue(D,"toneMappingExposure",S.toneMappingExposure),St.needsLights&&Cl(sn,Dr),rt&&U.fog===!0&&K.refreshFogUniforms(sn,rt),K.refreshMaterialUniforms(sn,U,st,j,m.state.transmissionRenderTarget[M.id]),pr.upload(D,Xs(St),sn,Bt)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(pr.upload(D,Xs(St),sn,Bt),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&de.setValue(D,"center",N.center),de.setValue(D,"modelViewMatrix",N.modelViewMatrix),de.setValue(D,"normalMatrix",N.normalMatrix),de.setValue(D,"modelMatrix",N.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const Ae=U.uniformsGroups;for(let Ur=0,Ll=Ae.length;Ur<Ll;Ur++){const $s=Ae[Ur];Ft.update($s,yn),Ft.bind($s,yn)}}return yn}function Cl(M,L){M.ambientLightColor.needsUpdate=L,M.lightProbe.needsUpdate=L,M.directionalLights.needsUpdate=L,M.directionalLightShadows.needsUpdate=L,M.pointLights.needsUpdate=L,M.pointLightShadows.needsUpdate=L,M.spotLights.needsUpdate=L,M.spotLightShadows.needsUpdate=L,M.rectAreaLights.needsUpdate=L,M.hemisphereLights.needsUpdate=L}function Pl(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(M,L,O){Rt.get(M.texture).__webglTexture=L,Rt.get(M.depthTexture).__webglTexture=O;const U=Rt.get(M);U.__hasExternalTextures=!0,U.__autoAllocateDepthBuffer=O===void 0,U.__autoAllocateDepthBuffer||gt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),U.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,L){const O=Rt.get(M);O.__webglFramebuffer=L,O.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(M,L=0,O=0){w=M,I=L,A=O;let U=!0,N=null,rt=!1,ut=!1;if(M){const vt=Rt.get(M);vt.__useDefaultFramebuffer!==void 0?(xt.bindFramebuffer(D.FRAMEBUFFER,null),U=!1):vt.__webglFramebuffer===void 0?Bt.setupRenderTarget(M):vt.__hasExternalTextures&&Bt.rebindTextures(M,Rt.get(M.texture).__webglTexture,Rt.get(M.depthTexture).__webglTexture);const Mt=M.texture;(Mt.isData3DTexture||Mt.isDataArrayTexture||Mt.isCompressedArrayTexture)&&(ut=!0);const yt=Rt.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(yt[L])?N=yt[L][O]:N=yt[L],rt=!0):M.samples>0&&Bt.useMultisampledRTT(M)===!1?N=Rt.get(M).__webglMultisampledFramebuffer:Array.isArray(yt)?N=yt[O]:N=yt,x.copy(M.viewport),F.copy(M.scissor),W=M.scissorTest}else x.copy(Z).multiplyScalar(st).floor(),F.copy(ft).multiplyScalar(st).floor(),W=It;if(xt.bindFramebuffer(D.FRAMEBUFFER,N)&&U&&xt.drawBuffers(M,N),xt.viewport(x),xt.scissor(F),xt.setScissorTest(W),rt){const vt=Rt.get(M.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+L,vt.__webglTexture,O)}else if(ut){const vt=Rt.get(M.texture),Mt=L||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,vt.__webglTexture,O||0,Mt)}V=-1},this.readRenderTargetPixels=function(M,L,O,U,N,rt,ut){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=Rt.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ut!==void 0&&(dt=dt[ut]),dt){xt.bindFramebuffer(D.FRAMEBUFFER,dt);try{const vt=M.texture,Mt=vt.format,yt=vt.type;if(!$t.textureFormatReadable(Mt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!$t.textureTypeReadable(yt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=M.width-U&&O>=0&&O<=M.height-N&&D.readPixels(L,O,U,N,ct.convert(Mt),ct.convert(yt),rt)}finally{const vt=w!==null?Rt.get(w).__webglFramebuffer:null;xt.bindFramebuffer(D.FRAMEBUFFER,vt)}}},this.copyFramebufferToTexture=function(M,L,O=0){const U=Math.pow(2,-O),N=Math.floor(L.image.width*U),rt=Math.floor(L.image.height*U);Bt.setTexture2D(L,0),D.copyTexSubImage2D(D.TEXTURE_2D,O,0,0,M.x,M.y,N,rt),xt.unbindTexture()},this.copyTextureToTexture=function(M,L,O,U=0){const N=L.image.width,rt=L.image.height,ut=ct.convert(O.format),dt=ct.convert(O.type);Bt.setTexture2D(O,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,O.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,O.unpackAlignment),L.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,U,M.x,M.y,N,rt,ut,dt,L.image.data):L.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,U,M.x,M.y,L.mipmaps[0].width,L.mipmaps[0].height,ut,L.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,U,M.x,M.y,ut,dt,L.image),U===0&&O.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),xt.unbindTexture()},this.copyTextureToTexture3D=function(M,L,O,U,N=0){const rt=M.max.x-M.min.x,ut=M.max.y-M.min.y,dt=M.max.z-M.min.z,vt=ct.convert(U.format),Mt=ct.convert(U.type);let yt;if(U.isData3DTexture)Bt.setTexture3D(U,0),yt=D.TEXTURE_3D;else if(U.isDataArrayTexture||U.isCompressedArrayTexture)Bt.setTexture2DArray(U,0),yt=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,U.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,U.unpackAlignment);const Ct=D.getParameter(D.UNPACK_ROW_LENGTH),re=D.getParameter(D.UNPACK_IMAGE_HEIGHT),ue=D.getParameter(D.UNPACK_SKIP_PIXELS),ye=D.getParameter(D.UNPACK_SKIP_ROWS),We=D.getParameter(D.UNPACK_SKIP_IMAGES),Ht=O.isCompressedTexture?O.mipmaps[N]:O.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Ht.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Ht.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,M.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,M.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,M.min.z),O.isDataTexture||O.isData3DTexture?D.texSubImage3D(yt,N,L.x,L.y,L.z,rt,ut,dt,vt,Mt,Ht.data):U.isCompressedArrayTexture?D.compressedTexSubImage3D(yt,N,L.x,L.y,L.z,rt,ut,dt,vt,Ht.data):D.texSubImage3D(yt,N,L.x,L.y,L.z,rt,ut,dt,vt,Mt,Ht),D.pixelStorei(D.UNPACK_ROW_LENGTH,Ct),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,re),D.pixelStorei(D.UNPACK_SKIP_PIXELS,ue),D.pixelStorei(D.UNPACK_SKIP_ROWS,ye),D.pixelStorei(D.UNPACK_SKIP_IMAGES,We),N===0&&U.generateMipmaps&&D.generateMipmap(yt),xt.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?Bt.setTextureCube(M,0):M.isData3DTexture?Bt.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?Bt.setTexture2DArray(M,0):Bt.setTexture2D(M,0),xt.unbindTexture()},this.resetState=function(){I=0,A=0,w=null,xt.reset(),At.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return en}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===Ps?"display-p3":"srgb",e.unpackColorSpace=Xt.workingColorSpace===Rr?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class Qm extends ie{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ke,this.environmentIntensity=1,this.environmentRotation=new ke,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class tg{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=bs,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Oe()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return il("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,s=this.stride;r<s;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Oe()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Oe()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const ge=new R;class Ml{constructor(t,e,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.applyMatrix4(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.applyNormalMatrix(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ge.fromBufferAttribute(this,e),ge.transformDirection(t),this.setXYZ(e,ge.x,ge.y,ge.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Ue(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Gt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ue(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ue(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ue(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ue(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array),r=Gt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),n=Gt(n,this.array),r=Gt(r,this.array),s=Gt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=s,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return new Ce(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Ml(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const Mo=new R,So=new qt,yo=new qt,hm=new R,Eo=new Dt,ir=new R,fs=new rn,To=new Dt,ps=new Ci;class eg extends Re{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Qs,this.bindMatrix=new Dt,this.bindMatrixInverse=new Dt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;this.boundingBox===null&&(this.boundingBox=new Sn),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,ir),this.boundingBox.expandByPoint(ir)}computeBoundingSphere(){const t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new rn),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,ir),this.boundingSphere.expandByPoint(ir)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),fs.copy(this.boundingSphere),fs.applyMatrix4(r),t.ray.intersectsSphere(fs)!==!1&&(To.copy(r).invert(),ps.copy(t.ray).applyMatrix4(To),!(this.boundingBox!==null&&ps.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,ps)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new qt,e=this.geometry.attributes.skinWeight;for(let n=0,r=e.count;n<r;n++){t.fromBufferAttribute(e,n);const s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Qs?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===mc?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,r=this.geometry;So.fromBufferAttribute(r.attributes.skinIndex,t),yo.fromBufferAttribute(r.attributes.skinWeight,t),Mo.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let s=0;s<4;s++){const a=yo.getComponent(s);if(a!==0){const o=So.getComponent(s);Eo.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(hm.copy(Mo).applyMatrix4(Eo),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}class um extends ie{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Fs extends ce{constructor(t=null,e=1,n=1,r,s,a,o,l,c=Me,h=Me,d,u){super(null,a,o,l,c,h,r,s,d,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const bo=new Dt,dm=new Dt;class Sl{constructor(t=[],e=[]){this.uuid=Oe(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Dt)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const n=new Dt;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=t.length;s<a;s++){const o=t[s]?t[s].matrixWorld:dm;bo.multiplyMatrices(o,e[s]),bo.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new Sl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Fs(e,t,t,Fe,He);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];if(r.name===t)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,r=t.bones.length;n<r;n++){const s=t.bones[n];let a=e[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new um),this.bones.push(a),this.boneInverses.push(new Dt().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let r=0,s=e.length;r<s;r++){const a=e[r];t.bones.push(a.uuid);const o=n[r];t.boneInverses.push(o.toArray())}return t}}class Ao extends Ce{constructor(t,e,n,r=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Zn=new Dt,wo=new Dt,rr=[],Ro=new Sn,fm=new Dt,Mi=new Re,Si=new rn;class ng extends Re{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ao(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,fm)}computeBoundingBox(){const t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Sn),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Zn),Ro.copy(t.boundingBox).applyMatrix4(Zn),this.boundingBox.union(Ro)}computeBoundingSphere(){const t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new rn),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,Zn),Si.copy(t.boundingSphere).applyMatrix4(Zn),this.boundingSphere.union(Si)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){const n=e.morphTargetInfluences,r=this.morphTexture.source.data.data,s=n.length+1,a=t*s+1;for(let o=0;o<n.length;o++)n[o]=r[a+o]}raycast(t,e){const n=this.matrixWorld,r=this.count;if(Mi.geometry=this.geometry,Mi.material=this.material,Mi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Si.copy(this.boundingSphere),Si.applyMatrix4(n),t.ray.intersectsSphere(Si)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Zn),wo.multiplyMatrices(n,Zn),Mi.matrixWorld=wo,Mi.raycast(t,rr);for(let a=0,o=rr.length;a<o;a++){const l=rr[a];l.instanceId=s,l.object=this,e.push(l)}rr.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new Ao(new Float32Array(this.instanceMatrix.count*3),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){const n=e.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new Fs(new Float32Array(r*this.count),r,this.count,jo,He));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=r*t;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class yl extends In{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Pt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const yr=new R,Er=new R,Co=new Dt,yi=new Ci,sr=new rn,ms=new R,Po=new R;class El extends ie{constructor(t=new Pe,e=new yl){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[0];for(let r=1,s=e.count;r<s;r++)yr.fromBufferAttribute(e,r-1),Er.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=yr.distanceTo(Er);t.setAttribute("lineDistance",new ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,s=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),sr.copy(n.boundingSphere),sr.applyMatrix4(r),sr.radius+=s,t.ray.intersectsSphere(sr)===!1)return;Co.copy(r).invert(),yi.copy(t.ray).applyMatrix4(Co);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,u=n.attributes.position;if(h!==null){const p=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const f=h.getX(_),E=h.getX(_+1),S=ar(this,t,yi,l,f,E);S&&e.push(S)}if(this.isLineLoop){const _=h.getX(g-1),m=h.getX(p),f=ar(this,t,yi,l,_,m);f&&e.push(f)}}else{const p=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let _=p,m=g-1;_<m;_+=c){const f=ar(this,t,yi,l,_,_+1);f&&e.push(f)}if(this.isLineLoop){const _=ar(this,t,yi,l,g-1,p);_&&e.push(_)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function ar(i,t,e,n,r,s){const a=i.geometry.attributes.position;if(yr.fromBufferAttribute(a,r),Er.fromBufferAttribute(a,s),e.distanceSqToSegment(yr,Er,ms,Po)>n)return;ms.applyMatrix4(i.matrixWorld);const l=t.ray.origin.distanceTo(ms);if(!(l<t.near||l>t.far))return{distance:l,point:Po.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,object:i}}const Lo=new R,Do=new R;class pm extends El{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[];for(let r=0,s=e.count;r<s;r+=2)Lo.fromBufferAttribute(e,r),Do.fromBufferAttribute(e,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Lo.distanceTo(Do);t.setAttribute("lineDistance",new ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ig extends El{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class mm extends In{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Pt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Io=new Dt,ws=new Ci,or=new rn,lr=new R;class rg extends ie{constructor(t=new Pe,e=new mm){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,s=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),or.copy(n.boundingSphere),or.applyMatrix4(r),or.radius+=s,t.ray.intersectsSphere(or)===!1)return;Io.copy(r).invert(),ws.copy(t.ray).applyMatrix4(Io);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const u=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let g=u,_=p;g<_;g++){const m=c.getX(g);lr.fromBufferAttribute(d,m),Uo(lr,m,l,r,t,e,this)}}else{const u=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let g=u,_=p;g<_;g++)lr.fromBufferAttribute(d,g),Uo(lr,g,l,r,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Uo(i,t,e,n,r,s,a){const o=ws.distanceSqToPoint(i);if(o<e){const l=new R;ws.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:a})}}class sg extends ce{constructor(t,e,n,r,s,a,o,l,c,h,d,u){super(null,a,o,l,c,h,r,s,d,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class ag extends ce{constructor(t,e,n,r,s,a,o,l,c){super(t,e,n,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class gm{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),s=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),s+=n.distanceTo(r),e.push(s),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let a;e?a=e:a=t*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const h=n[r],u=n[r+1]-h,p=(a-h)/u;return(r+p)/(s-1)}getTangent(t,e){let r=t-1e-4,s=t+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=e||(a.isVector2?new Lt:new R);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new R,r=[],s=[],a=[],o=new R,l=new Dt;for(let p=0;p<=t;p++){const g=p/t;r[p]=this.getTangentAt(g,new R)}s[0]=new R,a[0]=new R;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),u<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=t;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const g=Math.acos(ne(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,g))}a[p].crossVectors(r[p],s[p])}if(e===!0){let p=Math.acos(ne(s[0].dot(s[t]),-1,1));p/=t,r[0].dot(o.crossVectors(s[0],s[t]))>0&&(p=-p);for(let g=1;g<=t;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],p*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class og extends gm{constructor(t=0,e=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new Lt){const n=e,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+t*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*h-p*d+this.aX,c=u*d+p*h+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}const cr=new R,hr=new R,gs=new R,ur=new Ne;class lg extends Pe{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){const r=Math.pow(10,4),s=Math.cos(ei*e),a=t.getIndex(),o=t.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),u={},p=[];for(let g=0;g<l;g+=3){a?(c[0]=a.getX(g),c[1]=a.getX(g+1),c[2]=a.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:_,b:m,c:f}=ur;if(_.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),f.fromBufferAttribute(o,c[2]),ur.getNormal(gs),d[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let E=0;E<3;E++){const S=(E+1)%3,b=d[E],I=d[S],A=ur[h[E]],w=ur[h[S]],V=`${b}_${I}`,y=`${I}_${b}`;y in u&&u[y]?(gs.dot(u[y].normal)<=s&&(p.push(A.x,A.y,A.z),p.push(w.x,w.y,w.z)),u[y]=null):V in u||(u[V]={index0:c[E],index1:c[S],normal:gs.clone()})}}for(const g in u)if(u[g]){const{index0:_,index1:m}=u[g];cr.fromBufferAttribute(o,_),hr.fromBufferAttribute(o,m),p.push(cr.x,cr.y,cr.z),p.push(hr.x,hr.y,hr.z)}this.setAttribute("position",new ve(p,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Tl extends Pe{constructor(t=.5,e=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],h=[];let d=t;const u=(e-t)/r,p=new R,g=new Lt;for(let _=0;_<=r;_++){for(let m=0;m<=n;m++){const f=s+m/n*a;p.x=d*Math.cos(f),p.y=d*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),g.x=(p.x/e+1)/2,g.y=(p.y/e+1)/2,h.push(g.x,g.y)}d+=u}for(let _=0;_<r;_++){const m=_*(n+1);for(let f=0;f<n;f++){const E=f+m,S=E,b=E+n+1,I=E+n+2,A=E+1;o.push(S,b,A),o.push(b,I,A)}}this.setIndex(o),this.setAttribute("position",new ve(l,3)),this.setAttribute("normal",new ve(c,3)),this.setAttribute("uv",new ve(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Tl(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class cg extends nn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _m extends In{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Pt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tl,this.normalScale=new Lt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ke,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class hg extends _m{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Lt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ne(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Pt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}function dr(i,t,e){return!i||!e&&i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}function vm(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function xm(i){function t(r,s){return i[r]-i[s]}const e=i.length,n=new Array(e);for(let r=0;r!==e;++r)n[r]=r;return n.sort(t),n}function No(i,t,e){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=e[s]*t;for(let l=0;l!==t;++l)r[a++]=i[o+l]}return r}function bl(i,t,e,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(t.push(s.time),e.push.apply(e,a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(t.push(s.time),a.toArray(e,e.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(t.push(s.time),e.push(a)),s=i[r++];while(s!==void 0)}class Lr{constructor(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],s=e[n-1];n:{t:{let a;e:{i:if(!(t<r)){for(let o=n+2;;){if(r===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=e[++n],t<r)break t}a=e.length;break e}if(!(t>=s)){const o=e[1];t<o&&(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=e[--n-1],t>=s)break t}a=n,n=0;break e}break n}for(;n<a;){const o=n+a>>>1;t<e[o]?a=o:n=o+1}if(r=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=t*r;for(let a=0;a!==r;++a)e[a]=n[s+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Mm extends Lr{constructor(t,e,n,r){super(t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Aa,endingEnd:Aa}}intervalChanged_(t,e,n){const r=this.parameterPositions;let s=t-2,a=t+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case wa:s=t,o=2*e-n;break;case Ra:s=r.length-2,o=e+r[s]-r[s+1];break;default:s=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case wa:a=t,l=2*n-e;break;case Ra:a=1,l=n+r[1]-r[0];break;default:a=t-1,l=e}const c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(t,e,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,d=this._offsetNext,u=this._weightPrev,p=this._weightNext,g=(n-e)/(r-e),_=g*g,m=_*g,f=-u*m+2*u*_-u*g,E=(1+u)*m+(-1.5-2*u)*_+(-.5+u)*g+1,S=(-1-p)*m+(1.5+p)*_+.5*g,b=p*m-p*_;for(let I=0;I!==o;++I)s[I]=f*a[h+I]+E*a[c+I]+S*a[l+I]+b*a[d+I];return s}}class Sm extends Lr{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(r-e),d=1-h;for(let u=0;u!==o;++u)s[u]=a[c+u]*d+a[l+u]*h;return s}}class ym extends Lr{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ge{constructor(t,e,n,r){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=dr(e,this.TimeBufferType),this.values=dr(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:dr(t.times,Array),values:dr(t.values,Array)};const r=t.getInterpolation();r!==t.DefaultInterpolation&&(n.interpolation=r)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new ym(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Sm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Mm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case gr:e=this.InterpolantFactoryMethodDiscrete;break;case _r:e=this.InterpolantFactoryMethodLinear;break;case Hr:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return gr;case this.InterpolantFactoryMethodLinear:return _r;case this.InterpolantFactoryMethodSmooth:return Hr}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(t!==1){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&&n[s]<t;)++s;for(;a!==-1&&n[a]>e;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(r!==void 0&&vm(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Hr,s=t.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(r)l=!0;else{const d=o*n,u=d-n,p=d+n;for(let g=0;g!==n;++g){const _=e[d+g];if(_!==e[u+g]||_!==e[p+g]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];const d=o*n,u=a*n;for(let p=0;p!==n;++p)e[u+p]=e[d+p]}++a}}if(s>0){t[a]=t[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=this.constructor,r=new n(this.name,t,e);return r.createInterpolant=this.createInterpolant,r}}Ge.prototype.TimeBufferType=Float32Array;Ge.prototype.ValueBufferType=Float32Array;Ge.prototype.DefaultInterpolation=_r;class ui extends Ge{}ui.prototype.ValueTypeName="bool";ui.prototype.ValueBufferType=Array;ui.prototype.DefaultInterpolation=gr;ui.prototype.InterpolantFactoryMethodLinear=void 0;ui.prototype.InterpolantFactoryMethodSmooth=void 0;class Al extends Ge{}Al.prototype.ValueTypeName="color";class Tr extends Ge{}Tr.prototype.ValueTypeName="number";class Em extends Lr{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(r-e);let c=t*o;for(let h=c+o;c!==h;c+=4)ci.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Li extends Ge{InterpolantFactoryMethodLinear(t){return new Em(this.times,this.values,this.getValueSize(),t)}}Li.prototype.ValueTypeName="quaternion";Li.prototype.DefaultInterpolation=_r;Li.prototype.InterpolantFactoryMethodSmooth=void 0;class di extends Ge{}di.prototype.ValueTypeName="string";di.prototype.ValueBufferType=Array;di.prototype.DefaultInterpolation=gr;di.prototype.InterpolantFactoryMethodLinear=void 0;di.prototype.InterpolantFactoryMethodSmooth=void 0;class br extends Ge{}br.prototype.ValueTypeName="vector";class ug{constructor(t="",e=-1,n=[],r=Ac){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Oe(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(bm(n[a]).scale(r));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let s=0,a=n.length;s!==a;++s)e.push(Ge.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const s=e.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=xm(l);l=No(l,1,h),c=No(c,1,h),!r&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new Tr(".morphTargetInfluences["+e[o].name+"]",l,c).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const r=t;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=t.length;o<l;o++){const c=t[o],h=c.name.match(s);if(h&&h.length>1){const d=h[1];let u=r[d];u||(r[d]=u=[]),u.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,u,p,g,_){if(p.length!==0){const m=[],f=[];bl(p,m,f,g),m.length!==0&&_.push(new d(u,m,f))}},r=[],s=t.name||"default",a=t.fps||30,o=t.blendMode;let l=t.length||-1;const c=t.hierarchy||[];for(let d=0;d<c.length;d++){const u=c[d].keys;if(!(!u||u.length===0))if(u[0].morphTargets){const p={};let g;for(g=0;g<u.length;g++)if(u[g].morphTargets)for(let _=0;_<u[g].morphTargets.length;_++)p[u[g].morphTargets[_]]=-1;for(const _ in p){const m=[],f=[];for(let E=0;E!==u[g].morphTargets.length;++E){const S=u[g];m.push(S.time),f.push(S.morphTarget===_?1:0)}r.push(new Tr(".morphTargetInfluence["+_+"]",m,f))}l=p.length*a}else{const p=".bones["+e[d].name+"]";n(br,p+".position",u,"pos",r),n(Li,p+".quaternion",u,"rot",r),n(br,p+".scale",u,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const t=this.tracks;let e=0;for(let n=0,r=t.length;n!==r;++n){const s=this.tracks[n];e=Math.max(e,s.times[s.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Tm(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Tr;case"vector":case"vector2":case"vector3":case"vector4":return br;case"color":return Al;case"quaternion":return Li;case"bool":case"boolean":return ui;case"string":return di}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function bm(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=Tm(i.type);if(i.times===void 0){const e=[],n=[];bl(i.keys,e,n,"value"),i.times=e,i.values=n}return t.parse!==void 0?t.parse(i):new t(i.name,i.times,i.values,i.interpolation)}const pn={enabled:!1,files:{},add:function(i,t){this.enabled!==!1&&(this.files[i]=t)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Am{constructor(t,e,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){const d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;d<u;d+=2){const p=c[d],g=c[d+1];if(p.global&&(p.lastIndex=0),p.test(h))return g}return null}}}const wm=new Am;class fi{constructor(t){this.manager=t!==void 0?t:wm,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(r,s){n.load(t,r,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}fi.DEFAULT_MATERIAL_NAME="__DEFAULT";const je={};class Rm extends Error{constructor(t,e){super(t),this.response=e}}class Cm extends fi{constructor(t){super(t)}load(t,e,n,r){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=pn.get(t);if(s!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(s),this.manager.itemEnd(t)},0),s;if(je[t]!==void 0){je[t].push({onLoad:e,onProgress:n,onError:r});return}je[t]=[],je[t].push({onLoad:e,onProgress:n,onError:r});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=je[t],d=c.body.getReader(),u=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=u?parseInt(u):0,g=p!==0;let _=0;const m=new ReadableStream({start(f){E();function E(){d.read().then(({done:S,value:b})=>{if(S)f.close();else{_+=b.byteLength;const I=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let A=0,w=h.length;A<w;A++){const V=h[A];V.onProgress&&V.onProgress(I)}f.enqueue(b),E()}})}}});return new Response(m)}else throw new Rm(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),u=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(u);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{pn.add(t,c);const h=je[t];delete je[t];for(let d=0,u=h.length;d<u;d++){const p=h[d];p.onLoad&&p.onLoad(c)}}).catch(c=>{const h=je[t];if(h===void 0)throw this.manager.itemError(t),c;delete je[t];for(let d=0,u=h.length;d<u;d++){const p=h[d];p.onError&&p.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Pm extends fi{constructor(t){super(t)}load(t,e,n,r){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=pn.get(t);if(a!==void 0)return s.manager.itemStart(t),setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a;const o=wi("img");function l(){h(),pn.add(t,this),e&&e(this),s.manager.itemEnd(t)}function c(d){h(),r&&r(d),s.manager.itemError(t),s.manager.itemEnd(t)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(t),o.src=t,o}}class dg extends fi{constructor(t){super(t)}load(t,e,n,r){const s=this,a=new Fs,o=new Cm(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(t,function(l){let c;try{c=s.parse(l)}catch(h){if(r!==void 0)r(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:tn,a.wrapT=c.wrapT!==void 0?c.wrapT:tn,a.magFilter=c.magFilter!==void 0?c.magFilter:xe,a.minFilter=c.minFilter!==void 0?c.minFilter:xe,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=fn),c.mipmapCount===1&&(a.minFilter=xe),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,e&&e(a,c)},n,r),a}}class fg extends fi{constructor(t){super(t)}load(t,e,n,r){const s=new ce,a=new Pm(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(o){s.image=o,s.needsUpdate=!0,e!==void 0&&e(s)},n,r),s}}class Os extends ie{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Pt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}}const _s=new Dt,Fo=new R,Oo=new R;class Bs{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Lt(512,512),this.map=null,this.mapPass=null,this.matrix=new Dt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Us,this._frameExtents=new Lt(1,1),this._viewportCount=1,this._viewports=[new qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Fo.setFromMatrixPosition(t.matrixWorld),e.position.copy(Fo),Oo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Oo),e.updateMatrixWorld(),_s.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_s),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(_s)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Lm extends Bs{constructor(){super(new be(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=ai*2*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=t.distance||e.far;(n!==e.fov||r!==e.aspect||s!==e.far)&&(e.fov=n,e.aspect=r,e.far=s,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class pg extends Os{constructor(t,e,n=0,r=Math.PI/3,s=0,a=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ie.DEFAULT_UP),this.updateMatrix(),this.target=new ie,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Lm}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Bo=new Dt,Ei=new R,vs=new R;class Dm extends Bs{constructor(){super(new be(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Lt(4,2),this._viewportCount=6,this._viewports=[new qt(2,1,1,1),new qt(0,1,1,1),new qt(3,1,1,1),new qt(1,1,1,1),new qt(3,0,1,1),new qt(1,0,1,1)],this._cubeDirections=[new R(1,0,0),new R(-1,0,0),new R(0,0,1),new R(0,0,-1),new R(0,1,0),new R(0,-1,0)],this._cubeUps=[new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,0,1),new R(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,s=t.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ei.setFromMatrixPosition(t.matrixWorld),n.position.copy(Ei),vs.copy(n.position),vs.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(vs),n.updateMatrixWorld(),r.makeTranslation(-Ei.x,-Ei.y,-Ei.z),Bo.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bo)}}class mg extends Os{constructor(t,e,n=0,r=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Dm}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Im extends Bs{constructor(){super(new fl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class gg extends Os{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ie.DEFAULT_UP),this.updateMatrix(),this.target=new ie,this.shadow=new Im}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class _g{static decodeText(t){if(typeof TextDecoder<"u")return new TextDecoder().decode(t);let e="";for(let n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch{return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class vg extends fi{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,r){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=pn.get(t);if(a!==void 0){if(s.manager.itemStart(t),a.then){a.then(c=>{e&&e(c),s.manager.itemEnd(t)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return pn.add(t,c),e&&e(c),s.manager.itemEnd(t),c}).catch(function(c){r&&r(c),pn.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)});pn.add(t,l),s.manager.itemStart(t)}}class xg{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=zo(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=zo();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function zo(){return(typeof performance>"u"?Date:performance).now()}const zs="\\[\\]\\.:\\/",Um=new RegExp("["+zs+"]","g"),Vs="[^"+zs+"]",Nm="[^"+zs.replace("\\.","")+"]",Fm=/((?:WC+[\/:])*)/.source.replace("WC",Vs),Om=/(WCOD+)?/.source.replace("WCOD",Nm),Bm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vs),zm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vs),Vm=new RegExp("^"+Fm+Om+Bm+zm+"$"),Hm=["material","materials","bones","map"];class km{constructor(t,e,n){const r=n||Wt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class Wt{constructor(t,e,n){this.path=e,this.parsedPath=n||Wt.parseTrackName(e),this.node=Wt.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Wt.Composite(t,e,n):new Wt(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Um,"")}static parseTrackName(t){const e=Vm.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);Hm.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===e||o.uuid===e)return o;const l=n(o.children);if(l)return l}return null},r=n(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)t[e++]=n[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,r=e.propertyName;let s=e.propertyIndex;if(t||(t=Wt.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}const a=t[r];if(a===void 0){const c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Wt.Composite=km;Wt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Wt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Wt.prototype.GetterByBindingType=[Wt.prototype._getValue_direct,Wt.prototype._getValue_array,Wt.prototype._getValue_arrayElement,Wt.prototype._getValue_toArray];Wt.prototype.SetterByBindingTypeAndVersioning=[[Wt.prototype._setValue_direct,Wt.prototype._setValue_direct_setNeedsUpdate,Wt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_array,Wt.prototype._setValue_array_setNeedsUpdate,Wt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_arrayElement,Wt.prototype._setValue_arrayElement_setNeedsUpdate,Wt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wt.prototype._setValue_fromArray,Wt.prototype._setValue_fromArray_setNeedsUpdate,Wt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class wl{constructor(t){this.value=t}clone(){return new wl(this.value.clone===void 0?this.value:this.value.clone())}}const Vo=new Dt;class Mg{constructor(t,e,n=0,r=1/0){this.ray=new Ci(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Is,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Vo.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Vo),this}intersectObject(t,e=!0,n=[]){return Rs(t,this,n,e),n.sort(Ho),n}intersectObjects(t,e=!0,n=[]){for(let r=0,s=t.length;r<s;r++)Rs(t[r],this,n,e);return n.sort(Ho),n}}function Ho(i,t){return i.distance-t.distance}function Rs(i,t,e,n){if(i.layers.test(t.layers)&&i.raycast(t,e),n===!0){const r=i.children;for(let s=0,a=r.length;s<a;s++)Rs(r[s],t,e,!0)}}class Sg{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(ne(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const ko=new R,fr=new R;class yg{constructor(t=new R,e=new R){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){ko.subVectors(t,this.start),fr.subVectors(this.end,this.start);const n=fr.dot(fr);let s=fr.dot(ko)/n;return e&&(s=ne(s,0,1)),s}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Eg extends pm{constructor(t=10,e=10,n=4473924,r=8947848){n=new Pt(n),r=new Pt(r);const s=e/2,a=t/e,o=t/2,l=[],c=[];for(let u=0,p=0,g=-o;u<=e;u++,g+=a){l.push(-o,0,g,o,0,g),l.push(g,0,-o,g,0,o);const _=u===s?n:r;_.toArray(c,p),p+=3,_.toArray(c,p),p+=3,_.toArray(c,p),p+=3,_.toArray(c,p),p+=3}const h=new Pe;h.setAttribute("position",new ve(l,3)),h.setAttribute("color",new ve(c,3));const d=new yl({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Cs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Cs);export{ie as $,uc as A,Pe as B,Pt as C,dg as D,Ss as E,He as F,nr as G,wr as H,cg as I,Xt as J,Zt as K,Mn as L,Re as M,mn as N,lc as O,be as P,ci as Q,Mg as R,ze as S,cc as T,Mh as U,R as V,Jm as W,hc as X,fc as Y,pc as Z,xg as _,Zm as a,Yo as a$,qm as a0,$m as a1,Ym as a2,_g as a3,pg as a4,mg as a5,gg as a6,al as a7,hg as a8,ng as a9,Ml as aA,ce as aB,br as aC,Tr as aD,Li as aE,Lr as aF,Cr as aG,wl as aH,ag as aI,Cs as aJ,sg as aK,rl as aL,dn as aM,Fe as aN,Tl as aO,lg as aP,Cn as aQ,yg as aR,Ne as aS,Se as aT,Ci as aU,ve as aV,Gm as aW,Wm as aX,Sg as aY,si as aZ,Fs as a_,Ao as aa,fg as ab,vg as ac,tg as ad,fn as ae,Es as af,mm as ag,In as ah,Wt as ai,eg as aj,pm as ak,ig as al,rg as am,fl as an,Sl as ao,ug as ap,um as aq,_r as ar,Me as as,gc as at,Nr as au,Ui as av,tn as aw,Ts as ax,gr as ay,_n as az,xe as b,vn as b0,qo as b1,_c as b2,vc as b3,Qo as b4,Tc as b5,jo as b6,Jo as b7,Zo as b8,Tt as b9,qt as ba,Ds as bb,jm as bc,gn as bd,Qn as be,Xm as bf,fi as c,Cm as d,Ce as e,Qm as f,Pi as g,Am as h,Dt as i,li as j,Lt as k,Km as l,Sn as m,rn as n,Eg as o,og as p,yl as q,El as r,Et as s,_m as t,Je as u,xn as v,Yp as w,Rc as x,nn as y,js as z};
|