gl-draw 0.6.2 → 0.6.3
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/constants.d.ts +4 -0
- package/dist/core/BaseObject.d.ts +45 -0
- package/dist/core/CSSRenderer/CSS2DRenderer.d.ts +17 -0
- package/dist/core/CSSRenderer/index.d.ts +19 -0
- package/dist/core/Camera.d.ts +30 -0
- package/dist/core/Composer.d.ts +60 -0
- package/dist/core/Control.d.ts +28 -0
- package/dist/core/GUIObject.d.ts +24 -0
- package/dist/core/Pencil.d.ts +146 -0
- package/dist/core/Renderer.d.ts +51 -0
- package/dist/core/Scene.d.ts +19 -0
- package/dist/core/pass/bloom/UnrealBloomPass.d.ts +46 -0
- package/dist/core/pass/bloom/index.d.ts +33 -0
- package/dist/core/pass/outline/index.d.ts +37 -0
- package/dist/core/pass/ssr/index.d.ts +38 -0
- package/dist/effect/bloom.d.ts +14 -0
- package/dist/effect/index.d.ts +5 -0
- package/dist/effect/index.js +3205 -0
- package/dist/effect/index.module.js +3205 -0
- package/dist/effect/outline.d.ts +15 -0
- package/dist/effect/scan.d.ts +39 -0
- package/dist/effect/scan2.d.ts +28 -0
- package/dist/effect/ssr.d.ts +15 -0
- package/dist/geojson/china.json +103310 -0
- package/dist/geojson/countries.json +27483 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3102 -0
- package/dist/index.module.js +3102 -0
- package/dist/objects/conicPolygon/geometry/index.d.ts +32 -0
- package/dist/objects/conicPolygon/geometry/triangulate.d.ts +11 -0
- package/dist/objects/conicPolygon/index.d.ts +19 -0
- package/dist/objects/extrudePolygon/coords2Vector.d.ts +7 -0
- package/dist/objects/extrudePolygon/createGeometry.d.ts +8 -0
- package/dist/objects/extrudePolygon/getWorkerGeometry.d.ts +16 -0
- package/dist/objects/extrudePolygon/index.d.ts +37 -0
- package/dist/objects/extrudePolygon/w.d.ts +1 -0
- package/dist/objects/fix.d.ts +2 -0
- package/dist/objects/image/index.d.ts +24 -0
- package/dist/objects/index.d.ts +10 -0
- package/dist/objects/index.js +3177 -0
- package/dist/objects/index.module.js +3177 -0
- package/dist/objects/line/coords2Vector.d.ts +7 -0
- package/dist/objects/line/createGeometry.d.ts +8 -0
- package/dist/objects/line/getWorkerGeometry.d.ts +15 -0
- package/dist/objects/line/index.d.ts +44 -0
- package/dist/objects/line/meshLine/index.d.ts +89 -0
- package/dist/objects/line/meshLine/shader/fragment.d.ts +2 -0
- package/dist/objects/line/meshLine/shader/vertex.d.ts +2 -0
- package/dist/objects/line/w.d.ts +1 -0
- package/dist/objects/node/index.d.ts +30 -0
- package/dist/objects/text/index.d.ts +23 -0
- package/dist/objects/video/index.d.ts +31 -0
- package/dist/plugins/Cache.d.ts +8 -0
- package/dist/plugins/Data.d.ts +8 -0
- package/dist/plugins/Draw.d.ts +35 -0
- package/dist/plugins/Worker.d.ts +31 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +3046 -0
- package/dist/plugins/index.module.js +3046 -0
- package/dist/shims.d.ts +5 -0
- package/dist/utils/chain.d.ts +23 -0
- package/dist/utils/colorCorrection.d.ts +2 -0
- package/dist/utils/disposeMesh.d.ts +2 -0
- package/dist/utils/exception.d.ts +26 -0
- package/dist/utils/getCache.d.ts +13 -0
- package/dist/utils/getElementView.d.ts +2 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +3046 -0
- package/dist/utils/index.module.js +3046 -0
- package/dist/utils/isPlainObject.d.ts +1 -0
- package/dist/utils/makePromiseCreator.d.ts +6 -0
- package/dist/utils/polar2Cartesian.d.ts +1 -0
- package/dist/utils/timer.d.ts +9 -0
- package/dist/utils/to.d.ts +8 -0
- package/dist/utils/uvGenerator.d.ts +9 -0
- package/dist/workers/extrudePolygon.js +3046 -0
- package/dist/workers/line.js +3177 -0
- package/package.json +2 -2
|
@@ -0,0 +1,3177 @@
|
|
|
1
|
+
var Xx=Object.defineProperty;var $f=Object.getOwnPropertySymbols;var Zx=Object.prototype.hasOwnProperty,jx=Object.prototype.propertyIsEnumerable;var Qf=Math.pow,Kf=(Je,Ze,Ce)=>Ze in Je?Xx(Je,Ze,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):Je[Ze]=Ce,ed=(Je,Ze)=>{for(var Ce in Ze||(Ze={}))Zx.call(Ze,Ce)&&Kf(Je,Ce,Ze[Ce]);if($f)for(var Ce of $f(Ze))jx.call(Ze,Ce)&&Kf(Je,Ce,Ze[Ce]);return Je};var io=(Je,Ze,Ce)=>new Promise((qe,He)=>{var ft=_t=>{try{lt(Ce.next(_t))}catch(ke){He(ke)}},Ke=_t=>{try{lt(Ce.throw(_t))}catch(ke){He(ke)}},lt=_t=>_t.done?qe(_t.value):Promise.resolve(_t.value).then(ft,Ke);lt((Ce=Ce.apply(Je,Ze)).next())});import*as td from"idb-keyval";import*as Yx from"three/examples/jsm/renderers/CSS2DRenderer";import*as nd from"three/examples/jsm/renderers/CSS3DRenderer";import*as id from"popmotion";import*as Jx from"three/examples/jsm//utils/BufferGeometryUtils";import*as su from"d3-array";import*as $x from"earcut";import*as Kx from"@turf/boolean-clockwise";import*as Qx from"delaunator";import*as e0 from"@turf/boolean-point-in-polygon";import*as Tl from"d3-geo";import*as t0 from"d3-geo-voronoi";import*as n0 from"d3-scale";var i0={666:function(Je){var Ze=function(Ce){"use strict";var qe=Object.prototype,He=qe.hasOwnProperty,ft,Ke=typeof Symbol=="function"?Symbol:{},lt=Ke.iterator||"@@iterator",_t=Ke.asyncIterator||"@@asyncIterator",ke=Ke.toStringTag||"@@toStringTag";function Mt(le,ie,ve){return Object.defineProperty(le,ie,{value:ve,enumerable:!0,configurable:!0,writable:!0}),le[ie]}try{Mt({},"")}catch(le){Mt=function(ie,ve,Qe){return ie[ve]=Qe}}function Vt(le,ie,ve,Qe){var ze=ie&&ie.prototype instanceof kt?ie:kt,Yt=Object.create(ze.prototype),Rt=new Ji(Qe||[]);return Yt._invoke=Hn(le,ve,Rt),Yt}Ce.wrap=Vt;function Wt(le,ie,ve){try{return{type:"normal",arg:le.call(ie,ve)}}catch(Qe){return{type:"throw",arg:Qe}}}var dt="suspendedStart",Q="suspendedYield",pt="executing",Ft="completed",et={};function kt(){}function mt(){}function Bt(){}var mn={};Mt(mn,lt,function(){return this});var Qt=Object.getPrototypeOf,qt=Qt&&Qt(Qt(_r([])));qt&&qt!==qe&&He.call(qt,lt)&&(mn=qt);var Xt=Bt.prototype=kt.prototype=Object.create(mn);mt.prototype=Bt,Mt(Xt,"constructor",Bt),Mt(Bt,"constructor",mt),mt.displayName=Mt(Bt,ke,"GeneratorFunction");function Pt(le){["next","throw","return"].forEach(function(ie){Mt(le,ie,function(ve){return this._invoke(ie,ve)})})}Ce.isGeneratorFunction=function(le){var ie=typeof le=="function"&&le.constructor;return ie?ie===mt||(ie.displayName||ie.name)==="GeneratorFunction":!1},Ce.mark=function(le){return Object.setPrototypeOf?Object.setPrototypeOf(le,Bt):(le.__proto__=Bt,Mt(le,ke,"GeneratorFunction")),le.prototype=Object.create(Xt),le},Ce.awrap=function(le){return{__await:le}};function nn(le,ie){function ve(Yt,Rt,hn,Tn){var fn=Wt(le[Yt],le,Rt);if(fn.type==="throw")Tn(fn.arg);else{var gi=fn.arg,vi=gi.value;return vi&&typeof vi=="object"&&He.call(vi,"__await")?ie.resolve(vi.__await).then(function(Bn){ve("next",Bn,hn,Tn)},function(Bn){ve("throw",Bn,hn,Tn)}):ie.resolve(vi).then(function(Bn){gi.value=Bn,hn(gi)},function(Bn){return ve("throw",Bn,hn,Tn)})}}var Qe;function ze(Yt,Rt){function hn(){return new ie(function(Tn,fn){ve(Yt,Rt,Tn,fn)})}return Qe=Qe?Qe.then(hn,hn):hn()}this._invoke=ze}Pt(nn.prototype),Mt(nn.prototype,_t,function(){return this}),Ce.AsyncIterator=nn,Ce.async=function(le,ie,ve,Qe,ze){ze===void 0&&(ze=Promise);var Yt=new nn(Vt(le,ie,ve,Qe),ze);return Ce.isGeneratorFunction(ie)?Yt:Yt.next().then(function(Rt){return Rt.done?Rt.value:Yt.next()})};function Hn(le,ie,ve){var Qe=dt;return function(Yt,Rt){if(Qe===pt)throw new Error("Generator is already running");if(Qe===Ft){if(Yt==="throw")throw Rt;return $i()}for(ve.method=Yt,ve.arg=Rt;;){var hn=ve.delegate;if(hn){var Tn=ni(hn,ve);if(Tn){if(Tn===et)continue;return Tn}}if(ve.method==="next")ve.sent=ve._sent=ve.arg;else if(ve.method==="throw"){if(Qe===dt)throw Qe=Ft,ve.arg;ve.dispatchException(ve.arg)}else ve.method==="return"&&ve.abrupt("return",ve.arg);Qe=pt;var fn=Wt(le,ie,ve);if(fn.type==="normal"){if(Qe=ve.done?Ft:Q,fn.arg===et)continue;return{value:fn.arg,done:ve.done}}else fn.type==="throw"&&(Qe=Ft,ve.method="throw",ve.arg=fn.arg)}}}function ni(le,ie){var ve=le.iterator[ie.method];if(ve===ft){if(ie.delegate=null,ie.method==="throw"){if(le.iterator.return&&(ie.method="return",ie.arg=ft,ni(le,ie),ie.method==="throw"))return et;ie.method="throw",ie.arg=new TypeError("The iterator does not provide a 'throw' method")}return et}var Qe=Wt(ve,le.iterator,ie.arg);if(Qe.type==="throw")return ie.method="throw",ie.arg=Qe.arg,ie.delegate=null,et;var ze=Qe.arg;if(!ze)return ie.method="throw",ie.arg=new TypeError("iterator result is not an object"),ie.delegate=null,et;if(ze.done)ie[le.resultName]=ze.value,ie.next=le.nextLoc,ie.method!=="return"&&(ie.method="next",ie.arg=ft);else return ze;return ie.delegate=null,et}Pt(Xt),Mt(Xt,ke,"Generator"),Mt(Xt,lt,function(){return this}),Mt(Xt,"toString",function(){return"[object Generator]"});function St(le){var ie={tryLoc:le[0]};1 in le&&(ie.catchLoc=le[1]),2 in le&&(ie.finallyLoc=le[2],ie.afterLoc=le[3]),this.tryEntries.push(ie)}function Ut(le){var ie=le.completion||{};ie.type="normal",delete ie.arg,le.completion=ie}function Ji(le){this.tryEntries=[{tryLoc:"root"}],le.forEach(St,this),this.reset(!0)}Ce.keys=function(le){var ie=[];for(var ve in le)ie.push(ve);return ie.reverse(),function Qe(){for(;ie.length;){var ze=ie.pop();if(ze in le)return Qe.value=ze,Qe.done=!1,Qe}return Qe.done=!0,Qe}};function _r(le){if(le){var ie=le[lt];if(ie)return ie.call(le);if(typeof le.next=="function")return le;if(!isNaN(le.length)){var ve=-1,Qe=function ze(){for(;++ve<le.length;)if(He.call(le,ve))return ze.value=le[ve],ze.done=!1,ze;return ze.value=ft,ze.done=!0,ze};return Qe.next=Qe}}return{next:$i}}Ce.values=_r;function $i(){return{value:ft,done:!0}}return Ji.prototype={constructor:Ji,reset:function(le){if(this.prev=0,this.next=0,this.sent=this._sent=ft,this.done=!1,this.delegate=null,this.method="next",this.arg=ft,this.tryEntries.forEach(Ut),!le)for(var ie in this)ie.charAt(0)==="t"&&He.call(this,ie)&&!isNaN(+ie.slice(1))&&(this[ie]=ft)},stop:function(){this.done=!0;var le=this.tryEntries[0],ie=le.completion;if(ie.type==="throw")throw ie.arg;return this.rval},dispatchException:function(le){if(this.done)throw le;var ie=this;function ve(Tn,fn){return Yt.type="throw",Yt.arg=le,ie.next=Tn,fn&&(ie.method="next",ie.arg=ft),!!fn}for(var Qe=this.tryEntries.length-1;Qe>=0;--Qe){var ze=this.tryEntries[Qe],Yt=ze.completion;if(ze.tryLoc==="root")return ve("end");if(ze.tryLoc<=this.prev){var Rt=He.call(ze,"catchLoc"),hn=He.call(ze,"finallyLoc");if(Rt&&hn){if(this.prev<ze.catchLoc)return ve(ze.catchLoc,!0);if(this.prev<ze.finallyLoc)return ve(ze.finallyLoc)}else if(Rt){if(this.prev<ze.catchLoc)return ve(ze.catchLoc,!0)}else if(hn){if(this.prev<ze.finallyLoc)return ve(ze.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(le,ie){for(var ve=this.tryEntries.length-1;ve>=0;--ve){var Qe=this.tryEntries[ve];if(Qe.tryLoc<=this.prev&&He.call(Qe,"finallyLoc")&&this.prev<Qe.finallyLoc){var ze=Qe;break}}ze&&(le==="break"||le==="continue")&&ze.tryLoc<=ie&&ie<=ze.finallyLoc&&(ze=null);var Yt=ze?ze.completion:{};return Yt.type=le,Yt.arg=ie,ze?(this.method="next",this.next=ze.finallyLoc,et):this.complete(Yt)},complete:function(le,ie){if(le.type==="throw")throw le.arg;return le.type==="break"||le.type==="continue"?this.next=le.arg:le.type==="return"?(this.rval=this.arg=le.arg,this.method="return",this.next="end"):le.type==="normal"&&ie&&(this.next=ie),et},finish:function(le){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var ve=this.tryEntries[ie];if(ve.finallyLoc===le)return this.complete(ve.completion,ve.afterLoc),Ut(ve),et}},catch:function(le){for(var ie=this.tryEntries.length-1;ie>=0;--ie){var ve=this.tryEntries[ie];if(ve.tryLoc===le){var Qe=ve.completion;if(Qe.type==="throw"){var ze=Qe.arg;Ut(ve)}return ze}}throw new Error("illegal catch attempt")},delegateYield:function(le,ie,ve){return this.delegate={iterator:_r(le),resultName:ie,nextLoc:ve},this.method==="next"&&(this.arg=ft),et}},Ce}(Je.exports);try{regeneratorRuntime=Ze}catch(Ce){typeof globalThis=="object"?globalThis.regeneratorRuntime=Ze:Function("r","regeneratorRuntime = r")(Ze)}},695:function(Je,Ze,Ce){Ce.d(Ze,{Z:function(){return qe}});function qe(He){if(He.geometry&&He.geometry.dispose(),He.material){var ft=Array.isArray(He.material)?He.material:[He.material];ft.forEach(function(Ke){var lt,_t,ke,Mt,Vt,Wt,dt,Q,pt,Ft,et,kt,mt;(lt=Ke.map)===null||lt===void 0||lt.dispose(),(_t=Ke.lightMap)===null||_t===void 0||_t.dispose(),(ke=Ke.bumpMap)===null||ke===void 0||ke.dispose(),(Mt=Ke.normalMap)===null||Mt===void 0||Mt.dispose(),(Vt=Ke.specularMap)===null||Vt===void 0||Vt.dispose(),(Wt=Ke.envMap)===null||Wt===void 0||Wt.dispose(),(dt=Ke.alphaMap)===null||dt===void 0||dt.dispose(),(Q=Ke.aoMap)===null||Q===void 0||Q.dispose(),(pt=Ke.displacementMap)===null||pt===void 0||pt.dispose(),(Ft=Ke.emissiveMap)===null||Ft===void 0||Ft.dispose(),(et=Ke.gradientMap)===null||et===void 0||et.dispose(),(kt=Ke.metalnessMap)===null||kt===void 0||kt.dispose(),(mt=Ke.roughnessMap)===null||mt===void 0||mt.dispose(),Ke.dispose()})}}},90:function(Je,Ze,Ce){Ce.d(Ze,{wf:function(){return Ke.Z}});var qe=Ce(666),He=Ce.n(qe),ft=null,Ke=Ce(695),lt=Ce(568),_t=Ce(924),ke=Ce(77),Mt=Ce(484),Vt=null,Wt=null,dt=function(){var pt=(0,lt.Z)(He().mark(function Ft(et,kt){var mt,Bt,mn,Qt,qt,Xt,Pt,nn,Hn;return He().wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return mt=kt.type,Bt=mt===void 0?"blob":mt,mn=kt.version,Qt=mn===void 0?"1":mn,St.next=4,(0,ke.get)(et);case 4:if(Xt=St.sent,!(Xt&&Xt[Qt])){St.next=9;break}qt=Xt[Qt],St.next=15;break;case 9:return St.next=11,(0,Mt.Z)(fetch(et).then(function(Ut){if(Ut.ok)return Ut[Bt]();throw new Error}));case 11:Pt=St.sent,nn=Pt.res,Hn=Pt.err,Hn||(qt=nn,(0,ke.set)(et,(0,_t.Z)({},Qt,nn)));case 15:return St.abrupt("return",qt?{url:Bt==="json"?et:URL.createObjectURL(qt),store:qt}:{url:et});case 16:case"end":return St.stop()}},Ft)}));return function(et,kt){return pt.apply(this,arguments)}}(),Q=Ce(705)},484:function(Je,Ze,Ce){Ce.d(Ze,{Z:function(){return He}});var qe=Ce(42);function He(ft){var Ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ft.then(function(lt){return(0,qe.Z)({err:null,res:lt},Ke)}).catch(function(lt){return(0,qe.Z)({err:lt,res:void 0},Ke)})}},705:function(Je,Ze,Ce){Ce.d(Ze,{C:function(){return Ke},y:function(){return ft}});var qe=Ce(212),He=new Map,ft=function(){var lt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{generateTopUV:function(_t,ke,Mt,Vt,Wt){var dt=ke[Mt*3],Q=ke[Mt*3+1],pt=ke[Vt*3],Ft=ke[Vt*3+1],et=ke[Wt*3],kt=ke[Wt*3+1],mt;if(He.has(_t))mt=He.get(_t);else{var Bt=lt.box3||new qe.Box3;if(!lt.box3){var mn=_t.parameters.shapes.getPoints();Bt.setFromArray(mn.map(function(nn){return[nn.x,nn.y,0]}).flat())}var Qt=Bt.getSize(new qe.Vector3);lt.split&&(Qt.y/=lt.split),mt={box:Bt,size:Qt},He.set(_t,mt)}var qt=mt.box,Xt=mt.size,Pt=lt.split?1-lt.split:0;return[new qe.Vector2((dt-qt.min.x)/Xt.x,(Q-qt.min.y)/Xt.y+Pt),new qe.Vector2((pt-qt.min.x)/Xt.x,(Ft-qt.min.y)/Xt.y+Pt),new qe.Vector2((et-qt.min.x)/Xt.x,(kt-qt.min.y)/Xt.y+Pt)]},generateSideWallUV:function(_t,ke,Mt,Vt,Wt,dt){var Q=ke[Mt*3],pt=ke[Mt*3+1],Ft=ke[Mt*3+2],et=ke[Vt*3],kt=ke[Vt*3+1],mt=ke[Vt*3+2],Bt=ke[Wt*3],mn=ke[Wt*3+1],Qt=ke[Wt*3+2],qt=ke[dt*3],Xt=ke[dt*3+1],Pt=ke[dt*3+2],nn;if(He.has(ke))nn=He.get(ke);else{var Hn=new qe.Box3;Hn.setFromArray(ke);var ni=Hn.getSize(new qe.Vector3);lt.split&&(ni.z/=1-lt.split),nn={box:Hn,size:ni},He.set(ke,nn)}var St=nn.box,Ut=nn.size;return Math.abs(pt-kt)<Math.abs(Q-et)?[new qe.Vector2((Q-St.min.x)/Ut.x,(Ft-St.min.z)/Ut.z),new qe.Vector2((et-St.min.x)/Ut.x,(mt-St.min.z)/Ut.z),new qe.Vector2((Bt-St.min.x)/Ut.x,(Qt-St.min.z)/Ut.z),new qe.Vector2((qt-St.min.x)/Ut.x,(Pt-St.min.z)/Ut.z)]:[new qe.Vector2((pt-St.min.y)/Ut.y,(Ft-St.min.z)/Ut.z),new qe.Vector2((kt-St.min.y)/Ut.y,(mt-St.min.z)/Ut.z),new qe.Vector2((mn-St.min.y)/Ut.y,(Qt-St.min.z)/Ut.z),new qe.Vector2((Xt-St.min.y)/Ut.y,(Pt-St.min.z)/Ut.z)]}}},Ke=function(){He.clear()}},212:function(Je,Ze,Ce){Ce.r(Ze),Ce.d(Ze,{ACESFilmicToneMapping:function(){return is},AddEquation:function(){return Pt},AddOperation:function(){return Zo},AdditiveAnimationBlendMode:function(){return co},AdditiveBlending:function(){return mn},AlphaFormat:function(){return nr},AlwaysDepth:function(){return Tn},AlwaysStencilFunc:function(){return cu},AmbientLight:function(){return Zc},AmbientLightProbe:function(){return xf},AnimationClip:function(){return Go},AnimationLoader:function(){return _y},AnimationMixer:function(){return Lf},AnimationObjectGroup:function(){return Cf},AnimationUtils:function(){return Jt},ArcCurve:function(){return xc},ArrayCamera:function(){return cc},ArrowHelper:function(){return $y},Audio:function(){return Kc},AudioAnalyser:function(){return Ef},AudioContext:function(){return $c},AudioListener:function(){return Ey},AudioLoader:function(){return vf},AxesHelper:function(){return Xf},AxisHelper:function(){return Tx},BackSide:function(){return pt},BasicDepthPacking:function(){return ou},BasicShadowMap:function(){return Mt},BinaryTextureLoader:function(){return Rx},Bone:function(){return Ja},BooleanKeyframeTrack:function(){return qr},BoundingBoxHelper:function(){return Ex},Box2:function(){return to},Box3:function(){return $n},Box3Helper:function(){return Yy},BoxBufferGeometry:function(){return Wi},BoxGeometry:function(){return Wi},BoxHelper:function(){return Wf},BufferAttribute:function(){return Tt},BufferGeometry:function(){return $e},BufferGeometryLoader:function(){return df},ByteType:function(){return Ll},Cache:function(){return Zr},Camera:function(){return yo},CameraHelper:function(){return jy},CanvasRenderer:function(){return Dx},CanvasTexture:function(){return Uh},CatmullRomCurve3:function(){return Sc},CineonToneMapping:function(){return ns},CircleBufferGeometry:function(){return Vs},CircleGeometry:function(){return Vs},ClampToEdgeWrapping:function(){return xn},Clock:function(){return Mf},Color:function(){return Me},ColorKeyframeTrack:function(){return Uc},CompressedTexture:function(){return gc},CompressedTextureLoader:function(){return by},ConeBufferGeometry:function(){return Ws},ConeGeometry:function(){return Ws},CubeCamera:function(){return Pa},CubeReflectionMapping:function(){return Bi},CubeRefractionMapping:function(){return Ni},CubeTexture:function(){return Ds},CubeTextureLoader:function(){return tf},CubeUVReflectionMapping:function(){return wr},CubeUVRefractionMapping:function(){return Ki},CubicBezierCurve:function(){return ol},CubicBezierCurve3:function(){return Tc},CubicInterpolant:function(){return $h},CullFaceBack:function(){return lt},CullFaceFront:function(){return _t},CullFaceFrontBack:function(){return ke},CullFaceNone:function(){return Ke},Curve:function(){return ei},CurvePath:function(){return kh},CustomBlending:function(){return Xt},CustomToneMapping:function(){return jo},CylinderBufferGeometry:function(){return vr},CylinderGeometry:function(){return vr},Cylindrical:function(){return Hy},DataTexture:function(){return Ur},DataTexture2DArray:function(){return Oa},DataTexture3D:function(){return oc},DataTextureLoader:function(){return nf},DataUtils:function(){return ex},DecrementStencilOp:function(){return ud},DecrementWrapStencilOp:function(){return fd},DefaultLoadingManager:function(){return ef},DepthFormat:function(){return Oi},DepthStencilFormat:function(){return Mi},DepthTexture:function(){return Ha},DirectionalLight:function(){return Xc},DirectionalLightHelper:function(){return Zy},DiscreteInterpolant:function(){return Kh},DodecahedronBufferGeometry:function(){return qs},DodecahedronGeometry:function(){return qs},DoubleSide:function(){return Ft},DstAlphaFactor:function(){return ve},DstColorFactor:function(){return ze},DynamicBufferAttribute:function(){return mx},DynamicCopyUsage:function(){return Ed},DynamicDrawUsage:function(){return vs},DynamicReadUsage:function(){return wd},EdgesGeometry:function(){return yc},EdgesHelper:function(){return Ax},EllipseCurve:function(){return Ro},EqualDepth:function(){return vi},EqualStencilFunc:function(){return gd},EquirectangularReflectionMapping:function(){return yn},EquirectangularRefractionMapping:function(){return Mr},Euler:function(){return Ir},EventDispatcher:function(){return rr},ExtrudeBufferGeometry:function(){return Ci},ExtrudeGeometry:function(){return Ci},FaceColors:function(){return rx},FileLoader:function(){return Li},FlatShading:function(){return et},Float16BufferAttribute:function(){return Pu},Float32Attribute:function(){return wx},Float32BufferAttribute:function(){return Fe},Float64Attribute:function(){return Sx},Float64BufferAttribute:function(){return Du},FloatType:function(){return ri},Fog:function(){return So},FogExp2:function(){return wo},Font:function(){return Ux},FontLoader:function(){return zx},FramebufferTexture:function(){return zh},FrontSide:function(){return Q},Frustum:function(){return xo},GLBufferAttribute:function(){return Pf},GLSL1:function(){return Cd},GLSL3:function(){return Pl},GreaterDepth:function(){return ts},GreaterEqualDepth:function(){return Bn},GreaterEqualStencilFunc:function(){return _d},GreaterStencilFunc:function(){return yd},GridHelper:function(){return Hf},Group:function(){return Or},HalfFloatType:function(){return _i},HemisphereLight:function(){return Hc},HemisphereLightHelper:function(){return qy},HemisphereLightProbe:function(){return yf},IcosahedronBufferGeometry:function(){return Zs},IcosahedronGeometry:function(){return Zs},ImageBitmapLoader:function(){return gf},ImageLoader:function(){return Ho},ImageUtils:function(){return Rr},ImmediateRenderObject:function(){return Gx},IncrementStencilOp:function(){return cd},IncrementWrapStencilOp:function(){return hd},InstancedBufferAttribute:function(){return Gr},InstancedBufferGeometry:function(){return Jc},InstancedInterleavedBuffer:function(){return Rf},InstancedMesh:function(){return fc},Int16Attribute:function(){return xx},Int16BufferAttribute:function(){return Lu},Int32Attribute:function(){return bx},Int32BufferAttribute:function(){return Ru},Int8Attribute:function(){return gx},Int8BufferAttribute:function(){return Eu},IntType:function(){return Jo},InterleavedBuffer:function(){return zr},InterleavedBufferAttribute:function(){return gr},Interpolant:function(){return Zi},InterpolateDiscrete:function(){return kn},InterpolateLinear:function(){return zn},InterpolateSmooth:function(){return An},InvertStencilOp:function(){return dd},JSONLoader:function(){return Ix},KeepStencilOp:function(){return aa},KeyframeTrack:function(){return di},LOD:function(){return Mh},LatheBufferGeometry:function(){return js},LatheGeometry:function(){return js},Layers:function(){return va},LensFlare:function(){return Bx},LessDepth:function(){return fn},LessEqualDepth:function(){return gi},LessEqualStencilFunc:function(){return vd},LessStencilFunc:function(){return md},Light:function(){return pi},LightProbe:function(){return Vo},Line:function(){return Xi},Line3:function(){return Bf},LineBasicMaterial:function(){return Sn},LineCurve:function(){return Io},LineCurve3:function(){return Hh},LineDashedMaterial:function(){return Oc},LineLoop:function(){return pc},LinePieces:function(){return nx},LineSegments:function(){return Vn},LineStrip:function(){return tx},LinearEncoding:function(){return oi},LinearFilter:function(){return en},LinearInterpolant:function(){return zc},LinearMipMapLinearFilter:function(){return so},LinearMipMapNearestFilter:function(){return Cl},LinearMipmapLinearFilter:function(){return Qi},LinearMipmapNearestFilter:function(){return xi},LinearToneMapping:function(){return Wn},Loader:function(){return Gn},LoaderUtils:function(){return pl},LoadingManager:function(){return Gc},LoopOnce:function(){return ps},LoopPingPong:function(){return On},LoopRepeat:function(){return ms},LuminanceAlphaFormat:function(){return ea},LuminanceFormat:function(){return Qo},MOUSE:function(){return He},Material:function(){return bn},MaterialLoader:function(){return ff},Math:function(){return fu},MathUtils:function(){return fu},Matrix3:function(){return gn},Matrix4:function(){return Oe},MaxEquation:function(){return St},Mesh:function(){return pn},MeshBasicMaterial:function(){return Vi},MeshDepthMaterial:function(){return Ua},MeshDistanceMaterial:function(){return Ga},MeshFaceMaterial:function(){return ox},MeshLambertMaterial:function(){return Bc},MeshMatcapMaterial:function(){return Nc},MeshNormalMaterial:function(){return Fc},MeshPhongMaterial:function(){return Dc},MeshPhysicalMaterial:function(){return Pc},MeshStandardMaterial:function(){return dl},MeshToonMaterial:function(){return Ic},MinEquation:function(){return ni},MirroredRepeatWrapping:function(){return yi},MixOperation:function(){return Xo},MultiMaterial:function(){return ax},MultiplyBlending:function(){return qt},MultiplyOperation:function(){return br},NearestFilter:function(){return Kt},NearestMipMapLinearFilter:function(){return Al},NearestMipMapNearestFilter:function(){return El},NearestMipmapLinearFilter:function(){return os},NearestMipmapNearestFilter:function(){return ss},NeverDepth:function(){return hn},NeverStencilFunc:function(){return pd},NoBlending:function(){return mt},NoColors:function(){return ix},NoToneMapping:function(){return li},NormalAnimationBlendMode:function(){return ir},NormalBlending:function(){return Bt},NotEqualDepth:function(){return qo},NotEqualStencilFunc:function(){return xd},NumberKeyframeTrack:function(){return zo},Object3D:function(){return bt},ObjectLoader:function(){return My},ObjectSpaceNormalMap:function(){return lu},OctahedronBufferGeometry:function(){return kr},OctahedronGeometry:function(){return kr},OneFactor:function(){return Ji},OneMinusDstAlphaFactor:function(){return Qe},OneMinusDstColorFactor:function(){return Yt},OneMinusSrcAlphaFactor:function(){return ie},OneMinusSrcColorFactor:function(){return $i},OrthographicCamera:function(){return _o},PCFShadowMap:function(){return Vt},PCFSoftShadowMap:function(){return Wt},PMREMGenerator:function(){return Hu},ParametricGeometry:function(){return Nx},Particle:function(){return cx},ParticleBasicMaterial:function(){return fx},ParticleSystem:function(){return ux},ParticleSystemMaterial:function(){return dx},Path:function(){return Fo},PerspectiveCamera:function(){return wn},Plane:function(){return wi},PlaneBufferGeometry:function(){return Fr},PlaneGeometry:function(){return Fr},PlaneHelper:function(){return Jy},PointCloud:function(){return lx},PointCloudMaterial:function(){return hx},PointLight:function(){return qc},PointLightHelper:function(){return Vy},Points:function(){return Lo},PointsMaterial:function(){return Hr},PolarGridHelper:function(){return Xy},PolyhedronBufferGeometry:function(){return Ti},PolyhedronGeometry:function(){return Ti},PositionalAudio:function(){return Cy},PropertyBinding:function(){return At},PropertyMixer:function(){return Af},QuadraticBezierCurve:function(){return al},QuadraticBezierCurve3:function(){return ll},Quaternion:function(){return Rn},QuaternionKeyframeTrack:function(){return eo},QuaternionLinearInterpolant:function(){return Qh},REVISION:function(){return qe},RGBADepthPacking:function(){return au},RGBAFormat:function(){return on},RGBAIntegerFormat:function(){return sa},RGBA_ASTC_10x10_Format:function(){return Ee},RGBA_ASTC_10x5_Format:function(){return ae},RGBA_ASTC_10x6_Format:function(){return fe},RGBA_ASTC_10x8_Format:function(){return de},RGBA_ASTC_12x10_Format:function(){return De},RGBA_ASTC_12x12_Format:function(){return Pe},RGBA_ASTC_4x4_Format:function(){return D},RGBA_ASTC_5x4_Format:function(){return R},RGBA_ASTC_5x5_Format:function(){return B},RGBA_ASTC_6x5_Format:function(){return z},RGBA_ASTC_6x6_Format:function(){return S},RGBA_ASTC_8x5_Format:function(){return k},RGBA_ASTC_8x6_Format:function(){return Y},RGBA_ASTC_8x8_Format:function(){return oe},RGBA_BPTC_Format:function(){return Ae},RGBA_ETC2_EAC_Format:function(){return b},RGBA_PVRTC_2BPPV1_Format:function(){return ds},RGBA_PVRTC_4BPPV1_Format:function(){return fs},RGBA_S3TC_DXT1_Format:function(){return Tr},RGBA_S3TC_DXT3_Format:function(){return us},RGBA_S3TC_DXT5_Format:function(){return hs},RGBFormat:function(){return bi},RGBIntegerFormat:function(){return ra},RGB_ETC1_Format:function(){return oa},RGB_ETC2_Format:function(){return lo},RGB_PVRTC_2BPPV1_Format:function(){return ao},RGB_PVRTC_4BPPV1_Format:function(){return oo},RGB_S3TC_DXT1_Format:function(){return cs},RGFormat:function(){return ls},RGIntegerFormat:function(){return ia},RawShaderMaterial:function(){return Fs},Ray:function(){return cr},Raycaster:function(){return Uy},RectAreaLight:function(){return jc},RedFormat:function(){return ta},RedIntegerFormat:function(){return na},ReinhardToneMapping:function(){return ro},RepeatWrapping:function(){return Sr},ReplaceStencilOp:function(){return ld},ReverseSubtractEquation:function(){return Hn},RingBufferGeometry:function(){return Ys},RingGeometry:function(){return Ys},SRGB8_ALPHA8_ASTC_10x10_Format:function(){return si},SRGB8_ALPHA8_ASTC_10x5_Format:function(){return En},SRGB8_ALPHA8_ASTC_10x6_Format:function(){return qn},SRGB8_ALPHA8_ASTC_10x8_Format:function(){return Xn},SRGB8_ALPHA8_ASTC_12x10_Format:function(){return Er},SRGB8_ALPHA8_ASTC_12x12_Format:function(){return an},SRGB8_ALPHA8_ASTC_4x4_Format:function(){return J},SRGB8_ALPHA8_ASTC_5x4_Format:function(){return je},SRGB8_ALPHA8_ASTC_5x5_Format:function(){return Ve},SRGB8_ALPHA8_ASTC_6x5_Format:function(){return Dt},SRGB8_ALPHA8_ASTC_6x6_Format:function(){return Be},SRGB8_ALPHA8_ASTC_8x5_Format:function(){return Gt},SRGB8_ALPHA8_ASTC_8x6_Format:function(){return _n},SRGB8_ALPHA8_ASTC_8x8_Format:function(){return Nn},Scene:function(){return ka},SceneUtils:function(){return Fx},ShaderChunk:function(){return gt},ShaderLib:function(){return fi},ShaderMaterial:function(){return qi},ShadowMaterial:function(){return Rc},Shape:function(){return Ei},ShapeBufferGeometry:function(){return Vr},ShapeGeometry:function(){return Vr},ShapePath:function(){return Ky},ShapeUtils:function(){return Ai},ShortType:function(){return Yo},Skeleton:function(){return $a},SkeletonHelper:function(){return Of},SkinnedMesh:function(){return Ya},SmoothShading:function(){return kt},Sphere:function(){return ar},SphereBufferGeometry:function(){return Wr},SphereGeometry:function(){return Wr},Spherical:function(){return Gy},SphericalHarmonics3:function(){return Yc},SplineCurve:function(){return cl},SpotLight:function(){return Vc},SpotLightHelper:function(){return ky},Sprite:function(){return Xa},SpriteMaterial:function(){return Va},SrcAlphaFactor:function(){return le},SrcAlphaSaturateFactor:function(){return Rt},SrcColorFactor:function(){return _r},StaticCopyUsage:function(){return Td},StaticDrawUsage:function(){return gs},StaticReadUsage:function(){return Md},StereoCamera:function(){return Sy},StreamCopyUsage:function(){return Ad},StreamDrawUsage:function(){return bd},StreamReadUsage:function(){return Sd},StringKeyframeTrack:function(){return Xr},SubtractEquation:function(){return nn},SubtractiveBlending:function(){return Qt},TOUCH:function(){return ft},TangentSpaceNormalMap:function(){return Cr},TetrahedronBufferGeometry:function(){return Js},TetrahedronGeometry:function(){return Js},TextGeometry:function(){return Ox},Texture:function(){return dn},TextureLoader:function(){return rf},TorusBufferGeometry:function(){return $s},TorusGeometry:function(){return $s},TorusKnotBufferGeometry:function(){return Ks},TorusKnotGeometry:function(){return Ks},Triangle:function(){return ln},TriangleFanDrawMode:function(){return od},TriangleStripDrawMode:function(){return sd},TrianglesDrawMode:function(){return uo},TubeBufferGeometry:function(){return Qs},TubeGeometry:function(){return Qs},UVMapping:function(){return rs},Uint16Attribute:function(){return _x},Uint16BufferAttribute:function(){return ba},Uint32Attribute:function(){return Mx},Uint32BufferAttribute:function(){return Ma},Uint8Attribute:function(){return vx},Uint8BufferAttribute:function(){return Au},Uint8ClampedAttribute:function(){return yx},Uint8ClampedBufferAttribute:function(){return Cu},Uniform:function(){return gl},UniformsLib:function(){return xe},UniformsUtils:function(){return Fu},UnsignedByteType:function(){return ii},UnsignedInt248Type:function(){return tr},UnsignedIntType:function(){return as},UnsignedShort4444Type:function(){return Rl},UnsignedShort5551Type:function(){return $o},UnsignedShort565Type:function(){return Ko},UnsignedShortType:function(){return er},VSMShadowMap:function(){return dt},Vector2:function(){return ee},Vector3:function(){return M},Vector4:function(){return Nt},VectorKeyframeTrack:function(){return Uo},Vertex:function(){return px},VertexColors:function(){return sx},VideoTexture:function(){return Oh},WebGL1Renderer:function(){return vh},WebGLCubeRenderTarget:function(){return Da},WebGLMultipleRenderTargets:function(){return pu},WebGLMultisampleRenderTarget:function(){return ua},WebGLRenderTarget:function(){return Jn},WebGLRenderTargetCube:function(){return Px},WebGLRenderer:function(){return Ot},WebGLUtils:function(){return gh},WireframeGeometry:function(){return Lc},WireframeHelper:function(){return Cx},WrapAroundEnding:function(){return Pn},XHRLoader:function(){return Lx},ZeroCurvatureEnding:function(){return Zn},ZeroFactor:function(){return Ut},ZeroSlopeEnding:function(){return jn},ZeroStencilOp:function(){return ad},sRGBEncoding:function(){return Ar}});/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2010-2021 Three.js Authors
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/const qe="136",He={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ft={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ke=0,lt=1,_t=2,ke=3,Mt=0,Vt=1,Wt=2,dt=3,Q=0,pt=1,Ft=2,et=1,kt=2,mt=0,Bt=1,mn=2,Qt=3,qt=4,Xt=5,Pt=100,nn=101,Hn=102,ni=103,St=104,Ut=200,Ji=201,_r=202,$i=203,le=204,ie=205,ve=206,Qe=207,ze=208,Yt=209,Rt=210,hn=0,Tn=1,fn=2,gi=3,vi=4,Bn=5,ts=6,qo=7,br=0,Xo=1,Zo=2,li=0,Wn=1,ro=2,ns=3,is=4,jo=5,rs=300,Bi=301,Ni=302,yn=303,Mr=304,wr=306,Ki=307,Sr=1e3,xn=1001,yi=1002,Kt=1003,ss=1004,El=1004,os=1005,Al=1005,en=1006,xi=1007,Cl=1007,Qi=1008,so=1008,ii=1009,Ll=1010,Yo=1011,er=1012,Jo=1013,as=1014,ri=1015,_i=1016,Rl=1017,$o=1018,Ko=1019,tr=1020,nr=1021,bi=1022,on=1023,Qo=1024,ea=1025,Oi=1026,Mi=1027,ta=1028,na=1029,ls=1030,ia=1031,ra=1032,sa=1033,cs=33776,Tr=33777,us=33778,hs=33779,oo=35840,ao=35841,fs=35842,ds=35843,oa=36196,lo=37492,b=37496,D=37808,R=37809,B=37810,z=37811,S=37812,k=37813,Y=37814,oe=37815,ae=37816,fe=37817,de=37818,Ee=37819,De=37820,Pe=37821,Ae=36492,J=37840,je=37841,Ve=37842,Dt=37843,Be=37844,Gt=37845,_n=37846,Nn=37847,En=37848,qn=37849,Xn=37850,si=37851,Er=37852,an=37853,ps=2200,ms=2201,On=2202,kn=2300,zn=2301,An=2302,Zn=2400,jn=2401,Pn=2402,ir=2500,co=2501,uo=0,sd=1,od=2,oi=3e3,Ar=3001,ou=3200,au=3201,Cr=0,lu=1,ad=0,aa=7680,ld=7681,cd=7682,ud=7683,hd=34055,fd=34056,dd=5386,pd=512,md=513,gd=514,vd=515,yd=516,xd=517,_d=518,cu=519,gs=35044,vs=35048,bd=35040,Md=35045,wd=35049,Sd=35041,Td=35046,Ed=35050,Ad=35042,Cd="100",Pl="300 es";class rr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,o=i.length;r<o;r++)i[r].call(this,e);e.target=null}}}const Cn=[];for(let s=0;s<256;s++)Cn[s]=(s<16?"0":"")+s.toString(16);let la=1234567;const Lr=Math.PI/180,ho=180/Math.PI;function Yn(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Cn[s&255]+Cn[s>>8&255]+Cn[s>>16&255]+Cn[s>>24&255]+"-"+Cn[e&255]+Cn[e>>8&255]+"-"+Cn[e>>16&15|64]+Cn[e>>24&255]+"-"+Cn[t&63|128]+Cn[t>>8&255]+"-"+Cn[t>>16&255]+Cn[t>>24&255]+Cn[n&255]+Cn[n>>8&255]+Cn[n>>16&255]+Cn[n>>24&255]).toUpperCase()}function Ln(s,e,t){return Math.max(e,Math.min(t,s))}function Dl(s,e){return(s%e+e)%e}function Ld(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Rd(s,e,t){return s!==e?(t-s)/(e-s):0}function fo(s,e,t){return(1-t)*s+t*e}function Pd(s,e,t,n){return fo(s,e,1-Math.exp(-t*n))}function Dd(s,e=1){return e-Math.abs(Dl(s,e*2)-e)}function Id(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Fd(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Bd(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Nd(s,e){return s+Math.random()*(e-s)}function Od(s){return s*(.5-Math.random())}function zd(s){return s!==void 0&&(la=s%2147483647),la=la*16807%2147483647,(la-1)/2147483646}function Ud(s){return s*Lr}function Gd(s){return s*ho}function Il(s){return(s&s-1)===0&&s!==0}function uu(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function hu(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Hd(s,e,t,n,i){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+n)/2),u=o((e+n)/2),h=r((e-n)/2),f=o((e-n)/2),d=r((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":s.set(a*u,l*h,l*f,a*c);break;case"YZY":s.set(l*f,a*u,l*h,a*c);break;case"ZXZ":s.set(l*h,l*f,a*u,a*c);break;case"XZX":s.set(a*u,l*m,l*d,a*c);break;case"YXY":s.set(l*d,a*u,l*m,a*c);break;case"ZYZ":s.set(l*m,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var fu=Object.freeze({__proto__:null,DEG2RAD:Lr,RAD2DEG:ho,generateUUID:Yn,clamp:Ln,euclideanModulo:Dl,mapLinear:Ld,inverseLerp:Rd,lerp:fo,damp:Pd,pingpong:Dd,smoothstep:Id,smootherstep:Fd,randInt:Bd,randFloat:Nd,randFloatSpread:Od,seededRandom:zd,degToRad:Ud,radToDeg:Gd,isPowerOfTwo:Il,ceilPowerOfTwo:uu,floorPowerOfTwo:hu,setQuaternionFromProperEuler:Hd});class ee{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}ee.prototype.isVector2=!0;class gn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],m=n[8],v=i[0],x=i[3],g=i[6],p=i[1],_=i[4],y=i[7],w=i[2],L=i[5],I=i[8];return r[0]=o*v+a*p+l*w,r[3]=o*x+a*_+l*L,r[6]=o*g+a*y+l*I,r[1]=c*v+u*p+h*w,r[4]=c*x+u*_+h*L,r[7]=c*g+u*y+h*I,r[2]=f*v+d*p+m*w,r[5]=f*x+d*_+m*L,r[8]=f*g+d*y+m*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*r*u+n*a*l+i*r*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*r,d=c*r-o*l,m=t*h+n*f+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=h*v,e[1]=(i*c-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=f*v,e[4]=(u*t-i*l)*v,e[5]=(i*r-a*t)*v,e[6]=d*v,e[7]=(n*l-c*t)*v,e[8]=(o*t-n*r)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],o=i[3],a=i[6],l=i[1],c=i[4],u=i[7];return i[0]=t*r+n*l,i[3]=t*o+n*c,i[6]=t*a+n*u,i[1]=-n*r+t*l,i[4]=-n*o+t*c,i[7]=-n*a+t*u,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}gn.prototype.isMatrix3=!0;function du(s){if(s.length===0)return-1/0;let e=s[0];for(let t=1,n=s.length;t<n;++t)s[t]>e&&(e=s[t]);return e}const kd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ys(s,e){return new kd[s](e)}function ca(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}let xs;class Rr{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{xs===void 0&&(xs=ca("canvas")),xs.width=e.width,xs.height=e.height;const n=xs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=xs}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}let Vd=0;class dn extends rr{constructor(e=dn.DEFAULT_IMAGE,t=dn.DEFAULT_MAPPING,n=xn,i=xn,r=en,o=Qi,a=on,l=ii,c=1,u=oi){super(),Object.defineProperty(this,"id",{value:Vd++}),this.uuid=Yn(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new ee(0,0),this.repeat=new ee(1,1),this.center=new ee(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new gn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const i=this.image;if(i.uuid===void 0&&(i.uuid=Yn()),!t&&e.images[i.uuid]===void 0){let r;if(Array.isArray(i)){r=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?r.push(Fl(i[o].image)):r.push(Fl(i[o]))}else r=Fl(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==rs)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sr:e.x=e.x-Math.floor(e.x);break;case xn:e.x=e.x<0?0:1;break;case yi:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sr:e.y=e.y-Math.floor(e.y);break;case xn:e.y=e.y<0?0:1;break;case yi:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}}dn.DEFAULT_IMAGE=void 0,dn.DEFAULT_MAPPING=rs,dn.prototype.isTexture=!0;function Fl(s){return typeof HTMLImageElement!="undefined"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&s instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&s instanceof ImageBitmap?Rr.getDataURL(s):s.data?{data:Array.prototype.slice.call(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class Nt{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){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: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],m=l[9],v=l[2],x=l[6],g=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-v)<.01&&Math.abs(m-x)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+v)<.1&&Math.abs(m+x)<.1&&Math.abs(c+d+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,y=(d+1)/2,w=(g+1)/2,L=(u+f)/4,I=(h+v)/4,O=(m+x)/4;return _>y&&_>w?_<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(_),i=L/n,r=I/n):y>w?y<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=L/i,r=O/i):w<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(w),n=I/r,i=O/r),this.set(n,i,r,t),this}let p=Math.sqrt((x-m)*(x-m)+(h-v)*(h-v)+(f-u)*(f-u));return Math.abs(p)<.001&&(p=1),this.x=(x-m)/p,this.y=(h-v)/p,this.z=(f-u)/p,this.w=Math.acos((c+d+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}}Nt.prototype.isVector4=!0;class Jn extends rr{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new Nt(0,0,e,t),this.scissorTest=!1,this.viewport=new Nt(0,0,e,t),this.texture=new dn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:en,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=ed({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}Jn.prototype.isWebGLRenderTarget=!0;class pu extends Jn{constructor(e,t,n){super(e,t);const i=this.texture;this.texture=[];for(let r=0;r<n;r++)this.texture[r]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}}pu.prototype.isWebGLMultipleRenderTargets=!0;class ua extends Jn{constructor(e,t,n={}){super(e,t,n),this.samples=4,this.ignoreDepthForMultisampleCopy=n.ignoreDepth!==void 0?n.ignoreDepth:!0,this.useRenderToTexture=n.useRenderToTexture!==void 0?n.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}}ua.prototype.isWebGLMultisampleRenderTarget=!0;class Rn{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,r,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const f=r[o+0],d=r[o+1],m=r[o+2],v=r[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=m,e[t+3]=v;return}if(h!==v||l!==f||c!==d||u!==m){let x=1-a;const g=l*f+c*d+u*m+h*v,p=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const w=Math.sqrt(_),L=Math.atan2(w,g*p);x=Math.sin(x*L)/w,a=Math.sin(a*L)/w}const y=a*p;if(l=l*x+f*y,c=c*x+d*y,u=u*x+m*y,h=h*x+v*y,x===1-a){const w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=r[o],f=r[o+1],d=r[o+2],m=r[o+3];return e[t]=a*m+u*h+l*d-c*f,e[t+1]=l*m+u*f+c*h-a*d,e[t+2]=c*m+u*d+a*f-l*h,e[t+3]=u*m-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(r/2),f=l(n/2),d=l(i/2),m=l(r/2);switch(o){case"XYZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"YZX":this._x=f*u*h+c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h-f*d*m;break;case"XZY":this._x=f*u*h-c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(r-c)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(r+c)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(r-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(r+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ln(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-r*l,this._y=i*u+o*l+r*a-n*c,this._z=r*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=r*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Rn.prototype.isQuaternion=!0;class M{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(mu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(mu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-r*i,h=l*i+r*n-o*t,f=-r*t-o*n-a*i;return this.x=c*l+f*-r+u*-a-h*-o,this.y=u*l+f*-o+h*-r-c*-a,this.z=h*l+f*-a+c*-o-u*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-r*a,this.y=r*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Bl.copy(this).projectOnVector(e),this.sub(Bl)}reflect(e){return this.sub(Bl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ln(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-Qf(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}M.prototype.isVector3=!0;const Bl=new M,mu=new Rn;class $n{constructor(e=new M(1/0,1/0,1/0),t=new M(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;l<c;l+=3){const u=e[l],h=e[l+1],f=e[l+2];u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>r&&(r=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(r,o,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;l<c;l++){const u=e.getX(l),h=e.getY(l),f=e.getZ(l);u<t&&(t=u),h<n&&(n=h),f<i&&(i=f),u>r&&(r=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,n,i),this.max.set(r,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=po.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);const t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Nl.copy(t.boundingBox),Nl.applyMatrix4(e.matrixWorld),this.union(Nl));const n=e.children;for(let i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,po),po.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(mo),ha.subVectors(this.max,mo),_s.subVectors(e.a,mo),bs.subVectors(e.b,mo),Ms.subVectors(e.c,mo),sr.subVectors(bs,_s),or.subVectors(Ms,bs),Pr.subVectors(_s,Ms);let t=[0,-sr.z,sr.y,0,-or.z,or.y,0,-Pr.z,Pr.y,sr.z,0,-sr.x,or.z,0,-or.x,Pr.z,0,-Pr.x,-sr.y,sr.x,0,-or.y,or.x,0,-Pr.y,Pr.x,0];return!Ol(t,_s,bs,Ms,ha)||(t=[1,0,0,0,1,0,0,0,1],!Ol(t,_s,bs,Ms,ha))?!1:(fa.crossVectors(sr,or),t=[fa.x,fa.y,fa.z],Ol(t,_s,bs,Ms,ha))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return po.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(po).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(zi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),zi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),zi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),zi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),zi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),zi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),zi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),zi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(zi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}$n.prototype.isBox3=!0;const zi=[new M,new M,new M,new M,new M,new M,new M,new M],po=new M,Nl=new $n,_s=new M,bs=new M,Ms=new M,sr=new M,or=new M,Pr=new M,mo=new M,ha=new M,fa=new M,Dr=new M;function Ol(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Dr.fromArray(s,r);const a=i.x*Math.abs(Dr.x)+i.y*Math.abs(Dr.y)+i.z*Math.abs(Dr.z),l=e.dot(Dr),c=t.dot(Dr),u=n.dot(Dr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Wd=new $n,gu=new M,da=new M,zl=new M;class ar{constructor(e=new M,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Wd.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;r<o;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){zl.subVectors(e,this.center);const t=zl.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(zl.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return this.center.equals(e.center)===!0?da.set(0,0,1).multiplyScalar(e.radius):da.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(gu.copy(e.center).add(da)),this.expandByPoint(gu.copy(e.center).sub(da)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ui=new M,Ul=new M,pa=new M,lr=new M,Gl=new M,ma=new M,Hl=new M;class cr{constructor(e=new M,t=new M(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ui)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ui.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ui.copy(this.direction).multiplyScalar(t).add(this.origin),Ui.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ul.copy(e).add(t).multiplyScalar(.5),pa.copy(t).sub(e).normalize(),lr.copy(this.origin).sub(Ul);const r=e.distanceTo(t)*.5,o=-this.direction.dot(pa),a=lr.dot(this.direction),l=-lr.dot(pa),c=lr.lengthSq(),u=Math.abs(1-o*o);let h,f,d,m;if(u>0)if(h=o*l-a,f=o*a-l,m=r*u,h>=0)if(f>=-m)if(f<=m){const v=1/u;h*=v,f*=v,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=r,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-r,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-o*r+a)),f=h>0?-r:Math.min(Math.max(-r,-l),r),d=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-r,-l),r),d=f*(f+2*l)+c):(h=Math.max(0,-(o*r+a)),f=h>0?r:Math.min(Math.max(-r,-l),r),d=-h*h+f*(f+2*l)+c);else f=o>0?-r:r,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(pa).multiplyScalar(f).add(Ul),d}intersectSphere(e,t){Ui.subVectors(e.center,this.origin);const n=Ui.dot(this.direction),i=Ui.dot(Ui)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,l=n+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(r=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(r=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||r>i||((r>n||n!==n)&&(n=r),(o<i||i!==i)&&(i=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Ui)!==null}intersectTriangle(e,t,n,i,r){Gl.subVectors(t,e),ma.subVectors(n,e),Hl.crossVectors(Gl,ma);let o=this.direction.dot(Hl),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;lr.subVectors(this.origin,e);const l=a*this.direction.dot(ma.crossVectors(lr,ma));if(l<0)return null;const c=a*this.direction.dot(Gl.cross(lr));if(c<0||l+c>o)return null;const u=-a*lr.dot(Hl);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Oe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,o,a,l,c,u,h,f,d,m,v,x){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=f,g[3]=d,g[7]=m,g[11]=v,g[15]=x,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 Oe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/ws.setFromMatrixColumn(e,0).length(),r=1/ws.setFromMatrixColumn(e,1).length(),o=1/ws.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+m*c,t[5]=f-v*c,t[9]=-a*l,t[2]=v-f*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,m=c*u,v=c*h;t[0]=f+v*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=v+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,m=c*u,v=c*h;t[0]=f-v*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=v-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=l*u,t[4]=m*c-d,t[8]=f*c+v,t[1]=l*h,t[5]=v*c+f,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=v-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+m,t[10]=f-v*h}else if(e.order==="XZY"){const f=o*l,d=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+v,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=v*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(qd,e,Xd)}lookAt(e,t,n){const i=this.elements;return Kn.subVectors(e,t),Kn.lengthSq()===0&&(Kn.z=1),Kn.normalize(),ur.crossVectors(n,Kn),ur.lengthSq()===0&&(Math.abs(n.z)===1?Kn.x+=1e-4:Kn.z+=1e-4,Kn.normalize(),ur.crossVectors(n,Kn)),ur.normalize(),ga.crossVectors(Kn,ur),i[0]=ur.x,i[4]=ga.x,i[8]=Kn.x,i[1]=ur.y,i[5]=ga.y,i[9]=Kn.y,i[2]=ur.z,i[6]=ga.z,i[10]=Kn.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],m=n[2],v=n[6],x=n[10],g=n[14],p=n[3],_=n[7],y=n[11],w=n[15],L=i[0],I=i[4],O=i[8],j=i[12],V=i[1],N=i[5],T=i[9],C=i[13],U=i[2],q=i[6],G=i[10],X=i[14],_e=i[3],Le=i[7],K=i[11],te=i[15];return r[0]=o*L+a*V+l*U+c*_e,r[4]=o*I+a*N+l*q+c*Le,r[8]=o*O+a*T+l*G+c*K,r[12]=o*j+a*C+l*X+c*te,r[1]=u*L+h*V+f*U+d*_e,r[5]=u*I+h*N+f*q+d*Le,r[9]=u*O+h*T+f*G+d*K,r[13]=u*j+h*C+f*X+d*te,r[2]=m*L+v*V+x*U+g*_e,r[6]=m*I+v*N+x*q+g*Le,r[10]=m*O+v*T+x*G+g*K,r[14]=m*j+v*C+x*X+g*te,r[3]=p*L+_*V+y*U+w*_e,r[7]=p*I+_*N+y*q+w*Le,r[11]=p*O+_*T+y*G+w*K,r[15]=p*j+_*C+y*X+w*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],v=e[7],x=e[11],g=e[15];return m*(+r*l*h-i*c*h-r*a*f+n*c*f+i*a*d-n*l*d)+v*(+t*l*d-t*c*f+r*o*f-i*o*d+i*c*u-r*l*u)+x*(+t*c*h-t*a*d-r*o*h+n*o*d+r*a*u-n*c*u)+g*(-i*a*u-t*l*h+t*a*f+i*o*h-n*o*f+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],v=e[13],x=e[14],g=e[15],p=h*x*c-v*f*c+v*l*d-a*x*d-h*l*g+a*f*g,_=m*f*c-u*x*c-m*l*d+o*x*d+u*l*g-o*f*g,y=u*v*c-m*h*c+m*a*d-o*v*d-u*a*g+o*h*g,w=m*h*l-u*v*l-m*a*f+o*v*f+u*a*x-o*h*x,L=t*p+n*_+i*y+r*w;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/L;return e[0]=p*I,e[1]=(v*f*r-h*x*r-v*i*d+n*x*d+h*i*g-n*f*g)*I,e[2]=(a*x*r-v*l*r+v*i*c-n*x*c-a*i*g+n*l*g)*I,e[3]=(h*l*r-a*f*r-h*i*c+n*f*c+a*i*d-n*l*d)*I,e[4]=_*I,e[5]=(u*x*r-m*f*r+m*i*d-t*x*d-u*i*g+t*f*g)*I,e[6]=(m*l*r-o*x*r-m*i*c+t*x*c+o*i*g-t*l*g)*I,e[7]=(o*f*r-u*l*r+u*i*c-t*f*c-o*i*d+t*l*d)*I,e[8]=y*I,e[9]=(m*h*r-u*v*r-m*n*d+t*v*d+u*n*g-t*h*g)*I,e[10]=(o*v*r-m*a*r+m*n*c-t*v*c-o*n*g+t*a*g)*I,e[11]=(u*a*r-o*h*r-u*n*c+t*h*c+o*n*d-t*a*d)*I,e[12]=w*I,e[13]=(u*v*i-m*h*i+m*n*f-t*v*f-u*n*x+t*h*x)*I,e[14]=(m*a*i-o*v*i-m*n*l+t*v*l+o*n*x-t*a*x)*I,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*f+t*a*f)*I,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,r*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,o){return this.set(1,n,r,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,h=a+a,f=r*c,d=r*u,m=r*h,v=o*u,x=o*h,g=a*h,p=l*c,_=l*u,y=l*h,w=n.x,L=n.y,I=n.z;return i[0]=(1-(v+g))*w,i[1]=(d+y)*w,i[2]=(m-_)*w,i[3]=0,i[4]=(d-y)*L,i[5]=(1-(f+g))*L,i[6]=(x+p)*L,i[7]=0,i[8]=(m+_)*I,i[9]=(x-p)*I,i[10]=(1-(f+v))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=ws.set(i[0],i[1],i[2]).length();const o=ws.set(i[4],i[5],i[6]).length(),a=ws.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],ci.copy(this);const c=1/r,u=1/o,h=1/a;return ci.elements[0]*=c,ci.elements[1]*=c,ci.elements[2]*=c,ci.elements[4]*=u,ci.elements[5]*=u,ci.elements[6]*=u,ci.elements[8]*=h,ci.elements[9]*=h,ci.elements[10]*=h,t.setFromRotationMatrix(ci),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,l=2*r/(t-e),c=2*r/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),f=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,o){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-r),h=(t+e)*l,f=(n+i)*c,d=(o+r)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Oe.prototype.isMatrix4=!0;const ws=new M,ci=new Oe,qd=new M(0,0,0),Xd=new M(1,1,1),ur=new M,ga=new M,Kn=new M,vu=new Oe,yu=new Rn;class Ir{constructor(e=0,t=0,n=0,i=Ir.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Ln(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ln(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ln(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Ln(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ln(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return vu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vu,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return yu.setFromEuler(this),this.setFromQuaternion(yu,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new M(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ir.prototype.isEuler=!0,Ir.DefaultOrder="XYZ",Ir.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class va{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Zd=0;const xu=new M,Ss=new Rn,Gi=new Oe,ya=new M,go=new M,jd=new M,Yd=new Rn,_u=new M(1,0,0),bu=new M(0,1,0),Mu=new M(0,0,1),Jd={type:"added"},wu={type:"removed"};class bt extends rr{constructor(){super(),Object.defineProperty(this,"id",{value:Zd++}),this.uuid=Yn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bt.DefaultUp.clone();const e=new M,t=new Ir,n=new Rn,i=new M(1,1,1);function r(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Oe},normalMatrix:{value:new gn}}),this.matrix=new Oe,this.matrixWorld=new Oe,this.matrixAutoUpdate=bt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new va,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ss.setFromAxisAngle(e,t),this.quaternion.multiply(Ss),this}rotateOnWorldAxis(e,t){return Ss.setFromAxisAngle(e,t),this.quaternion.premultiply(Ss),this}rotateX(e){return this.rotateOnAxis(_u,e)}rotateY(e){return this.rotateOnAxis(bu,e)}rotateZ(e){return this.rotateOnAxis(Mu,e)}translateOnAxis(e,t){return xu.copy(e).applyQuaternion(this.quaternion),this.position.add(xu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_u,e)}translateY(e){return this.translateOnAxis(bu,e)}translateZ(e){return this.translateOnAxis(Mu,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Gi.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ya.copy(e):ya.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),go.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gi.lookAt(go,ya,this.up):Gi.lookAt(ya,go,this.up),this.quaternion.setFromRotationMatrix(Gi),i&&(Gi.extractRotation(i.matrixWorld),Ss.setFromRotationMatrix(Gi),this.quaternion.premultiply(Ss.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Jd)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(wu)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(wu)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Gi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Gi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Gi),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(go,e,jd),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(go,Yd,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let r=0,o=i.length;r<o;r++)i[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];r(e.shapes,h)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(r(e.materials,this.material[l]));i.material=a}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(r(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),d=o(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}bt.DefaultUp=new M(0,1,0),bt.DefaultMatrixAutoUpdate=!0,bt.prototype.isObject3D=!0;const ui=new M,Hi=new M,kl=new M,ki=new M,Ts=new M,Es=new M,Su=new M,Vl=new M,Wl=new M,ql=new M;class ln{constructor(e=new M,t=new M,n=new M){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),ui.subVectors(e,t),i.cross(ui);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){ui.subVectors(i,t),Hi.subVectors(n,t),kl.subVectors(e,t);const o=ui.dot(ui),a=ui.dot(Hi),l=ui.dot(kl),c=Hi.dot(Hi),u=Hi.dot(kl),h=o*c-a*a;if(h===0)return r.set(-2,-1,-1);const f=1/h,d=(c*l-a*u)*f,m=(o*u-a*l)*f;return r.set(1-d-m,m,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,ki),ki.x>=0&&ki.y>=0&&ki.x+ki.y<=1}static getUV(e,t,n,i,r,o,a,l){return this.getBarycoord(e,t,n,i,ki),l.set(0,0),l.addScaledVector(r,ki.x),l.addScaledVector(o,ki.y),l.addScaledVector(a,ki.z),l}static isFrontFacing(e,t,n,i){return ui.subVectors(n,t),Hi.subVectors(e,t),ui.cross(Hi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ui.subVectors(this.c,this.b),Hi.subVectors(this.a,this.b),ui.cross(Hi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ln.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ln.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return ln.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return ln.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ln.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let o,a;Ts.subVectors(i,n),Es.subVectors(r,n),Vl.subVectors(e,n);const l=Ts.dot(Vl),c=Es.dot(Vl);if(l<=0&&c<=0)return t.copy(n);Wl.subVectors(e,i);const u=Ts.dot(Wl),h=Es.dot(Wl);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ts,o);ql.subVectors(e,r);const d=Ts.dot(ql),m=Es.dot(ql);if(m>=0&&d<=m)return t.copy(r);const v=d*c-l*m;if(v<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(n).addScaledVector(Es,a);const x=u*m-d*h;if(x<=0&&h-u>=0&&d-m>=0)return Su.subVectors(r,i),a=(h-u)/(h-u+(d-m)),t.copy(i).addScaledVector(Su,a);const g=1/(x+v+f);return o=v*g,a=f*g,t.copy(n).addScaledVector(Ts,o).addScaledVector(Es,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let $d=0;class bn extends rr{constructor(){super(),Object.defineProperty(this,"id",{value:$d++}),this.uuid=Yn(),this.name="",this.type="Material",this.fog=!0,this.blending=Bt,this.side=Q,this.vertexColors=!1,this.opacity=1,this.format=on,this.transparent=!1,this.blendSrc=le,this.blendDst=ie,this.blendEquation=Pt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=gi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=cu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=aa,this.stencilZFail=aa,this.stencilZPass=aa,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===et;continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,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&&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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),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(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 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!==Bt&&(n.blending=this.blending),this.side!==Q&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==on&&(n.format=this.format),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&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&&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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}bn.prototype.isMaterial=!0;const Tu={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},hi={h:0,s:0,l:0},xa={h:0,s:0,l:0};function Xl(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}function Zl(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function jl(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}class Me{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=Dl(e,1),t=Ln(t,0,1),n=Ln(n,0,1),t===0)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Xl(r,i,e+1/3),this.g=Xl(r,i,e),this.b=Xl(r,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i;const r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,c)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],r=i.length;if(r===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(r===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Tu[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Zl(e.r),this.g=Zl(e.g),this.b=Zl(e.b),this}copyLinearToSRGB(e){return this.r=jl(e.r),this.g=jl(e.g),this.b=jl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),o=Math.min(t,n,i);let a,l;const c=(o+r)/2;if(o===r)a=0,l=0;else{const u=r-o;switch(l=c<=.5?u/(r+o):u/(2-r-o),r){case t:a=(n-i)/u+(n<i?6:0);break;case n:a=(i-t)/u+2;break;case i:a=(t-n)/u+4;break}a/=6}return e.h=a,e.s=l,e.l=c,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(hi),hi.h+=e,hi.s+=t,hi.l+=n,this.setHSL(hi.h,hi.s,hi.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(hi),e.getHSL(xa);const n=fo(hi.h,xa.h,t),i=fo(hi.s,xa.s,t),r=fo(hi.l,xa.l,t);return this.setHSL(n,i,r),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Me.NAMES=Tu,Me.prototype.isColor=!0,Me.prototype.r=1,Me.prototype.g=1,Me.prototype.b=1;class Vi extends bn{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new Me(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.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Vi.prototype.isMeshBasicMaterial=!0;const Zt=new M,_a=new ee;class Tt{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=gs,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new Me),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new ee),t[n++]=o.x,t[n++]=o.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new M),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let i=0,r=e.length;i<r;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new Nt),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)_a.fromBufferAttribute(this,t),_a.applyMatrix3(e),this.setXY(t,_a.x,_a.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Zt.fromBufferAttribute(this,t),Zt.applyMatrix3(e),this.setXYZ(t,Zt.x,Zt.y,Zt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Zt.x=this.getX(t),Zt.y=this.getY(t),Zt.z=this.getZ(t),Zt.applyMatrix4(e),this.setXYZ(t,Zt.x,Zt.y,Zt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Zt.x=this.getX(t),Zt.y=this.getY(t),Zt.z=this.getZ(t),Zt.applyNormalMatrix(e),this.setXYZ(t,Zt.x,Zt.y,Zt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Zt.x=this.getX(t),Zt.y=this.getY(t),Zt.z=this.getZ(t),Zt.transformDirection(e),this.setXYZ(t,Zt.x,Zt.y,Zt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==gs&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}Tt.prototype.isBufferAttribute=!0;class Eu extends Tt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Au extends Tt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Cu extends Tt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class Lu extends Tt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class ba extends Tt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ru extends Tt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Ma extends Tt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Pu extends Tt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}Pu.prototype.isFloat16BufferAttribute=!0;class Fe extends Tt{constructor(e,t,n){super(new Float32Array(e),t,n)}}class Du extends Tt{constructor(e,t,n){super(new Float64Array(e),t,n)}}let Kd=0;const ai=new Oe,Yl=new bt,As=new M,Qn=new $n,vo=new $n,Mn=new M;class $e extends rr{constructor(){super(),Object.defineProperty(this,"id",{value:Kd++}),this.uuid=Yn(),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(e){return Array.isArray(e)?this.index=new(du(e)>65535?Ma:ba)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const r=new gn().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ai.makeRotationFromQuaternion(e),this.applyMatrix4(ai),this}rotateX(e){return ai.makeRotationX(e),this.applyMatrix4(ai),this}rotateY(e){return ai.makeRotationY(e),this.applyMatrix4(ai),this}rotateZ(e){return ai.makeRotationZ(e),this.applyMatrix4(ai),this}translate(e,t,n){return ai.makeTranslation(e,t,n),this.applyMatrix4(ai),this}scale(e,t,n){return ai.makeScale(e,t,n),this.applyMatrix4(ai),this}lookAt(e){return Yl.lookAt(e),Yl.updateMatrix(),this.applyMatrix4(Yl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(As).negate(),this.translate(As.x,As.y,As.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Fe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new $n);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const r=t[n];Qn.setFromBufferAttribute(r),this.morphTargetsRelative?(Mn.addVectors(this.boundingBox.min,Qn.min),this.boundingBox.expandByPoint(Mn),Mn.addVectors(this.boundingBox.max,Qn.max),this.boundingBox.expandByPoint(Mn)):(this.boundingBox.expandByPoint(Qn.min),this.boundingBox.expandByPoint(Qn.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 ar);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new M,1/0);return}if(e){const n=this.boundingSphere.center;if(Qn.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){const a=t[r];vo.setFromBufferAttribute(a),this.morphTargetsRelative?(Mn.addVectors(Qn.min,vo.min),Qn.expandByPoint(Mn),Mn.addVectors(Qn.max,vo.max),Qn.expandByPoint(Mn)):(Qn.expandByPoint(vo.min),Qn.expandByPoint(vo.max))}Qn.getCenter(n);let i=0;for(let r=0,o=e.count;r<o;r++)Mn.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Mn));if(t)for(let r=0,o=t.length;r<o;r++){const a=t[r],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Mn.fromBufferAttribute(a,c),l&&(As.fromBufferAttribute(e,c),Mn.add(As)),i=Math.max(i,n.distanceToSquared(Mn))}this.boundingSphere.radius=Math.sqrt(i),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 e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,r=t.normal.array,o=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new Tt(new Float32Array(4*a),4));const l=t.tangent.array,c=[],u=[];for(let V=0;V<a;V++)c[V]=new M,u[V]=new M;const h=new M,f=new M,d=new M,m=new ee,v=new ee,x=new ee,g=new M,p=new M;function _(V,N,T){h.fromArray(i,V*3),f.fromArray(i,N*3),d.fromArray(i,T*3),m.fromArray(o,V*2),v.fromArray(o,N*2),x.fromArray(o,T*2),f.sub(h),d.sub(h),v.sub(m),x.sub(m);const C=1/(v.x*x.y-x.x*v.y);!isFinite(C)||(g.copy(f).multiplyScalar(x.y).addScaledVector(d,-v.y).multiplyScalar(C),p.copy(d).multiplyScalar(v.x).addScaledVector(f,-x.x).multiplyScalar(C),c[V].add(g),c[N].add(g),c[T].add(g),u[V].add(p),u[N].add(p),u[T].add(p))}let y=this.groups;y.length===0&&(y=[{start:0,count:n.length}]);for(let V=0,N=y.length;V<N;++V){const T=y[V],C=T.start,U=T.count;for(let q=C,G=C+U;q<G;q+=3)_(n[q+0],n[q+1],n[q+2])}const w=new M,L=new M,I=new M,O=new M;function j(V){I.fromArray(r,V*3),O.copy(I);const N=c[V];w.copy(N),w.sub(I.multiplyScalar(I.dot(N))).normalize(),L.crossVectors(O,N);const C=L.dot(u[V])<0?-1:1;l[V*4]=w.x,l[V*4+1]=w.y,l[V*4+2]=w.z,l[V*4+3]=C}for(let V=0,N=y.length;V<N;++V){const T=y[V],C=T.start,U=T.count;for(let q=C,G=C+U;q<G;q+=3)j(n[q+0]),j(n[q+1]),j(n[q+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Tt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);const i=new M,r=new M,o=new M,a=new M,l=new M,c=new M,u=new M,h=new M;if(e)for(let f=0,d=e.count;f<d;f+=3){const m=e.getX(f+0),v=e.getX(f+1),x=e.getX(f+2);i.fromBufferAttribute(t,m),r.fromBufferAttribute(t,v),o.fromBufferAttribute(t,x),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,x),a.add(u),l.add(u),c.add(u),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(x,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),r.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,r),h.subVectors(i,r),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(e.attributes[i]===void 0)continue;const o=n[i].array,a=e.attributes[i],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,f=c;h<u;h++,f++)o[f]=l[h]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Mn.fromBufferAttribute(e,t),Mn.normalize(),e.setXYZ(t,Mn.x,Mn.y,Mn.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u);let d=0,m=0;for(let v=0,x=l.length;v<x;v++){a.isInterleavedBufferAttribute?d=l[v]*a.data.stride+a.offset:d=l[v]*u;for(let g=0;g<u;g++)f[m++]=c[d++]}return new Tt(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new $e,n=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,n);t.setAttribute(a,c)}const r=this.morphAttributes;for(const a in r){const l=[],c=r[a];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(i[l]=u,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],h=r[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}$e.prototype.isBufferGeometry=!0;const Iu=new Oe,Cs=new cr,Jl=new ar,hr=new M,fr=new M,dr=new M,$l=new M,Kl=new M,Ql=new M,wa=new M,Sa=new M,Ta=new M,Ea=new ee,Aa=new ee,Ca=new ee,ec=new M,La=new M;class pn extends bt{constructor(e=new $e,t=new Vi){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Jl.copy(n.boundingSphere),Jl.applyMatrix4(r),e.ray.intersectsSphere(Jl)===!1)||(Iu.copy(r).invert(),Cs.copy(e.ray).applyMatrix4(Iu),n.boundingBox!==null&&Cs.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){const a=n.index,l=n.attributes.position,c=n.morphAttributes.position,u=n.morphTargetsRelative,h=n.attributes.uv,f=n.attributes.uv2,d=n.groups,m=n.drawRange;if(a!==null)if(Array.isArray(i))for(let v=0,x=d.length;v<x;v++){const g=d[v],p=i[g.materialIndex],_=Math.max(g.start,m.start),y=Math.min(a.count,Math.min(g.start+g.count,m.start+m.count));for(let w=_,L=y;w<L;w+=3){const I=a.getX(w),O=a.getX(w+1),j=a.getX(w+2);o=Ra(this,p,e,Cs,l,c,u,h,f,I,O,j),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const v=Math.max(0,m.start),x=Math.min(a.count,m.start+m.count);for(let g=v,p=x;g<p;g+=3){const _=a.getX(g),y=a.getX(g+1),w=a.getX(g+2);o=Ra(this,i,e,Cs,l,c,u,h,f,_,y,w),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(i))for(let v=0,x=d.length;v<x;v++){const g=d[v],p=i[g.materialIndex],_=Math.max(g.start,m.start),y=Math.min(l.count,Math.min(g.start+g.count,m.start+m.count));for(let w=_,L=y;w<L;w+=3){const I=w,O=w+1,j=w+2;o=Ra(this,p,e,Cs,l,c,u,h,f,I,O,j),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{const v=Math.max(0,m.start),x=Math.min(l.count,m.start+m.count);for(let g=v,p=x;g<p;g+=3){const _=g,y=g+1,w=g+2;o=Ra(this,i,e,Cs,l,c,u,h,f,_,y,w),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}pn.prototype.isMesh=!0;function Qd(s,e,t,n,i,r,o,a){let l;if(e.side===pt?l=n.intersectTriangle(o,r,i,!0,a):l=n.intersectTriangle(i,r,o,e.side!==Ft,a),l===null)return null;La.copy(a),La.applyMatrix4(s.matrixWorld);const c=t.ray.origin.distanceTo(La);return c<t.near||c>t.far?null:{distance:c,point:La.clone(),object:s}}function Ra(s,e,t,n,i,r,o,a,l,c,u,h){hr.fromBufferAttribute(i,c),fr.fromBufferAttribute(i,u),dr.fromBufferAttribute(i,h);const f=s.morphTargetInfluences;if(r&&f){wa.set(0,0,0),Sa.set(0,0,0),Ta.set(0,0,0);for(let m=0,v=r.length;m<v;m++){const x=f[m],g=r[m];x!==0&&($l.fromBufferAttribute(g,c),Kl.fromBufferAttribute(g,u),Ql.fromBufferAttribute(g,h),o?(wa.addScaledVector($l,x),Sa.addScaledVector(Kl,x),Ta.addScaledVector(Ql,x)):(wa.addScaledVector($l.sub(hr),x),Sa.addScaledVector(Kl.sub(fr),x),Ta.addScaledVector(Ql.sub(dr),x)))}hr.add(wa),fr.add(Sa),dr.add(Ta)}s.isSkinnedMesh&&(s.boneTransform(c,hr),s.boneTransform(u,fr),s.boneTransform(h,dr));const d=Qd(s,e,t,n,hr,fr,dr,ec);if(d){a&&(Ea.fromBufferAttribute(a,c),Aa.fromBufferAttribute(a,u),Ca.fromBufferAttribute(a,h),d.uv=ln.getUV(ec,hr,fr,dr,Ea,Aa,Ca,new ee)),l&&(Ea.fromBufferAttribute(l,c),Aa.fromBufferAttribute(l,u),Ca.fromBufferAttribute(l,h),d.uv2=ln.getUV(ec,hr,fr,dr,Ea,Aa,Ca,new ee));const m={a:c,b:u,c:h,normal:new M,materialIndex:0};ln.getNormal(hr,fr,dr,m.normal),d.face=m}return d}class Wi extends $e{constructor(e=1,t=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,n,t,e,o,r,0),m("z","y","x",1,-1,n,t,-e,o,r,1),m("x","z","y",1,1,e,n,t,i,o,2),m("x","z","y",1,-1,e,n,-t,i,o,3),m("x","y","z",1,-1,e,t,n,i,r,4),m("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(l),this.setAttribute("position",new Fe(c,3)),this.setAttribute("normal",new Fe(u,3)),this.setAttribute("uv",new Fe(h,2));function m(v,x,g,p,_,y,w,L,I,O,j){const V=y/I,N=w/O,T=y/2,C=w/2,U=L/2,q=I+1,G=O+1;let X=0,_e=0;const Le=new M;for(let K=0;K<G;K++){const te=K*N-C;for(let Re=0;Re<q;Re++){const Te=Re*V-T;Le[v]=Te*p,Le[x]=te*_,Le[g]=U,c.push(Le.x,Le.y,Le.z),Le[v]=0,Le[x]=0,Le[g]=L>0?1:-1,u.push(Le.x,Le.y,Le.z),h.push(Re/I),h.push(1-K/O),X+=1}}for(let K=0;K<O;K++)for(let te=0;te<I;te++){const Re=f+te+q*K,Te=f+te+q*(K+1),Ne=f+(te+1)+q*(K+1),wt=f+(te+1)+q*K;l.push(Re,Te,wt),l.push(Te,Ne,wt),_e+=6}a.addGroup(d,_e,j),d+=_e,f+=X}}static fromJSON(e){return new Wi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ls(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Dn(s){const e={};for(let t=0;t<s.length;t++){const n=Ls(s[t]);for(const i in n)e[i]=n[i]}return e}const Fu={clone:Ls,merge:Dn};var ep=`void main() {
|
|
6
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
+
}`,tp=`void main() {
|
|
8
|
+
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
+
}`;class qi extends bn{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=ep,this.fragmentShader=tp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ls(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}qi.prototype.isShaderMaterial=!0;class yo extends bt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Oe,this.projectionMatrix=new Oe,this.projectionMatrixInverse=new Oe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}yo.prototype.isCamera=!0;class wn extends yo{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ho*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Lr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ho*2*Math.atan(Math.tan(Lr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Lr*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}wn.prototype.isPerspectiveCamera=!0;const Rs=90,Ps=1;class Pa extends bt{constructor(e,t,n){if(super(),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;const i=new wn(Rs,Ps,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new M(1,0,0)),this.add(i);const r=new wn(Rs,Ps,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new M(-1,0,0)),this.add(r);const o=new wn(Rs,Ps,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new M(0,1,0)),this.add(o);const a=new wn(Rs,Ps,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new M(0,-1,0)),this.add(a);const l=new wn(Rs,Ps,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new M(0,0,1)),this.add(l);const c=new wn(Rs,Ps,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new M(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,o,a,l,c]=this.children,u=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(h),e.xr.enabled=u}}class Ds extends dn{constructor(e,t,n,i,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Bi,super(e,t,n,i,r,o,a,l,c,u),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Ds.prototype.isCubeTexture=!0;class Da extends Jn{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new Ds(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:en,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=on,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.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
|
+
`},i=new Wi(5,5,5),r=new qi({name:"CubemapFromEquirect",uniforms:Ls(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:pt,blending:mt});r.uniforms.tEquirect.value=t;const o=new pn(i,r),a=t.minFilter;return t.minFilter===Qi&&(t.minFilter=en),new Pa(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(r)}}Da.prototype.isWebGLCubeRenderTarget=!0;const tc=new M,np=new M,ip=new gn;class wi{constructor(e=new M(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=tc.subVectors(n,t).cross(np.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(tc),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||ip.getNormalMatrix(e),i=this.coplanarPoint(tc).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}wi.prototype.isPlane=!0;const Is=new ar,Ia=new M;class xo{constructor(e=new wi,t=new wi,n=new wi,i=new wi,r=new wi,o=new wi){this.planes=[e,t,n,i,r,o]}set(e,t,n,i,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],h=n[7],f=n[8],d=n[9],m=n[10],v=n[11],x=n[12],g=n[13],p=n[14],_=n[15];return t[0].setComponents(a-i,h-l,v-f,_-x).normalize(),t[1].setComponents(a+i,h+l,v+f,_+x).normalize(),t[2].setComponents(a+r,h+c,v+d,_+g).normalize(),t[3].setComponents(a-r,h-c,v-d,_-g).normalize(),t[4].setComponents(a-o,h-u,v-m,_-p).normalize(),t[5].setComponents(a+o,h+u,v+m,_+p).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Is.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Is)}intersectsSprite(e){return Is.center.set(0,0,0),Is.radius=.7071067811865476,Is.applyMatrix4(e.matrixWorld),this.intersectsSphere(Is)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Ia.x=i.normal.x>0?e.max.x:e.min.x,Ia.y=i.normal.y>0?e.max.y:e.min.y,Ia.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ia)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Bu(){let s=null,e=!1,t=null,n=null;function i(r,o){t(r,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function rp(s,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const h=c.array,f=c.usage,d=s.createBuffer();s.bindBuffer(u,d),s.bufferData(u,h,f),c.onUploadCallback();let m=5126;return h instanceof Float32Array?m=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?c.isFloat16BufferAttribute?t?m=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):m=5123:h instanceof Int16Array?m=5122:h instanceof Uint32Array?m=5125:h instanceof Int32Array?m=5124:h instanceof Int8Array?m=5120:(h instanceof Uint8Array||h instanceof Uint8ClampedArray)&&(m=5121),{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function r(c,u,h){const f=u.array,d=u.updateRange;s.bindBuffer(h,c),d.count===-1?s.bufferSubData(h,0,f):(t?s.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):s.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(s.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=n.get(c);(!f||f.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=n.get(c);h===void 0?n.set(c,i(c,u)):h.version<c.version&&(r(h.buffer,c,u),h.version=c.version)}return{get:o,remove:a,update:l}}class Fr extends $e{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,u=l+1,h=e/a,f=t/l,d=[],m=[],v=[],x=[];for(let g=0;g<u;g++){const p=g*f-o;for(let _=0;_<c;_++){const y=_*h-r;m.push(y,-p,0),v.push(0,0,1),x.push(_/a),x.push(1-g/l)}}for(let g=0;g<l;g++)for(let p=0;p<a;p++){const _=p+c*g,y=p+c*(g+1),w=p+1+c*(g+1),L=p+1+c*g;d.push(_,y,L),d.push(y,w,L)}this.setIndex(d),this.setAttribute("position",new Fe(m,3)),this.setAttribute("normal",new Fe(v,3)),this.setAttribute("uv",new Fe(x,2))}static fromJSON(e){return new Fr(e.width,e.height,e.widthSegments,e.heightSegments)}}var sp=`#ifdef USE_ALPHAMAP
|
|
45
|
+
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
46
|
+
#endif`,op=`#ifdef USE_ALPHAMAP
|
|
47
|
+
uniform sampler2D alphaMap;
|
|
48
|
+
#endif`,ap=`#ifdef USE_ALPHATEST
|
|
49
|
+
if ( diffuseColor.a < alphaTest ) discard;
|
|
50
|
+
#endif`,lp=`#ifdef USE_ALPHATEST
|
|
51
|
+
uniform float alphaTest;
|
|
52
|
+
#endif`,cp=`#ifdef USE_AOMAP
|
|
53
|
+
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
54
|
+
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
55
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
56
|
+
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
57
|
+
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
58
|
+
#endif
|
|
59
|
+
#endif`,up=`#ifdef USE_AOMAP
|
|
60
|
+
uniform sampler2D aoMap;
|
|
61
|
+
uniform float aoMapIntensity;
|
|
62
|
+
#endif`,hp="vec3 transformed = vec3( position );",fp=`vec3 objectNormal = vec3( normal );
|
|
63
|
+
#ifdef USE_TANGENT
|
|
64
|
+
vec3 objectTangent = vec3( tangent.xyz );
|
|
65
|
+
#endif`,dp=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
66
|
+
return RECIPROCAL_PI * diffuseColor;
|
|
67
|
+
}
|
|
68
|
+
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
69
|
+
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
70
|
+
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
71
|
+
}
|
|
72
|
+
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
73
|
+
float a2 = pow2( alpha );
|
|
74
|
+
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
75
|
+
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
76
|
+
return 0.5 / max( gv + gl, EPSILON );
|
|
77
|
+
}
|
|
78
|
+
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
79
|
+
float a2 = pow2( alpha );
|
|
80
|
+
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
81
|
+
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
82
|
+
}
|
|
83
|
+
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
|
84
|
+
float alpha = pow2( roughness );
|
|
85
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
86
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
87
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
88
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
89
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
90
|
+
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
91
|
+
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
92
|
+
float D = D_GGX( alpha, dotNH );
|
|
93
|
+
return F * ( V * D );
|
|
94
|
+
}
|
|
95
|
+
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
96
|
+
const float LUT_SIZE = 64.0;
|
|
97
|
+
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
98
|
+
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
99
|
+
float dotNV = saturate( dot( N, V ) );
|
|
100
|
+
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
101
|
+
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
102
|
+
return uv;
|
|
103
|
+
}
|
|
104
|
+
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
105
|
+
float l = length( f );
|
|
106
|
+
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
107
|
+
}
|
|
108
|
+
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
109
|
+
float x = dot( v1, v2 );
|
|
110
|
+
float y = abs( x );
|
|
111
|
+
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
112
|
+
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
113
|
+
float v = a / b;
|
|
114
|
+
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
115
|
+
return cross( v1, v2 ) * theta_sintheta;
|
|
116
|
+
}
|
|
117
|
+
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
118
|
+
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
119
|
+
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
120
|
+
vec3 lightNormal = cross( v1, v2 );
|
|
121
|
+
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
122
|
+
vec3 T1, T2;
|
|
123
|
+
T1 = normalize( V - N * dot( V, N ) );
|
|
124
|
+
T2 = - cross( N, T1 );
|
|
125
|
+
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
126
|
+
vec3 coords[ 4 ];
|
|
127
|
+
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
128
|
+
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
129
|
+
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
130
|
+
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
131
|
+
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
132
|
+
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
133
|
+
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
134
|
+
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
135
|
+
vec3 vectorFormFactor = vec3( 0.0 );
|
|
136
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
137
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
138
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
139
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
140
|
+
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
141
|
+
return vec3( result );
|
|
142
|
+
}
|
|
143
|
+
float G_BlinnPhong_Implicit( ) {
|
|
144
|
+
return 0.25;
|
|
145
|
+
}
|
|
146
|
+
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
147
|
+
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
148
|
+
}
|
|
149
|
+
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
150
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
151
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
152
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
153
|
+
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
154
|
+
float G = G_BlinnPhong_Implicit( );
|
|
155
|
+
float D = D_BlinnPhong( shininess, dotNH );
|
|
156
|
+
return F * ( G * D );
|
|
157
|
+
}
|
|
158
|
+
#if defined( USE_SHEEN )
|
|
159
|
+
float D_Charlie( float roughness, float dotNH ) {
|
|
160
|
+
float alpha = pow2( roughness );
|
|
161
|
+
float invAlpha = 1.0 / alpha;
|
|
162
|
+
float cos2h = dotNH * dotNH;
|
|
163
|
+
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
164
|
+
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
165
|
+
}
|
|
166
|
+
float V_Neubelt( float dotNV, float dotNL ) {
|
|
167
|
+
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
168
|
+
}
|
|
169
|
+
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
170
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
171
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
172
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
173
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
174
|
+
float D = D_Charlie( sheenRoughness, dotNH );
|
|
175
|
+
float V = V_Neubelt( dotNV, dotNL );
|
|
176
|
+
return sheenColor * ( D * V );
|
|
177
|
+
}
|
|
178
|
+
#endif`,pp=`#ifdef USE_BUMPMAP
|
|
179
|
+
uniform sampler2D bumpMap;
|
|
180
|
+
uniform float bumpScale;
|
|
181
|
+
vec2 dHdxy_fwd() {
|
|
182
|
+
vec2 dSTdx = dFdx( vUv );
|
|
183
|
+
vec2 dSTdy = dFdy( vUv );
|
|
184
|
+
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
|
185
|
+
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
|
186
|
+
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
|
187
|
+
return vec2( dBx, dBy );
|
|
188
|
+
}
|
|
189
|
+
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
190
|
+
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
|
191
|
+
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
|
192
|
+
vec3 vN = surf_norm;
|
|
193
|
+
vec3 R1 = cross( vSigmaY, vN );
|
|
194
|
+
vec3 R2 = cross( vN, vSigmaX );
|
|
195
|
+
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
196
|
+
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
197
|
+
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
198
|
+
}
|
|
199
|
+
#endif`,mp=`#if NUM_CLIPPING_PLANES > 0
|
|
200
|
+
vec4 plane;
|
|
201
|
+
#pragma unroll_loop_start
|
|
202
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
203
|
+
plane = clippingPlanes[ i ];
|
|
204
|
+
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
205
|
+
}
|
|
206
|
+
#pragma unroll_loop_end
|
|
207
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
208
|
+
bool clipped = true;
|
|
209
|
+
#pragma unroll_loop_start
|
|
210
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
211
|
+
plane = clippingPlanes[ i ];
|
|
212
|
+
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
213
|
+
}
|
|
214
|
+
#pragma unroll_loop_end
|
|
215
|
+
if ( clipped ) discard;
|
|
216
|
+
#endif
|
|
217
|
+
#endif`,gp=`#if NUM_CLIPPING_PLANES > 0
|
|
218
|
+
varying vec3 vClipPosition;
|
|
219
|
+
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
220
|
+
#endif`,vp=`#if NUM_CLIPPING_PLANES > 0
|
|
221
|
+
varying vec3 vClipPosition;
|
|
222
|
+
#endif`,yp=`#if NUM_CLIPPING_PLANES > 0
|
|
223
|
+
vClipPosition = - mvPosition.xyz;
|
|
224
|
+
#endif`,xp=`#if defined( USE_COLOR_ALPHA )
|
|
225
|
+
diffuseColor *= vColor;
|
|
226
|
+
#elif defined( USE_COLOR )
|
|
227
|
+
diffuseColor.rgb *= vColor;
|
|
228
|
+
#endif`,_p=`#if defined( USE_COLOR_ALPHA )
|
|
229
|
+
varying vec4 vColor;
|
|
230
|
+
#elif defined( USE_COLOR )
|
|
231
|
+
varying vec3 vColor;
|
|
232
|
+
#endif`,bp=`#if defined( USE_COLOR_ALPHA )
|
|
233
|
+
varying vec4 vColor;
|
|
234
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
235
|
+
varying vec3 vColor;
|
|
236
|
+
#endif`,Mp=`#if defined( USE_COLOR_ALPHA )
|
|
237
|
+
vColor = vec4( 1.0 );
|
|
238
|
+
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
239
|
+
vColor = vec3( 1.0 );
|
|
240
|
+
#endif
|
|
241
|
+
#ifdef USE_COLOR
|
|
242
|
+
vColor *= color;
|
|
243
|
+
#endif
|
|
244
|
+
#ifdef USE_INSTANCING_COLOR
|
|
245
|
+
vColor.xyz *= instanceColor.xyz;
|
|
246
|
+
#endif`,wp=`#define PI 3.141592653589793
|
|
247
|
+
#define PI2 6.283185307179586
|
|
248
|
+
#define PI_HALF 1.5707963267948966
|
|
249
|
+
#define RECIPROCAL_PI 0.3183098861837907
|
|
250
|
+
#define RECIPROCAL_PI2 0.15915494309189535
|
|
251
|
+
#define EPSILON 1e-6
|
|
252
|
+
#ifndef saturate
|
|
253
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
254
|
+
#endif
|
|
255
|
+
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
256
|
+
float pow2( const in float x ) { return x*x; }
|
|
257
|
+
float pow3( const in float x ) { return x*x*x; }
|
|
258
|
+
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
259
|
+
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
260
|
+
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
|
261
|
+
highp float rand( const in vec2 uv ) {
|
|
262
|
+
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
263
|
+
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
264
|
+
return fract( sin( sn ) * c );
|
|
265
|
+
}
|
|
266
|
+
#ifdef HIGH_PRECISION
|
|
267
|
+
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
268
|
+
#else
|
|
269
|
+
float precisionSafeLength( vec3 v ) {
|
|
270
|
+
float maxComponent = max3( abs( v ) );
|
|
271
|
+
return length( v / maxComponent ) * maxComponent;
|
|
272
|
+
}
|
|
273
|
+
#endif
|
|
274
|
+
struct IncidentLight {
|
|
275
|
+
vec3 color;
|
|
276
|
+
vec3 direction;
|
|
277
|
+
bool visible;
|
|
278
|
+
};
|
|
279
|
+
struct ReflectedLight {
|
|
280
|
+
vec3 directDiffuse;
|
|
281
|
+
vec3 directSpecular;
|
|
282
|
+
vec3 indirectDiffuse;
|
|
283
|
+
vec3 indirectSpecular;
|
|
284
|
+
};
|
|
285
|
+
struct GeometricContext {
|
|
286
|
+
vec3 position;
|
|
287
|
+
vec3 normal;
|
|
288
|
+
vec3 viewDir;
|
|
289
|
+
#ifdef USE_CLEARCOAT
|
|
290
|
+
vec3 clearcoatNormal;
|
|
291
|
+
#endif
|
|
292
|
+
};
|
|
293
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
294
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
295
|
+
}
|
|
296
|
+
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
297
|
+
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
298
|
+
}
|
|
299
|
+
mat3 transposeMat3( const in mat3 m ) {
|
|
300
|
+
mat3 tmp;
|
|
301
|
+
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
302
|
+
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
303
|
+
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
304
|
+
return tmp;
|
|
305
|
+
}
|
|
306
|
+
float linearToRelativeLuminance( const in vec3 color ) {
|
|
307
|
+
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
|
308
|
+
return dot( weights, color.rgb );
|
|
309
|
+
}
|
|
310
|
+
bool isPerspectiveMatrix( mat4 m ) {
|
|
311
|
+
return m[ 2 ][ 3 ] == - 1.0;
|
|
312
|
+
}
|
|
313
|
+
vec2 equirectUv( in vec3 dir ) {
|
|
314
|
+
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
315
|
+
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
316
|
+
return vec2( u, v );
|
|
317
|
+
}`,Sp=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
318
|
+
#define cubeUV_maxMipLevel 8.0
|
|
319
|
+
#define cubeUV_minMipLevel 4.0
|
|
320
|
+
#define cubeUV_maxTileSize 256.0
|
|
321
|
+
#define cubeUV_minTileSize 16.0
|
|
322
|
+
float getFace( vec3 direction ) {
|
|
323
|
+
vec3 absDirection = abs( direction );
|
|
324
|
+
float face = - 1.0;
|
|
325
|
+
if ( absDirection.x > absDirection.z ) {
|
|
326
|
+
if ( absDirection.x > absDirection.y )
|
|
327
|
+
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
328
|
+
else
|
|
329
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
330
|
+
} else {
|
|
331
|
+
if ( absDirection.z > absDirection.y )
|
|
332
|
+
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
333
|
+
else
|
|
334
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
335
|
+
}
|
|
336
|
+
return face;
|
|
337
|
+
}
|
|
338
|
+
vec2 getUV( vec3 direction, float face ) {
|
|
339
|
+
vec2 uv;
|
|
340
|
+
if ( face == 0.0 ) {
|
|
341
|
+
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
342
|
+
} else if ( face == 1.0 ) {
|
|
343
|
+
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
344
|
+
} else if ( face == 2.0 ) {
|
|
345
|
+
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
346
|
+
} else if ( face == 3.0 ) {
|
|
347
|
+
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
348
|
+
} else if ( face == 4.0 ) {
|
|
349
|
+
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
350
|
+
} else {
|
|
351
|
+
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
352
|
+
}
|
|
353
|
+
return 0.5 * ( uv + 1.0 );
|
|
354
|
+
}
|
|
355
|
+
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
356
|
+
float face = getFace( direction );
|
|
357
|
+
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
358
|
+
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
359
|
+
float faceSize = exp2( mipInt );
|
|
360
|
+
float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
|
|
361
|
+
vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;
|
|
362
|
+
if ( face > 2.0 ) {
|
|
363
|
+
uv.y += faceSize;
|
|
364
|
+
face -= 3.0;
|
|
365
|
+
}
|
|
366
|
+
uv.x += face * faceSize;
|
|
367
|
+
if ( mipInt < cubeUV_maxMipLevel ) {
|
|
368
|
+
uv.y += 2.0 * cubeUV_maxTileSize;
|
|
369
|
+
}
|
|
370
|
+
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
|
|
371
|
+
uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
|
|
372
|
+
uv *= texelSize;
|
|
373
|
+
return texture2D( envMap, uv ).rgb;
|
|
374
|
+
}
|
|
375
|
+
#define r0 1.0
|
|
376
|
+
#define v0 0.339
|
|
377
|
+
#define m0 - 2.0
|
|
378
|
+
#define r1 0.8
|
|
379
|
+
#define v1 0.276
|
|
380
|
+
#define m1 - 1.0
|
|
381
|
+
#define r4 0.4
|
|
382
|
+
#define v4 0.046
|
|
383
|
+
#define m4 2.0
|
|
384
|
+
#define r5 0.305
|
|
385
|
+
#define v5 0.016
|
|
386
|
+
#define m5 3.0
|
|
387
|
+
#define r6 0.21
|
|
388
|
+
#define v6 0.0038
|
|
389
|
+
#define m6 4.0
|
|
390
|
+
float roughnessToMip( float roughness ) {
|
|
391
|
+
float mip = 0.0;
|
|
392
|
+
if ( roughness >= r1 ) {
|
|
393
|
+
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
|
|
394
|
+
} else if ( roughness >= r4 ) {
|
|
395
|
+
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
|
|
396
|
+
} else if ( roughness >= r5 ) {
|
|
397
|
+
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
|
|
398
|
+
} else if ( roughness >= r6 ) {
|
|
399
|
+
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
|
|
400
|
+
} else {
|
|
401
|
+
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
402
|
+
return mip;
|
|
403
|
+
}
|
|
404
|
+
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
405
|
+
float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
|
|
406
|
+
float mipF = fract( mip );
|
|
407
|
+
float mipInt = floor( mip );
|
|
408
|
+
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
409
|
+
if ( mipF == 0.0 ) {
|
|
410
|
+
return vec4( color0, 1.0 );
|
|
411
|
+
} else {
|
|
412
|
+
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
413
|
+
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
#endif`,Tp=`vec3 transformedNormal = objectNormal;
|
|
417
|
+
#ifdef USE_INSTANCING
|
|
418
|
+
mat3 m = mat3( instanceMatrix );
|
|
419
|
+
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
420
|
+
transformedNormal = m * transformedNormal;
|
|
421
|
+
#endif
|
|
422
|
+
transformedNormal = normalMatrix * transformedNormal;
|
|
423
|
+
#ifdef FLIP_SIDED
|
|
424
|
+
transformedNormal = - transformedNormal;
|
|
425
|
+
#endif
|
|
426
|
+
#ifdef USE_TANGENT
|
|
427
|
+
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
428
|
+
#ifdef FLIP_SIDED
|
|
429
|
+
transformedTangent = - transformedTangent;
|
|
430
|
+
#endif
|
|
431
|
+
#endif`,Ep=`#ifdef USE_DISPLACEMENTMAP
|
|
432
|
+
uniform sampler2D displacementMap;
|
|
433
|
+
uniform float displacementScale;
|
|
434
|
+
uniform float displacementBias;
|
|
435
|
+
#endif`,Ap=`#ifdef USE_DISPLACEMENTMAP
|
|
436
|
+
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
|
437
|
+
#endif`,Cp=`#ifdef USE_EMISSIVEMAP
|
|
438
|
+
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
|
439
|
+
emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
|
|
440
|
+
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
441
|
+
#endif`,Lp=`#ifdef USE_EMISSIVEMAP
|
|
442
|
+
uniform sampler2D emissiveMap;
|
|
443
|
+
#endif`,Rp="gl_FragColor = linearToOutputTexel( gl_FragColor );",Pp=`vec4 LinearToLinear( in vec4 value ) {
|
|
444
|
+
return value;
|
|
445
|
+
}
|
|
446
|
+
vec4 sRGBToLinear( in vec4 value ) {
|
|
447
|
+
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
448
|
+
}
|
|
449
|
+
vec4 LinearTosRGB( in vec4 value ) {
|
|
450
|
+
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 );
|
|
451
|
+
}`,Dp=`#ifdef USE_ENVMAP
|
|
452
|
+
#ifdef ENV_WORLDPOS
|
|
453
|
+
vec3 cameraToFrag;
|
|
454
|
+
if ( isOrthographic ) {
|
|
455
|
+
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
456
|
+
} else {
|
|
457
|
+
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
458
|
+
}
|
|
459
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
460
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
461
|
+
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
462
|
+
#else
|
|
463
|
+
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
464
|
+
#endif
|
|
465
|
+
#else
|
|
466
|
+
vec3 reflectVec = vReflect;
|
|
467
|
+
#endif
|
|
468
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
469
|
+
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
470
|
+
envColor = envMapTexelToLinear( envColor );
|
|
471
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
472
|
+
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
|
473
|
+
#else
|
|
474
|
+
vec4 envColor = vec4( 0.0 );
|
|
475
|
+
#endif
|
|
476
|
+
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
477
|
+
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
478
|
+
#elif defined( ENVMAP_BLENDING_MIX )
|
|
479
|
+
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
480
|
+
#elif defined( ENVMAP_BLENDING_ADD )
|
|
481
|
+
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
482
|
+
#endif
|
|
483
|
+
#endif`,Ip=`#ifdef USE_ENVMAP
|
|
484
|
+
uniform float envMapIntensity;
|
|
485
|
+
uniform float flipEnvMap;
|
|
486
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
487
|
+
uniform samplerCube envMap;
|
|
488
|
+
#else
|
|
489
|
+
uniform sampler2D envMap;
|
|
490
|
+
#endif
|
|
491
|
+
|
|
492
|
+
#endif`,Fp=`#ifdef USE_ENVMAP
|
|
493
|
+
uniform float reflectivity;
|
|
494
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
|
495
|
+
#define ENV_WORLDPOS
|
|
496
|
+
#endif
|
|
497
|
+
#ifdef ENV_WORLDPOS
|
|
498
|
+
varying vec3 vWorldPosition;
|
|
499
|
+
uniform float refractionRatio;
|
|
500
|
+
#else
|
|
501
|
+
varying vec3 vReflect;
|
|
502
|
+
#endif
|
|
503
|
+
#endif`,Bp=`#ifdef USE_ENVMAP
|
|
504
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
|
505
|
+
#define ENV_WORLDPOS
|
|
506
|
+
#endif
|
|
507
|
+
#ifdef ENV_WORLDPOS
|
|
508
|
+
|
|
509
|
+
varying vec3 vWorldPosition;
|
|
510
|
+
#else
|
|
511
|
+
varying vec3 vReflect;
|
|
512
|
+
uniform float refractionRatio;
|
|
513
|
+
#endif
|
|
514
|
+
#endif`,Np=`#ifdef USE_ENVMAP
|
|
515
|
+
#ifdef ENV_WORLDPOS
|
|
516
|
+
vWorldPosition = worldPosition.xyz;
|
|
517
|
+
#else
|
|
518
|
+
vec3 cameraToVertex;
|
|
519
|
+
if ( isOrthographic ) {
|
|
520
|
+
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
521
|
+
} else {
|
|
522
|
+
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
523
|
+
}
|
|
524
|
+
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
525
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
526
|
+
vReflect = reflect( cameraToVertex, worldNormal );
|
|
527
|
+
#else
|
|
528
|
+
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
529
|
+
#endif
|
|
530
|
+
#endif
|
|
531
|
+
#endif`,Op=`#ifdef USE_FOG
|
|
532
|
+
vFogDepth = - mvPosition.z;
|
|
533
|
+
#endif`,zp=`#ifdef USE_FOG
|
|
534
|
+
varying float vFogDepth;
|
|
535
|
+
#endif`,Up=`#ifdef USE_FOG
|
|
536
|
+
#ifdef FOG_EXP2
|
|
537
|
+
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
538
|
+
#else
|
|
539
|
+
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
540
|
+
#endif
|
|
541
|
+
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
542
|
+
#endif`,Gp=`#ifdef USE_FOG
|
|
543
|
+
uniform vec3 fogColor;
|
|
544
|
+
varying float vFogDepth;
|
|
545
|
+
#ifdef FOG_EXP2
|
|
546
|
+
uniform float fogDensity;
|
|
547
|
+
#else
|
|
548
|
+
uniform float fogNear;
|
|
549
|
+
uniform float fogFar;
|
|
550
|
+
#endif
|
|
551
|
+
#endif`,Hp=`#ifdef USE_GRADIENTMAP
|
|
552
|
+
uniform sampler2D gradientMap;
|
|
553
|
+
#endif
|
|
554
|
+
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
555
|
+
float dotNL = dot( normal, lightDirection );
|
|
556
|
+
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
557
|
+
#ifdef USE_GRADIENTMAP
|
|
558
|
+
return vec3( texture2D( gradientMap, coord ).r );
|
|
559
|
+
#else
|
|
560
|
+
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
|
561
|
+
#endif
|
|
562
|
+
}`,kp=`#ifdef USE_LIGHTMAP
|
|
563
|
+
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
564
|
+
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
565
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
566
|
+
lightMapIrradiance *= PI;
|
|
567
|
+
#endif
|
|
568
|
+
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
569
|
+
#endif`,Vp=`#ifdef USE_LIGHTMAP
|
|
570
|
+
uniform sampler2D lightMap;
|
|
571
|
+
uniform float lightMapIntensity;
|
|
572
|
+
#endif`,Wp=`vec3 diffuse = vec3( 1.0 );
|
|
573
|
+
GeometricContext geometry;
|
|
574
|
+
geometry.position = mvPosition.xyz;
|
|
575
|
+
geometry.normal = normalize( transformedNormal );
|
|
576
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
577
|
+
GeometricContext backGeometry;
|
|
578
|
+
backGeometry.position = geometry.position;
|
|
579
|
+
backGeometry.normal = -geometry.normal;
|
|
580
|
+
backGeometry.viewDir = geometry.viewDir;
|
|
581
|
+
vLightFront = vec3( 0.0 );
|
|
582
|
+
vIndirectFront = vec3( 0.0 );
|
|
583
|
+
#ifdef DOUBLE_SIDED
|
|
584
|
+
vLightBack = vec3( 0.0 );
|
|
585
|
+
vIndirectBack = vec3( 0.0 );
|
|
586
|
+
#endif
|
|
587
|
+
IncidentLight directLight;
|
|
588
|
+
float dotNL;
|
|
589
|
+
vec3 directLightColor_Diffuse;
|
|
590
|
+
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
591
|
+
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
592
|
+
#ifdef DOUBLE_SIDED
|
|
593
|
+
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
594
|
+
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
|
|
595
|
+
#endif
|
|
596
|
+
#if NUM_POINT_LIGHTS > 0
|
|
597
|
+
#pragma unroll_loop_start
|
|
598
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
599
|
+
getPointLightInfo( pointLights[ i ], geometry, directLight );
|
|
600
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
601
|
+
directLightColor_Diffuse = directLight.color;
|
|
602
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
603
|
+
#ifdef DOUBLE_SIDED
|
|
604
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
605
|
+
#endif
|
|
606
|
+
}
|
|
607
|
+
#pragma unroll_loop_end
|
|
608
|
+
#endif
|
|
609
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
610
|
+
#pragma unroll_loop_start
|
|
611
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
612
|
+
getSpotLightInfo( spotLights[ i ], geometry, directLight );
|
|
613
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
614
|
+
directLightColor_Diffuse = directLight.color;
|
|
615
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
616
|
+
#ifdef DOUBLE_SIDED
|
|
617
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
618
|
+
#endif
|
|
619
|
+
}
|
|
620
|
+
#pragma unroll_loop_end
|
|
621
|
+
#endif
|
|
622
|
+
#if NUM_DIR_LIGHTS > 0
|
|
623
|
+
#pragma unroll_loop_start
|
|
624
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
625
|
+
getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
|
|
626
|
+
dotNL = dot( geometry.normal, directLight.direction );
|
|
627
|
+
directLightColor_Diffuse = directLight.color;
|
|
628
|
+
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
629
|
+
#ifdef DOUBLE_SIDED
|
|
630
|
+
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
|
631
|
+
#endif
|
|
632
|
+
}
|
|
633
|
+
#pragma unroll_loop_end
|
|
634
|
+
#endif
|
|
635
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
636
|
+
#pragma unroll_loop_start
|
|
637
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
638
|
+
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
639
|
+
#ifdef DOUBLE_SIDED
|
|
640
|
+
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
|
|
641
|
+
#endif
|
|
642
|
+
}
|
|
643
|
+
#pragma unroll_loop_end
|
|
644
|
+
#endif`,qp=`uniform bool receiveShadow;
|
|
645
|
+
uniform vec3 ambientLightColor;
|
|
646
|
+
uniform vec3 lightProbe[ 9 ];
|
|
647
|
+
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
648
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
649
|
+
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
650
|
+
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
651
|
+
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
652
|
+
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
653
|
+
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
654
|
+
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
655
|
+
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
656
|
+
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
657
|
+
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
658
|
+
return result;
|
|
659
|
+
}
|
|
660
|
+
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
661
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
662
|
+
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
663
|
+
return irradiance;
|
|
664
|
+
}
|
|
665
|
+
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
666
|
+
vec3 irradiance = ambientLightColor;
|
|
667
|
+
return irradiance;
|
|
668
|
+
}
|
|
669
|
+
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
670
|
+
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
|
671
|
+
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
672
|
+
if ( cutoffDistance > 0.0 ) {
|
|
673
|
+
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
674
|
+
}
|
|
675
|
+
return distanceFalloff;
|
|
676
|
+
#else
|
|
677
|
+
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
678
|
+
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
679
|
+
}
|
|
680
|
+
return 1.0;
|
|
681
|
+
#endif
|
|
682
|
+
}
|
|
683
|
+
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
684
|
+
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
685
|
+
}
|
|
686
|
+
#if NUM_DIR_LIGHTS > 0
|
|
687
|
+
struct DirectionalLight {
|
|
688
|
+
vec3 direction;
|
|
689
|
+
vec3 color;
|
|
690
|
+
};
|
|
691
|
+
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
692
|
+
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
693
|
+
light.color = directionalLight.color;
|
|
694
|
+
light.direction = directionalLight.direction;
|
|
695
|
+
light.visible = true;
|
|
696
|
+
}
|
|
697
|
+
#endif
|
|
698
|
+
#if NUM_POINT_LIGHTS > 0
|
|
699
|
+
struct PointLight {
|
|
700
|
+
vec3 position;
|
|
701
|
+
vec3 color;
|
|
702
|
+
float distance;
|
|
703
|
+
float decay;
|
|
704
|
+
};
|
|
705
|
+
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
706
|
+
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
707
|
+
vec3 lVector = pointLight.position - geometry.position;
|
|
708
|
+
light.direction = normalize( lVector );
|
|
709
|
+
float lightDistance = length( lVector );
|
|
710
|
+
light.color = pointLight.color;
|
|
711
|
+
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
712
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
713
|
+
}
|
|
714
|
+
#endif
|
|
715
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
716
|
+
struct SpotLight {
|
|
717
|
+
vec3 position;
|
|
718
|
+
vec3 direction;
|
|
719
|
+
vec3 color;
|
|
720
|
+
float distance;
|
|
721
|
+
float decay;
|
|
722
|
+
float coneCos;
|
|
723
|
+
float penumbraCos;
|
|
724
|
+
};
|
|
725
|
+
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
726
|
+
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
|
|
727
|
+
vec3 lVector = spotLight.position - geometry.position;
|
|
728
|
+
light.direction = normalize( lVector );
|
|
729
|
+
float angleCos = dot( light.direction, spotLight.direction );
|
|
730
|
+
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
731
|
+
if ( spotAttenuation > 0.0 ) {
|
|
732
|
+
float lightDistance = length( lVector );
|
|
733
|
+
light.color = spotLight.color * spotAttenuation;
|
|
734
|
+
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
735
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
736
|
+
} else {
|
|
737
|
+
light.color = vec3( 0.0 );
|
|
738
|
+
light.visible = false;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
#endif
|
|
742
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
743
|
+
struct RectAreaLight {
|
|
744
|
+
vec3 color;
|
|
745
|
+
vec3 position;
|
|
746
|
+
vec3 halfWidth;
|
|
747
|
+
vec3 halfHeight;
|
|
748
|
+
};
|
|
749
|
+
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
750
|
+
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
751
|
+
#endif
|
|
752
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
753
|
+
struct HemisphereLight {
|
|
754
|
+
vec3 direction;
|
|
755
|
+
vec3 skyColor;
|
|
756
|
+
vec3 groundColor;
|
|
757
|
+
};
|
|
758
|
+
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
759
|
+
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
760
|
+
float dotNL = dot( normal, hemiLight.direction );
|
|
761
|
+
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
762
|
+
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
763
|
+
return irradiance;
|
|
764
|
+
}
|
|
765
|
+
#endif`,Xp=`#if defined( USE_ENVMAP )
|
|
766
|
+
#ifdef ENVMAP_MODE_REFRACTION
|
|
767
|
+
uniform float refractionRatio;
|
|
768
|
+
#endif
|
|
769
|
+
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
770
|
+
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
771
|
+
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
772
|
+
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|
773
|
+
return PI * envMapColor.rgb * envMapIntensity;
|
|
774
|
+
#else
|
|
775
|
+
return vec3( 0.0 );
|
|
776
|
+
#endif
|
|
777
|
+
}
|
|
778
|
+
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
779
|
+
#if defined( ENVMAP_TYPE_CUBE_UV )
|
|
780
|
+
vec3 reflectVec;
|
|
781
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
782
|
+
reflectVec = reflect( - viewDir, normal );
|
|
783
|
+
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
784
|
+
#else
|
|
785
|
+
reflectVec = refract( - viewDir, normal, refractionRatio );
|
|
786
|
+
#endif
|
|
787
|
+
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
788
|
+
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|
789
|
+
return envMapColor.rgb * envMapIntensity;
|
|
790
|
+
#else
|
|
791
|
+
return vec3( 0.0 );
|
|
792
|
+
#endif
|
|
793
|
+
}
|
|
794
|
+
#endif`,Zp=`ToonMaterial material;
|
|
795
|
+
material.diffuseColor = diffuseColor.rgb;`,jp=`varying vec3 vViewPosition;
|
|
796
|
+
struct ToonMaterial {
|
|
797
|
+
vec3 diffuseColor;
|
|
798
|
+
};
|
|
799
|
+
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
800
|
+
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
|
801
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
802
|
+
}
|
|
803
|
+
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
804
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
805
|
+
}
|
|
806
|
+
#define RE_Direct RE_Direct_Toon
|
|
807
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
808
|
+
#define Material_LightProbeLOD( material ) (0)`,Yp=`BlinnPhongMaterial material;
|
|
809
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
810
|
+
material.specularColor = specular;
|
|
811
|
+
material.specularShininess = shininess;
|
|
812
|
+
material.specularStrength = specularStrength;`,Jp=`varying vec3 vViewPosition;
|
|
813
|
+
struct BlinnPhongMaterial {
|
|
814
|
+
vec3 diffuseColor;
|
|
815
|
+
vec3 specularColor;
|
|
816
|
+
float specularShininess;
|
|
817
|
+
float specularStrength;
|
|
818
|
+
};
|
|
819
|
+
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
820
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
821
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
822
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
823
|
+
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
824
|
+
}
|
|
825
|
+
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
826
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
827
|
+
}
|
|
828
|
+
#define RE_Direct RE_Direct_BlinnPhong
|
|
829
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
830
|
+
#define Material_LightProbeLOD( material ) (0)`,$p=`PhysicalMaterial material;
|
|
831
|
+
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
832
|
+
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
|
833
|
+
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
834
|
+
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
835
|
+
material.roughness = min( material.roughness, 1.0 );
|
|
836
|
+
#ifdef IOR
|
|
837
|
+
#ifdef SPECULAR
|
|
838
|
+
float specularIntensityFactor = specularIntensity;
|
|
839
|
+
vec3 specularColorFactor = specularColor;
|
|
840
|
+
#ifdef USE_SPECULARINTENSITYMAP
|
|
841
|
+
specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
|
|
842
|
+
#endif
|
|
843
|
+
#ifdef USE_SPECULARCOLORMAP
|
|
844
|
+
specularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;
|
|
845
|
+
#endif
|
|
846
|
+
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
847
|
+
#else
|
|
848
|
+
float specularIntensityFactor = 1.0;
|
|
849
|
+
vec3 specularColorFactor = vec3( 1.0 );
|
|
850
|
+
material.specularF90 = 1.0;
|
|
851
|
+
#endif
|
|
852
|
+
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|
853
|
+
#else
|
|
854
|
+
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
|
855
|
+
material.specularF90 = 1.0;
|
|
856
|
+
#endif
|
|
857
|
+
#ifdef USE_CLEARCOAT
|
|
858
|
+
material.clearcoat = clearcoat;
|
|
859
|
+
material.clearcoatRoughness = clearcoatRoughness;
|
|
860
|
+
material.clearcoatF0 = vec3( 0.04 );
|
|
861
|
+
material.clearcoatF90 = 1.0;
|
|
862
|
+
#ifdef USE_CLEARCOATMAP
|
|
863
|
+
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
|
864
|
+
#endif
|
|
865
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
866
|
+
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
|
867
|
+
#endif
|
|
868
|
+
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
869
|
+
material.clearcoatRoughness += geometryRoughness;
|
|
870
|
+
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
871
|
+
#endif
|
|
872
|
+
#ifdef USE_SHEEN
|
|
873
|
+
material.sheenColor = sheenColor;
|
|
874
|
+
#ifdef USE_SHEENCOLORMAP
|
|
875
|
+
material.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;
|
|
876
|
+
#endif
|
|
877
|
+
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|
878
|
+
#ifdef USE_SHEENROUGHNESSMAP
|
|
879
|
+
material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
|
|
880
|
+
#endif
|
|
881
|
+
#endif`,Kp=`struct PhysicalMaterial {
|
|
882
|
+
vec3 diffuseColor;
|
|
883
|
+
float roughness;
|
|
884
|
+
vec3 specularColor;
|
|
885
|
+
float specularF90;
|
|
886
|
+
#ifdef USE_CLEARCOAT
|
|
887
|
+
float clearcoat;
|
|
888
|
+
float clearcoatRoughness;
|
|
889
|
+
vec3 clearcoatF0;
|
|
890
|
+
float clearcoatF90;
|
|
891
|
+
#endif
|
|
892
|
+
#ifdef USE_SHEEN
|
|
893
|
+
vec3 sheenColor;
|
|
894
|
+
float sheenRoughness;
|
|
895
|
+
#endif
|
|
896
|
+
};
|
|
897
|
+
vec3 clearcoatSpecular = vec3( 0.0 );
|
|
898
|
+
vec3 sheenSpecular = vec3( 0.0 );
|
|
899
|
+
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {
|
|
900
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
901
|
+
float r2 = roughness * roughness;
|
|
902
|
+
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
|
903
|
+
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
|
904
|
+
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
|
905
|
+
return saturate( DG * RECIPROCAL_PI );
|
|
906
|
+
}
|
|
907
|
+
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
908
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
909
|
+
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
910
|
+
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
911
|
+
vec4 r = roughness * c0 + c1;
|
|
912
|
+
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
913
|
+
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
|
914
|
+
return fab;
|
|
915
|
+
}
|
|
916
|
+
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
917
|
+
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
918
|
+
return specularColor * fab.x + specularF90 * fab.y;
|
|
919
|
+
}
|
|
920
|
+
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 ) {
|
|
921
|
+
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
|
922
|
+
vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;
|
|
923
|
+
float Ess = fab.x + fab.y;
|
|
924
|
+
float Ems = 1.0 - Ess;
|
|
925
|
+
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
926
|
+
singleScatter += FssEss;
|
|
927
|
+
multiScatter += Fms * Ems;
|
|
928
|
+
}
|
|
929
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
930
|
+
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
931
|
+
vec3 normal = geometry.normal;
|
|
932
|
+
vec3 viewDir = geometry.viewDir;
|
|
933
|
+
vec3 position = geometry.position;
|
|
934
|
+
vec3 lightPos = rectAreaLight.position;
|
|
935
|
+
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
936
|
+
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
937
|
+
vec3 lightColor = rectAreaLight.color;
|
|
938
|
+
float roughness = material.roughness;
|
|
939
|
+
vec3 rectCoords[ 4 ];
|
|
940
|
+
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
941
|
+
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
942
|
+
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
943
|
+
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
944
|
+
vec4 t1 = texture2D( ltc_1, uv );
|
|
945
|
+
vec4 t2 = texture2D( ltc_2, uv );
|
|
946
|
+
mat3 mInv = mat3(
|
|
947
|
+
vec3( t1.x, 0, t1.y ),
|
|
948
|
+
vec3( 0, 1, 0 ),
|
|
949
|
+
vec3( t1.z, 0, t1.w )
|
|
950
|
+
);
|
|
951
|
+
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
952
|
+
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
953
|
+
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
954
|
+
}
|
|
955
|
+
#endif
|
|
956
|
+
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
957
|
+
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
958
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
959
|
+
#ifdef USE_CLEARCOAT
|
|
960
|
+
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
|
961
|
+
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
962
|
+
clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
963
|
+
#endif
|
|
964
|
+
#ifdef USE_SHEEN
|
|
965
|
+
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
|
|
966
|
+
#endif
|
|
967
|
+
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
|
|
968
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
969
|
+
}
|
|
970
|
+
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
971
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
972
|
+
}
|
|
973
|
+
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
974
|
+
#ifdef USE_CLEARCOAT
|
|
975
|
+
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
976
|
+
#endif
|
|
977
|
+
#ifdef USE_SHEEN
|
|
978
|
+
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
|
|
979
|
+
#endif
|
|
980
|
+
vec3 singleScattering = vec3( 0.0 );
|
|
981
|
+
vec3 multiScattering = vec3( 0.0 );
|
|
982
|
+
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
983
|
+
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
|
984
|
+
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
|
985
|
+
reflectedLight.indirectSpecular += radiance * singleScattering;
|
|
986
|
+
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
987
|
+
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
988
|
+
}
|
|
989
|
+
#define RE_Direct RE_Direct_Physical
|
|
990
|
+
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
991
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
992
|
+
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
993
|
+
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
994
|
+
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
995
|
+
}`,Qp=`
|
|
996
|
+
GeometricContext geometry;
|
|
997
|
+
geometry.position = - vViewPosition;
|
|
998
|
+
geometry.normal = normal;
|
|
999
|
+
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1000
|
+
#ifdef USE_CLEARCOAT
|
|
1001
|
+
geometry.clearcoatNormal = clearcoatNormal;
|
|
1002
|
+
#endif
|
|
1003
|
+
IncidentLight directLight;
|
|
1004
|
+
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1005
|
+
PointLight pointLight;
|
|
1006
|
+
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1007
|
+
PointLightShadow pointLightShadow;
|
|
1008
|
+
#endif
|
|
1009
|
+
#pragma unroll_loop_start
|
|
1010
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1011
|
+
pointLight = pointLights[ i ];
|
|
1012
|
+
getPointLightInfo( pointLight, geometry, directLight );
|
|
1013
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
1014
|
+
pointLightShadow = pointLightShadows[ i ];
|
|
1015
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1016
|
+
#endif
|
|
1017
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1018
|
+
}
|
|
1019
|
+
#pragma unroll_loop_end
|
|
1020
|
+
#endif
|
|
1021
|
+
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1022
|
+
SpotLight spotLight;
|
|
1023
|
+
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1024
|
+
SpotLightShadow spotLightShadow;
|
|
1025
|
+
#endif
|
|
1026
|
+
#pragma unroll_loop_start
|
|
1027
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1028
|
+
spotLight = spotLights[ i ];
|
|
1029
|
+
getSpotLightInfo( spotLight, geometry, directLight );
|
|
1030
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1031
|
+
spotLightShadow = spotLightShadows[ i ];
|
|
1032
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1033
|
+
#endif
|
|
1034
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1035
|
+
}
|
|
1036
|
+
#pragma unroll_loop_end
|
|
1037
|
+
#endif
|
|
1038
|
+
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1039
|
+
DirectionalLight directionalLight;
|
|
1040
|
+
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1041
|
+
DirectionalLightShadow directionalLightShadow;
|
|
1042
|
+
#endif
|
|
1043
|
+
#pragma unroll_loop_start
|
|
1044
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1045
|
+
directionalLight = directionalLights[ i ];
|
|
1046
|
+
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
|
1047
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1048
|
+
directionalLightShadow = directionalLightShadows[ i ];
|
|
1049
|
+
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1050
|
+
#endif
|
|
1051
|
+
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1052
|
+
}
|
|
1053
|
+
#pragma unroll_loop_end
|
|
1054
|
+
#endif
|
|
1055
|
+
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1056
|
+
RectAreaLight rectAreaLight;
|
|
1057
|
+
#pragma unroll_loop_start
|
|
1058
|
+
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1059
|
+
rectAreaLight = rectAreaLights[ i ];
|
|
1060
|
+
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
|
1061
|
+
}
|
|
1062
|
+
#pragma unroll_loop_end
|
|
1063
|
+
#endif
|
|
1064
|
+
#if defined( RE_IndirectDiffuse )
|
|
1065
|
+
vec3 iblIrradiance = vec3( 0.0 );
|
|
1066
|
+
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1067
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
1068
|
+
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1069
|
+
#pragma unroll_loop_start
|
|
1070
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1071
|
+
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
|
1072
|
+
}
|
|
1073
|
+
#pragma unroll_loop_end
|
|
1074
|
+
#endif
|
|
1075
|
+
#endif
|
|
1076
|
+
#if defined( RE_IndirectSpecular )
|
|
1077
|
+
vec3 radiance = vec3( 0.0 );
|
|
1078
|
+
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1079
|
+
#endif`,em=`#if defined( RE_IndirectDiffuse )
|
|
1080
|
+
#ifdef USE_LIGHTMAP
|
|
1081
|
+
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
|
1082
|
+
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
1083
|
+
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1084
|
+
lightMapIrradiance *= PI;
|
|
1085
|
+
#endif
|
|
1086
|
+
irradiance += lightMapIrradiance;
|
|
1087
|
+
#endif
|
|
1088
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1089
|
+
iblIrradiance += getIBLIrradiance( geometry.normal );
|
|
1090
|
+
#endif
|
|
1091
|
+
#endif
|
|
1092
|
+
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1093
|
+
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
|
|
1094
|
+
#ifdef USE_CLEARCOAT
|
|
1095
|
+
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
|
|
1096
|
+
#endif
|
|
1097
|
+
#endif`,tm=`#if defined( RE_IndirectDiffuse )
|
|
1098
|
+
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
1099
|
+
#endif
|
|
1100
|
+
#if defined( RE_IndirectSpecular )
|
|
1101
|
+
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
|
1102
|
+
#endif`,nm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1103
|
+
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1104
|
+
#endif`,im=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1105
|
+
uniform float logDepthBufFC;
|
|
1106
|
+
varying float vFragDepth;
|
|
1107
|
+
varying float vIsPerspective;
|
|
1108
|
+
#endif`,rm=`#ifdef USE_LOGDEPTHBUF
|
|
1109
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1110
|
+
varying float vFragDepth;
|
|
1111
|
+
varying float vIsPerspective;
|
|
1112
|
+
#else
|
|
1113
|
+
uniform float logDepthBufFC;
|
|
1114
|
+
#endif
|
|
1115
|
+
#endif`,sm=`#ifdef USE_LOGDEPTHBUF
|
|
1116
|
+
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1117
|
+
vFragDepth = 1.0 + gl_Position.w;
|
|
1118
|
+
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1119
|
+
#else
|
|
1120
|
+
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|
1121
|
+
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|
1122
|
+
gl_Position.z *= gl_Position.w;
|
|
1123
|
+
}
|
|
1124
|
+
#endif
|
|
1125
|
+
#endif`,om=`#ifdef USE_MAP
|
|
1126
|
+
vec4 texelColor = texture2D( map, vUv );
|
|
1127
|
+
texelColor = mapTexelToLinear( texelColor );
|
|
1128
|
+
diffuseColor *= texelColor;
|
|
1129
|
+
#endif`,am=`#ifdef USE_MAP
|
|
1130
|
+
uniform sampler2D map;
|
|
1131
|
+
#endif`,lm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1132
|
+
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1133
|
+
#endif
|
|
1134
|
+
#ifdef USE_MAP
|
|
1135
|
+
vec4 mapTexel = texture2D( map, uv );
|
|
1136
|
+
diffuseColor *= mapTexelToLinear( mapTexel );
|
|
1137
|
+
#endif
|
|
1138
|
+
#ifdef USE_ALPHAMAP
|
|
1139
|
+
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1140
|
+
#endif`,cm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1141
|
+
uniform mat3 uvTransform;
|
|
1142
|
+
#endif
|
|
1143
|
+
#ifdef USE_MAP
|
|
1144
|
+
uniform sampler2D map;
|
|
1145
|
+
#endif
|
|
1146
|
+
#ifdef USE_ALPHAMAP
|
|
1147
|
+
uniform sampler2D alphaMap;
|
|
1148
|
+
#endif`,um=`float metalnessFactor = metalness;
|
|
1149
|
+
#ifdef USE_METALNESSMAP
|
|
1150
|
+
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
|
1151
|
+
metalnessFactor *= texelMetalness.b;
|
|
1152
|
+
#endif`,hm=`#ifdef USE_METALNESSMAP
|
|
1153
|
+
uniform sampler2D metalnessMap;
|
|
1154
|
+
#endif`,fm=`#ifdef USE_MORPHNORMALS
|
|
1155
|
+
objectNormal *= morphTargetBaseInfluence;
|
|
1156
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1157
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1158
|
+
if ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];
|
|
1159
|
+
}
|
|
1160
|
+
#else
|
|
1161
|
+
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
1162
|
+
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
1163
|
+
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1164
|
+
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1165
|
+
#endif
|
|
1166
|
+
#endif`,dm=`#ifdef USE_MORPHTARGETS
|
|
1167
|
+
uniform float morphTargetBaseInfluence;
|
|
1168
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1169
|
+
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1170
|
+
uniform sampler2DArray morphTargetsTexture;
|
|
1171
|
+
uniform vec2 morphTargetsTextureSize;
|
|
1172
|
+
vec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {
|
|
1173
|
+
float texelIndex = float( vertexIndex * stride + offset );
|
|
1174
|
+
float y = floor( texelIndex / morphTargetsTextureSize.x );
|
|
1175
|
+
float x = texelIndex - y * morphTargetsTextureSize.x;
|
|
1176
|
+
vec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );
|
|
1177
|
+
return texture( morphTargetsTexture, morphUV ).xyz;
|
|
1178
|
+
}
|
|
1179
|
+
#else
|
|
1180
|
+
#ifndef USE_MORPHNORMALS
|
|
1181
|
+
uniform float morphTargetInfluences[ 8 ];
|
|
1182
|
+
#else
|
|
1183
|
+
uniform float morphTargetInfluences[ 4 ];
|
|
1184
|
+
#endif
|
|
1185
|
+
#endif
|
|
1186
|
+
#endif`,pm=`#ifdef USE_MORPHTARGETS
|
|
1187
|
+
transformed *= morphTargetBaseInfluence;
|
|
1188
|
+
#ifdef MORPHTARGETS_TEXTURE
|
|
1189
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1190
|
+
#ifndef USE_MORPHNORMALS
|
|
1191
|
+
if ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];
|
|
1192
|
+
#else
|
|
1193
|
+
if ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];
|
|
1194
|
+
#endif
|
|
1195
|
+
}
|
|
1196
|
+
#else
|
|
1197
|
+
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
1198
|
+
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
1199
|
+
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
1200
|
+
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
1201
|
+
#ifndef USE_MORPHNORMALS
|
|
1202
|
+
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
1203
|
+
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
1204
|
+
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
1205
|
+
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1206
|
+
#endif
|
|
1207
|
+
#endif
|
|
1208
|
+
#endif`,mm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1209
|
+
#ifdef FLAT_SHADED
|
|
1210
|
+
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
|
1211
|
+
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
|
1212
|
+
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1213
|
+
#else
|
|
1214
|
+
vec3 normal = normalize( vNormal );
|
|
1215
|
+
#ifdef DOUBLE_SIDED
|
|
1216
|
+
normal = normal * faceDirection;
|
|
1217
|
+
#endif
|
|
1218
|
+
#ifdef USE_TANGENT
|
|
1219
|
+
vec3 tangent = normalize( vTangent );
|
|
1220
|
+
vec3 bitangent = normalize( vBitangent );
|
|
1221
|
+
#ifdef DOUBLE_SIDED
|
|
1222
|
+
tangent = tangent * faceDirection;
|
|
1223
|
+
bitangent = bitangent * faceDirection;
|
|
1224
|
+
#endif
|
|
1225
|
+
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
|
1226
|
+
mat3 vTBN = mat3( tangent, bitangent, normal );
|
|
1227
|
+
#endif
|
|
1228
|
+
#endif
|
|
1229
|
+
#endif
|
|
1230
|
+
vec3 geometryNormal = normal;`,gm=`#ifdef OBJECTSPACE_NORMALMAP
|
|
1231
|
+
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1232
|
+
#ifdef FLIP_SIDED
|
|
1233
|
+
normal = - normal;
|
|
1234
|
+
#endif
|
|
1235
|
+
#ifdef DOUBLE_SIDED
|
|
1236
|
+
normal = normal * faceDirection;
|
|
1237
|
+
#endif
|
|
1238
|
+
normal = normalize( normalMatrix * normal );
|
|
1239
|
+
#elif defined( TANGENTSPACE_NORMALMAP )
|
|
1240
|
+
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1241
|
+
mapN.xy *= normalScale;
|
|
1242
|
+
#ifdef USE_TANGENT
|
|
1243
|
+
normal = normalize( vTBN * mapN );
|
|
1244
|
+
#else
|
|
1245
|
+
normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
|
|
1246
|
+
#endif
|
|
1247
|
+
#elif defined( USE_BUMPMAP )
|
|
1248
|
+
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1249
|
+
#endif`,vm=`#ifndef FLAT_SHADED
|
|
1250
|
+
varying vec3 vNormal;
|
|
1251
|
+
#ifdef USE_TANGENT
|
|
1252
|
+
varying vec3 vTangent;
|
|
1253
|
+
varying vec3 vBitangent;
|
|
1254
|
+
#endif
|
|
1255
|
+
#endif`,ym=`#ifndef FLAT_SHADED
|
|
1256
|
+
varying vec3 vNormal;
|
|
1257
|
+
#ifdef USE_TANGENT
|
|
1258
|
+
varying vec3 vTangent;
|
|
1259
|
+
varying vec3 vBitangent;
|
|
1260
|
+
#endif
|
|
1261
|
+
#endif`,xm=`#ifndef FLAT_SHADED
|
|
1262
|
+
vNormal = normalize( transformedNormal );
|
|
1263
|
+
#ifdef USE_TANGENT
|
|
1264
|
+
vTangent = normalize( transformedTangent );
|
|
1265
|
+
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1266
|
+
#endif
|
|
1267
|
+
#endif`,_m=`#ifdef USE_NORMALMAP
|
|
1268
|
+
uniform sampler2D normalMap;
|
|
1269
|
+
uniform vec2 normalScale;
|
|
1270
|
+
#endif
|
|
1271
|
+
#ifdef OBJECTSPACE_NORMALMAP
|
|
1272
|
+
uniform mat3 normalMatrix;
|
|
1273
|
+
#endif
|
|
1274
|
+
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
|
1275
|
+
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
|
1276
|
+
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
|
1277
|
+
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
|
1278
|
+
vec2 st0 = dFdx( vUv.st );
|
|
1279
|
+
vec2 st1 = dFdy( vUv.st );
|
|
1280
|
+
vec3 N = surf_norm;
|
|
1281
|
+
vec3 q1perp = cross( q1, N );
|
|
1282
|
+
vec3 q0perp = cross( N, q0 );
|
|
1283
|
+
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1284
|
+
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1285
|
+
float det = max( dot( T, T ), dot( B, B ) );
|
|
1286
|
+
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
|
1287
|
+
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
|
1288
|
+
}
|
|
1289
|
+
#endif`,bm=`#ifdef USE_CLEARCOAT
|
|
1290
|
+
vec3 clearcoatNormal = geometryNormal;
|
|
1291
|
+
#endif`,Mm=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1292
|
+
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1293
|
+
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1294
|
+
#ifdef USE_TANGENT
|
|
1295
|
+
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
|
1296
|
+
#else
|
|
1297
|
+
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
|
|
1298
|
+
#endif
|
|
1299
|
+
#endif`,wm=`#ifdef USE_CLEARCOATMAP
|
|
1300
|
+
uniform sampler2D clearcoatMap;
|
|
1301
|
+
#endif
|
|
1302
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1303
|
+
uniform sampler2D clearcoatRoughnessMap;
|
|
1304
|
+
#endif
|
|
1305
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1306
|
+
uniform sampler2D clearcoatNormalMap;
|
|
1307
|
+
uniform vec2 clearcoatNormalScale;
|
|
1308
|
+
#endif`,Sm=`#ifdef OPAQUE
|
|
1309
|
+
diffuseColor.a = 1.0;
|
|
1310
|
+
#endif
|
|
1311
|
+
#ifdef USE_TRANSMISSION
|
|
1312
|
+
diffuseColor.a *= transmissionAlpha + 0.1;
|
|
1313
|
+
#endif
|
|
1314
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Tm=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1315
|
+
return normalize( normal ) * 0.5 + 0.5;
|
|
1316
|
+
}
|
|
1317
|
+
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1318
|
+
return 2.0 * rgb.xyz - 1.0;
|
|
1319
|
+
}
|
|
1320
|
+
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
1321
|
+
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
1322
|
+
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
1323
|
+
const float ShiftRight8 = 1. / 256.;
|
|
1324
|
+
vec4 packDepthToRGBA( const in float v ) {
|
|
1325
|
+
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
1326
|
+
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
1327
|
+
}
|
|
1328
|
+
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1329
|
+
return dot( v, UnpackFactors );
|
|
1330
|
+
}
|
|
1331
|
+
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
1332
|
+
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
1333
|
+
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
1334
|
+
}
|
|
1335
|
+
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
1336
|
+
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1337
|
+
}
|
|
1338
|
+
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1339
|
+
return ( viewZ + near ) / ( near - far );
|
|
1340
|
+
}
|
|
1341
|
+
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
|
1342
|
+
return linearClipZ * ( near - far ) - near;
|
|
1343
|
+
}
|
|
1344
|
+
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1345
|
+
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
1346
|
+
}
|
|
1347
|
+
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
|
1348
|
+
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
1349
|
+
}`,Em=`#ifdef PREMULTIPLIED_ALPHA
|
|
1350
|
+
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1351
|
+
#endif`,Am=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1352
|
+
#ifdef USE_INSTANCING
|
|
1353
|
+
mvPosition = instanceMatrix * mvPosition;
|
|
1354
|
+
#endif
|
|
1355
|
+
mvPosition = modelViewMatrix * mvPosition;
|
|
1356
|
+
gl_Position = projectionMatrix * mvPosition;`,Cm=`#ifdef DITHERING
|
|
1357
|
+
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1358
|
+
#endif`,Lm=`#ifdef DITHERING
|
|
1359
|
+
vec3 dithering( vec3 color ) {
|
|
1360
|
+
float grid_position = rand( gl_FragCoord.xy );
|
|
1361
|
+
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1362
|
+
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1363
|
+
return color + dither_shift_RGB;
|
|
1364
|
+
}
|
|
1365
|
+
#endif`,Rm=`float roughnessFactor = roughness;
|
|
1366
|
+
#ifdef USE_ROUGHNESSMAP
|
|
1367
|
+
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
|
1368
|
+
roughnessFactor *= texelRoughness.g;
|
|
1369
|
+
#endif`,Pm=`#ifdef USE_ROUGHNESSMAP
|
|
1370
|
+
uniform sampler2D roughnessMap;
|
|
1371
|
+
#endif`,Dm=`#ifdef USE_SHADOWMAP
|
|
1372
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1373
|
+
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1374
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1375
|
+
struct DirectionalLightShadow {
|
|
1376
|
+
float shadowBias;
|
|
1377
|
+
float shadowNormalBias;
|
|
1378
|
+
float shadowRadius;
|
|
1379
|
+
vec2 shadowMapSize;
|
|
1380
|
+
};
|
|
1381
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1382
|
+
#endif
|
|
1383
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1384
|
+
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1385
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1386
|
+
struct SpotLightShadow {
|
|
1387
|
+
float shadowBias;
|
|
1388
|
+
float shadowNormalBias;
|
|
1389
|
+
float shadowRadius;
|
|
1390
|
+
vec2 shadowMapSize;
|
|
1391
|
+
};
|
|
1392
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1393
|
+
#endif
|
|
1394
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1395
|
+
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1396
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1397
|
+
struct PointLightShadow {
|
|
1398
|
+
float shadowBias;
|
|
1399
|
+
float shadowNormalBias;
|
|
1400
|
+
float shadowRadius;
|
|
1401
|
+
vec2 shadowMapSize;
|
|
1402
|
+
float shadowCameraNear;
|
|
1403
|
+
float shadowCameraFar;
|
|
1404
|
+
};
|
|
1405
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1406
|
+
#endif
|
|
1407
|
+
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
1408
|
+
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
1409
|
+
}
|
|
1410
|
+
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
1411
|
+
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
1412
|
+
}
|
|
1413
|
+
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
1414
|
+
float occlusion = 1.0;
|
|
1415
|
+
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
1416
|
+
float hard_shadow = step( compare , distribution.x );
|
|
1417
|
+
if (hard_shadow != 1.0 ) {
|
|
1418
|
+
float distance = compare - distribution.x ;
|
|
1419
|
+
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
1420
|
+
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 );
|
|
1421
|
+
}
|
|
1422
|
+
return occlusion;
|
|
1423
|
+
}
|
|
1424
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1425
|
+
float shadow = 1.0;
|
|
1426
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1427
|
+
shadowCoord.z += shadowBias;
|
|
1428
|
+
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
|
1429
|
+
bool inFrustum = all( inFrustumVec );
|
|
1430
|
+
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
|
1431
|
+
bool frustumTest = all( frustumTestVec );
|
|
1432
|
+
if ( frustumTest ) {
|
|
1433
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1434
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1435
|
+
float dx0 = - texelSize.x * shadowRadius;
|
|
1436
|
+
float dy0 = - texelSize.y * shadowRadius;
|
|
1437
|
+
float dx1 = + texelSize.x * shadowRadius;
|
|
1438
|
+
float dy1 = + texelSize.y * shadowRadius;
|
|
1439
|
+
float dx2 = dx0 / 2.0;
|
|
1440
|
+
float dy2 = dy0 / 2.0;
|
|
1441
|
+
float dx3 = dx1 / 2.0;
|
|
1442
|
+
float dy3 = dy1 / 2.0;
|
|
1443
|
+
shadow = (
|
|
1444
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
1445
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
1446
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
1447
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
1448
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
1449
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
1450
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
1451
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
1452
|
+
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
1453
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
1454
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
1455
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
1456
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
1457
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
1458
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
1459
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
1460
|
+
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
1461
|
+
) * ( 1.0 / 17.0 );
|
|
1462
|
+
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
1463
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1464
|
+
float dx = texelSize.x;
|
|
1465
|
+
float dy = texelSize.y;
|
|
1466
|
+
vec2 uv = shadowCoord.xy;
|
|
1467
|
+
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
1468
|
+
uv -= f * texelSize;
|
|
1469
|
+
shadow = (
|
|
1470
|
+
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
1471
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
1472
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
1473
|
+
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
1474
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
1475
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
1476
|
+
f.x ) +
|
|
1477
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
1478
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
1479
|
+
f.x ) +
|
|
1480
|
+
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
1481
|
+
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
1482
|
+
f.y ) +
|
|
1483
|
+
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
1484
|
+
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
1485
|
+
f.y ) +
|
|
1486
|
+
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
1487
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
1488
|
+
f.x ),
|
|
1489
|
+
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
1490
|
+
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
1491
|
+
f.x ),
|
|
1492
|
+
f.y )
|
|
1493
|
+
) * ( 1.0 / 9.0 );
|
|
1494
|
+
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1495
|
+
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1496
|
+
#else
|
|
1497
|
+
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1498
|
+
#endif
|
|
1499
|
+
}
|
|
1500
|
+
return shadow;
|
|
1501
|
+
}
|
|
1502
|
+
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
1503
|
+
vec3 absV = abs( v );
|
|
1504
|
+
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
1505
|
+
absV *= scaleToCube;
|
|
1506
|
+
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
1507
|
+
vec2 planar = v.xy;
|
|
1508
|
+
float almostATexel = 1.5 * texelSizeY;
|
|
1509
|
+
float almostOne = 1.0 - almostATexel;
|
|
1510
|
+
if ( absV.z >= almostOne ) {
|
|
1511
|
+
if ( v.z > 0.0 )
|
|
1512
|
+
planar.x = 4.0 - v.x;
|
|
1513
|
+
} else if ( absV.x >= almostOne ) {
|
|
1514
|
+
float signX = sign( v.x );
|
|
1515
|
+
planar.x = v.z * signX + 2.0 * signX;
|
|
1516
|
+
} else if ( absV.y >= almostOne ) {
|
|
1517
|
+
float signY = sign( v.y );
|
|
1518
|
+
planar.x = v.x + 2.0 * signY + 2.0;
|
|
1519
|
+
planar.y = v.z * signY - 2.0;
|
|
1520
|
+
}
|
|
1521
|
+
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
1522
|
+
}
|
|
1523
|
+
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1524
|
+
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
1525
|
+
vec3 lightToPosition = shadowCoord.xyz;
|
|
1526
|
+
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
1527
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
1528
|
+
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
1529
|
+
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
1530
|
+
return (
|
|
1531
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
1532
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
1533
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
1534
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
1535
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
1536
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
1537
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
1538
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
1539
|
+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
1540
|
+
) * ( 1.0 / 9.0 );
|
|
1541
|
+
#else
|
|
1542
|
+
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
1543
|
+
#endif
|
|
1544
|
+
}
|
|
1545
|
+
#endif`,Im=`#ifdef USE_SHADOWMAP
|
|
1546
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1547
|
+
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1548
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1549
|
+
struct DirectionalLightShadow {
|
|
1550
|
+
float shadowBias;
|
|
1551
|
+
float shadowNormalBias;
|
|
1552
|
+
float shadowRadius;
|
|
1553
|
+
vec2 shadowMapSize;
|
|
1554
|
+
};
|
|
1555
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1556
|
+
#endif
|
|
1557
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1558
|
+
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1559
|
+
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1560
|
+
struct SpotLightShadow {
|
|
1561
|
+
float shadowBias;
|
|
1562
|
+
float shadowNormalBias;
|
|
1563
|
+
float shadowRadius;
|
|
1564
|
+
vec2 shadowMapSize;
|
|
1565
|
+
};
|
|
1566
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1567
|
+
#endif
|
|
1568
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1569
|
+
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1570
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1571
|
+
struct PointLightShadow {
|
|
1572
|
+
float shadowBias;
|
|
1573
|
+
float shadowNormalBias;
|
|
1574
|
+
float shadowRadius;
|
|
1575
|
+
vec2 shadowMapSize;
|
|
1576
|
+
float shadowCameraNear;
|
|
1577
|
+
float shadowCameraFar;
|
|
1578
|
+
};
|
|
1579
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1580
|
+
#endif
|
|
1581
|
+
#endif`,Fm=`#ifdef USE_SHADOWMAP
|
|
1582
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
|
|
1583
|
+
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1584
|
+
vec4 shadowWorldPosition;
|
|
1585
|
+
#endif
|
|
1586
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1587
|
+
#pragma unroll_loop_start
|
|
1588
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1589
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
1590
|
+
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
1591
|
+
}
|
|
1592
|
+
#pragma unroll_loop_end
|
|
1593
|
+
#endif
|
|
1594
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1595
|
+
#pragma unroll_loop_start
|
|
1596
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1597
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
|
|
1598
|
+
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
|
|
1599
|
+
}
|
|
1600
|
+
#pragma unroll_loop_end
|
|
1601
|
+
#endif
|
|
1602
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1603
|
+
#pragma unroll_loop_start
|
|
1604
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1605
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
1606
|
+
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
1607
|
+
}
|
|
1608
|
+
#pragma unroll_loop_end
|
|
1609
|
+
#endif
|
|
1610
|
+
#endif`,Bm=`float getShadowMask() {
|
|
1611
|
+
float shadow = 1.0;
|
|
1612
|
+
#ifdef USE_SHADOWMAP
|
|
1613
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1614
|
+
DirectionalLightShadow directionalLight;
|
|
1615
|
+
#pragma unroll_loop_start
|
|
1616
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1617
|
+
directionalLight = directionalLightShadows[ i ];
|
|
1618
|
+
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1619
|
+
}
|
|
1620
|
+
#pragma unroll_loop_end
|
|
1621
|
+
#endif
|
|
1622
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1623
|
+
SpotLightShadow spotLight;
|
|
1624
|
+
#pragma unroll_loop_start
|
|
1625
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1626
|
+
spotLight = spotLightShadows[ i ];
|
|
1627
|
+
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1628
|
+
}
|
|
1629
|
+
#pragma unroll_loop_end
|
|
1630
|
+
#endif
|
|
1631
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1632
|
+
PointLightShadow pointLight;
|
|
1633
|
+
#pragma unroll_loop_start
|
|
1634
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1635
|
+
pointLight = pointLightShadows[ i ];
|
|
1636
|
+
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
1637
|
+
}
|
|
1638
|
+
#pragma unroll_loop_end
|
|
1639
|
+
#endif
|
|
1640
|
+
#endif
|
|
1641
|
+
return shadow;
|
|
1642
|
+
}`,Nm=`#ifdef USE_SKINNING
|
|
1643
|
+
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1644
|
+
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1645
|
+
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1646
|
+
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1647
|
+
#endif`,Om=`#ifdef USE_SKINNING
|
|
1648
|
+
uniform mat4 bindMatrix;
|
|
1649
|
+
uniform mat4 bindMatrixInverse;
|
|
1650
|
+
#ifdef BONE_TEXTURE
|
|
1651
|
+
uniform highp sampler2D boneTexture;
|
|
1652
|
+
uniform int boneTextureSize;
|
|
1653
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1654
|
+
float j = i * 4.0;
|
|
1655
|
+
float x = mod( j, float( boneTextureSize ) );
|
|
1656
|
+
float y = floor( j / float( boneTextureSize ) );
|
|
1657
|
+
float dx = 1.0 / float( boneTextureSize );
|
|
1658
|
+
float dy = 1.0 / float( boneTextureSize );
|
|
1659
|
+
y = dy * ( y + 0.5 );
|
|
1660
|
+
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
|
1661
|
+
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
|
1662
|
+
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
|
1663
|
+
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
|
1664
|
+
mat4 bone = mat4( v1, v2, v3, v4 );
|
|
1665
|
+
return bone;
|
|
1666
|
+
}
|
|
1667
|
+
#else
|
|
1668
|
+
uniform mat4 boneMatrices[ MAX_BONES ];
|
|
1669
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
1670
|
+
mat4 bone = boneMatrices[ int(i) ];
|
|
1671
|
+
return bone;
|
|
1672
|
+
}
|
|
1673
|
+
#endif
|
|
1674
|
+
#endif`,zm=`#ifdef USE_SKINNING
|
|
1675
|
+
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
1676
|
+
vec4 skinned = vec4( 0.0 );
|
|
1677
|
+
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
1678
|
+
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
1679
|
+
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
1680
|
+
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
1681
|
+
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
1682
|
+
#endif`,Um=`#ifdef USE_SKINNING
|
|
1683
|
+
mat4 skinMatrix = mat4( 0.0 );
|
|
1684
|
+
skinMatrix += skinWeight.x * boneMatX;
|
|
1685
|
+
skinMatrix += skinWeight.y * boneMatY;
|
|
1686
|
+
skinMatrix += skinWeight.z * boneMatZ;
|
|
1687
|
+
skinMatrix += skinWeight.w * boneMatW;
|
|
1688
|
+
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
1689
|
+
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
1690
|
+
#ifdef USE_TANGENT
|
|
1691
|
+
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
1692
|
+
#endif
|
|
1693
|
+
#endif`,Gm=`float specularStrength;
|
|
1694
|
+
#ifdef USE_SPECULARMAP
|
|
1695
|
+
vec4 texelSpecular = texture2D( specularMap, vUv );
|
|
1696
|
+
specularStrength = texelSpecular.r;
|
|
1697
|
+
#else
|
|
1698
|
+
specularStrength = 1.0;
|
|
1699
|
+
#endif`,Hm=`#ifdef USE_SPECULARMAP
|
|
1700
|
+
uniform sampler2D specularMap;
|
|
1701
|
+
#endif`,km=`#if defined( TONE_MAPPING )
|
|
1702
|
+
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
1703
|
+
#endif`,Vm=`#ifndef saturate
|
|
1704
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
1705
|
+
#endif
|
|
1706
|
+
uniform float toneMappingExposure;
|
|
1707
|
+
vec3 LinearToneMapping( vec3 color ) {
|
|
1708
|
+
return toneMappingExposure * color;
|
|
1709
|
+
}
|
|
1710
|
+
vec3 ReinhardToneMapping( vec3 color ) {
|
|
1711
|
+
color *= toneMappingExposure;
|
|
1712
|
+
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
1713
|
+
}
|
|
1714
|
+
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
1715
|
+
color *= toneMappingExposure;
|
|
1716
|
+
color = max( vec3( 0.0 ), color - 0.004 );
|
|
1717
|
+
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
1718
|
+
}
|
|
1719
|
+
vec3 RRTAndODTFit( vec3 v ) {
|
|
1720
|
+
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
1721
|
+
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
1722
|
+
return a / b;
|
|
1723
|
+
}
|
|
1724
|
+
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
1725
|
+
const mat3 ACESInputMat = mat3(
|
|
1726
|
+
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
1727
|
+
vec3( 0.04823, 0.01566, 0.83777 )
|
|
1728
|
+
);
|
|
1729
|
+
const mat3 ACESOutputMat = mat3(
|
|
1730
|
+
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
1731
|
+
vec3( -0.07367, -0.00605, 1.07602 )
|
|
1732
|
+
);
|
|
1733
|
+
color *= toneMappingExposure / 0.6;
|
|
1734
|
+
color = ACESInputMat * color;
|
|
1735
|
+
color = RRTAndODTFit( color );
|
|
1736
|
+
color = ACESOutputMat * color;
|
|
1737
|
+
return saturate( color );
|
|
1738
|
+
}
|
|
1739
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Wm=`#ifdef USE_TRANSMISSION
|
|
1740
|
+
float transmissionAlpha = 1.0;
|
|
1741
|
+
float transmissionFactor = transmission;
|
|
1742
|
+
float thicknessFactor = thickness;
|
|
1743
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
1744
|
+
transmissionFactor *= texture2D( transmissionMap, vUv ).r;
|
|
1745
|
+
#endif
|
|
1746
|
+
#ifdef USE_THICKNESSMAP
|
|
1747
|
+
thicknessFactor *= texture2D( thicknessMap, vUv ).g;
|
|
1748
|
+
#endif
|
|
1749
|
+
vec3 pos = vWorldPosition;
|
|
1750
|
+
vec3 v = normalize( cameraPosition - pos );
|
|
1751
|
+
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
|
1752
|
+
vec4 transmission = getIBLVolumeRefraction(
|
|
1753
|
+
n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
|
|
1754
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
|
|
1755
|
+
attenuationColor, attenuationDistance );
|
|
1756
|
+
totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
|
|
1757
|
+
transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
|
|
1758
|
+
#endif`,qm=`#ifdef USE_TRANSMISSION
|
|
1759
|
+
uniform float transmission;
|
|
1760
|
+
uniform float thickness;
|
|
1761
|
+
uniform float attenuationDistance;
|
|
1762
|
+
uniform vec3 attenuationColor;
|
|
1763
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
1764
|
+
uniform sampler2D transmissionMap;
|
|
1765
|
+
#endif
|
|
1766
|
+
#ifdef USE_THICKNESSMAP
|
|
1767
|
+
uniform sampler2D thicknessMap;
|
|
1768
|
+
#endif
|
|
1769
|
+
uniform vec2 transmissionSamplerSize;
|
|
1770
|
+
uniform sampler2D transmissionSamplerMap;
|
|
1771
|
+
uniform mat4 modelMatrix;
|
|
1772
|
+
uniform mat4 projectionMatrix;
|
|
1773
|
+
varying vec3 vWorldPosition;
|
|
1774
|
+
vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
|
|
1775
|
+
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
1776
|
+
vec3 modelScale;
|
|
1777
|
+
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
1778
|
+
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
1779
|
+
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
1780
|
+
return normalize( refractionVector ) * thickness * modelScale;
|
|
1781
|
+
}
|
|
1782
|
+
float applyIorToRoughness( float roughness, float ior ) {
|
|
1783
|
+
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
1784
|
+
}
|
|
1785
|
+
vec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {
|
|
1786
|
+
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
1787
|
+
#ifdef TEXTURE_LOD_EXT
|
|
1788
|
+
return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
1789
|
+
#else
|
|
1790
|
+
return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
|
1791
|
+
#endif
|
|
1792
|
+
}
|
|
1793
|
+
vec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {
|
|
1794
|
+
if ( attenuationDistance == 0.0 ) {
|
|
1795
|
+
return radiance;
|
|
1796
|
+
} else {
|
|
1797
|
+
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
1798
|
+
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,
|
|
1802
|
+
vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,
|
|
1803
|
+
vec3 attenuationColor, float attenuationDistance ) {
|
|
1804
|
+
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
1805
|
+
vec3 refractedRayExit = position + transmissionRay;
|
|
1806
|
+
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
1807
|
+
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
1808
|
+
refractionCoords += 1.0;
|
|
1809
|
+
refractionCoords /= 2.0;
|
|
1810
|
+
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
1811
|
+
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
1812
|
+
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
1813
|
+
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
|
|
1814
|
+
}
|
|
1815
|
+
#endif`,Xm=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
|
1816
|
+
varying vec2 vUv;
|
|
1817
|
+
#endif`,Zm=`#ifdef USE_UV
|
|
1818
|
+
#ifdef UVS_VERTEX_ONLY
|
|
1819
|
+
vec2 vUv;
|
|
1820
|
+
#else
|
|
1821
|
+
varying vec2 vUv;
|
|
1822
|
+
#endif
|
|
1823
|
+
uniform mat3 uvTransform;
|
|
1824
|
+
#endif`,jm=`#ifdef USE_UV
|
|
1825
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1826
|
+
#endif`,Ym=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1827
|
+
varying vec2 vUv2;
|
|
1828
|
+
#endif`,Jm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1829
|
+
attribute vec2 uv2;
|
|
1830
|
+
varying vec2 vUv2;
|
|
1831
|
+
uniform mat3 uv2Transform;
|
|
1832
|
+
#endif`,$m=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
1833
|
+
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
|
1834
|
+
#endif`,Km=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
|
|
1835
|
+
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
1836
|
+
#ifdef USE_INSTANCING
|
|
1837
|
+
worldPosition = instanceMatrix * worldPosition;
|
|
1838
|
+
#endif
|
|
1839
|
+
worldPosition = modelMatrix * worldPosition;
|
|
1840
|
+
#endif`;const gt={alphamap_fragment:sp,alphamap_pars_fragment:op,alphatest_fragment:ap,alphatest_pars_fragment:lp,aomap_fragment:cp,aomap_pars_fragment:up,begin_vertex:hp,beginnormal_vertex:fp,bsdfs:dp,bumpmap_pars_fragment:pp,clipping_planes_fragment:mp,clipping_planes_pars_fragment:gp,clipping_planes_pars_vertex:vp,clipping_planes_vertex:yp,color_fragment:xp,color_pars_fragment:_p,color_pars_vertex:bp,color_vertex:Mp,common:wp,cube_uv_reflection_fragment:Sp,defaultnormal_vertex:Tp,displacementmap_pars_vertex:Ep,displacementmap_vertex:Ap,emissivemap_fragment:Cp,emissivemap_pars_fragment:Lp,encodings_fragment:Rp,encodings_pars_fragment:Pp,envmap_fragment:Dp,envmap_common_pars_fragment:Ip,envmap_pars_fragment:Fp,envmap_pars_vertex:Bp,envmap_physical_pars_fragment:Xp,envmap_vertex:Np,fog_vertex:Op,fog_pars_vertex:zp,fog_fragment:Up,fog_pars_fragment:Gp,gradientmap_pars_fragment:Hp,lightmap_fragment:kp,lightmap_pars_fragment:Vp,lights_lambert_vertex:Wp,lights_pars_begin:qp,lights_toon_fragment:Zp,lights_toon_pars_fragment:jp,lights_phong_fragment:Yp,lights_phong_pars_fragment:Jp,lights_physical_fragment:$p,lights_physical_pars_fragment:Kp,lights_fragment_begin:Qp,lights_fragment_maps:em,lights_fragment_end:tm,logdepthbuf_fragment:nm,logdepthbuf_pars_fragment:im,logdepthbuf_pars_vertex:rm,logdepthbuf_vertex:sm,map_fragment:om,map_pars_fragment:am,map_particle_fragment:lm,map_particle_pars_fragment:cm,metalnessmap_fragment:um,metalnessmap_pars_fragment:hm,morphnormal_vertex:fm,morphtarget_pars_vertex:dm,morphtarget_vertex:pm,normal_fragment_begin:mm,normal_fragment_maps:gm,normal_pars_fragment:vm,normal_pars_vertex:ym,normal_vertex:xm,normalmap_pars_fragment:_m,clearcoat_normal_fragment_begin:bm,clearcoat_normal_fragment_maps:Mm,clearcoat_pars_fragment:wm,output_fragment:Sm,packing:Tm,premultiplied_alpha_fragment:Em,project_vertex:Am,dithering_fragment:Cm,dithering_pars_fragment:Lm,roughnessmap_fragment:Rm,roughnessmap_pars_fragment:Pm,shadowmap_pars_fragment:Dm,shadowmap_pars_vertex:Im,shadowmap_vertex:Fm,shadowmask_pars_fragment:Bm,skinbase_vertex:Nm,skinning_pars_vertex:Om,skinning_vertex:zm,skinnormal_vertex:Um,specularmap_fragment:Gm,specularmap_pars_fragment:Hm,tonemapping_fragment:km,tonemapping_pars_fragment:Vm,transmission_fragment:Wm,transmission_pars_fragment:qm,uv_pars_fragment:Xm,uv_pars_vertex:Zm,uv_vertex:jm,uv2_pars_fragment:Ym,uv2_pars_vertex:Jm,uv2_vertex:$m,worldpos_vertex:Km,background_vert:`varying vec2 vUv;
|
|
1841
|
+
uniform mat3 uvTransform;
|
|
1842
|
+
void main() {
|
|
1843
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
1844
|
+
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
1845
|
+
}`,background_frag:`uniform sampler2D t2D;
|
|
1846
|
+
varying vec2 vUv;
|
|
1847
|
+
void main() {
|
|
1848
|
+
vec4 texColor = texture2D( t2D, vUv );
|
|
1849
|
+
gl_FragColor = mapTexelToLinear( texColor );
|
|
1850
|
+
#include <tonemapping_fragment>
|
|
1851
|
+
#include <encodings_fragment>
|
|
1852
|
+
}`,cube_vert:`varying vec3 vWorldDirection;
|
|
1853
|
+
#include <common>
|
|
1854
|
+
void main() {
|
|
1855
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1856
|
+
#include <begin_vertex>
|
|
1857
|
+
#include <project_vertex>
|
|
1858
|
+
gl_Position.z = gl_Position.w;
|
|
1859
|
+
}`,cube_frag:`#include <envmap_common_pars_fragment>
|
|
1860
|
+
uniform float opacity;
|
|
1861
|
+
varying vec3 vWorldDirection;
|
|
1862
|
+
#include <cube_uv_reflection_fragment>
|
|
1863
|
+
void main() {
|
|
1864
|
+
vec3 vReflect = vWorldDirection;
|
|
1865
|
+
#include <envmap_fragment>
|
|
1866
|
+
gl_FragColor = envColor;
|
|
1867
|
+
gl_FragColor.a *= opacity;
|
|
1868
|
+
#include <tonemapping_fragment>
|
|
1869
|
+
#include <encodings_fragment>
|
|
1870
|
+
}`,depth_vert:`#include <common>
|
|
1871
|
+
#include <uv_pars_vertex>
|
|
1872
|
+
#include <displacementmap_pars_vertex>
|
|
1873
|
+
#include <morphtarget_pars_vertex>
|
|
1874
|
+
#include <skinning_pars_vertex>
|
|
1875
|
+
#include <logdepthbuf_pars_vertex>
|
|
1876
|
+
#include <clipping_planes_pars_vertex>
|
|
1877
|
+
varying vec2 vHighPrecisionZW;
|
|
1878
|
+
void main() {
|
|
1879
|
+
#include <uv_vertex>
|
|
1880
|
+
#include <skinbase_vertex>
|
|
1881
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1882
|
+
#include <beginnormal_vertex>
|
|
1883
|
+
#include <morphnormal_vertex>
|
|
1884
|
+
#include <skinnormal_vertex>
|
|
1885
|
+
#endif
|
|
1886
|
+
#include <begin_vertex>
|
|
1887
|
+
#include <morphtarget_vertex>
|
|
1888
|
+
#include <skinning_vertex>
|
|
1889
|
+
#include <displacementmap_vertex>
|
|
1890
|
+
#include <project_vertex>
|
|
1891
|
+
#include <logdepthbuf_vertex>
|
|
1892
|
+
#include <clipping_planes_vertex>
|
|
1893
|
+
vHighPrecisionZW = gl_Position.zw;
|
|
1894
|
+
}`,depth_frag:`#if DEPTH_PACKING == 3200
|
|
1895
|
+
uniform float opacity;
|
|
1896
|
+
#endif
|
|
1897
|
+
#include <common>
|
|
1898
|
+
#include <packing>
|
|
1899
|
+
#include <uv_pars_fragment>
|
|
1900
|
+
#include <map_pars_fragment>
|
|
1901
|
+
#include <alphamap_pars_fragment>
|
|
1902
|
+
#include <alphatest_pars_fragment>
|
|
1903
|
+
#include <logdepthbuf_pars_fragment>
|
|
1904
|
+
#include <clipping_planes_pars_fragment>
|
|
1905
|
+
varying vec2 vHighPrecisionZW;
|
|
1906
|
+
void main() {
|
|
1907
|
+
#include <clipping_planes_fragment>
|
|
1908
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1909
|
+
#if DEPTH_PACKING == 3200
|
|
1910
|
+
diffuseColor.a = opacity;
|
|
1911
|
+
#endif
|
|
1912
|
+
#include <map_fragment>
|
|
1913
|
+
#include <alphamap_fragment>
|
|
1914
|
+
#include <alphatest_fragment>
|
|
1915
|
+
#include <logdepthbuf_fragment>
|
|
1916
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
1917
|
+
#if DEPTH_PACKING == 3200
|
|
1918
|
+
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
1919
|
+
#elif DEPTH_PACKING == 3201
|
|
1920
|
+
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
1921
|
+
#endif
|
|
1922
|
+
}`,distanceRGBA_vert:`#define DISTANCE
|
|
1923
|
+
varying vec3 vWorldPosition;
|
|
1924
|
+
#include <common>
|
|
1925
|
+
#include <uv_pars_vertex>
|
|
1926
|
+
#include <displacementmap_pars_vertex>
|
|
1927
|
+
#include <morphtarget_pars_vertex>
|
|
1928
|
+
#include <skinning_pars_vertex>
|
|
1929
|
+
#include <clipping_planes_pars_vertex>
|
|
1930
|
+
void main() {
|
|
1931
|
+
#include <uv_vertex>
|
|
1932
|
+
#include <skinbase_vertex>
|
|
1933
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
1934
|
+
#include <beginnormal_vertex>
|
|
1935
|
+
#include <morphnormal_vertex>
|
|
1936
|
+
#include <skinnormal_vertex>
|
|
1937
|
+
#endif
|
|
1938
|
+
#include <begin_vertex>
|
|
1939
|
+
#include <morphtarget_vertex>
|
|
1940
|
+
#include <skinning_vertex>
|
|
1941
|
+
#include <displacementmap_vertex>
|
|
1942
|
+
#include <project_vertex>
|
|
1943
|
+
#include <worldpos_vertex>
|
|
1944
|
+
#include <clipping_planes_vertex>
|
|
1945
|
+
vWorldPosition = worldPosition.xyz;
|
|
1946
|
+
}`,distanceRGBA_frag:`#define DISTANCE
|
|
1947
|
+
uniform vec3 referencePosition;
|
|
1948
|
+
uniform float nearDistance;
|
|
1949
|
+
uniform float farDistance;
|
|
1950
|
+
varying vec3 vWorldPosition;
|
|
1951
|
+
#include <common>
|
|
1952
|
+
#include <packing>
|
|
1953
|
+
#include <uv_pars_fragment>
|
|
1954
|
+
#include <map_pars_fragment>
|
|
1955
|
+
#include <alphamap_pars_fragment>
|
|
1956
|
+
#include <alphatest_pars_fragment>
|
|
1957
|
+
#include <clipping_planes_pars_fragment>
|
|
1958
|
+
void main () {
|
|
1959
|
+
#include <clipping_planes_fragment>
|
|
1960
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
1961
|
+
#include <map_fragment>
|
|
1962
|
+
#include <alphamap_fragment>
|
|
1963
|
+
#include <alphatest_fragment>
|
|
1964
|
+
float dist = length( vWorldPosition - referencePosition );
|
|
1965
|
+
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
1966
|
+
dist = saturate( dist );
|
|
1967
|
+
gl_FragColor = packDepthToRGBA( dist );
|
|
1968
|
+
}`,equirect_vert:`varying vec3 vWorldDirection;
|
|
1969
|
+
#include <common>
|
|
1970
|
+
void main() {
|
|
1971
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
1972
|
+
#include <begin_vertex>
|
|
1973
|
+
#include <project_vertex>
|
|
1974
|
+
}`,equirect_frag:`uniform sampler2D tEquirect;
|
|
1975
|
+
varying vec3 vWorldDirection;
|
|
1976
|
+
#include <common>
|
|
1977
|
+
void main() {
|
|
1978
|
+
vec3 direction = normalize( vWorldDirection );
|
|
1979
|
+
vec2 sampleUV = equirectUv( direction );
|
|
1980
|
+
vec4 texColor = texture2D( tEquirect, sampleUV );
|
|
1981
|
+
gl_FragColor = mapTexelToLinear( texColor );
|
|
1982
|
+
#include <tonemapping_fragment>
|
|
1983
|
+
#include <encodings_fragment>
|
|
1984
|
+
}`,linedashed_vert:`uniform float scale;
|
|
1985
|
+
attribute float lineDistance;
|
|
1986
|
+
varying float vLineDistance;
|
|
1987
|
+
#include <common>
|
|
1988
|
+
#include <color_pars_vertex>
|
|
1989
|
+
#include <fog_pars_vertex>
|
|
1990
|
+
#include <morphtarget_pars_vertex>
|
|
1991
|
+
#include <logdepthbuf_pars_vertex>
|
|
1992
|
+
#include <clipping_planes_pars_vertex>
|
|
1993
|
+
void main() {
|
|
1994
|
+
vLineDistance = scale * lineDistance;
|
|
1995
|
+
#include <color_vertex>
|
|
1996
|
+
#include <begin_vertex>
|
|
1997
|
+
#include <morphtarget_vertex>
|
|
1998
|
+
#include <project_vertex>
|
|
1999
|
+
#include <logdepthbuf_vertex>
|
|
2000
|
+
#include <clipping_planes_vertex>
|
|
2001
|
+
#include <fog_vertex>
|
|
2002
|
+
}`,linedashed_frag:`uniform vec3 diffuse;
|
|
2003
|
+
uniform float opacity;
|
|
2004
|
+
uniform float dashSize;
|
|
2005
|
+
uniform float totalSize;
|
|
2006
|
+
varying float vLineDistance;
|
|
2007
|
+
#include <common>
|
|
2008
|
+
#include <color_pars_fragment>
|
|
2009
|
+
#include <fog_pars_fragment>
|
|
2010
|
+
#include <logdepthbuf_pars_fragment>
|
|
2011
|
+
#include <clipping_planes_pars_fragment>
|
|
2012
|
+
void main() {
|
|
2013
|
+
#include <clipping_planes_fragment>
|
|
2014
|
+
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2015
|
+
discard;
|
|
2016
|
+
}
|
|
2017
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2018
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2019
|
+
#include <logdepthbuf_fragment>
|
|
2020
|
+
#include <color_fragment>
|
|
2021
|
+
outgoingLight = diffuseColor.rgb;
|
|
2022
|
+
#include <output_fragment>
|
|
2023
|
+
#include <tonemapping_fragment>
|
|
2024
|
+
#include <encodings_fragment>
|
|
2025
|
+
#include <fog_fragment>
|
|
2026
|
+
#include <premultiplied_alpha_fragment>
|
|
2027
|
+
}`,meshbasic_vert:`#include <common>
|
|
2028
|
+
#include <uv_pars_vertex>
|
|
2029
|
+
#include <uv2_pars_vertex>
|
|
2030
|
+
#include <envmap_pars_vertex>
|
|
2031
|
+
#include <color_pars_vertex>
|
|
2032
|
+
#include <fog_pars_vertex>
|
|
2033
|
+
#include <morphtarget_pars_vertex>
|
|
2034
|
+
#include <skinning_pars_vertex>
|
|
2035
|
+
#include <logdepthbuf_pars_vertex>
|
|
2036
|
+
#include <clipping_planes_pars_vertex>
|
|
2037
|
+
void main() {
|
|
2038
|
+
#include <uv_vertex>
|
|
2039
|
+
#include <uv2_vertex>
|
|
2040
|
+
#include <color_vertex>
|
|
2041
|
+
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
2042
|
+
#include <beginnormal_vertex>
|
|
2043
|
+
#include <morphnormal_vertex>
|
|
2044
|
+
#include <skinbase_vertex>
|
|
2045
|
+
#include <skinnormal_vertex>
|
|
2046
|
+
#include <defaultnormal_vertex>
|
|
2047
|
+
#endif
|
|
2048
|
+
#include <begin_vertex>
|
|
2049
|
+
#include <morphtarget_vertex>
|
|
2050
|
+
#include <skinning_vertex>
|
|
2051
|
+
#include <project_vertex>
|
|
2052
|
+
#include <logdepthbuf_vertex>
|
|
2053
|
+
#include <clipping_planes_vertex>
|
|
2054
|
+
#include <worldpos_vertex>
|
|
2055
|
+
#include <envmap_vertex>
|
|
2056
|
+
#include <fog_vertex>
|
|
2057
|
+
}`,meshbasic_frag:`uniform vec3 diffuse;
|
|
2058
|
+
uniform float opacity;
|
|
2059
|
+
#ifndef FLAT_SHADED
|
|
2060
|
+
varying vec3 vNormal;
|
|
2061
|
+
#endif
|
|
2062
|
+
#include <common>
|
|
2063
|
+
#include <dithering_pars_fragment>
|
|
2064
|
+
#include <color_pars_fragment>
|
|
2065
|
+
#include <uv_pars_fragment>
|
|
2066
|
+
#include <uv2_pars_fragment>
|
|
2067
|
+
#include <map_pars_fragment>
|
|
2068
|
+
#include <alphamap_pars_fragment>
|
|
2069
|
+
#include <alphatest_pars_fragment>
|
|
2070
|
+
#include <aomap_pars_fragment>
|
|
2071
|
+
#include <lightmap_pars_fragment>
|
|
2072
|
+
#include <envmap_common_pars_fragment>
|
|
2073
|
+
#include <envmap_pars_fragment>
|
|
2074
|
+
#include <cube_uv_reflection_fragment>
|
|
2075
|
+
#include <fog_pars_fragment>
|
|
2076
|
+
#include <specularmap_pars_fragment>
|
|
2077
|
+
#include <logdepthbuf_pars_fragment>
|
|
2078
|
+
#include <clipping_planes_pars_fragment>
|
|
2079
|
+
void main() {
|
|
2080
|
+
#include <clipping_planes_fragment>
|
|
2081
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2082
|
+
#include <logdepthbuf_fragment>
|
|
2083
|
+
#include <map_fragment>
|
|
2084
|
+
#include <color_fragment>
|
|
2085
|
+
#include <alphamap_fragment>
|
|
2086
|
+
#include <alphatest_fragment>
|
|
2087
|
+
#include <specularmap_fragment>
|
|
2088
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2089
|
+
#ifdef USE_LIGHTMAP
|
|
2090
|
+
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
2091
|
+
reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
2092
|
+
#else
|
|
2093
|
+
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2094
|
+
#endif
|
|
2095
|
+
#include <aomap_fragment>
|
|
2096
|
+
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2097
|
+
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2098
|
+
#include <envmap_fragment>
|
|
2099
|
+
#include <output_fragment>
|
|
2100
|
+
#include <tonemapping_fragment>
|
|
2101
|
+
#include <encodings_fragment>
|
|
2102
|
+
#include <fog_fragment>
|
|
2103
|
+
#include <premultiplied_alpha_fragment>
|
|
2104
|
+
#include <dithering_fragment>
|
|
2105
|
+
}`,meshlambert_vert:`#define LAMBERT
|
|
2106
|
+
varying vec3 vLightFront;
|
|
2107
|
+
varying vec3 vIndirectFront;
|
|
2108
|
+
#ifdef DOUBLE_SIDED
|
|
2109
|
+
varying vec3 vLightBack;
|
|
2110
|
+
varying vec3 vIndirectBack;
|
|
2111
|
+
#endif
|
|
2112
|
+
#include <common>
|
|
2113
|
+
#include <uv_pars_vertex>
|
|
2114
|
+
#include <uv2_pars_vertex>
|
|
2115
|
+
#include <envmap_pars_vertex>
|
|
2116
|
+
#include <bsdfs>
|
|
2117
|
+
#include <lights_pars_begin>
|
|
2118
|
+
#include <color_pars_vertex>
|
|
2119
|
+
#include <fog_pars_vertex>
|
|
2120
|
+
#include <morphtarget_pars_vertex>
|
|
2121
|
+
#include <skinning_pars_vertex>
|
|
2122
|
+
#include <shadowmap_pars_vertex>
|
|
2123
|
+
#include <logdepthbuf_pars_vertex>
|
|
2124
|
+
#include <clipping_planes_pars_vertex>
|
|
2125
|
+
void main() {
|
|
2126
|
+
#include <uv_vertex>
|
|
2127
|
+
#include <uv2_vertex>
|
|
2128
|
+
#include <color_vertex>
|
|
2129
|
+
#include <beginnormal_vertex>
|
|
2130
|
+
#include <morphnormal_vertex>
|
|
2131
|
+
#include <skinbase_vertex>
|
|
2132
|
+
#include <skinnormal_vertex>
|
|
2133
|
+
#include <defaultnormal_vertex>
|
|
2134
|
+
#include <begin_vertex>
|
|
2135
|
+
#include <morphtarget_vertex>
|
|
2136
|
+
#include <skinning_vertex>
|
|
2137
|
+
#include <project_vertex>
|
|
2138
|
+
#include <logdepthbuf_vertex>
|
|
2139
|
+
#include <clipping_planes_vertex>
|
|
2140
|
+
#include <worldpos_vertex>
|
|
2141
|
+
#include <envmap_vertex>
|
|
2142
|
+
#include <lights_lambert_vertex>
|
|
2143
|
+
#include <shadowmap_vertex>
|
|
2144
|
+
#include <fog_vertex>
|
|
2145
|
+
}`,meshlambert_frag:`uniform vec3 diffuse;
|
|
2146
|
+
uniform vec3 emissive;
|
|
2147
|
+
uniform float opacity;
|
|
2148
|
+
varying vec3 vLightFront;
|
|
2149
|
+
varying vec3 vIndirectFront;
|
|
2150
|
+
#ifdef DOUBLE_SIDED
|
|
2151
|
+
varying vec3 vLightBack;
|
|
2152
|
+
varying vec3 vIndirectBack;
|
|
2153
|
+
#endif
|
|
2154
|
+
#include <common>
|
|
2155
|
+
#include <packing>
|
|
2156
|
+
#include <dithering_pars_fragment>
|
|
2157
|
+
#include <color_pars_fragment>
|
|
2158
|
+
#include <uv_pars_fragment>
|
|
2159
|
+
#include <uv2_pars_fragment>
|
|
2160
|
+
#include <map_pars_fragment>
|
|
2161
|
+
#include <alphamap_pars_fragment>
|
|
2162
|
+
#include <alphatest_pars_fragment>
|
|
2163
|
+
#include <aomap_pars_fragment>
|
|
2164
|
+
#include <lightmap_pars_fragment>
|
|
2165
|
+
#include <emissivemap_pars_fragment>
|
|
2166
|
+
#include <envmap_common_pars_fragment>
|
|
2167
|
+
#include <envmap_pars_fragment>
|
|
2168
|
+
#include <cube_uv_reflection_fragment>
|
|
2169
|
+
#include <bsdfs>
|
|
2170
|
+
#include <lights_pars_begin>
|
|
2171
|
+
#include <fog_pars_fragment>
|
|
2172
|
+
#include <shadowmap_pars_fragment>
|
|
2173
|
+
#include <shadowmask_pars_fragment>
|
|
2174
|
+
#include <specularmap_pars_fragment>
|
|
2175
|
+
#include <logdepthbuf_pars_fragment>
|
|
2176
|
+
#include <clipping_planes_pars_fragment>
|
|
2177
|
+
void main() {
|
|
2178
|
+
#include <clipping_planes_fragment>
|
|
2179
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2180
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2181
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2182
|
+
#include <logdepthbuf_fragment>
|
|
2183
|
+
#include <map_fragment>
|
|
2184
|
+
#include <color_fragment>
|
|
2185
|
+
#include <alphamap_fragment>
|
|
2186
|
+
#include <alphatest_fragment>
|
|
2187
|
+
#include <specularmap_fragment>
|
|
2188
|
+
#include <emissivemap_fragment>
|
|
2189
|
+
#ifdef DOUBLE_SIDED
|
|
2190
|
+
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
|
2191
|
+
#else
|
|
2192
|
+
reflectedLight.indirectDiffuse += vIndirectFront;
|
|
2193
|
+
#endif
|
|
2194
|
+
#include <lightmap_fragment>
|
|
2195
|
+
reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );
|
|
2196
|
+
#ifdef DOUBLE_SIDED
|
|
2197
|
+
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
|
2198
|
+
#else
|
|
2199
|
+
reflectedLight.directDiffuse = vLightFront;
|
|
2200
|
+
#endif
|
|
2201
|
+
reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();
|
|
2202
|
+
#include <aomap_fragment>
|
|
2203
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2204
|
+
#include <envmap_fragment>
|
|
2205
|
+
#include <output_fragment>
|
|
2206
|
+
#include <tonemapping_fragment>
|
|
2207
|
+
#include <encodings_fragment>
|
|
2208
|
+
#include <fog_fragment>
|
|
2209
|
+
#include <premultiplied_alpha_fragment>
|
|
2210
|
+
#include <dithering_fragment>
|
|
2211
|
+
}`,meshmatcap_vert:`#define MATCAP
|
|
2212
|
+
varying vec3 vViewPosition;
|
|
2213
|
+
#include <common>
|
|
2214
|
+
#include <uv_pars_vertex>
|
|
2215
|
+
#include <color_pars_vertex>
|
|
2216
|
+
#include <displacementmap_pars_vertex>
|
|
2217
|
+
#include <fog_pars_vertex>
|
|
2218
|
+
#include <normal_pars_vertex>
|
|
2219
|
+
#include <morphtarget_pars_vertex>
|
|
2220
|
+
#include <skinning_pars_vertex>
|
|
2221
|
+
#include <logdepthbuf_pars_vertex>
|
|
2222
|
+
#include <clipping_planes_pars_vertex>
|
|
2223
|
+
void main() {
|
|
2224
|
+
#include <uv_vertex>
|
|
2225
|
+
#include <color_vertex>
|
|
2226
|
+
#include <beginnormal_vertex>
|
|
2227
|
+
#include <morphnormal_vertex>
|
|
2228
|
+
#include <skinbase_vertex>
|
|
2229
|
+
#include <skinnormal_vertex>
|
|
2230
|
+
#include <defaultnormal_vertex>
|
|
2231
|
+
#include <normal_vertex>
|
|
2232
|
+
#include <begin_vertex>
|
|
2233
|
+
#include <morphtarget_vertex>
|
|
2234
|
+
#include <skinning_vertex>
|
|
2235
|
+
#include <displacementmap_vertex>
|
|
2236
|
+
#include <project_vertex>
|
|
2237
|
+
#include <logdepthbuf_vertex>
|
|
2238
|
+
#include <clipping_planes_vertex>
|
|
2239
|
+
#include <fog_vertex>
|
|
2240
|
+
vViewPosition = - mvPosition.xyz;
|
|
2241
|
+
}`,meshmatcap_frag:`#define MATCAP
|
|
2242
|
+
uniform vec3 diffuse;
|
|
2243
|
+
uniform float opacity;
|
|
2244
|
+
uniform sampler2D matcap;
|
|
2245
|
+
varying vec3 vViewPosition;
|
|
2246
|
+
#include <common>
|
|
2247
|
+
#include <dithering_pars_fragment>
|
|
2248
|
+
#include <color_pars_fragment>
|
|
2249
|
+
#include <uv_pars_fragment>
|
|
2250
|
+
#include <map_pars_fragment>
|
|
2251
|
+
#include <alphamap_pars_fragment>
|
|
2252
|
+
#include <alphatest_pars_fragment>
|
|
2253
|
+
#include <fog_pars_fragment>
|
|
2254
|
+
#include <normal_pars_fragment>
|
|
2255
|
+
#include <bumpmap_pars_fragment>
|
|
2256
|
+
#include <normalmap_pars_fragment>
|
|
2257
|
+
#include <logdepthbuf_pars_fragment>
|
|
2258
|
+
#include <clipping_planes_pars_fragment>
|
|
2259
|
+
void main() {
|
|
2260
|
+
#include <clipping_planes_fragment>
|
|
2261
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2262
|
+
#include <logdepthbuf_fragment>
|
|
2263
|
+
#include <map_fragment>
|
|
2264
|
+
#include <color_fragment>
|
|
2265
|
+
#include <alphamap_fragment>
|
|
2266
|
+
#include <alphatest_fragment>
|
|
2267
|
+
#include <normal_fragment_begin>
|
|
2268
|
+
#include <normal_fragment_maps>
|
|
2269
|
+
vec3 viewDir = normalize( vViewPosition );
|
|
2270
|
+
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
2271
|
+
vec3 y = cross( viewDir, x );
|
|
2272
|
+
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
2273
|
+
#ifdef USE_MATCAP
|
|
2274
|
+
vec4 matcapColor = texture2D( matcap, uv );
|
|
2275
|
+
matcapColor = matcapTexelToLinear( matcapColor );
|
|
2276
|
+
#else
|
|
2277
|
+
vec4 matcapColor = vec4( 1.0 );
|
|
2278
|
+
#endif
|
|
2279
|
+
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
2280
|
+
#include <output_fragment>
|
|
2281
|
+
#include <tonemapping_fragment>
|
|
2282
|
+
#include <encodings_fragment>
|
|
2283
|
+
#include <fog_fragment>
|
|
2284
|
+
#include <premultiplied_alpha_fragment>
|
|
2285
|
+
#include <dithering_fragment>
|
|
2286
|
+
}`,meshnormal_vert:`#define NORMAL
|
|
2287
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2288
|
+
varying vec3 vViewPosition;
|
|
2289
|
+
#endif
|
|
2290
|
+
#include <common>
|
|
2291
|
+
#include <uv_pars_vertex>
|
|
2292
|
+
#include <displacementmap_pars_vertex>
|
|
2293
|
+
#include <normal_pars_vertex>
|
|
2294
|
+
#include <morphtarget_pars_vertex>
|
|
2295
|
+
#include <skinning_pars_vertex>
|
|
2296
|
+
#include <logdepthbuf_pars_vertex>
|
|
2297
|
+
#include <clipping_planes_pars_vertex>
|
|
2298
|
+
void main() {
|
|
2299
|
+
#include <uv_vertex>
|
|
2300
|
+
#include <beginnormal_vertex>
|
|
2301
|
+
#include <morphnormal_vertex>
|
|
2302
|
+
#include <skinbase_vertex>
|
|
2303
|
+
#include <skinnormal_vertex>
|
|
2304
|
+
#include <defaultnormal_vertex>
|
|
2305
|
+
#include <normal_vertex>
|
|
2306
|
+
#include <begin_vertex>
|
|
2307
|
+
#include <morphtarget_vertex>
|
|
2308
|
+
#include <skinning_vertex>
|
|
2309
|
+
#include <displacementmap_vertex>
|
|
2310
|
+
#include <project_vertex>
|
|
2311
|
+
#include <logdepthbuf_vertex>
|
|
2312
|
+
#include <clipping_planes_vertex>
|
|
2313
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2314
|
+
vViewPosition = - mvPosition.xyz;
|
|
2315
|
+
#endif
|
|
2316
|
+
}`,meshnormal_frag:`#define NORMAL
|
|
2317
|
+
uniform float opacity;
|
|
2318
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2319
|
+
varying vec3 vViewPosition;
|
|
2320
|
+
#endif
|
|
2321
|
+
#include <packing>
|
|
2322
|
+
#include <uv_pars_fragment>
|
|
2323
|
+
#include <normal_pars_fragment>
|
|
2324
|
+
#include <bumpmap_pars_fragment>
|
|
2325
|
+
#include <normalmap_pars_fragment>
|
|
2326
|
+
#include <logdepthbuf_pars_fragment>
|
|
2327
|
+
#include <clipping_planes_pars_fragment>
|
|
2328
|
+
void main() {
|
|
2329
|
+
#include <clipping_planes_fragment>
|
|
2330
|
+
#include <logdepthbuf_fragment>
|
|
2331
|
+
#include <normal_fragment_begin>
|
|
2332
|
+
#include <normal_fragment_maps>
|
|
2333
|
+
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|
2334
|
+
}`,meshphong_vert:`#define PHONG
|
|
2335
|
+
varying vec3 vViewPosition;
|
|
2336
|
+
#include <common>
|
|
2337
|
+
#include <uv_pars_vertex>
|
|
2338
|
+
#include <uv2_pars_vertex>
|
|
2339
|
+
#include <displacementmap_pars_vertex>
|
|
2340
|
+
#include <envmap_pars_vertex>
|
|
2341
|
+
#include <color_pars_vertex>
|
|
2342
|
+
#include <fog_pars_vertex>
|
|
2343
|
+
#include <normal_pars_vertex>
|
|
2344
|
+
#include <morphtarget_pars_vertex>
|
|
2345
|
+
#include <skinning_pars_vertex>
|
|
2346
|
+
#include <shadowmap_pars_vertex>
|
|
2347
|
+
#include <logdepthbuf_pars_vertex>
|
|
2348
|
+
#include <clipping_planes_pars_vertex>
|
|
2349
|
+
void main() {
|
|
2350
|
+
#include <uv_vertex>
|
|
2351
|
+
#include <uv2_vertex>
|
|
2352
|
+
#include <color_vertex>
|
|
2353
|
+
#include <beginnormal_vertex>
|
|
2354
|
+
#include <morphnormal_vertex>
|
|
2355
|
+
#include <skinbase_vertex>
|
|
2356
|
+
#include <skinnormal_vertex>
|
|
2357
|
+
#include <defaultnormal_vertex>
|
|
2358
|
+
#include <normal_vertex>
|
|
2359
|
+
#include <begin_vertex>
|
|
2360
|
+
#include <morphtarget_vertex>
|
|
2361
|
+
#include <skinning_vertex>
|
|
2362
|
+
#include <displacementmap_vertex>
|
|
2363
|
+
#include <project_vertex>
|
|
2364
|
+
#include <logdepthbuf_vertex>
|
|
2365
|
+
#include <clipping_planes_vertex>
|
|
2366
|
+
vViewPosition = - mvPosition.xyz;
|
|
2367
|
+
#include <worldpos_vertex>
|
|
2368
|
+
#include <envmap_vertex>
|
|
2369
|
+
#include <shadowmap_vertex>
|
|
2370
|
+
#include <fog_vertex>
|
|
2371
|
+
}`,meshphong_frag:`#define PHONG
|
|
2372
|
+
uniform vec3 diffuse;
|
|
2373
|
+
uniform vec3 emissive;
|
|
2374
|
+
uniform vec3 specular;
|
|
2375
|
+
uniform float shininess;
|
|
2376
|
+
uniform float opacity;
|
|
2377
|
+
#include <common>
|
|
2378
|
+
#include <packing>
|
|
2379
|
+
#include <dithering_pars_fragment>
|
|
2380
|
+
#include <color_pars_fragment>
|
|
2381
|
+
#include <uv_pars_fragment>
|
|
2382
|
+
#include <uv2_pars_fragment>
|
|
2383
|
+
#include <map_pars_fragment>
|
|
2384
|
+
#include <alphamap_pars_fragment>
|
|
2385
|
+
#include <alphatest_pars_fragment>
|
|
2386
|
+
#include <aomap_pars_fragment>
|
|
2387
|
+
#include <lightmap_pars_fragment>
|
|
2388
|
+
#include <emissivemap_pars_fragment>
|
|
2389
|
+
#include <envmap_common_pars_fragment>
|
|
2390
|
+
#include <envmap_pars_fragment>
|
|
2391
|
+
#include <cube_uv_reflection_fragment>
|
|
2392
|
+
#include <fog_pars_fragment>
|
|
2393
|
+
#include <bsdfs>
|
|
2394
|
+
#include <lights_pars_begin>
|
|
2395
|
+
#include <normal_pars_fragment>
|
|
2396
|
+
#include <lights_phong_pars_fragment>
|
|
2397
|
+
#include <shadowmap_pars_fragment>
|
|
2398
|
+
#include <bumpmap_pars_fragment>
|
|
2399
|
+
#include <normalmap_pars_fragment>
|
|
2400
|
+
#include <specularmap_pars_fragment>
|
|
2401
|
+
#include <logdepthbuf_pars_fragment>
|
|
2402
|
+
#include <clipping_planes_pars_fragment>
|
|
2403
|
+
void main() {
|
|
2404
|
+
#include <clipping_planes_fragment>
|
|
2405
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2406
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2407
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2408
|
+
#include <logdepthbuf_fragment>
|
|
2409
|
+
#include <map_fragment>
|
|
2410
|
+
#include <color_fragment>
|
|
2411
|
+
#include <alphamap_fragment>
|
|
2412
|
+
#include <alphatest_fragment>
|
|
2413
|
+
#include <specularmap_fragment>
|
|
2414
|
+
#include <normal_fragment_begin>
|
|
2415
|
+
#include <normal_fragment_maps>
|
|
2416
|
+
#include <emissivemap_fragment>
|
|
2417
|
+
#include <lights_phong_fragment>
|
|
2418
|
+
#include <lights_fragment_begin>
|
|
2419
|
+
#include <lights_fragment_maps>
|
|
2420
|
+
#include <lights_fragment_end>
|
|
2421
|
+
#include <aomap_fragment>
|
|
2422
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2423
|
+
#include <envmap_fragment>
|
|
2424
|
+
#include <output_fragment>
|
|
2425
|
+
#include <tonemapping_fragment>
|
|
2426
|
+
#include <encodings_fragment>
|
|
2427
|
+
#include <fog_fragment>
|
|
2428
|
+
#include <premultiplied_alpha_fragment>
|
|
2429
|
+
#include <dithering_fragment>
|
|
2430
|
+
}`,meshphysical_vert:`#define STANDARD
|
|
2431
|
+
varying vec3 vViewPosition;
|
|
2432
|
+
#ifdef USE_TRANSMISSION
|
|
2433
|
+
varying vec3 vWorldPosition;
|
|
2434
|
+
#endif
|
|
2435
|
+
#include <common>
|
|
2436
|
+
#include <uv_pars_vertex>
|
|
2437
|
+
#include <uv2_pars_vertex>
|
|
2438
|
+
#include <displacementmap_pars_vertex>
|
|
2439
|
+
#include <color_pars_vertex>
|
|
2440
|
+
#include <fog_pars_vertex>
|
|
2441
|
+
#include <normal_pars_vertex>
|
|
2442
|
+
#include <morphtarget_pars_vertex>
|
|
2443
|
+
#include <skinning_pars_vertex>
|
|
2444
|
+
#include <shadowmap_pars_vertex>
|
|
2445
|
+
#include <logdepthbuf_pars_vertex>
|
|
2446
|
+
#include <clipping_planes_pars_vertex>
|
|
2447
|
+
void main() {
|
|
2448
|
+
#include <uv_vertex>
|
|
2449
|
+
#include <uv2_vertex>
|
|
2450
|
+
#include <color_vertex>
|
|
2451
|
+
#include <beginnormal_vertex>
|
|
2452
|
+
#include <morphnormal_vertex>
|
|
2453
|
+
#include <skinbase_vertex>
|
|
2454
|
+
#include <skinnormal_vertex>
|
|
2455
|
+
#include <defaultnormal_vertex>
|
|
2456
|
+
#include <normal_vertex>
|
|
2457
|
+
#include <begin_vertex>
|
|
2458
|
+
#include <morphtarget_vertex>
|
|
2459
|
+
#include <skinning_vertex>
|
|
2460
|
+
#include <displacementmap_vertex>
|
|
2461
|
+
#include <project_vertex>
|
|
2462
|
+
#include <logdepthbuf_vertex>
|
|
2463
|
+
#include <clipping_planes_vertex>
|
|
2464
|
+
vViewPosition = - mvPosition.xyz;
|
|
2465
|
+
#include <worldpos_vertex>
|
|
2466
|
+
#include <shadowmap_vertex>
|
|
2467
|
+
#include <fog_vertex>
|
|
2468
|
+
#ifdef USE_TRANSMISSION
|
|
2469
|
+
vWorldPosition = worldPosition.xyz;
|
|
2470
|
+
#endif
|
|
2471
|
+
}`,meshphysical_frag:`#define STANDARD
|
|
2472
|
+
#ifdef PHYSICAL
|
|
2473
|
+
#define IOR
|
|
2474
|
+
#define SPECULAR
|
|
2475
|
+
#endif
|
|
2476
|
+
uniform vec3 diffuse;
|
|
2477
|
+
uniform vec3 emissive;
|
|
2478
|
+
uniform float roughness;
|
|
2479
|
+
uniform float metalness;
|
|
2480
|
+
uniform float opacity;
|
|
2481
|
+
#ifdef IOR
|
|
2482
|
+
uniform float ior;
|
|
2483
|
+
#endif
|
|
2484
|
+
#ifdef SPECULAR
|
|
2485
|
+
uniform float specularIntensity;
|
|
2486
|
+
uniform vec3 specularColor;
|
|
2487
|
+
#ifdef USE_SPECULARINTENSITYMAP
|
|
2488
|
+
uniform sampler2D specularIntensityMap;
|
|
2489
|
+
#endif
|
|
2490
|
+
#ifdef USE_SPECULARCOLORMAP
|
|
2491
|
+
uniform sampler2D specularColorMap;
|
|
2492
|
+
#endif
|
|
2493
|
+
#endif
|
|
2494
|
+
#ifdef USE_CLEARCOAT
|
|
2495
|
+
uniform float clearcoat;
|
|
2496
|
+
uniform float clearcoatRoughness;
|
|
2497
|
+
#endif
|
|
2498
|
+
#ifdef USE_SHEEN
|
|
2499
|
+
uniform vec3 sheenColor;
|
|
2500
|
+
uniform float sheenRoughness;
|
|
2501
|
+
#ifdef USE_SHEENCOLORMAP
|
|
2502
|
+
uniform sampler2D sheenColorMap;
|
|
2503
|
+
#endif
|
|
2504
|
+
#ifdef USE_SHEENROUGHNESSMAP
|
|
2505
|
+
uniform sampler2D sheenRoughnessMap;
|
|
2506
|
+
#endif
|
|
2507
|
+
#endif
|
|
2508
|
+
varying vec3 vViewPosition;
|
|
2509
|
+
#include <common>
|
|
2510
|
+
#include <packing>
|
|
2511
|
+
#include <dithering_pars_fragment>
|
|
2512
|
+
#include <color_pars_fragment>
|
|
2513
|
+
#include <uv_pars_fragment>
|
|
2514
|
+
#include <uv2_pars_fragment>
|
|
2515
|
+
#include <map_pars_fragment>
|
|
2516
|
+
#include <alphamap_pars_fragment>
|
|
2517
|
+
#include <alphatest_pars_fragment>
|
|
2518
|
+
#include <aomap_pars_fragment>
|
|
2519
|
+
#include <lightmap_pars_fragment>
|
|
2520
|
+
#include <emissivemap_pars_fragment>
|
|
2521
|
+
#include <bsdfs>
|
|
2522
|
+
#include <cube_uv_reflection_fragment>
|
|
2523
|
+
#include <envmap_common_pars_fragment>
|
|
2524
|
+
#include <envmap_physical_pars_fragment>
|
|
2525
|
+
#include <fog_pars_fragment>
|
|
2526
|
+
#include <lights_pars_begin>
|
|
2527
|
+
#include <normal_pars_fragment>
|
|
2528
|
+
#include <lights_physical_pars_fragment>
|
|
2529
|
+
#include <transmission_pars_fragment>
|
|
2530
|
+
#include <shadowmap_pars_fragment>
|
|
2531
|
+
#include <bumpmap_pars_fragment>
|
|
2532
|
+
#include <normalmap_pars_fragment>
|
|
2533
|
+
#include <clearcoat_pars_fragment>
|
|
2534
|
+
#include <roughnessmap_pars_fragment>
|
|
2535
|
+
#include <metalnessmap_pars_fragment>
|
|
2536
|
+
#include <logdepthbuf_pars_fragment>
|
|
2537
|
+
#include <clipping_planes_pars_fragment>
|
|
2538
|
+
void main() {
|
|
2539
|
+
#include <clipping_planes_fragment>
|
|
2540
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2541
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2542
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2543
|
+
#include <logdepthbuf_fragment>
|
|
2544
|
+
#include <map_fragment>
|
|
2545
|
+
#include <color_fragment>
|
|
2546
|
+
#include <alphamap_fragment>
|
|
2547
|
+
#include <alphatest_fragment>
|
|
2548
|
+
#include <roughnessmap_fragment>
|
|
2549
|
+
#include <metalnessmap_fragment>
|
|
2550
|
+
#include <normal_fragment_begin>
|
|
2551
|
+
#include <normal_fragment_maps>
|
|
2552
|
+
#include <clearcoat_normal_fragment_begin>
|
|
2553
|
+
#include <clearcoat_normal_fragment_maps>
|
|
2554
|
+
#include <emissivemap_fragment>
|
|
2555
|
+
#include <lights_physical_fragment>
|
|
2556
|
+
#include <lights_fragment_begin>
|
|
2557
|
+
#include <lights_fragment_maps>
|
|
2558
|
+
#include <lights_fragment_end>
|
|
2559
|
+
#include <aomap_fragment>
|
|
2560
|
+
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
2561
|
+
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
2562
|
+
#include <transmission_fragment>
|
|
2563
|
+
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
2564
|
+
#ifdef USE_SHEEN
|
|
2565
|
+
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|
2566
|
+
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
|
|
2567
|
+
#endif
|
|
2568
|
+
#ifdef USE_CLEARCOAT
|
|
2569
|
+
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
|
2570
|
+
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
2571
|
+
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
|
|
2572
|
+
#endif
|
|
2573
|
+
#include <output_fragment>
|
|
2574
|
+
#include <tonemapping_fragment>
|
|
2575
|
+
#include <encodings_fragment>
|
|
2576
|
+
#include <fog_fragment>
|
|
2577
|
+
#include <premultiplied_alpha_fragment>
|
|
2578
|
+
#include <dithering_fragment>
|
|
2579
|
+
}`,meshtoon_vert:`#define TOON
|
|
2580
|
+
varying vec3 vViewPosition;
|
|
2581
|
+
#include <common>
|
|
2582
|
+
#include <uv_pars_vertex>
|
|
2583
|
+
#include <uv2_pars_vertex>
|
|
2584
|
+
#include <displacementmap_pars_vertex>
|
|
2585
|
+
#include <color_pars_vertex>
|
|
2586
|
+
#include <fog_pars_vertex>
|
|
2587
|
+
#include <normal_pars_vertex>
|
|
2588
|
+
#include <morphtarget_pars_vertex>
|
|
2589
|
+
#include <skinning_pars_vertex>
|
|
2590
|
+
#include <shadowmap_pars_vertex>
|
|
2591
|
+
#include <logdepthbuf_pars_vertex>
|
|
2592
|
+
#include <clipping_planes_pars_vertex>
|
|
2593
|
+
void main() {
|
|
2594
|
+
#include <uv_vertex>
|
|
2595
|
+
#include <uv2_vertex>
|
|
2596
|
+
#include <color_vertex>
|
|
2597
|
+
#include <beginnormal_vertex>
|
|
2598
|
+
#include <morphnormal_vertex>
|
|
2599
|
+
#include <skinbase_vertex>
|
|
2600
|
+
#include <skinnormal_vertex>
|
|
2601
|
+
#include <defaultnormal_vertex>
|
|
2602
|
+
#include <normal_vertex>
|
|
2603
|
+
#include <begin_vertex>
|
|
2604
|
+
#include <morphtarget_vertex>
|
|
2605
|
+
#include <skinning_vertex>
|
|
2606
|
+
#include <displacementmap_vertex>
|
|
2607
|
+
#include <project_vertex>
|
|
2608
|
+
#include <logdepthbuf_vertex>
|
|
2609
|
+
#include <clipping_planes_vertex>
|
|
2610
|
+
vViewPosition = - mvPosition.xyz;
|
|
2611
|
+
#include <worldpos_vertex>
|
|
2612
|
+
#include <shadowmap_vertex>
|
|
2613
|
+
#include <fog_vertex>
|
|
2614
|
+
}`,meshtoon_frag:`#define TOON
|
|
2615
|
+
uniform vec3 diffuse;
|
|
2616
|
+
uniform vec3 emissive;
|
|
2617
|
+
uniform float opacity;
|
|
2618
|
+
#include <common>
|
|
2619
|
+
#include <packing>
|
|
2620
|
+
#include <dithering_pars_fragment>
|
|
2621
|
+
#include <color_pars_fragment>
|
|
2622
|
+
#include <uv_pars_fragment>
|
|
2623
|
+
#include <uv2_pars_fragment>
|
|
2624
|
+
#include <map_pars_fragment>
|
|
2625
|
+
#include <alphamap_pars_fragment>
|
|
2626
|
+
#include <alphatest_pars_fragment>
|
|
2627
|
+
#include <aomap_pars_fragment>
|
|
2628
|
+
#include <lightmap_pars_fragment>
|
|
2629
|
+
#include <emissivemap_pars_fragment>
|
|
2630
|
+
#include <gradientmap_pars_fragment>
|
|
2631
|
+
#include <fog_pars_fragment>
|
|
2632
|
+
#include <bsdfs>
|
|
2633
|
+
#include <lights_pars_begin>
|
|
2634
|
+
#include <normal_pars_fragment>
|
|
2635
|
+
#include <lights_toon_pars_fragment>
|
|
2636
|
+
#include <shadowmap_pars_fragment>
|
|
2637
|
+
#include <bumpmap_pars_fragment>
|
|
2638
|
+
#include <normalmap_pars_fragment>
|
|
2639
|
+
#include <logdepthbuf_pars_fragment>
|
|
2640
|
+
#include <clipping_planes_pars_fragment>
|
|
2641
|
+
void main() {
|
|
2642
|
+
#include <clipping_planes_fragment>
|
|
2643
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2644
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2645
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
2646
|
+
#include <logdepthbuf_fragment>
|
|
2647
|
+
#include <map_fragment>
|
|
2648
|
+
#include <color_fragment>
|
|
2649
|
+
#include <alphamap_fragment>
|
|
2650
|
+
#include <alphatest_fragment>
|
|
2651
|
+
#include <normal_fragment_begin>
|
|
2652
|
+
#include <normal_fragment_maps>
|
|
2653
|
+
#include <emissivemap_fragment>
|
|
2654
|
+
#include <lights_toon_fragment>
|
|
2655
|
+
#include <lights_fragment_begin>
|
|
2656
|
+
#include <lights_fragment_maps>
|
|
2657
|
+
#include <lights_fragment_end>
|
|
2658
|
+
#include <aomap_fragment>
|
|
2659
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2660
|
+
#include <output_fragment>
|
|
2661
|
+
#include <tonemapping_fragment>
|
|
2662
|
+
#include <encodings_fragment>
|
|
2663
|
+
#include <fog_fragment>
|
|
2664
|
+
#include <premultiplied_alpha_fragment>
|
|
2665
|
+
#include <dithering_fragment>
|
|
2666
|
+
}`,points_vert:`uniform float size;
|
|
2667
|
+
uniform float scale;
|
|
2668
|
+
#include <common>
|
|
2669
|
+
#include <color_pars_vertex>
|
|
2670
|
+
#include <fog_pars_vertex>
|
|
2671
|
+
#include <morphtarget_pars_vertex>
|
|
2672
|
+
#include <logdepthbuf_pars_vertex>
|
|
2673
|
+
#include <clipping_planes_pars_vertex>
|
|
2674
|
+
void main() {
|
|
2675
|
+
#include <color_vertex>
|
|
2676
|
+
#include <begin_vertex>
|
|
2677
|
+
#include <morphtarget_vertex>
|
|
2678
|
+
#include <project_vertex>
|
|
2679
|
+
gl_PointSize = size;
|
|
2680
|
+
#ifdef USE_SIZEATTENUATION
|
|
2681
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2682
|
+
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
2683
|
+
#endif
|
|
2684
|
+
#include <logdepthbuf_vertex>
|
|
2685
|
+
#include <clipping_planes_vertex>
|
|
2686
|
+
#include <worldpos_vertex>
|
|
2687
|
+
#include <fog_vertex>
|
|
2688
|
+
}`,points_frag:`uniform vec3 diffuse;
|
|
2689
|
+
uniform float opacity;
|
|
2690
|
+
#include <common>
|
|
2691
|
+
#include <color_pars_fragment>
|
|
2692
|
+
#include <map_particle_pars_fragment>
|
|
2693
|
+
#include <alphatest_pars_fragment>
|
|
2694
|
+
#include <fog_pars_fragment>
|
|
2695
|
+
#include <logdepthbuf_pars_fragment>
|
|
2696
|
+
#include <clipping_planes_pars_fragment>
|
|
2697
|
+
void main() {
|
|
2698
|
+
#include <clipping_planes_fragment>
|
|
2699
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2700
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2701
|
+
#include <logdepthbuf_fragment>
|
|
2702
|
+
#include <map_particle_fragment>
|
|
2703
|
+
#include <color_fragment>
|
|
2704
|
+
#include <alphatest_fragment>
|
|
2705
|
+
outgoingLight = diffuseColor.rgb;
|
|
2706
|
+
#include <output_fragment>
|
|
2707
|
+
#include <tonemapping_fragment>
|
|
2708
|
+
#include <encodings_fragment>
|
|
2709
|
+
#include <fog_fragment>
|
|
2710
|
+
#include <premultiplied_alpha_fragment>
|
|
2711
|
+
}`,shadow_vert:`#include <common>
|
|
2712
|
+
#include <fog_pars_vertex>
|
|
2713
|
+
#include <morphtarget_pars_vertex>
|
|
2714
|
+
#include <skinning_pars_vertex>
|
|
2715
|
+
#include <shadowmap_pars_vertex>
|
|
2716
|
+
void main() {
|
|
2717
|
+
#include <beginnormal_vertex>
|
|
2718
|
+
#include <morphnormal_vertex>
|
|
2719
|
+
#include <skinbase_vertex>
|
|
2720
|
+
#include <skinnormal_vertex>
|
|
2721
|
+
#include <defaultnormal_vertex>
|
|
2722
|
+
#include <begin_vertex>
|
|
2723
|
+
#include <morphtarget_vertex>
|
|
2724
|
+
#include <skinning_vertex>
|
|
2725
|
+
#include <project_vertex>
|
|
2726
|
+
#include <worldpos_vertex>
|
|
2727
|
+
#include <shadowmap_vertex>
|
|
2728
|
+
#include <fog_vertex>
|
|
2729
|
+
}`,shadow_frag:`uniform vec3 color;
|
|
2730
|
+
uniform float opacity;
|
|
2731
|
+
#include <common>
|
|
2732
|
+
#include <packing>
|
|
2733
|
+
#include <fog_pars_fragment>
|
|
2734
|
+
#include <bsdfs>
|
|
2735
|
+
#include <lights_pars_begin>
|
|
2736
|
+
#include <shadowmap_pars_fragment>
|
|
2737
|
+
#include <shadowmask_pars_fragment>
|
|
2738
|
+
void main() {
|
|
2739
|
+
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
2740
|
+
#include <tonemapping_fragment>
|
|
2741
|
+
#include <encodings_fragment>
|
|
2742
|
+
#include <fog_fragment>
|
|
2743
|
+
}`,sprite_vert:`uniform float rotation;
|
|
2744
|
+
uniform vec2 center;
|
|
2745
|
+
#include <common>
|
|
2746
|
+
#include <uv_pars_vertex>
|
|
2747
|
+
#include <fog_pars_vertex>
|
|
2748
|
+
#include <logdepthbuf_pars_vertex>
|
|
2749
|
+
#include <clipping_planes_pars_vertex>
|
|
2750
|
+
void main() {
|
|
2751
|
+
#include <uv_vertex>
|
|
2752
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2753
|
+
vec2 scale;
|
|
2754
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
2755
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
2756
|
+
#ifndef USE_SIZEATTENUATION
|
|
2757
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2758
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
2759
|
+
#endif
|
|
2760
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
2761
|
+
vec2 rotatedPosition;
|
|
2762
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
2763
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
2764
|
+
mvPosition.xy += rotatedPosition;
|
|
2765
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
2766
|
+
#include <logdepthbuf_vertex>
|
|
2767
|
+
#include <clipping_planes_vertex>
|
|
2768
|
+
#include <fog_vertex>
|
|
2769
|
+
}`,sprite_frag:`uniform vec3 diffuse;
|
|
2770
|
+
uniform float opacity;
|
|
2771
|
+
#include <common>
|
|
2772
|
+
#include <uv_pars_fragment>
|
|
2773
|
+
#include <map_pars_fragment>
|
|
2774
|
+
#include <alphamap_pars_fragment>
|
|
2775
|
+
#include <alphatest_pars_fragment>
|
|
2776
|
+
#include <fog_pars_fragment>
|
|
2777
|
+
#include <logdepthbuf_pars_fragment>
|
|
2778
|
+
#include <clipping_planes_pars_fragment>
|
|
2779
|
+
void main() {
|
|
2780
|
+
#include <clipping_planes_fragment>
|
|
2781
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
2782
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2783
|
+
#include <logdepthbuf_fragment>
|
|
2784
|
+
#include <map_fragment>
|
|
2785
|
+
#include <alphamap_fragment>
|
|
2786
|
+
#include <alphatest_fragment>
|
|
2787
|
+
outgoingLight = diffuseColor.rgb;
|
|
2788
|
+
#include <output_fragment>
|
|
2789
|
+
#include <tonemapping_fragment>
|
|
2790
|
+
#include <encodings_fragment>
|
|
2791
|
+
#include <fog_fragment>
|
|
2792
|
+
}`},xe={common:{diffuse:{value:new Me(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new gn},uv2Transform:{value:new gn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ee(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Me(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 Me(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new gn}},sprite:{diffuse:{value:new Me(16777215)},opacity:{value:1},center:{value:new ee(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new gn}}},fi={basic:{uniforms:Dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:Dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.fog,xe.lights,{emissive:{value:new Me(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:Dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new Me(0)},specular:{value:new Me(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:Dn([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new Me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:Dn([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new Me(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:Dn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:Dn([xe.points,xe.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:Dn([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:Dn([xe.common,xe.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:Dn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:Dn([xe.sprite,xe.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new gn},t2D:{value:null}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},cube:{uniforms:Dn([xe.envmap,{opacity:{value:1}}]),vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:Dn([xe.common,xe.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:Dn([xe.lights,xe.fog,{color:{value:new Me(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};fi.physical={uniforms:Dn([fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ee(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Me(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ee},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Me(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new Me(1,1,1)},specularColorMap:{value:null}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};function Qm(s,e,t,n,i){const r=new Me(0);let o=0,a,l,c=null,u=0,h=null;function f(m,v){let x=!1,g=v.isScene===!0?v.background:null;g&&g.isTexture&&(g=e.get(g));const p=s.xr,_=p.getSession&&p.getSession();_&&_.environmentBlendMode==="additive"&&(g=null),g===null?d(r,o):g&&g.isColor&&(d(g,1),x=!0),(s.autoClear||x)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),g&&(g.isCubeTexture||g.mapping===wr)?(l===void 0&&(l=new pn(new Wi(1,1,1),new qi({name:"BackgroundCubeMaterial",uniforms:Ls(fi.cube.uniforms),vertexShader:fi.cube.vertexShader,fragmentShader:fi.cube.fragmentShader,side:pt,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(y,w,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,(c!==g||u!==g.version||h!==s.toneMapping)&&(l.material.needsUpdate=!0,c=g,u=g.version,h=s.toneMapping),m.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(a===void 0&&(a=new pn(new Fr(2,2),new qi({name:"BackgroundMaterial",uniforms:Ls(fi.background.uniforms),vertexShader:fi.background.vertexShader,fragmentShader:fi.background.fragmentShader,side:Q,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=g,g.matrixAutoUpdate===!0&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),(c!==g||u!==g.version||h!==s.toneMapping)&&(a.material.needsUpdate=!0,c=g,u=g.version,h=s.toneMapping),m.unshift(a,a.geometry,a.material,0,0,null))}function d(m,v){t.buffers.color.setClear(m.r,m.g,m.b,v,i)}return{getClearColor:function(){return r},setClearColor:function(m,v=1){r.set(m),o=v,d(r,o)},getClearAlpha:function(){return o},setClearAlpha:function(m){o=m,d(r,o)},render:f}}function eg(s,e,t,n){const i=s.getParameter(34921),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||r!==null,a={},l=v(null);let c=l;function u(C,U,q,G,X){let _e=!1;if(o){const Le=m(G,q,U);c!==Le&&(c=Le,f(c.object)),_e=x(G,X),_e&&g(G,X)}else{const Le=U.wireframe===!0;(c.geometry!==G.id||c.program!==q.id||c.wireframe!==Le)&&(c.geometry=G.id,c.program=q.id,c.wireframe=Le,_e=!0)}C.isInstancedMesh===!0&&(_e=!0),X!==null&&t.update(X,34963),_e&&(I(C,U,q,G),X!==null&&s.bindBuffer(34963,t.get(X).buffer))}function h(){return n.isWebGL2?s.createVertexArray():r.createVertexArrayOES()}function f(C){return n.isWebGL2?s.bindVertexArray(C):r.bindVertexArrayOES(C)}function d(C){return n.isWebGL2?s.deleteVertexArray(C):r.deleteVertexArrayOES(C)}function m(C,U,q){const G=q.wireframe===!0;let X=a[C.id];X===void 0&&(X={},a[C.id]=X);let _e=X[U.id];_e===void 0&&(_e={},X[U.id]=_e);let Le=_e[G];return Le===void 0&&(Le=v(h()),_e[G]=Le),Le}function v(C){const U=[],q=[],G=[];for(let X=0;X<i;X++)U[X]=0,q[X]=0,G[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:q,attributeDivisors:G,object:C,attributes:{},index:null}}function x(C,U){const q=c.attributes,G=C.attributes;let X=0;for(const _e in G){const Le=q[_e],K=G[_e];if(Le===void 0||Le.attribute!==K||Le.data!==K.data)return!0;X++}return c.attributesNum!==X||c.index!==U}function g(C,U){const q={},G=C.attributes;let X=0;for(const _e in G){const Le=G[_e],K={};K.attribute=Le,Le.data&&(K.data=Le.data),q[_e]=K,X++}c.attributes=q,c.attributesNum=X,c.index=U}function p(){const C=c.newAttributes;for(let U=0,q=C.length;U<q;U++)C[U]=0}function _(C){y(C,0)}function y(C,U){const q=c.newAttributes,G=c.enabledAttributes,X=c.attributeDivisors;q[C]=1,G[C]===0&&(s.enableVertexAttribArray(C),G[C]=1),X[C]!==U&&((n.isWebGL2?s:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](C,U),X[C]=U)}function w(){const C=c.newAttributes,U=c.enabledAttributes;for(let q=0,G=U.length;q<G;q++)U[q]!==C[q]&&(s.disableVertexAttribArray(q),U[q]=0)}function L(C,U,q,G,X,_e){n.isWebGL2===!0&&(q===5124||q===5125)?s.vertexAttribIPointer(C,U,q,X,_e):s.vertexAttribPointer(C,U,q,G,X,_e)}function I(C,U,q,G){if(n.isWebGL2===!1&&(C.isInstancedMesh||G.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;p();const X=G.attributes,_e=q.getAttributes(),Le=U.defaultAttributeValues;for(const K in _e){const te=_e[K];if(te.location>=0){let Re=X[K];if(Re===void 0&&(K==="instanceMatrix"&&C.instanceMatrix&&(Re=C.instanceMatrix),K==="instanceColor"&&C.instanceColor&&(Re=C.instanceColor)),Re!==void 0){const Te=Re.normalized,Ne=Re.itemSize,wt=t.get(Re);if(wt===void 0)continue;const se=wt.buffer,ct=wt.type,Xe=wt.bytesPerElement;if(Re.isInterleavedBufferAttribute){const Ge=Re.data,We=Ge.stride,Ct=Re.offset;if(Ge&&Ge.isInstancedInterleavedBuffer){for(let $=0;$<te.locationSize;$++)y(te.location+$,Ge.meshPerAttribute);C.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Ge.meshPerAttribute*Ge.count)}else for(let $=0;$<te.locationSize;$++)_(te.location+$);s.bindBuffer(34962,se);for(let $=0;$<te.locationSize;$++)L(te.location+$,Ne/te.locationSize,ct,Te,We*Xe,(Ct+Ne/te.locationSize*$)*Xe)}else{if(Re.isInstancedBufferAttribute){for(let Ge=0;Ge<te.locationSize;Ge++)y(te.location+Ge,Re.meshPerAttribute);C.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Re.meshPerAttribute*Re.count)}else for(let Ge=0;Ge<te.locationSize;Ge++)_(te.location+Ge);s.bindBuffer(34962,se);for(let Ge=0;Ge<te.locationSize;Ge++)L(te.location+Ge,Ne/te.locationSize,ct,Te,Ne*Xe,Ne/te.locationSize*Ge*Xe)}}else if(Le!==void 0){const Te=Le[K];if(Te!==void 0)switch(Te.length){case 2:s.vertexAttrib2fv(te.location,Te);break;case 3:s.vertexAttrib3fv(te.location,Te);break;case 4:s.vertexAttrib4fv(te.location,Te);break;default:s.vertexAttrib1fv(te.location,Te)}}}}w()}function O(){N();for(const C in a){const U=a[C];for(const q in U){const G=U[q];for(const X in G)d(G[X].object),delete G[X];delete U[q]}delete a[C]}}function j(C){if(a[C.id]===void 0)return;const U=a[C.id];for(const q in U){const G=U[q];for(const X in G)d(G[X].object),delete G[X];delete U[q]}delete a[C.id]}function V(C){for(const U in a){const q=a[U];if(q[C.id]===void 0)continue;const G=q[C.id];for(const X in G)d(G[X].object),delete G[X];delete q[C.id]}}function N(){T(),c!==l&&(c=l,f(c.object))}function T(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:N,resetDefaultState:T,dispose:O,releaseStatesOfGeometry:j,releaseStatesOfProgram:V,initAttributes:p,enableAttribute:_,disableUnusedAttributes:w}}function tg(s,e,t,n){const i=n.isWebGL2;let r;function o(c){r=c}function a(c,u){s.drawArrays(r,c,u),t.update(u,r,1)}function l(c,u,h){if(h===0)return;let f,d;if(i)f=s,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](r,c,u,h),t.update(u,r,h)}this.setMode=o,this.render=a,this.renderInstances=l}function ng(s,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");n=s.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function r(I){if(I==="highp"){if(s.getShaderPrecisionFormat(35633,36338).precision>0&&s.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";I="mediump"}return I==="mediump"&&s.getShaderPrecisionFormat(35633,36337).precision>0&&s.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&s instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&s instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=s.getParameter(34930),f=s.getParameter(35660),d=s.getParameter(3379),m=s.getParameter(34076),v=s.getParameter(34921),x=s.getParameter(36347),g=s.getParameter(36348),p=s.getParameter(36349),_=f>0,y=o||e.has("OES_texture_float"),w=_&&y,L=o?s.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:v,maxVertexUniforms:x,maxVaryings:g,maxFragmentUniforms:p,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:w,maxSamples:L}}function ig(s){const e=this;let t=null,n=0,i=!1,r=!1;const o=new wi,a=new gn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,d){const m=h.length!==0||f||n!==0||i;return i=f,t=u(h,d,0),n=h.length,m},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1,c()},this.setState=function(h,f,d){const m=h.clippingPlanes,v=h.clipIntersection,x=h.clipShadows,g=s.get(h);if(!i||m===null||m.length===0||r&&!x)r?u(null):c();else{const p=r?0:n,_=p*4;let y=g.clippingState||null;l.value=y,y=u(m,f,_,d);for(let w=0;w!==_;++w)y[w]=t[w];g.clippingState=y,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=p}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,m){const v=h!==null?h.length:0;let x=null;if(v!==0){if(x=l.value,m!==!0||x===null){const g=d+v*4,p=f.matrixWorldInverse;a.getNormalMatrix(p),(x===null||x.length<g)&&(x=new Float32Array(g));for(let _=0,y=d;_!==v;++_,y+=4)o.copy(h[_]).applyMatrix4(p,a),o.normal.toArray(x,y),x[y+3]=o.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,x}}function rg(s){let e=new WeakMap;function t(o,a){return a===yn?o.mapping=Bi:a===Mr&&(o.mapping=Ni),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===yn||a===Mr)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=s.getRenderTarget(),u=new Da(l.height/2);return u.fromEquirectangularTexture(s,o),e.set(o,u),s.setRenderTarget(c),o.addEventListener("dispose",i),t(u.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}class _o extends yo{constructor(e=-1,t=1,n=1,i=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,o){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=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}_o.prototype.isOrthographicCamera=!0;class Fs extends qi{constructor(e){super(e),this.type="RawShaderMaterial"}}Fs.prototype.isRawShaderMaterial=!0;const Bs=4,pr=8,Si=Math.pow(2,pr),Nu=[.125,.215,.35,.446,.526,.582],Ou=pr-Bs+1+Nu.length,Ns=20,Fa={[oi]:0,[Ar]:1},nc=new _o,{_lodPlanes:bo,_sizeLods:zu,_sigmas:Ba}=sg(),Uu=new Me;let ic=null;const Br=(1+Math.sqrt(5))/2,Os=1/Br,Gu=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,Br,Os),new M(0,Br,-Os),new M(Os,0,Br),new M(-Os,0,Br),new M(Br,Os,0),new M(-Br,Os,0)];class Hu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=og(Ns),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){ic=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=Wu(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=Vu(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<bo.length;e++)bo[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(ic),e.scissorTest=!1,Na(e,0,0,e.width,e.height)}_fromTexture(e){ic=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:en,minFilter:en,generateMipmaps:!1,type:_i,format:on,encoding:oi,depthBuffer:!1},n=ku(t);return n.depthBuffer=!e,this._pingPongRenderTarget=ku(t),n}_compileMaterial(e){const t=new pn(bo[0],e);this._renderer.compile(t,nc)}_sceneToCubeUV(e,t,n,i){const a=new wn(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(Uu),u.toneMapping=li,u.autoClear=!1;const d=new Vi({name:"PMREM.Background",side:pt,depthWrite:!1,depthTest:!1}),m=new pn(new Wi,d);let v=!1;const x=e.background;x?x.isColor&&(d.color.copy(x),e.background=null,v=!0):(d.color.copy(Uu),v=!0);for(let g=0;g<6;g++){const p=g%3;p==0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):p==1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g])),Na(i,p*Si,g>2?Si:0,Si,Si),u.setRenderTarget(i),v&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=x}_setEncoding(e,t){this._renderer.capabilities.isWebGL2===!0&&t.format===on&&t.type===ii&&t.encoding===Ar?e.value=Fa[oi]:e.value=Fa[t.encoding]}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Bi||e.mapping===Ni;i?this._cubemapShader==null&&(this._cubemapShader=Wu()):this._equirectShader==null&&(this._equirectShader=Vu());const r=i?this._cubemapShader:this._equirectShader,o=new pn(bo[0],r),a=r.uniforms;a.envMap.value=e,i||a.texelSize.value.set(1/e.image.width,1/e.image.height),this._setEncoding(a.inputEncoding,e),Na(t,0,0,3*Si,2*Si),n.setRenderTarget(t),n.render(o,nc)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<Ou;i++){const r=Math.sqrt(Ba[i]*Ba[i]-Ba[i-1]*Ba[i-1]),o=Gu[(i-1)%Gu.length];this._blur(e,i-1,i,r,o)}t.autoClear=n}_blur(e,t,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",r),this._halfBlur(o,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new pn(bo[i],c),f=c.uniforms,d=zu[n]-1,m=isFinite(r)?Math.PI/(2*d):2*Math.PI/(2*Ns-1),v=r/m,x=isFinite(r)?1+Math.floor(u*v):Ns;x>Ns&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Ns}`);const g=[];let p=0;for(let L=0;L<Ns;++L){const I=L/v,O=Math.exp(-I*I/2);g.push(O),L==0?p+=O:L<x&&(p+=2*O)}for(let L=0;L<g.length;L++)g[L]=g[L]/p;f.envMap.value=e.texture,f.samples.value=x,f.weights.value=g,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a),f.dTheta.value=m,f.mipInt.value=pr-n;const _=zu[i],y=3*Math.max(0,Si-2*_),w=(i===0?0:2*Si)+2*_*(i>pr-Bs?i-pr+Bs:0);Na(t,y,w,3*_,2*_),l.setRenderTarget(t),l.render(h,nc)}}function sg(){const s=[],e=[],t=[];let n=pr;for(let i=0;i<Ou;i++){const r=Math.pow(2,n);e.push(r);let o=1/r;i>pr-Bs?o=Nu[i-pr+Bs-1]:i==0&&(o=0),t.push(o);const a=1/(r-1),l=-a/2,c=1+a/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,f=6,d=3,m=2,v=1,x=new Float32Array(d*f*h),g=new Float32Array(m*f*h),p=new Float32Array(v*f*h);for(let y=0;y<h;y++){const w=y%3*2/3-1,L=y>2?0:-1,I=[w,L,0,w+2/3,L,0,w+2/3,L+1,0,w,L,0,w+2/3,L+1,0,w,L+1,0];x.set(I,d*f*y),g.set(u,m*f*y);const O=[y,y,y,y,y,y];p.set(O,v*f*y)}const _=new $e;_.setAttribute("position",new Tt(x,d)),_.setAttribute("uv",new Tt(g,m)),_.setAttribute("faceIndex",new Tt(p,v)),s.push(_),n>Bs&&n--}return{_lodPlanes:s,_sizeLods:e,_sigmas:t}}function ku(s){const e=new Jn(3*Si,3*Si,s);return e.texture.mapping=wr,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Na(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function og(s){const e=new Float32Array(s),t=new M(0,1,0);return new Fs({name:"SphericalGaussianBlur",defines:{n:s},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}},vertexShader:rc(),fragmentShader:`
|
|
2793
|
+
|
|
2794
|
+
precision mediump float;
|
|
2795
|
+
precision mediump int;
|
|
2796
|
+
|
|
2797
|
+
varying vec3 vOutputDirection;
|
|
2798
|
+
|
|
2799
|
+
uniform sampler2D envMap;
|
|
2800
|
+
uniform int samples;
|
|
2801
|
+
uniform float weights[ n ];
|
|
2802
|
+
uniform bool latitudinal;
|
|
2803
|
+
uniform float dTheta;
|
|
2804
|
+
uniform float mipInt;
|
|
2805
|
+
uniform vec3 poleAxis;
|
|
2806
|
+
|
|
2807
|
+
${sc()}
|
|
2808
|
+
|
|
2809
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
2810
|
+
#include <cube_uv_reflection_fragment>
|
|
2811
|
+
|
|
2812
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
2813
|
+
|
|
2814
|
+
float cosTheta = cos( theta );
|
|
2815
|
+
// Rodrigues' axis-angle rotation
|
|
2816
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
2817
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
2818
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
2819
|
+
|
|
2820
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
2821
|
+
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
void main() {
|
|
2825
|
+
|
|
2826
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
2827
|
+
|
|
2828
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
2829
|
+
|
|
2830
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
2831
|
+
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
axis = normalize( axis );
|
|
2835
|
+
|
|
2836
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2837
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
2838
|
+
|
|
2839
|
+
for ( int i = 1; i < n; i++ ) {
|
|
2840
|
+
|
|
2841
|
+
if ( i >= samples ) {
|
|
2842
|
+
|
|
2843
|
+
break;
|
|
2844
|
+
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
float theta = dTheta * float( i );
|
|
2848
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
2849
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
2850
|
+
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
}
|
|
2854
|
+
`,blending:mt,depthTest:!1,depthWrite:!1})}function Vu(){const s=new ee(1,1);return new Fs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:s},inputEncoding:{value:Fa[oi]}},vertexShader:rc(),fragmentShader:`
|
|
2855
|
+
|
|
2856
|
+
precision mediump float;
|
|
2857
|
+
precision mediump int;
|
|
2858
|
+
|
|
2859
|
+
varying vec3 vOutputDirection;
|
|
2860
|
+
|
|
2861
|
+
uniform sampler2D envMap;
|
|
2862
|
+
uniform vec2 texelSize;
|
|
2863
|
+
|
|
2864
|
+
${sc()}
|
|
2865
|
+
|
|
2866
|
+
#include <common>
|
|
2867
|
+
|
|
2868
|
+
void main() {
|
|
2869
|
+
|
|
2870
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2871
|
+
|
|
2872
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
2873
|
+
vec2 uv = equirectUv( outputDirection );
|
|
2874
|
+
|
|
2875
|
+
vec2 f = fract( uv / texelSize - 0.5 );
|
|
2876
|
+
uv -= f * texelSize;
|
|
2877
|
+
vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
|
|
2878
|
+
uv.x += texelSize.x;
|
|
2879
|
+
vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
|
|
2880
|
+
uv.y += texelSize.y;
|
|
2881
|
+
vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
|
|
2882
|
+
uv.x -= texelSize.x;
|
|
2883
|
+
vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
|
|
2884
|
+
|
|
2885
|
+
vec3 tm = mix( tl, tr, f.x );
|
|
2886
|
+
vec3 bm = mix( bl, br, f.x );
|
|
2887
|
+
gl_FragColor.rgb = mix( tm, bm, f.y );
|
|
2888
|
+
|
|
2889
|
+
}
|
|
2890
|
+
`,blending:mt,depthTest:!1,depthWrite:!1})}function Wu(){return new Fs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Fa[oi]}},vertexShader:rc(),fragmentShader:`
|
|
2891
|
+
|
|
2892
|
+
precision mediump float;
|
|
2893
|
+
precision mediump int;
|
|
2894
|
+
|
|
2895
|
+
varying vec3 vOutputDirection;
|
|
2896
|
+
|
|
2897
|
+
uniform samplerCube envMap;
|
|
2898
|
+
|
|
2899
|
+
${sc()}
|
|
2900
|
+
|
|
2901
|
+
void main() {
|
|
2902
|
+
|
|
2903
|
+
gl_FragColor = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) );
|
|
2904
|
+
|
|
2905
|
+
}
|
|
2906
|
+
`,blending:mt,depthTest:!1,depthWrite:!1})}function rc(){return`
|
|
2907
|
+
|
|
2908
|
+
precision mediump float;
|
|
2909
|
+
precision mediump int;
|
|
2910
|
+
|
|
2911
|
+
attribute vec3 position;
|
|
2912
|
+
attribute vec2 uv;
|
|
2913
|
+
attribute float faceIndex;
|
|
2914
|
+
|
|
2915
|
+
varying vec3 vOutputDirection;
|
|
2916
|
+
|
|
2917
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
2918
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
2919
|
+
|
|
2920
|
+
uv = 2.0 * uv - 1.0;
|
|
2921
|
+
|
|
2922
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
2923
|
+
|
|
2924
|
+
if ( face == 0.0 ) {
|
|
2925
|
+
|
|
2926
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
2927
|
+
|
|
2928
|
+
} else if ( face == 1.0 ) {
|
|
2929
|
+
|
|
2930
|
+
direction = direction.xzy;
|
|
2931
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
2932
|
+
|
|
2933
|
+
} else if ( face == 2.0 ) {
|
|
2934
|
+
|
|
2935
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
2936
|
+
|
|
2937
|
+
} else if ( face == 3.0 ) {
|
|
2938
|
+
|
|
2939
|
+
direction = direction.zyx;
|
|
2940
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
2941
|
+
|
|
2942
|
+
} else if ( face == 4.0 ) {
|
|
2943
|
+
|
|
2944
|
+
direction = direction.xzy;
|
|
2945
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
2946
|
+
|
|
2947
|
+
} else if ( face == 5.0 ) {
|
|
2948
|
+
|
|
2949
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
2950
|
+
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
return direction;
|
|
2954
|
+
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
void main() {
|
|
2958
|
+
|
|
2959
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
2960
|
+
gl_Position = vec4( position, 1.0 );
|
|
2961
|
+
|
|
2962
|
+
}
|
|
2963
|
+
`}function sc(){return`
|
|
2964
|
+
|
|
2965
|
+
uniform int inputEncoding;
|
|
2966
|
+
|
|
2967
|
+
#include <encodings_pars_fragment>
|
|
2968
|
+
|
|
2969
|
+
vec4 inputTexelToLinear( vec4 value ) {
|
|
2970
|
+
|
|
2971
|
+
if ( inputEncoding == 0 ) {
|
|
2972
|
+
|
|
2973
|
+
return value;
|
|
2974
|
+
|
|
2975
|
+
} else {
|
|
2976
|
+
|
|
2977
|
+
return sRGBToLinear( value );
|
|
2978
|
+
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
vec4 envMapTexelToLinear( vec4 color ) {
|
|
2984
|
+
|
|
2985
|
+
return inputTexelToLinear( color );
|
|
2986
|
+
|
|
2987
|
+
}
|
|
2988
|
+
`}function ag(s){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const l=a.mapping,c=l===yn||l===Mr,u=l===Bi||l===Ni;if(c||u){if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){const f=s.getRenderTarget();t===null&&(t=new Hu(s));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),s.setRenderTarget(f),a.addEventListener("dispose",r),d.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function r(a){const l=a.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function lg(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function cg(s,e,t,n){const i={},r=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const m in f.attributes)e.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete i[f.id];const d=r.get(f);d&&(e.remove(d),r.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return i[f.id]===!0||(f.addEventListener("dispose",o),i[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const m in f)e.update(f[m],34962);const d=h.morphAttributes;for(const m in d){const v=d[m];for(let x=0,g=v.length;x<g;x++)e.update(v[x],34962)}}function c(h){const f=[],d=h.index,m=h.attributes.position;let v=0;if(d!==null){const p=d.array;v=d.version;for(let _=0,y=p.length;_<y;_+=3){const w=p[_+0],L=p[_+1],I=p[_+2];f.push(w,L,L,I,I,w)}}else{const p=m.array;v=m.version;for(let _=0,y=p.length/3-1;_<y;_+=3){const w=_+0,L=_+1,I=_+2;f.push(w,L,L,I,I,w)}}const x=new(du(f)>65535?Ma:ba)(f,1);x.version=v;const g=r.get(h);g&&e.remove(g),r.set(h,x)}function u(h){const f=r.get(h);if(f){const d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return r.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function ug(s,e,t,n){const i=n.isWebGL2;let r;function o(f){r=f}let a,l;function c(f){a=f.type,l=f.bytesPerElement}function u(f,d){s.drawElements(r,d,a,f*l),t.update(d,r,1)}function h(f,d,m){if(m===0)return;let v,x;if(i)v=s,x="drawElementsInstanced";else if(v=e.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",v===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[x](r,d,a,f*l,m),t.update(d,r,m)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function hg(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(r/3);break;case 1:t.lines+=a*(r/2);break;case 3:t.lines+=a*(r-1);break;case 2:t.lines+=a*r;break;case 0:t.points+=a*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}class Oa extends dn{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Kt,this.minFilter=Kt,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Oa.prototype.isDataTexture2DArray=!0;function fg(s,e){return s[0]-e[0]}function dg(s,e){return Math.abs(e[1])-Math.abs(s[1])}function qu(s,e){let t=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),s.divideScalar(t)}function pg(s,e,t){const n={},i=new Float32Array(8),r=new WeakMap,o=new M,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h,f){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const m=u.morphAttributes.position.length;let v=r.get(u);if(v===void 0||v.count!==m){v!==void 0&&v.texture.dispose();const p=u.morphAttributes.normal!==void 0,_=u.morphAttributes.position,y=u.morphAttributes.normal||[],w=u.attributes.position.count,L=p===!0?2:1;let I=w*L,O=1;I>e.maxTextureSize&&(O=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const j=new Float32Array(I*O*4*m),V=new Oa(j,I,O,m);V.format=on,V.type=ri,V.needsUpdate=!0;const N=L*4;for(let T=0;T<m;T++){const C=_[T],U=y[T],q=I*O*4*T;for(let G=0;G<C.count;G++){o.fromBufferAttribute(C,G),C.normalized===!0&&qu(o,C);const X=G*N;j[q+X+0]=o.x,j[q+X+1]=o.y,j[q+X+2]=o.z,j[q+X+3]=0,p===!0&&(o.fromBufferAttribute(U,G),U.normalized===!0&&qu(o,U),j[q+X+4]=o.x,j[q+X+5]=o.y,j[q+X+6]=o.z,j[q+X+7]=0)}}v={count:m,texture:V,size:new ee(I,O)},r.set(u,v)}let x=0;for(let p=0;p<d.length;p++)x+=d[p];const g=u.morphTargetsRelative?1:1-x;f.getUniforms().setValue(s,"morphTargetBaseInfluence",g),f.getUniforms().setValue(s,"morphTargetInfluences",d),f.getUniforms().setValue(s,"morphTargetsTexture",v.texture,t),f.getUniforms().setValue(s,"morphTargetsTextureSize",v.size)}else{const m=d===void 0?0:d.length;let v=n[u.id];if(v===void 0||v.length!==m){v=[];for(let y=0;y<m;y++)v[y]=[y,0];n[u.id]=v}for(let y=0;y<m;y++){const w=v[y];w[0]=y,w[1]=d[y]}v.sort(dg);for(let y=0;y<8;y++)y<m&&v[y][1]?(a[y][0]=v[y][0],a[y][1]=v[y][1]):(a[y][0]=Number.MAX_SAFE_INTEGER,a[y][1]=0);a.sort(fg);const x=u.morphAttributes.position,g=u.morphAttributes.normal;let p=0;for(let y=0;y<8;y++){const w=a[y],L=w[0],I=w[1];L!==Number.MAX_SAFE_INTEGER&&I?(x&&u.getAttribute("morphTarget"+y)!==x[L]&&u.setAttribute("morphTarget"+y,x[L]),g&&u.getAttribute("morphNormal"+y)!==g[L]&&u.setAttribute("morphNormal"+y,g[L]),i[y]=I,p+=I):(x&&u.hasAttribute("morphTarget"+y)===!0&&u.deleteAttribute("morphTarget"+y),g&&u.hasAttribute("morphNormal"+y)===!0&&u.deleteAttribute("morphNormal"+y),i[y]=0)}const _=u.morphTargetsRelative?1:1-p;f.getUniforms().setValue(s,"morphTargetBaseInfluence",_),f.getUniforms().setValue(s,"morphTargetInfluences",i)}}return{update:l}}function mg(s,e,t,n){let i=new WeakMap;function r(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);return i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),h}function o(){i=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:r,dispose:o}}class oc extends dn{constructor(e=null,t=1,n=1,i=1){super(null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Kt,this.minFilter=Kt,this.wrapR=xn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}oc.prototype.isDataTexture3D=!0;const Xu=new dn,Zu=new Oa,ju=new oc,Yu=new Ds,Ju=[],$u=[],Ku=new Float32Array(16),Qu=new Float32Array(9),eh=new Float32Array(4);function zs(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=Ju[i];if(r===void 0&&(r=new Float32Array(i),Ju[i]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,s[o].toArray(r,a)}return r}function Un(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function In(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function za(s,e){let t=$u[e];t===void 0&&(t=new Int32Array(e),$u[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function gg(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function vg(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Un(t,e))return;s.uniform2fv(this.addr,e),In(t,e)}}function yg(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Un(t,e))return;s.uniform3fv(this.addr,e),In(t,e)}}function xg(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(s.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Un(t,e))return;s.uniform4fv(this.addr,e),In(t,e)}}function _g(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),In(t,e)}else{if(Un(t,n))return;eh.set(n),s.uniformMatrix2fv(this.addr,!1,eh),In(t,n)}}function bg(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),In(t,e)}else{if(Un(t,n))return;Qu.set(n),s.uniformMatrix3fv(this.addr,!1,Qu),In(t,n)}}function Mg(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Un(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),In(t,e)}else{if(Un(t,n))return;Ku.set(n),s.uniformMatrix4fv(this.addr,!1,Ku),In(t,n)}}function wg(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function Sg(s,e){const t=this.cache;Un(t,e)||(s.uniform2iv(this.addr,e),In(t,e))}function Tg(s,e){const t=this.cache;Un(t,e)||(s.uniform3iv(this.addr,e),In(t,e))}function Eg(s,e){const t=this.cache;Un(t,e)||(s.uniform4iv(this.addr,e),In(t,e))}function Ag(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function Cg(s,e){const t=this.cache;Un(t,e)||(s.uniform2uiv(this.addr,e),In(t,e))}function Lg(s,e){const t=this.cache;Un(t,e)||(s.uniform3uiv(this.addr,e),In(t,e))}function Rg(s,e){const t=this.cache;Un(t,e)||(s.uniform4uiv(this.addr,e),In(t,e))}function Pg(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||Xu,i)}function Dg(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||ju,i)}function Ig(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||Yu,i)}function Fg(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Zu,i)}function Bg(s){switch(s){case 5126:return gg;case 35664:return vg;case 35665:return yg;case 35666:return xg;case 35674:return _g;case 35675:return bg;case 35676:return Mg;case 5124:case 35670:return wg;case 35667:case 35671:return Sg;case 35668:case 35672:return Tg;case 35669:case 35673:return Eg;case 5125:return Ag;case 36294:return Cg;case 36295:return Lg;case 36296:return Rg;case 35678:case 36198:case 36298:case 36306:case 35682:return Pg;case 35679:case 36299:case 36307:return Dg;case 35680:case 36300:case 36308:case 36293:return Ig;case 36289:case 36303:case 36311:case 36292:return Fg}}function Ng(s,e){s.uniform1fv(this.addr,e)}function Og(s,e){const t=zs(e,this.size,2);s.uniform2fv(this.addr,t)}function zg(s,e){const t=zs(e,this.size,3);s.uniform3fv(this.addr,t)}function Ug(s,e){const t=zs(e,this.size,4);s.uniform4fv(this.addr,t)}function Gg(s,e){const t=zs(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function Hg(s,e){const t=zs(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function kg(s,e){const t=zs(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function Vg(s,e){s.uniform1iv(this.addr,e)}function Wg(s,e){s.uniform2iv(this.addr,e)}function qg(s,e){s.uniform3iv(this.addr,e)}function Xg(s,e){s.uniform4iv(this.addr,e)}function Zg(s,e){s.uniform1uiv(this.addr,e)}function jg(s,e){s.uniform2uiv(this.addr,e)}function Yg(s,e){s.uniform3uiv(this.addr,e)}function Jg(s,e){s.uniform4uiv(this.addr,e)}function $g(s,e,t){const n=e.length,i=za(t,n);s.uniform1iv(this.addr,i);for(let r=0;r!==n;++r)t.safeSetTexture2D(e[r]||Xu,i[r])}function Kg(s,e,t){const n=e.length,i=za(t,n);s.uniform1iv(this.addr,i);for(let r=0;r!==n;++r)t.setTexture3D(e[r]||ju,i[r])}function Qg(s,e,t){const n=e.length,i=za(t,n);s.uniform1iv(this.addr,i);for(let r=0;r!==n;++r)t.safeSetTextureCube(e[r]||Yu,i[r])}function ev(s,e,t){const n=e.length,i=za(t,n);s.uniform1iv(this.addr,i);for(let r=0;r!==n;++r)t.setTexture2DArray(e[r]||Zu,i[r])}function tv(s){switch(s){case 5126:return Ng;case 35664:return Og;case 35665:return zg;case 35666:return Ug;case 35674:return Gg;case 35675:return Hg;case 35676:return kg;case 5124:case 35670:return Vg;case 35667:case 35671:return Wg;case 35668:case 35672:return qg;case 35669:case 35673:return Xg;case 5125:return Zg;case 36294:return jg;case 36295:return Yg;case 36296:return Jg;case 35678:case 36198:case 36298:case 36306:case 35682:return $g;case 35679:case 36299:case 36307:return Kg;case 35680:case 36300:case 36308:case 36293:return Qg;case 36289:case 36303:case 36311:case 36292:return ev}}function nv(s,e,t){this.id=s,this.addr=t,this.cache=[],this.setValue=Bg(e.type)}function th(s,e,t){this.id=s,this.addr=t,this.cache=[],this.size=e.size,this.setValue=tv(e.type)}th.prototype.updateCache=function(s){const e=this.cache;s instanceof Float32Array&&e.length!==s.length&&(this.cache=new Float32Array(s.length)),In(e,s)};function nh(s){this.id=s,this.seq=[],this.map={}}nh.prototype.setValue=function(s,e,t){const n=this.seq;for(let i=0,r=n.length;i!==r;++i){const o=n[i];o.setValue(s,e[o.id],t)}};const ac=/(\w+)(\])?(\[|\.)?/g;function ih(s,e){s.seq.push(e),s.map[e.id]=e}function iv(s,e,t){const n=s.name,i=n.length;for(ac.lastIndex=0;;){const r=ac.exec(n),o=ac.lastIndex;let a=r[1];const l=r[2]==="]",c=r[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){ih(t,c===void 0?new nv(a,s,e):new th(a,s,e));break}else{let h=t.map[a];h===void 0&&(h=new nh(a),ih(t,h)),t=h}}}function mr(s,e){this.seq=[],this.map={};const t=s.getProgramParameter(e,35718);for(let n=0;n<t;++n){const i=s.getActiveUniform(e,n),r=s.getUniformLocation(e,i.name);iv(i,r,this)}}mr.prototype.setValue=function(s,e,t,n){const i=this.map[e];i!==void 0&&i.setValue(s,t,n)},mr.prototype.setOptional=function(s,e,t){const n=e[t];n!==void 0&&this.setValue(s,t,n)},mr.upload=function(s,e,t,n){for(let i=0,r=e.length;i!==r;++i){const o=e[i],a=t[o.id];a.needsUpdate!==!1&&o.setValue(s,a.value,n)}},mr.seqWithValue=function(s,e){const t=[];for(let n=0,i=s.length;n!==i;++n){const r=s[n];r.id in e&&t.push(r)}return t};function rh(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}let rv=0;function sv(s){const e=s.split(`
|
|
2989
|
+
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
2990
|
+
`)}function sh(s){switch(s){case oi:return["Linear","( value )"];case Ar:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",s),["Linear","( value )"]}}function oh(s,e,t){const n=s.getShaderParameter(e,35713),i=s.getShaderInfoLog(e).trim();return n&&i===""?"":t.toUpperCase()+`
|
|
2991
|
+
|
|
2992
|
+
`+i+`
|
|
2993
|
+
|
|
2994
|
+
`+sv(s.getShaderSource(e))}function Nr(s,e){const t=sh(e);return"vec4 "+s+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function ov(s,e){const t=sh(e);return"vec4 "+s+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function av(s,e){let t;switch(e){case Wn:t="Linear";break;case ro:t="Reinhard";break;case ns:t="OptimizedCineon";break;case is:t="ACESFilmic";break;case jo:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function lv(s){return[s.extensionDerivatives||s.envMapCubeUV||s.bumpMap||s.tangentSpaceNormalMap||s.clearcoatNormalMap||s.flatShading||s.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Mo).join(`
|
|
2995
|
+
`)}function cv(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
2996
|
+
`)}function uv(s,e){const t={},n=s.getProgramParameter(e,35721);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),o=r.name;let a=1;r.type===35674&&(a=2),r.type===35675&&(a=3),r.type===35676&&(a=4),t[o]={type:r.type,location:s.getAttribLocation(e,o),locationSize:a}}return t}function Mo(s){return s!==""}function ah(s,e){return s.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function lh(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const hv=/^[ \t]*#include +<([\w\d./]+)>/gm;function lc(s){return s.replace(hv,fv)}function fv(s,e){const t=gt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return lc(t)}const dv=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,pv=/#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 ch(s){return s.replace(pv,uh).replace(dv,mv)}function mv(s,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),uh(s,e,t,n)}function uh(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function hh(s){let e="precision "+s.precision+` float;
|
|
2997
|
+
precision `+s.precision+" int;";return s.precision==="highp"?e+=`
|
|
2998
|
+
#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
|
|
2999
|
+
#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
|
|
3000
|
+
#define LOW_PRECISION`),e}function gv(s){let e="SHADOWMAP_TYPE_BASIC";return s.shadowMapType===Vt?e="SHADOWMAP_TYPE_PCF":s.shadowMapType===Wt?e="SHADOWMAP_TYPE_PCF_SOFT":s.shadowMapType===dt&&(e="SHADOWMAP_TYPE_VSM"),e}function vv(s){let e="ENVMAP_TYPE_CUBE";if(s.envMap)switch(s.envMapMode){case Bi:case Ni:e="ENVMAP_TYPE_CUBE";break;case wr:case Ki:e="ENVMAP_TYPE_CUBE_UV";break}return e}function yv(s){let e="ENVMAP_MODE_REFLECTION";if(s.envMap)switch(s.envMapMode){case Ni:case Ki:e="ENVMAP_MODE_REFRACTION";break}return e}function xv(s){let e="ENVMAP_BLENDING_NONE";if(s.envMap)switch(s.combine){case br:e="ENVMAP_BLENDING_MULTIPLY";break;case Xo:e="ENVMAP_BLENDING_MIX";break;case Zo:e="ENVMAP_BLENDING_ADD";break}return e}function _v(s,e,t,n){const i=s.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=gv(t),c=vv(t),u=yv(t),h=xv(t),f=t.isWebGL2?"":lv(t),d=cv(r),m=i.createProgram();let v,x,g=t.glslVersion?"#version "+t.glslVersion+`
|
|
3001
|
+
`:"";t.isRawShaderMaterial?(v=[d].filter(Mo).join(`
|
|
3002
|
+
`),v.length>0&&(v+=`
|
|
3003
|
+
`),x=[f,d].filter(Mo).join(`
|
|
3004
|
+
`),x.length>0&&(x+=`
|
|
3005
|
+
`)):(v=[hh(t),"#define SHADER_NAME "+t.shaderName,d,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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",`
|
|
3006
|
+
`].filter(Mo).join(`
|
|
3007
|
+
`),x=[f,hh(t),"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==li?"#define TONE_MAPPING":"",t.toneMapping!==li?gt.tonemapping_pars_fragment:"",t.toneMapping!==li?av("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.format===bi?"#define OPAQUE":"",gt.encodings_pars_fragment,t.map?Nr("mapTexelToLinear",t.mapEncoding):"",t.matcap?Nr("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?Nr("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?Nr("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.specularColorMap?Nr("specularColorMapTexelToLinear",t.specularColorMapEncoding):"",t.sheenColorMap?Nr("sheenColorMapTexelToLinear",t.sheenColorMapEncoding):"",t.lightMap?Nr("lightMapTexelToLinear",t.lightMapEncoding):"",ov("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3008
|
+
`].filter(Mo).join(`
|
|
3009
|
+
`)),o=lc(o),o=ah(o,t),o=lh(o,t),a=lc(a),a=ah(a,t),a=lh(a,t),o=ch(o),a=ch(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(g=`#version 300 es
|
|
3010
|
+
`,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3011
|
+
`)+`
|
|
3012
|
+
`+v,x=["#define varying in",t.glslVersion===Pl?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Pl?"":"#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(`
|
|
3013
|
+
`)+`
|
|
3014
|
+
`+x);const p=g+v+o,_=g+x+a,y=rh(i,35633,p),w=rh(i,35632,_);if(i.attachShader(m,y),i.attachShader(m,w),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),s.debug.checkShaderErrors){const O=i.getProgramInfoLog(m).trim(),j=i.getShaderInfoLog(y).trim(),V=i.getShaderInfoLog(w).trim();let N=!0,T=!0;if(i.getProgramParameter(m,35714)===!1){N=!1;const C=oh(i,y,"vertex"),U=oh(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,35715)+`
|
|
3015
|
+
|
|
3016
|
+
Program Info Log: `+O+`
|
|
3017
|
+
`+C+`
|
|
3018
|
+
`+U)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(j===""||V==="")&&(T=!1);T&&(this.diagnostics={runnable:N,programLog:O,vertexShader:{log:j,prefix:v},fragmentShader:{log:V,prefix:x}})}i.deleteShader(y),i.deleteShader(w);let L;this.getUniforms=function(){return L===void 0&&(L=new mr(i,m)),L};let I;return this.getAttributes=function(){return I===void 0&&(I=uv(i,m)),I},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=rv++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=y,this.fragmentShader=w,this}let bv=0;class Mv{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const n=new wv;t.set(e,n)}return t.get(e)}}class wv{constructor(){this.id=bv++,this.usedTimes=0}}function Sv(s,e,t,n,i,r,o){const a=new va,l=new Mv,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.floatVertexTextures,d=i.maxVertexUniforms,m=i.vertexTextures;let v=i.precision;const x={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 g(T){const U=T.skeleton.bones;if(f)return 1024;{const G=Math.floor((d-20)/4),X=Math.min(G,U.length);return X<U.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+U.length+" bones. This GPU supports "+X+"."),0):X}}function p(T){let C;return T&&T.isTexture?C=T.encoding:T&&T.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),C=T.texture.encoding):C=oi,u&&T&&T.isTexture&&T.format===on&&T.type===ii&&T.encoding===Ar&&(C=oi),C}function _(T,C,U,q,G){const X=q.fog,_e=T.isMeshStandardMaterial?q.environment:null,Le=(T.isMeshStandardMaterial?t:e).get(T.envMap||_e),K=x[T.type],te=G.isSkinnedMesh?g(G):0;T.precision!==null&&(v=i.getMaxPrecision(T.precision),v!==T.precision&&console.warn("THREE.WebGLProgram.getParameters:",T.precision,"not supported, using",v,"instead."));let Re,Te,Ne,wt;if(K){const We=fi[K];Re=We.vertexShader,Te=We.fragmentShader}else Re=T.vertexShader,Te=T.fragmentShader,l.update(T),Ne=l.getVertexShaderID(T),wt=l.getFragmentShaderID(T);const se=s.getRenderTarget(),ct=T.alphaTest>0,Xe=T.clearcoat>0;return{isWebGL2:u,shaderID:K,shaderName:T.type,vertexShader:Re,fragmentShader:Te,defines:T.defines,customVertexShaderID:Ne,customFragmentShaderID:wt,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:v,instancing:G.isInstancedMesh===!0,instancingColor:G.isInstancedMesh===!0&&G.instanceColor!==null,supportsVertexTextures:m,outputEncoding:se!==null?p(se.texture):s.outputEncoding,map:!!T.map,mapEncoding:p(T.map),matcap:!!T.matcap,matcapEncoding:p(T.matcap),envMap:!!Le,envMapMode:Le&&Le.mapping,envMapEncoding:p(Le),envMapCubeUV:!!Le&&(Le.mapping===wr||Le.mapping===Ki),lightMap:!!T.lightMap,lightMapEncoding:p(T.lightMap),aoMap:!!T.aoMap,emissiveMap:!!T.emissiveMap,emissiveMapEncoding:p(T.emissiveMap),bumpMap:!!T.bumpMap,normalMap:!!T.normalMap,objectSpaceNormalMap:T.normalMapType===lu,tangentSpaceNormalMap:T.normalMapType===Cr,clearcoat:Xe,clearcoatMap:Xe&&!!T.clearcoatMap,clearcoatRoughnessMap:Xe&&!!T.clearcoatRoughnessMap,clearcoatNormalMap:Xe&&!!T.clearcoatNormalMap,displacementMap:!!T.displacementMap,roughnessMap:!!T.roughnessMap,metalnessMap:!!T.metalnessMap,specularMap:!!T.specularMap,specularIntensityMap:!!T.specularIntensityMap,specularColorMap:!!T.specularColorMap,specularColorMapEncoding:p(T.specularColorMap),alphaMap:!!T.alphaMap,alphaTest:ct,gradientMap:!!T.gradientMap,sheen:T.sheen>0,sheenColorMap:!!T.sheenColorMap,sheenColorMapEncoding:p(T.sheenColorMap),sheenRoughnessMap:!!T.sheenRoughnessMap,transmission:T.transmission>0,transmissionMap:!!T.transmissionMap,thicknessMap:!!T.thicknessMap,combine:T.combine,vertexTangents:!!T.normalMap&&!!G.geometry&&!!G.geometry.attributes.tangent,vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!G.geometry&&!!G.geometry.attributes.color&&G.geometry.attributes.color.itemSize===4,vertexUvs:!!T.map||!!T.bumpMap||!!T.normalMap||!!T.specularMap||!!T.alphaMap||!!T.emissiveMap||!!T.roughnessMap||!!T.metalnessMap||!!T.clearcoatMap||!!T.clearcoatRoughnessMap||!!T.clearcoatNormalMap||!!T.displacementMap||!!T.transmissionMap||!!T.thicknessMap||!!T.specularIntensityMap||!!T.specularColorMap||!!T.sheenColorMap||!!T.sheenRoughnessMap,uvsVertexOnly:!(!!T.map||!!T.bumpMap||!!T.normalMap||!!T.specularMap||!!T.alphaMap||!!T.emissiveMap||!!T.roughnessMap||!!T.metalnessMap||!!T.clearcoatNormalMap||T.transmission>0||!!T.transmissionMap||!!T.thicknessMap||!!T.specularIntensityMap||!!T.specularColorMap||T.sheen>0||!!T.sheenColorMap||!!T.sheenRoughnessMap)&&!!T.displacementMap,fog:!!X,useFog:T.fog,fogExp2:X&&X.isFogExp2,flatShading:!!T.flatShading,sizeAttenuation:T.sizeAttenuation,logarithmicDepthBuffer:h,skinning:G.isSkinnedMesh===!0&&te>0,maxBones:te,useVertexTexture:f,morphTargets:!!G.geometry&&!!G.geometry.morphAttributes.position,morphNormals:!!G.geometry&&!!G.geometry.morphAttributes.normal,morphTargetsCount:!!G.geometry&&!!G.geometry.morphAttributes.position?G.geometry.morphAttributes.position.length:0,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,format:T.format,dithering:T.dithering,shadowMapEnabled:s.shadowMap.enabled&&U.length>0,shadowMapType:s.shadowMap.type,toneMapping:T.toneMapped?s.toneMapping:li,physicallyCorrectLights:s.physicallyCorrectLights,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===Ft,flipSided:T.side===pt,depthPacking:T.depthPacking!==void 0?T.depthPacking:!1,index0AttributeName:T.index0AttributeName,extensionDerivatives:T.extensions&&T.extensions.derivatives,extensionFragDepth:T.extensions&&T.extensions.fragDepth,extensionDrawBuffers:T.extensions&&T.extensions.drawBuffers,extensionShaderTextureLOD:T.extensions&&T.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:T.customProgramCacheKey()}}function y(T){const C=[];if(T.shaderID?C.push(T.shaderID):(C.push(T.customVertexShaderID),C.push(T.customFragmentShaderID)),T.defines!==void 0)for(const U in T.defines)C.push(U),C.push(T.defines[U]);return T.isRawShaderMaterial===!1&&(w(C,T),L(C,T),C.push(s.outputEncoding)),C.push(T.customProgramCacheKey),C.join()}function w(T,C){T.push(C.precision),T.push(C.outputEncoding),T.push(C.mapEncoding),T.push(C.matcapEncoding),T.push(C.envMapMode),T.push(C.envMapEncoding),T.push(C.lightMapEncoding),T.push(C.emissiveMapEncoding),T.push(C.combine),T.push(C.vertexUvs),T.push(C.fogExp2),T.push(C.sizeAttenuation),T.push(C.maxBones),T.push(C.morphTargetsCount),T.push(C.numDirLights),T.push(C.numPointLights),T.push(C.numSpotLights),T.push(C.numHemiLights),T.push(C.numRectAreaLights),T.push(C.numDirLightShadows),T.push(C.numPointLightShadows),T.push(C.numSpotLightShadows),T.push(C.shadowMapType),T.push(C.toneMapping),T.push(C.numClippingPlanes),T.push(C.numClipIntersection),T.push(C.format),T.push(C.specularColorMapEncoding),T.push(C.sheenColorMapEncoding)}function L(T,C){a.disableAll(),C.isWebGL2&&a.enable(0),C.supportsVertexTextures&&a.enable(1),C.instancing&&a.enable(2),C.instancingColor&&a.enable(3),C.map&&a.enable(4),C.matcap&&a.enable(5),C.envMap&&a.enable(6),C.envMapCubeUV&&a.enable(7),C.lightMap&&a.enable(8),C.aoMap&&a.enable(9),C.emissiveMap&&a.enable(10),C.bumpMap&&a.enable(11),C.normalMap&&a.enable(12),C.objectSpaceNormalMap&&a.enable(13),C.tangentSpaceNormalMap&&a.enable(14),C.clearcoat&&a.enable(15),C.clearcoatMap&&a.enable(16),C.clearcoatRoughnessMap&&a.enable(17),C.clearcoatNormalMap&&a.enable(18),C.displacementMap&&a.enable(19),C.specularMap&&a.enable(20),C.roughnessMap&&a.enable(21),C.metalnessMap&&a.enable(22),C.gradientMap&&a.enable(23),C.alphaMap&&a.enable(24),C.alphaTest&&a.enable(25),C.vertexColors&&a.enable(26),C.vertexAlphas&&a.enable(27),C.vertexUvs&&a.enable(28),C.vertexTangents&&a.enable(29),C.uvsVertexOnly&&a.enable(30),C.fog&&a.enable(31),T.push(a.mask),a.disableAll(),C.useFog&&a.enable(0),C.flatShading&&a.enable(1),C.logarithmicDepthBuffer&&a.enable(2),C.skinning&&a.enable(3),C.useVertexTexture&&a.enable(4),C.morphTargets&&a.enable(5),C.morphNormals&&a.enable(6),C.premultipliedAlpha&&a.enable(7),C.shadowMapEnabled&&a.enable(8),C.physicallyCorrectLights&&a.enable(9),C.doubleSided&&a.enable(10),C.flipSided&&a.enable(11),C.depthPacking&&a.enable(12),C.dithering&&a.enable(13),C.specularIntensityMap&&a.enable(14),C.specularColorMap&&a.enable(15),C.transmission&&a.enable(16),C.transmissionMap&&a.enable(17),C.thicknessMap&&a.enable(18),C.sheen&&a.enable(19),C.sheenColorMap&&a.enable(20),C.sheenRoughnessMap&&a.enable(21),T.push(a.mask)}function I(T){const C=x[T.type];let U;if(C){const q=fi[C];U=Fu.clone(q.uniforms)}else U=T.uniforms;return U}function O(T,C){let U;for(let q=0,G=c.length;q<G;q++){const X=c[q];if(X.cacheKey===C){U=X,++U.usedTimes;break}}return U===void 0&&(U=new _v(s,C,T,r),c.push(U)),U}function j(T){if(--T.usedTimes===0){const C=c.indexOf(T);c[C]=c[c.length-1],c.pop(),T.destroy()}}function V(T){l.remove(T)}function N(){l.dispose()}return{getParameters:_,getProgramCacheKey:y,getUniforms:I,acquireProgram:O,releaseProgram:j,releaseShaderCache:V,programs:c,dispose:N}}function Tv(){let s=new WeakMap;function e(r){let o=s.get(r);return o===void 0&&(o={},s.set(r,o)),o}function t(r){s.delete(r)}function n(r,o,a){s.get(r)[o]=a}function i(){s=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function Ev(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function fh(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function dh(){const s=[];let e=0;const t=[],n=[],i=[];function r(){e=0,t.length=0,n.length=0,i.length=0}function o(h,f,d,m,v,x){let g=s[e];return g===void 0?(g={id:h.id,object:h,geometry:f,material:d,groupOrder:m,renderOrder:h.renderOrder,z:v,group:x},s[e]=g):(g.id=h.id,g.object=h,g.geometry=f,g.material=d,g.groupOrder=m,g.renderOrder=h.renderOrder,g.z=v,g.group=x),e++,g}function a(h,f,d,m,v,x){const g=o(h,f,d,m,v,x);d.transmission>0?n.push(g):d.transparent===!0?i.push(g):t.push(g)}function l(h,f,d,m,v,x){const g=o(h,f,d,m,v,x);d.transmission>0?n.unshift(g):d.transparent===!0?i.unshift(g):t.unshift(g)}function c(h,f){t.length>1&&t.sort(h||Ev),n.length>1&&n.sort(f||fh),i.length>1&&i.sort(f||fh)}function u(){for(let h=e,f=s.length;h<f;h++){const d=s[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:i,init:r,push:a,unshift:l,finish:u,sort:c}}function Av(){let s=new WeakMap;function e(n,i){let r;return s.has(n)===!1?(r=new dh,s.set(n,[r])):i>=s.get(n).length?(r=new dh,s.get(n).push(r)):r=s.get(n)[i],r}function t(){s=new WeakMap}return{get:e,dispose:t}}function Cv(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new M,color:new Me};break;case"SpotLight":t={position:new M,direction:new M,color:new Me,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new M,color:new Me,distance:0,decay:0};break;case"HemisphereLight":t={direction:new M,skyColor:new Me,groundColor:new Me};break;case"RectAreaLight":t={color:new Me,position:new M,halfWidth:new M,halfHeight:new M};break}return s[e.id]=t,t}}}function Lv(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let Rv=0;function Pv(s,e){return(e.castShadow?1:0)-(s.castShadow?1:0)}function Dv(s,e){const t=new Cv,n=Lv(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)i.probe.push(new M);const r=new M,o=new Oe,a=new Oe;function l(u,h){let f=0,d=0,m=0;for(let j=0;j<9;j++)i.probe[j].set(0,0,0);let v=0,x=0,g=0,p=0,_=0,y=0,w=0,L=0;u.sort(Pv);const I=h!==!0?Math.PI:1;for(let j=0,V=u.length;j<V;j++){const N=u[j],T=N.color,C=N.intensity,U=N.distance,q=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)f+=T.r*C*I,d+=T.g*C*I,m+=T.b*C*I;else if(N.isLightProbe)for(let G=0;G<9;G++)i.probe[G].addScaledVector(N.sh.coefficients[G],C);else if(N.isDirectionalLight){const G=t.get(N);if(G.color.copy(N.color).multiplyScalar(N.intensity*I),N.castShadow){const X=N.shadow,_e=n.get(N);_e.shadowBias=X.bias,_e.shadowNormalBias=X.normalBias,_e.shadowRadius=X.radius,_e.shadowMapSize=X.mapSize,i.directionalShadow[v]=_e,i.directionalShadowMap[v]=q,i.directionalShadowMatrix[v]=N.shadow.matrix,y++}i.directional[v]=G,v++}else if(N.isSpotLight){const G=t.get(N);if(G.position.setFromMatrixPosition(N.matrixWorld),G.color.copy(T).multiplyScalar(C*I),G.distance=U,G.coneCos=Math.cos(N.angle),G.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),G.decay=N.decay,N.castShadow){const X=N.shadow,_e=n.get(N);_e.shadowBias=X.bias,_e.shadowNormalBias=X.normalBias,_e.shadowRadius=X.radius,_e.shadowMapSize=X.mapSize,i.spotShadow[g]=_e,i.spotShadowMap[g]=q,i.spotShadowMatrix[g]=N.shadow.matrix,L++}i.spot[g]=G,g++}else if(N.isRectAreaLight){const G=t.get(N);G.color.copy(T).multiplyScalar(C),G.halfWidth.set(N.width*.5,0,0),G.halfHeight.set(0,N.height*.5,0),i.rectArea[p]=G,p++}else if(N.isPointLight){const G=t.get(N);if(G.color.copy(N.color).multiplyScalar(N.intensity*I),G.distance=N.distance,G.decay=N.decay,N.castShadow){const X=N.shadow,_e=n.get(N);_e.shadowBias=X.bias,_e.shadowNormalBias=X.normalBias,_e.shadowRadius=X.radius,_e.shadowMapSize=X.mapSize,_e.shadowCameraNear=X.camera.near,_e.shadowCameraFar=X.camera.far,i.pointShadow[x]=_e,i.pointShadowMap[x]=q,i.pointShadowMatrix[x]=N.shadow.matrix,w++}i.point[x]=G,x++}else if(N.isHemisphereLight){const G=t.get(N);G.skyColor.copy(N.color).multiplyScalar(C*I),G.groundColor.copy(N.groundColor).multiplyScalar(C*I),i.hemi[_]=G,_++}}p>0&&(e.isWebGL2||s.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):s.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=m;const O=i.hash;(O.directionalLength!==v||O.pointLength!==x||O.spotLength!==g||O.rectAreaLength!==p||O.hemiLength!==_||O.numDirectionalShadows!==y||O.numPointShadows!==w||O.numSpotShadows!==L)&&(i.directional.length=v,i.spot.length=g,i.rectArea.length=p,i.point.length=x,i.hemi.length=_,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=L,i.spotShadowMap.length=L,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=w,i.spotShadowMatrix.length=L,O.directionalLength=v,O.pointLength=x,O.spotLength=g,O.rectAreaLength=p,O.hemiLength=_,O.numDirectionalShadows=y,O.numPointShadows=w,O.numSpotShadows=L,i.version=Rv++)}function c(u,h){let f=0,d=0,m=0,v=0,x=0;const g=h.matrixWorldInverse;for(let p=0,_=u.length;p<_;p++){const y=u[p];if(y.isDirectionalLight){const w=i.directional[f];w.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(r),w.direction.transformDirection(g),f++}else if(y.isSpotLight){const w=i.spot[m];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(g),w.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),w.direction.sub(r),w.direction.transformDirection(g),m++}else if(y.isRectAreaLight){const w=i.rectArea[v];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(g),a.identity(),o.copy(y.matrixWorld),o.premultiply(g),a.extractRotation(o),w.halfWidth.set(y.width*.5,0,0),w.halfHeight.set(0,y.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),v++}else if(y.isPointLight){const w=i.point[d];w.position.setFromMatrixPosition(y.matrixWorld),w.position.applyMatrix4(g),d++}else if(y.isHemisphereLight){const w=i.hemi[x];w.direction.setFromMatrixPosition(y.matrixWorld),w.direction.transformDirection(g),w.direction.normalize(),x++}}}return{setup:l,setupView:c,state:i}}function ph(s,e){const t=new Dv(s,e),n=[],i=[];function r(){n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(h){t.setup(n,h)}function c(h){t.setupView(n,h)}return{init:r,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function Iv(s,e){let t=new WeakMap;function n(r,o=0){let a;return t.has(r)===!1?(a=new ph(s,e),t.set(r,[a])):o>=t.get(r).length?(a=new ph(s,e),t.get(r).push(a)):a=t.get(r)[o],a}function i(){t=new WeakMap}return{get:n,dispose:i}}class Ua extends bn{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=ou,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}Ua.prototype.isMeshDepthMaterial=!0;class Ga extends bn{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Ga.prototype.isMeshDistanceMaterial=!0;const Fv=`void main() {
|
|
3019
|
+
gl_Position = vec4( position, 1.0 );
|
|
3020
|
+
}`,Bv=`uniform sampler2D shadow_pass;
|
|
3021
|
+
uniform vec2 resolution;
|
|
3022
|
+
uniform float radius;
|
|
3023
|
+
#include <packing>
|
|
3024
|
+
void main() {
|
|
3025
|
+
const float samples = float( VSM_SAMPLES );
|
|
3026
|
+
float mean = 0.0;
|
|
3027
|
+
float squared_mean = 0.0;
|
|
3028
|
+
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
|
3029
|
+
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
|
3030
|
+
for ( float i = 0.0; i < samples; i ++ ) {
|
|
3031
|
+
float uvOffset = uvStart + i * uvStride;
|
|
3032
|
+
#ifdef HORIZONTAL_PASS
|
|
3033
|
+
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
|
3034
|
+
mean += distribution.x;
|
|
3035
|
+
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
3036
|
+
#else
|
|
3037
|
+
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
|
3038
|
+
mean += depth;
|
|
3039
|
+
squared_mean += depth * depth;
|
|
3040
|
+
#endif
|
|
3041
|
+
}
|
|
3042
|
+
mean = mean / samples;
|
|
3043
|
+
squared_mean = squared_mean / samples;
|
|
3044
|
+
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3045
|
+
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3046
|
+
}`;function mh(s,e,t){let n=new xo;const i=new ee,r=new ee,o=new Nt,a=new Ua({depthPacking:au}),l=new Ga,c={},u=t.maxTextureSize,h={0:pt,1:Q,2:Ft},f=new qi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ee},radius:{value:4}},vertexShader:Fv,fragmentShader:Bv}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new $e;m.setAttribute("position",new Tt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new pn(m,f),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Vt,this.render=function(y,w,L){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||y.length===0)return;const I=s.getRenderTarget(),O=s.getActiveCubeFace(),j=s.getActiveMipmapLevel(),V=s.state;V.setBlending(mt),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);for(let N=0,T=y.length;N<T;N++){const C=y[N],U=C.shadow;if(U===void 0){console.warn("THREE.WebGLShadowMap:",C,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;i.copy(U.mapSize);const q=U.getFrameExtents();if(i.multiply(q),r.copy(U.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(r.x=Math.floor(u/q.x),i.x=r.x*q.x,U.mapSize.x=r.x),i.y>u&&(r.y=Math.floor(u/q.y),i.y=r.y*q.y,U.mapSize.y=r.y)),U.map===null&&!U.isPointLightShadow&&this.type===dt){const X={minFilter:en,magFilter:en,format:on};U.map=new Jn(i.x,i.y,X),U.map.texture.name=C.name+".shadowMap",U.mapPass=new Jn(i.x,i.y,X),U.camera.updateProjectionMatrix()}if(U.map===null){const X={minFilter:Kt,magFilter:Kt,format:on};U.map=new Jn(i.x,i.y,X),U.map.texture.name=C.name+".shadowMap",U.camera.updateProjectionMatrix()}s.setRenderTarget(U.map),s.clear();const G=U.getViewportCount();for(let X=0;X<G;X++){const _e=U.getViewport(X);o.set(r.x*_e.x,r.y*_e.y,r.x*_e.z,r.y*_e.w),V.viewport(o),U.updateMatrices(C,X),n=U.getFrustum(),_(w,L,U.camera,C,this.type)}!U.isPointLightShadow&&this.type===dt&&g(U,L),U.needsUpdate=!1}x.needsUpdate=!1,s.setRenderTarget(I,O,j)};function g(y,w){const L=e.update(v);f.defines.VSM_SAMPLES!==y.blurSamples&&(f.defines.VSM_SAMPLES=y.blurSamples,d.defines.VSM_SAMPLES=y.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=y.map.texture,f.uniforms.resolution.value=y.mapSize,f.uniforms.radius.value=y.radius,s.setRenderTarget(y.mapPass),s.clear(),s.renderBufferDirect(w,null,L,f,v,null),d.uniforms.shadow_pass.value=y.mapPass.texture,d.uniforms.resolution.value=y.mapSize,d.uniforms.radius.value=y.radius,s.setRenderTarget(y.map),s.clear(),s.renderBufferDirect(w,null,L,d,v,null)}function p(y,w,L,I,O,j,V){let N=null;const T=I.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(T!==void 0?N=T:N=I.isPointLight===!0?l:a,s.localClippingEnabled&&L.clipShadows===!0&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0){const C=N.uuid,U=L.uuid;let q=c[C];q===void 0&&(q={},c[C]=q);let G=q[U];G===void 0&&(G=N.clone(),q[U]=G),N=G}return N.visible=L.visible,N.wireframe=L.wireframe,V===dt?N.side=L.shadowSide!==null?L.shadowSide:L.side:N.side=L.shadowSide!==null?L.shadowSide:h[L.side],N.alphaMap=L.alphaMap,N.alphaTest=L.alphaTest,N.clipShadows=L.clipShadows,N.clippingPlanes=L.clippingPlanes,N.clipIntersection=L.clipIntersection,N.displacementMap=L.displacementMap,N.displacementScale=L.displacementScale,N.displacementBias=L.displacementBias,N.wireframeLinewidth=L.wireframeLinewidth,N.linewidth=L.linewidth,I.isPointLight===!0&&N.isMeshDistanceMaterial===!0&&(N.referencePosition.setFromMatrixPosition(I.matrixWorld),N.nearDistance=O,N.farDistance=j),N}function _(y,w,L,I,O){if(y.visible===!1)return;if(y.layers.test(w.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&O===dt)&&(!y.frustumCulled||n.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,y.matrixWorld);const N=e.update(y),T=y.material;if(Array.isArray(T)){const C=N.groups;for(let U=0,q=C.length;U<q;U++){const G=C[U],X=T[G.materialIndex];if(X&&X.visible){const _e=p(y,N,X,I,L.near,L.far,O);s.renderBufferDirect(L,null,N,_e,y,G)}}}else if(T.visible){const C=p(y,N,T,I,L.near,L.far,O);s.renderBufferDirect(L,null,N,C,y,null)}}const V=y.children;for(let N=0,T=V.length;N<T;N++)_(V[N],w,L,I,O)}}function Nv(s,e,t){const n=t.isWebGL2;function i(){let F=!1;const ge=new Nt;let pe=null;const ot=new Nt(0,0,0,0);return{setMask:function(Ue){pe!==Ue&&!F&&(s.colorMask(Ue,Ue,Ue,Ue),pe=Ue)},setLocked:function(Ue){F=Ue},setClear:function(Ue,ht,Se,ut,jt){jt===!0&&(Ue*=ut,ht*=ut,Se*=ut),ge.set(Ue,ht,Se,ut),ot.equals(ge)===!1&&(s.clearColor(Ue,ht,Se,ut),ot.copy(ge))},reset:function(){F=!1,pe=null,ot.set(-1,0,0,0)}}}function r(){let F=!1,ge=null,pe=null,ot=null;return{setTest:function(Ue){Ue?Te(2929):Ne(2929)},setMask:function(Ue){ge!==Ue&&!F&&(s.depthMask(Ue),ge=Ue)},setFunc:function(Ue){if(pe!==Ue){if(Ue)switch(Ue){case hn:s.depthFunc(512);break;case Tn:s.depthFunc(519);break;case fn:s.depthFunc(513);break;case gi:s.depthFunc(515);break;case vi:s.depthFunc(514);break;case Bn:s.depthFunc(518);break;case ts:s.depthFunc(516);break;case qo:s.depthFunc(517);break;default:s.depthFunc(515)}else s.depthFunc(515);pe=Ue}},setLocked:function(Ue){F=Ue},setClear:function(Ue){ot!==Ue&&(s.clearDepth(Ue),ot=Ue)},reset:function(){F=!1,ge=null,pe=null,ot=null}}}function o(){let F=!1,ge=null,pe=null,ot=null,Ue=null,ht=null,Se=null,ut=null,jt=null;return{setTest:function(Ht){F||(Ht?Te(2960):Ne(2960))},setMask:function(Ht){ge!==Ht&&!F&&(s.stencilMask(Ht),ge=Ht)},setFunc:function(Ht,Ri,Pi){(pe!==Ht||ot!==Ri||Ue!==Pi)&&(s.stencilFunc(Ht,Ri,Pi),pe=Ht,ot=Ri,Ue=Pi)},setOp:function(Ht,Ri,Pi){(ht!==Ht||Se!==Ri||ut!==Pi)&&(s.stencilOp(Ht,Ri,Pi),ht=Ht,Se=Ri,ut=Pi)},setLocked:function(Ht){F=Ht},setClear:function(Ht){jt!==Ht&&(s.clearStencil(Ht),jt=Ht)},reset:function(){F=!1,ge=null,pe=null,ot=null,Ue=null,ht=null,Se=null,ut=null,jt=null}}}const a=new i,l=new r,c=new o;let u={},h={},f=null,d=!1,m=null,v=null,x=null,g=null,p=null,_=null,y=null,w=!1,L=null,I=null,O=null,j=null,V=null;const N=s.getParameter(35661);let T=!1,C=0;const U=s.getParameter(7938);U.indexOf("WebGL")!==-1?(C=parseFloat(/^WebGL (\d)/.exec(U)[1]),T=C>=1):U.indexOf("OpenGL ES")!==-1&&(C=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),T=C>=2);let q=null,G={};const X=s.getParameter(3088),_e=s.getParameter(2978),Le=new Nt().fromArray(X),K=new Nt().fromArray(_e);function te(F,ge,pe){const ot=new Uint8Array(4),Ue=s.createTexture();s.bindTexture(F,Ue),s.texParameteri(F,10241,9728),s.texParameteri(F,10240,9728);for(let ht=0;ht<pe;ht++)s.texImage2D(ge+ht,0,6408,1,1,0,6408,5121,ot);return Ue}const Re={};Re[3553]=te(3553,3553,1),Re[34067]=te(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Te(2929),l.setFunc(gi),Ct(!1),$(lt),Te(2884),Ge(mt);function Te(F){u[F]!==!0&&(s.enable(F),u[F]=!0)}function Ne(F){u[F]!==!1&&(s.disable(F),u[F]=!1)}function wt(F,ge){return h[F]!==ge?(s.bindFramebuffer(F,ge),h[F]=ge,n&&(F===36009&&(h[36160]=ge),F===36160&&(h[36009]=ge)),!0):!1}function se(F){return f!==F?(s.useProgram(F),f=F,!0):!1}const ct={[Pt]:32774,[nn]:32778,[Hn]:32779};if(n)ct[ni]=32775,ct[St]=32776;else{const F=e.get("EXT_blend_minmax");F!==null&&(ct[ni]=F.MIN_EXT,ct[St]=F.MAX_EXT)}const Xe={[Ut]:0,[Ji]:1,[_r]:768,[le]:770,[Rt]:776,[ze]:774,[ve]:772,[$i]:769,[ie]:771,[Yt]:775,[Qe]:773};function Ge(F,ge,pe,ot,Ue,ht,Se,ut){if(F===mt){d===!0&&(Ne(3042),d=!1);return}if(d===!1&&(Te(3042),d=!0),F!==Xt){if(F!==m||ut!==w){if((v!==Pt||p!==Pt)&&(s.blendEquation(32774),v=Pt,p=Pt),ut)switch(F){case Bt:s.blendFuncSeparate(1,771,1,771);break;case mn:s.blendFunc(1,1);break;case Qt:s.blendFuncSeparate(0,0,769,771);break;case qt:s.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",F);break}else switch(F){case Bt:s.blendFuncSeparate(770,771,1,771);break;case mn:s.blendFunc(770,1);break;case Qt:s.blendFunc(0,769);break;case qt:s.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",F);break}x=null,g=null,_=null,y=null,m=F,w=ut}return}Ue=Ue||ge,ht=ht||pe,Se=Se||ot,(ge!==v||Ue!==p)&&(s.blendEquationSeparate(ct[ge],ct[Ue]),v=ge,p=Ue),(pe!==x||ot!==g||ht!==_||Se!==y)&&(s.blendFuncSeparate(Xe[pe],Xe[ot],Xe[ht],Xe[Se]),x=pe,g=ot,_=ht,y=Se),m=F,w=null}function We(F,ge){F.side===Ft?Ne(2884):Te(2884);let pe=F.side===pt;ge&&(pe=!pe),Ct(pe),F.blending===Bt&&F.transparent===!1?Ge(mt):Ge(F.blending,F.blendEquation,F.blendSrc,F.blendDst,F.blendEquationAlpha,F.blendSrcAlpha,F.blendDstAlpha,F.premultipliedAlpha),l.setFunc(F.depthFunc),l.setTest(F.depthTest),l.setMask(F.depthWrite),a.setMask(F.colorWrite);const ot=F.stencilWrite;c.setTest(ot),ot&&(c.setMask(F.stencilWriteMask),c.setFunc(F.stencilFunc,F.stencilRef,F.stencilFuncMask),c.setOp(F.stencilFail,F.stencilZFail,F.stencilZPass)),me(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),F.alphaToCoverage===!0?Te(32926):Ne(32926)}function Ct(F){L!==F&&(F?s.frontFace(2304):s.frontFace(2305),L=F)}function $(F){F!==Ke?(Te(2884),F!==I&&(F===lt?s.cullFace(1029):F===_t?s.cullFace(1028):s.cullFace(1032))):Ne(2884),I=F}function he(F){F!==O&&(T&&s.lineWidth(F),O=F)}function me(F,ge,pe){F?(Te(32823),(j!==ge||V!==pe)&&(s.polygonOffset(ge,pe),j=ge,V=pe)):Ne(32823)}function Ie(F){F?Te(3089):Ne(3089)}function we(F){F===void 0&&(F=33984+N-1),q!==F&&(s.activeTexture(F),q=F)}function rt(F,ge){q===null&&we();let pe=G[q];pe===void 0&&(pe={type:void 0,texture:void 0},G[q]=pe),(pe.type!==F||pe.texture!==ge)&&(s.bindTexture(F,ge||Re[F]),pe.type=F,pe.texture=ge)}function st(){const F=G[q];F!==void 0&&F.type!==void 0&&(s.bindTexture(F.type,null),F.type=void 0,F.texture=void 0)}function vt(){try{s.compressedTexImage2D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function $t(){try{s.texSubImage2D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function P(){try{s.texSubImage3D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function A(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function re(){try{s.texStorage2D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function ue(){try{s.texStorage3D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function be(){try{s.texImage2D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function ce(){try{s.texImage3D.apply(s,arguments)}catch(F){console.error("THREE.WebGLState:",F)}}function tt(F){Le.equals(F)===!1&&(s.scissor(F.x,F.y,F.z,F.w),Le.copy(F))}function Ye(F){K.equals(F)===!1&&(s.viewport(F.x,F.y,F.z,F.w),K.copy(F))}function ye(){s.disable(3042),s.disable(2884),s.disable(2929),s.disable(32823),s.disable(3089),s.disable(2960),s.disable(32926),s.blendEquation(32774),s.blendFunc(1,0),s.blendFuncSeparate(1,0,1,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(513),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(519,0,4294967295),s.stencilOp(7680,7680,7680),s.clearStencil(0),s.cullFace(1029),s.frontFace(2305),s.polygonOffset(0,0),s.activeTexture(33984),s.bindFramebuffer(36160,null),n===!0&&(s.bindFramebuffer(36009,null),s.bindFramebuffer(36008,null)),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),u={},q=null,G={},h={},f=null,d=!1,m=null,v=null,x=null,g=null,p=null,_=null,y=null,w=!1,L=null,I=null,O=null,j=null,V=null,Le.set(0,0,s.canvas.width,s.canvas.height),K.set(0,0,s.canvas.width,s.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:Te,disable:Ne,bindFramebuffer:wt,useProgram:se,setBlending:Ge,setMaterial:We,setFlipSided:Ct,setCullFace:$,setLineWidth:he,setPolygonOffset:me,setScissorTest:Ie,activeTexture:we,bindTexture:rt,unbindTexture:st,compressedTexImage2D:vt,texImage2D:be,texImage3D:ce,texStorage2D:re,texStorage3D:ue,texSubImage2D:$t,texSubImage3D:P,compressedTexSubImage2D:A,scissor:tt,viewport:Ye,reset:ye}}function Ov(s,e,t,n,i,r,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,m=new WeakMap;let v,x=!1;try{x=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(P){}function g(P,A){return x?new OffscreenCanvas(P,A):ca("canvas")}function p(P,A,re,ue){let be=1;if((P.width>ue||P.height>ue)&&(be=ue/Math.max(P.width,P.height)),be<1||A===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const ce=A?hu:Math.floor,tt=ce(be*P.width),Ye=ce(be*P.height);v===void 0&&(v=g(tt,Ye));const ye=re?g(tt,Ye):v;return ye.width=tt,ye.height=Ye,ye.getContext("2d").drawImage(P,0,0,tt,Ye),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+tt+"x"+Ye+")."),ye}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function _(P){return Il(P.width)&&Il(P.height)}function y(P){return a?!1:P.wrapS!==xn||P.wrapT!==xn||P.minFilter!==Kt&&P.minFilter!==en}function w(P,A){return P.generateMipmaps&&A&&P.minFilter!==Kt&&P.minFilter!==en}function L(P){s.generateMipmap(P)}function I(P,A,re,ue){if(a===!1)return A;if(P!==null){if(s[P]!==void 0)return s[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let be=A;return A===6403&&(re===5126&&(be=33326),re===5131&&(be=33325),re===5121&&(be=33321)),A===6407&&(re===5126&&(be=34837),re===5131&&(be=34843),re===5121&&(be=32849)),A===6408&&(re===5126&&(be=34836),re===5131&&(be=34842),re===5121&&(be=ue===Ar?35907:32856)),(be===33325||be===33326||be===34842||be===34836)&&e.get("EXT_color_buffer_float"),be}function O(P,A,re){return w(P,re)===!0||P.isFramebufferTexture&&P.minFilter!==Kt&&P.minFilter!==en?Math.log2(Math.max(A.width,A.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?A.mipmaps.length:1}function j(P){return P===Kt||P===ss||P===os?9728:9729}function V(P){const A=P.target;A.removeEventListener("dispose",V),T(A),A.isVideoTexture&&m.delete(A),o.memory.textures--}function N(P){const A=P.target;A.removeEventListener("dispose",N),C(A)}function T(P){const A=n.get(P);A.__webglInit!==void 0&&(s.deleteTexture(A.__webglTexture),n.remove(P))}function C(P){const A=P.texture,re=n.get(P),ue=n.get(A);if(!!P){if(ue.__webglTexture!==void 0&&(s.deleteTexture(ue.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let be=0;be<6;be++)s.deleteFramebuffer(re.__webglFramebuffer[be]),re.__webglDepthbuffer&&s.deleteRenderbuffer(re.__webglDepthbuffer[be]);else s.deleteFramebuffer(re.__webglFramebuffer),re.__webglDepthbuffer&&s.deleteRenderbuffer(re.__webglDepthbuffer),re.__webglMultisampledFramebuffer&&s.deleteFramebuffer(re.__webglMultisampledFramebuffer),re.__webglColorRenderbuffer&&s.deleteRenderbuffer(re.__webglColorRenderbuffer),re.__webglDepthRenderbuffer&&s.deleteRenderbuffer(re.__webglDepthRenderbuffer);if(P.isWebGLMultipleRenderTargets)for(let be=0,ce=A.length;be<ce;be++){const tt=n.get(A[be]);tt.__webglTexture&&(s.deleteTexture(tt.__webglTexture),o.memory.textures--),n.remove(A[be])}n.remove(A),n.remove(P)}}let U=0;function q(){U=0}function G(){const P=U;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),U+=1,P}function X(P,A){const re=n.get(P);if(P.isVideoTexture&&we(P),P.version>0&&re.__version!==P.version){const ue=P.image;if(ue===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{wt(re,P,A);return}}t.activeTexture(33984+A),t.bindTexture(3553,re.__webglTexture)}function _e(P,A){const re=n.get(P);if(P.version>0&&re.__version!==P.version){wt(re,P,A);return}t.activeTexture(33984+A),t.bindTexture(35866,re.__webglTexture)}function Le(P,A){const re=n.get(P);if(P.version>0&&re.__version!==P.version){wt(re,P,A);return}t.activeTexture(33984+A),t.bindTexture(32879,re.__webglTexture)}function K(P,A){const re=n.get(P);if(P.version>0&&re.__version!==P.version){se(re,P,A);return}t.activeTexture(33984+A),t.bindTexture(34067,re.__webglTexture)}const te={[Sr]:10497,[xn]:33071,[yi]:33648},Re={[Kt]:9728,[ss]:9984,[os]:9986,[en]:9729,[xi]:9985,[Qi]:9987};function Te(P,A,re){if(re?(s.texParameteri(P,10242,te[A.wrapS]),s.texParameteri(P,10243,te[A.wrapT]),(P===32879||P===35866)&&s.texParameteri(P,32882,te[A.wrapR]),s.texParameteri(P,10240,Re[A.magFilter]),s.texParameteri(P,10241,Re[A.minFilter])):(s.texParameteri(P,10242,33071),s.texParameteri(P,10243,33071),(P===32879||P===35866)&&s.texParameteri(P,32882,33071),(A.wrapS!==xn||A.wrapT!==xn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),s.texParameteri(P,10240,j(A.magFilter)),s.texParameteri(P,10241,j(A.minFilter)),A.minFilter!==Kt&&A.minFilter!==en&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ue=e.get("EXT_texture_filter_anisotropic");if(A.type===ri&&e.has("OES_texture_float_linear")===!1||a===!1&&A.type===_i&&e.has("OES_texture_half_float_linear")===!1)return;(A.anisotropy>1||n.get(A).__currentAnisotropy)&&(s.texParameterf(P,ue.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,i.getMaxAnisotropy())),n.get(A).__currentAnisotropy=A.anisotropy)}}function Ne(P,A){P.__webglInit===void 0&&(P.__webglInit=!0,A.addEventListener("dispose",V),P.__webglTexture=s.createTexture(),o.memory.textures++)}function wt(P,A,re){let ue=3553;A.isDataTexture2DArray&&(ue=35866),A.isDataTexture3D&&(ue=32879),Ne(P,A),t.activeTexture(33984+re),t.bindTexture(ue,P.__webglTexture),s.pixelStorei(37440,A.flipY),s.pixelStorei(37441,A.premultiplyAlpha),s.pixelStorei(3317,A.unpackAlignment),s.pixelStorei(37443,0);const be=y(A)&&_(A.image)===!1,ce=p(A.image,be,!1,u),tt=_(ce)||a,Ye=r.convert(A.format);let ye=r.convert(A.type),F=I(A.internalFormat,Ye,ye,A.encoding);Te(ue,A,tt);let ge;const pe=A.mipmaps,ot=a&&A.isVideoTexture!==!0,Ue=P.__version===void 0,ht=O(A,ce,tt);if(A.isDepthTexture)F=6402,a?A.type===ri?F=36012:A.type===as?F=33190:A.type===tr?F=35056:F=33189:A.type===ri&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),A.format===Oi&&F===6402&&A.type!==er&&A.type!==as&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),A.type=er,ye=r.convert(A.type)),A.format===Mi&&F===6402&&(F=34041,A.type!==tr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),A.type=tr,ye=r.convert(A.type))),ot&&Ue?t.texStorage2D(3553,1,F,ce.width,ce.height):t.texImage2D(3553,0,F,ce.width,ce.height,0,Ye,ye,null);else if(A.isDataTexture)if(pe.length>0&&tt){ot&&Ue&&t.texStorage2D(3553,ht,F,pe[0].width,pe[0].height);for(let Se=0,ut=pe.length;Se<ut;Se++)ge=pe[Se],ot?t.texSubImage2D(3553,0,0,0,ge.width,ge.height,Ye,ye,ge.data):t.texImage2D(3553,Se,F,ge.width,ge.height,0,Ye,ye,ge.data);A.generateMipmaps=!1}else ot?(Ue&&t.texStorage2D(3553,ht,F,ce.width,ce.height),t.texSubImage2D(3553,0,0,0,ce.width,ce.height,Ye,ye,ce.data)):t.texImage2D(3553,0,F,ce.width,ce.height,0,Ye,ye,ce.data);else if(A.isCompressedTexture){ot&&Ue&&t.texStorage2D(3553,ht,F,pe[0].width,pe[0].height);for(let Se=0,ut=pe.length;Se<ut;Se++)ge=pe[Se],A.format!==on&&A.format!==bi?Ye!==null?ot?t.compressedTexSubImage2D(3553,Se,0,0,ge.width,ge.height,Ye,ge.data):t.compressedTexImage2D(3553,Se,F,ge.width,ge.height,0,ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ot?t.texSubImage2D(3553,Se,0,0,ge.width,ge.height,Ye,ye,ge.data):t.texImage2D(3553,Se,F,ge.width,ge.height,0,Ye,ye,ge.data)}else if(A.isDataTexture2DArray)ot?(Ue&&t.texStorage3D(35866,ht,F,ce.width,ce.height,ce.depth),t.texSubImage3D(35866,0,0,0,0,ce.width,ce.height,ce.depth,Ye,ye,ce.data)):t.texImage3D(35866,0,F,ce.width,ce.height,ce.depth,0,Ye,ye,ce.data);else if(A.isDataTexture3D)ot?(Ue&&t.texStorage3D(32879,ht,F,ce.width,ce.height,ce.depth),t.texSubImage3D(32879,0,0,0,0,ce.width,ce.height,ce.depth,Ye,ye,ce.data)):t.texImage3D(32879,0,F,ce.width,ce.height,ce.depth,0,Ye,ye,ce.data);else if(A.isFramebufferTexture)ot&&Ue?t.texStorage2D(3553,ht,F,ce.width,ce.height):t.texImage2D(3553,0,F,ce.width,ce.height,0,Ye,ye,null);else if(pe.length>0&&tt){ot&&Ue&&t.texStorage2D(3553,ht,F,pe[0].width,pe[0].height);for(let Se=0,ut=pe.length;Se<ut;Se++)ge=pe[Se],ot?t.texSubImage2D(3553,Se,0,0,Ye,ye,ge):t.texImage2D(3553,Se,F,Ye,ye,ge);A.generateMipmaps=!1}else ot?(Ue&&t.texStorage2D(3553,ht,F,ce.width,ce.height),t.texSubImage2D(3553,0,0,0,Ye,ye,ce)):t.texImage2D(3553,0,F,Ye,ye,ce);w(A,tt)&&L(ue),P.__version=A.version,A.onUpdate&&A.onUpdate(A)}function se(P,A,re){if(A.image.length!==6)return;Ne(P,A),t.activeTexture(33984+re),t.bindTexture(34067,P.__webglTexture),s.pixelStorei(37440,A.flipY),s.pixelStorei(37441,A.premultiplyAlpha),s.pixelStorei(3317,A.unpackAlignment),s.pixelStorei(37443,0);const ue=A&&(A.isCompressedTexture||A.image[0].isCompressedTexture),be=A.image[0]&&A.image[0].isDataTexture,ce=[];for(let Se=0;Se<6;Se++)!ue&&!be?ce[Se]=p(A.image[Se],!1,!0,c):ce[Se]=be?A.image[Se].image:A.image[Se];const tt=ce[0],Ye=_(tt)||a,ye=r.convert(A.format),F=r.convert(A.type),ge=I(A.internalFormat,ye,F,A.encoding),pe=a&&A.isVideoTexture!==!0,ot=P.__version===void 0;let Ue=O(A,tt,Ye);Te(34067,A,Ye);let ht;if(ue){pe&&ot&&t.texStorage2D(34067,Ue,ge,tt.width,tt.height);for(let Se=0;Se<6;Se++){ht=ce[Se].mipmaps;for(let ut=0;ut<ht.length;ut++){const jt=ht[ut];A.format!==on&&A.format!==bi?ye!==null?pe?t.compressedTexSubImage2D(34069+Se,ut,0,0,jt.width,jt.height,ye,jt.data):t.compressedTexImage2D(34069+Se,ut,ge,jt.width,jt.height,0,jt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):pe?t.texSubImage2D(34069+Se,ut,0,0,jt.width,jt.height,ye,F,jt.data):t.texImage2D(34069+Se,ut,ge,jt.width,jt.height,0,ye,F,jt.data)}}}else{ht=A.mipmaps,pe&&ot&&(ht.length>0&&Ue++,t.texStorage2D(34067,Ue,ge,ce[0].width,ce[0].height));for(let Se=0;Se<6;Se++)if(be){pe?t.texSubImage2D(34069+Se,0,0,0,ce[Se].width,ce[Se].height,ye,F,ce[Se].data):t.texImage2D(34069+Se,0,ge,ce[Se].width,ce[Se].height,0,ye,F,ce[Se].data);for(let ut=0;ut<ht.length;ut++){const Ht=ht[ut].image[Se].image;pe?t.texSubImage2D(34069+Se,ut+1,0,0,Ht.width,Ht.height,ye,F,Ht.data):t.texImage2D(34069+Se,ut+1,ge,Ht.width,Ht.height,0,ye,F,Ht.data)}}else{pe?t.texSubImage2D(34069+Se,0,0,0,ye,F,ce[Se]):t.texImage2D(34069+Se,0,ge,ye,F,ce[Se]);for(let ut=0;ut<ht.length;ut++){const jt=ht[ut];pe?t.texSubImage2D(34069+Se,ut+1,0,0,ye,F,jt.image[Se]):t.texImage2D(34069+Se,ut+1,ge,ye,F,jt.image[Se])}}}w(A,Ye)&&L(34067),P.__version=A.version,A.onUpdate&&A.onUpdate(A)}function ct(P,A,re,ue,be){const ce=r.convert(re.format),tt=r.convert(re.type),Ye=I(re.internalFormat,ce,tt,re.encoding);n.get(A).__hasExternalTextures||(be===32879||be===35866?t.texImage3D(be,0,Ye,A.width,A.height,A.depth,0,ce,tt,null):t.texImage2D(be,0,Ye,A.width,A.height,0,ce,tt,null)),t.bindFramebuffer(36160,P),A.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,ue,be,n.get(re).__webglTexture,0,Ie(A)):s.framebufferTexture2D(36160,ue,be,n.get(re).__webglTexture,0),t.bindFramebuffer(36160,null)}function Xe(P,A,re){if(s.bindRenderbuffer(36161,P),A.depthBuffer&&!A.stencilBuffer){let ue=33189;if(re||A.useRenderToTexture){const be=A.depthTexture;be&&be.isDepthTexture&&(be.type===ri?ue=36012:be.type===as&&(ue=33190));const ce=Ie(A);A.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,ce,ue,A.width,A.height):s.renderbufferStorageMultisample(36161,ce,ue,A.width,A.height)}else s.renderbufferStorage(36161,ue,A.width,A.height);s.framebufferRenderbuffer(36160,36096,36161,P)}else if(A.depthBuffer&&A.stencilBuffer){const ue=Ie(A);re&&A.useRenderbuffer?s.renderbufferStorageMultisample(36161,ue,35056,A.width,A.height):A.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,ue,35056,A.width,A.height):s.renderbufferStorage(36161,34041,A.width,A.height),s.framebufferRenderbuffer(36160,33306,36161,P)}else{const ue=A.isWebGLMultipleRenderTargets===!0?A.texture[0]:A.texture,be=r.convert(ue.format),ce=r.convert(ue.type),tt=I(ue.internalFormat,be,ce,ue.encoding),Ye=Ie(A);re&&A.useRenderbuffer?s.renderbufferStorageMultisample(36161,Ye,tt,A.width,A.height):A.useRenderToTexture?d.renderbufferStorageMultisampleEXT(36161,Ye,tt,A.width,A.height):s.renderbufferStorage(36161,tt,A.width,A.height)}s.bindRenderbuffer(36161,null)}function Ge(P,A){if(A&&A.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(A.depthTexture&&A.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(A.depthTexture).__webglTexture||A.depthTexture.image.width!==A.width||A.depthTexture.image.height!==A.height)&&(A.depthTexture.image.width=A.width,A.depthTexture.image.height=A.height,A.depthTexture.needsUpdate=!0),X(A.depthTexture,0);const ue=n.get(A.depthTexture).__webglTexture,be=Ie(A);if(A.depthTexture.format===Oi)A.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,ue,0,be):s.framebufferTexture2D(36160,36096,3553,ue,0);else if(A.depthTexture.format===Mi)A.useRenderToTexture?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,ue,0,be):s.framebufferTexture2D(36160,33306,3553,ue,0);else throw new Error("Unknown depthTexture format")}function We(P){const A=n.get(P),re=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!A.__autoAllocateDepthBuffer){if(re)throw new Error("target.depthTexture not supported in Cube render targets");Ge(A.__webglFramebuffer,P)}else if(re){A.__webglDepthbuffer=[];for(let ue=0;ue<6;ue++)t.bindFramebuffer(36160,A.__webglFramebuffer[ue]),A.__webglDepthbuffer[ue]=s.createRenderbuffer(),Xe(A.__webglDepthbuffer[ue],P,!1)}else t.bindFramebuffer(36160,A.__webglFramebuffer),A.__webglDepthbuffer=s.createRenderbuffer(),Xe(A.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Ct(P,A,re){const ue=n.get(P);A!==void 0&&ct(ue.__webglFramebuffer,P,P.texture,36064,3553),re!==void 0&&We(P)}function $(P){const A=P.texture,re=n.get(P),ue=n.get(A);P.addEventListener("dispose",N),P.isWebGLMultipleRenderTargets!==!0&&(ue.__webglTexture===void 0&&(ue.__webglTexture=s.createTexture()),ue.__version=A.version,o.memory.textures++);const be=P.isWebGLCubeRenderTarget===!0,ce=P.isWebGLMultipleRenderTargets===!0,tt=A.isDataTexture3D||A.isDataTexture2DArray,Ye=_(P)||a;if(a&&A.format===bi&&(A.type===ri||A.type===_i)&&(A.format=on,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),be){re.__webglFramebuffer=[];for(let ye=0;ye<6;ye++)re.__webglFramebuffer[ye]=s.createFramebuffer()}else if(re.__webglFramebuffer=s.createFramebuffer(),ce)if(i.drawBuffers){const ye=P.texture;for(let F=0,ge=ye.length;F<ge;F++){const pe=n.get(ye[F]);pe.__webglTexture===void 0&&(pe.__webglTexture=s.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(P.useRenderbuffer)if(a){re.__webglMultisampledFramebuffer=s.createFramebuffer(),re.__webglColorRenderbuffer=s.createRenderbuffer(),s.bindRenderbuffer(36161,re.__webglColorRenderbuffer);const ye=r.convert(A.format),F=r.convert(A.type),ge=I(A.internalFormat,ye,F,A.encoding),pe=Ie(P);s.renderbufferStorageMultisample(36161,pe,ge,P.width,P.height),t.bindFramebuffer(36160,re.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(36160,36064,36161,re.__webglColorRenderbuffer),s.bindRenderbuffer(36161,null),P.depthBuffer&&(re.__webglDepthRenderbuffer=s.createRenderbuffer(),Xe(re.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(be){t.bindTexture(34067,ue.__webglTexture),Te(34067,A,Ye);for(let ye=0;ye<6;ye++)ct(re.__webglFramebuffer[ye],P,A,36064,34069+ye);w(A,Ye)&&L(34067),t.unbindTexture()}else if(ce){const ye=P.texture;for(let F=0,ge=ye.length;F<ge;F++){const pe=ye[F],ot=n.get(pe);t.bindTexture(3553,ot.__webglTexture),Te(3553,pe,Ye),ct(re.__webglFramebuffer,P,pe,36064+F,3553),w(pe,Ye)&&L(3553)}t.unbindTexture()}else{let ye=3553;tt&&(a?ye=A.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(ye,ue.__webglTexture),Te(ye,A,Ye),ct(re.__webglFramebuffer,P,A,36064,ye),w(A,Ye)&&L(ye),t.unbindTexture()}P.depthBuffer&&We(P)}function he(P){const A=_(P)||a,re=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ue=0,be=re.length;ue<be;ue++){const ce=re[ue];if(w(ce,A)){const tt=P.isWebGLCubeRenderTarget?34067:3553,Ye=n.get(ce).__webglTexture;t.bindTexture(tt,Ye),L(tt),t.unbindTexture()}}}function me(P){if(P.useRenderbuffer)if(a){const A=P.width,re=P.height;let ue=16384;const be=[36064],ce=P.stencilBuffer?33306:36096;P.depthBuffer&&be.push(ce),P.ignoreDepthForMultisampleCopy||(P.depthBuffer&&(ue|=256),P.stencilBuffer&&(ue|=1024));const tt=n.get(P);t.bindFramebuffer(36008,tt.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,tt.__webglFramebuffer),P.ignoreDepthForMultisampleCopy&&(s.invalidateFramebuffer(36008,[ce]),s.invalidateFramebuffer(36009,[ce])),s.blitFramebuffer(0,0,A,re,0,0,A,re,ue,9728),s.invalidateFramebuffer(36008,be),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,tt.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function Ie(P){return a&&(P.useRenderbuffer||P.useRenderToTexture)?Math.min(h,P.samples):0}function we(P){const A=o.render.frame;m.get(P)!==A&&(m.set(P,A),P.update())}let rt=!1,st=!1;function vt(P,A){P&&P.isWebGLRenderTarget&&(rt===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),rt=!0),P=P.texture),X(P,A)}function $t(P,A){P&&P.isWebGLCubeRenderTarget&&(st===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),st=!0),P=P.texture),K(P,A)}this.allocateTextureUnit=G,this.resetTextureUnits=q,this.setTexture2D=X,this.setTexture2DArray=_e,this.setTexture3D=Le,this.setTextureCube=K,this.rebindTextures=Ct,this.setupRenderTarget=$,this.updateRenderTargetMipmap=he,this.updateMultisampleRenderTarget=me,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=ct,this.safeSetTexture2D=vt,this.safeSetTextureCube=$t}function gh(s,e,t){const n=t.isWebGL2;function i(r){let o;if(r===ii)return 5121;if(r===Rl)return 32819;if(r===$o)return 32820;if(r===Ko)return 33635;if(r===Ll)return 5120;if(r===Yo)return 5122;if(r===er)return 5123;if(r===Jo)return 5124;if(r===as)return 5125;if(r===ri)return 5126;if(r===_i)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(r===nr)return 6406;if(r===bi)return 6407;if(r===on)return 6408;if(r===Qo)return 6409;if(r===ea)return 6410;if(r===Oi)return 6402;if(r===Mi)return 34041;if(r===ta)return 6403;if(r===na)return 36244;if(r===ls)return 33319;if(r===ia)return 33320;if(r===ra)return 36248;if(r===sa)return 36249;if(r===cs||r===Tr||r===us||r===hs)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(r===cs)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Tr)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===us)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===hs)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===oo||r===ao||r===fs||r===ds)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(r===oo)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===ao)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===fs)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===ds)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===oa)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((r===lo||r===b)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(r===lo)return o.COMPRESSED_RGB8_ETC2;if(r===b)return o.COMPRESSED_RGBA8_ETC2_EAC}if(r===D||r===R||r===B||r===z||r===S||r===k||r===Y||r===oe||r===ae||r===fe||r===de||r===Ee||r===De||r===Pe||r===J||r===je||r===Ve||r===Dt||r===Be||r===Gt||r===_n||r===Nn||r===En||r===qn||r===Xn||r===si||r===Er||r===an)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?r:null;if(r===Ae)return o=e.get("EXT_texture_compression_bptc"),o!==null?r:null;if(r===tr)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}class cc extends wn{constructor(e=[]){super(),this.cameras=e}}cc.prototype.isArrayCamera=!0;class Or extends bt{constructor(){super(),this.type="Group"}}Or.prototype.isGroup=!0;const zv={type:"move"};class uc{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Or,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 Or,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Or,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(zv))),c&&e.hand){o=!0;for(const v of e.hand.values()){const x=t.getJointPose(v,n);if(c.joints[v.jointName]===void 0){const p=new Or;p.matrixAutoUpdate=!1,p.visible=!1,c.joints[v.jointName]=p,c.add(p)}const g=c.joints[v.jointName];x!==null&&(g.matrix.fromArray(x.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=x.radius),g.visible=x!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}}class Ha extends dn{constructor(e,t,n,i,r,o,a,l,c,u){if(u=u!==void 0?u:Oi,u!==Oi&&u!==Mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Oi&&(n=er),n===void 0&&u===Mi&&(n=tr),super(null,i,r,o,a,l,u,n,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:Kt,this.minFilter=l!==void 0?l:Kt,this.flipY=!1,this.generateMipmaps=!1}}Ha.prototype.isDepthTexture=!0;class Uv extends rr{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor";const l=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,u=null,h=null,f=null,d=!1,m=null;const v=t.getContextAttributes();let x=null,g=null;const p=[],_=new Map,y=new wn;y.layers.enable(1),y.viewport=new Nt;const w=new wn;w.layers.enable(2),w.viewport=new Nt;const L=[y,w],I=new cc;I.layers.enable(1),I.layers.enable(2);let O=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let te=p[K];return te===void 0&&(te=new uc,p[K]=te),te.getTargetRaySpace()},this.getControllerGrip=function(K){let te=p[K];return te===void 0&&(te=new uc,p[K]=te),te.getGripSpace()},this.getHand=function(K){let te=p[K];return te===void 0&&(te=new uc,p[K]=te),te.getHandSpace()};function V(K){const te=_.get(K.inputSource);te&&te.dispatchEvent({type:K.type,data:K.inputSource})}function N(){_.forEach(function(K,te){K.disconnect(te)}),_.clear(),O=null,j=null,e.setRenderTarget(x),f=null,h=null,u=null,i=null,g=null,Le.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){r=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){a=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=function(K){return io(this,null,function*(){if(i=K,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",V),i.addEventListener("selectstart",V),i.addEventListener("selectend",V),i.addEventListener("squeeze",V),i.addEventListener("squeezestart",V),i.addEventListener("squeezeend",V),i.addEventListener("end",N),i.addEventListener("inputsourceschange",T),v.xrCompatible!==!0&&(yield t.makeXRCompatible()),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const te={antialias:i.renderState.layers===void 0?v.antialias:!0,alpha:v.alpha,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,te),i.updateRenderState({baseLayer:f}),g=new Jn(f.framebufferWidth,f.framebufferHeight,{format:on,type:ii,encoding:e.outputEncoding})}else{d=v.antialias;let te=null,Re=null,Te=null;v.depth&&(Te=v.stencil?35056:33190,te=v.stencil?Mi:Oi,Re=v.stencil?tr:er);const Ne={colorFormat:v.alpha||d?32856:32849,depthFormat:Te,scaleFactor:r};u=new XRWebGLBinding(i,t),h=u.createProjectionLayer(Ne),i.updateRenderState({layers:[h]}),d?g=new ua(h.textureWidth,h.textureHeight,{format:on,type:ii,depthTexture:new Ha(h.textureWidth,h.textureHeight,Re,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:v.stencil,ignoreDepth:h.ignoreDepthValues,useRenderToTexture:l,encoding:e.outputEncoding}):g=new Jn(h.textureWidth,h.textureHeight,{format:v.alpha?on:bi,type:ii,depthTexture:new Ha(h.textureWidth,h.textureHeight,Re,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:v.stencil,ignoreDepth:h.ignoreDepthValues,encoding:e.outputEncoding})}this.setFoveation(1),o=yield i.requestReferenceSpace(a),Le.setContext(i),Le.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}})};function T(K){const te=i.inputSources;for(let Re=0;Re<p.length;Re++)_.set(te[Re],p[Re]);for(let Re=0;Re<K.removed.length;Re++){const Te=K.removed[Re],Ne=_.get(Te);Ne&&(Ne.dispatchEvent({type:"disconnected",data:Te}),_.delete(Te))}for(let Re=0;Re<K.added.length;Re++){const Te=K.added[Re],Ne=_.get(Te);Ne&&Ne.dispatchEvent({type:"connected",data:Te})}}const C=new M,U=new M;function q(K,te,Re){C.setFromMatrixPosition(te.matrixWorld),U.setFromMatrixPosition(Re.matrixWorld);const Te=C.distanceTo(U),Ne=te.projectionMatrix.elements,wt=Re.projectionMatrix.elements,se=Ne[14]/(Ne[10]-1),ct=Ne[14]/(Ne[10]+1),Xe=(Ne[9]+1)/Ne[5],Ge=(Ne[9]-1)/Ne[5],We=(Ne[8]-1)/Ne[0],Ct=(wt[8]+1)/wt[0],$=se*We,he=se*Ct,me=Te/(-We+Ct),Ie=me*-We;te.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(Ie),K.translateZ(me),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const we=se+me,rt=ct+me,st=$-Ie,vt=he+(Te-Ie),$t=Xe*ct/rt*we,P=Ge*ct/rt*we;K.projectionMatrix.makePerspective(st,vt,$t,P,we,rt)}function G(K,te){te===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(te.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(i===null)return;I.near=w.near=y.near=K.near,I.far=w.far=y.far=K.far,(O!==I.near||j!==I.far)&&(i.updateRenderState({depthNear:I.near,depthFar:I.far}),O=I.near,j=I.far);const te=K.parent,Re=I.cameras;G(I,te);for(let Ne=0;Ne<Re.length;Ne++)G(Re[Ne],te);I.matrixWorld.decompose(I.position,I.quaternion,I.scale),K.position.copy(I.position),K.quaternion.copy(I.quaternion),K.scale.copy(I.scale),K.matrix.copy(I.matrix),K.matrixWorld.copy(I.matrixWorld);const Te=K.children;for(let Ne=0,wt=Te.length;Ne<wt;Ne++)Te[Ne].updateMatrixWorld(!0);Re.length===2?q(I,y,w):I.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return I},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(K){h!==null&&(h.fixedFoveation=K),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=K)};let X=null;function _e(K,te){if(c=te.getViewerPose(o),m=te,c!==null){const Te=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let Ne=!1;Te.length!==I.cameras.length&&(I.cameras.length=0,Ne=!0);for(let wt=0;wt<Te.length;wt++){const se=Te[wt];let ct=null;if(f!==null)ct=f.getViewport(se);else{const Ge=u.getViewSubImage(h,se);ct=Ge.viewport,wt===0&&(e.setRenderTargetTextures(g,Ge.colorTexture,h.ignoreDepthValues?void 0:Ge.depthStencilTexture),e.setRenderTarget(g))}const Xe=L[wt];Xe.matrix.fromArray(se.transform.matrix),Xe.projectionMatrix.fromArray(se.projectionMatrix),Xe.viewport.set(ct.x,ct.y,ct.width,ct.height),wt===0&&I.matrix.copy(Xe.matrix),Ne===!0&&I.cameras.push(Xe)}}const Re=i.inputSources;for(let Te=0;Te<p.length;Te++){const Ne=p[Te],wt=Re[Te];Ne.update(wt,te,o)}X&&X(K,te),m=null}const Le=new Bu;Le.setAnimationLoop(_e),this.setAnimationLoop=function(K){X=K},this.dispose=function(){}}}function Gv(s){function e(g,p){g.fogColor.value.copy(p.color),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function t(g,p,_,y,w){p.isMeshBasicMaterial?n(g,p):p.isMeshLambertMaterial?(n(g,p),l(g,p)):p.isMeshToonMaterial?(n(g,p),u(g,p)):p.isMeshPhongMaterial?(n(g,p),c(g,p)):p.isMeshStandardMaterial?(n(g,p),p.isMeshPhysicalMaterial?f(g,p,w):h(g,p)):p.isMeshMatcapMaterial?(n(g,p),d(g,p)):p.isMeshDepthMaterial?(n(g,p),m(g,p)):p.isMeshDistanceMaterial?(n(g,p),v(g,p)):p.isMeshNormalMaterial?(n(g,p),x(g,p)):p.isLineBasicMaterial?(i(g,p),p.isLineDashedMaterial&&r(g,p)):p.isPointsMaterial?o(g,p,_,y):p.isSpriteMaterial?a(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function n(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.specularMap&&(g.specularMap.value=p.specularMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const _=s.get(p).envMap;_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity);let y;p.map?y=p.map:p.specularMap?y=p.specularMap:p.displacementMap?y=p.displacementMap:p.normalMap?y=p.normalMap:p.bumpMap?y=p.bumpMap:p.roughnessMap?y=p.roughnessMap:p.metalnessMap?y=p.metalnessMap:p.alphaMap?y=p.alphaMap:p.emissiveMap?y=p.emissiveMap:p.clearcoatMap?y=p.clearcoatMap:p.clearcoatNormalMap?y=p.clearcoatNormalMap:p.clearcoatRoughnessMap?y=p.clearcoatRoughnessMap:p.specularIntensityMap?y=p.specularIntensityMap:p.specularColorMap?y=p.specularColorMap:p.transmissionMap?y=p.transmissionMap:p.thicknessMap?y=p.thicknessMap:p.sheenColorMap?y=p.sheenColorMap:p.sheenRoughnessMap&&(y=p.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let w;p.aoMap?w=p.aoMap:p.lightMap&&(w=p.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),g.uv2Transform.value.copy(w.matrix))}function i(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity}function r(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function o(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let w;p.map?w=p.map:p.alphaMap&&(w=p.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),g.uvTransform.value.copy(w.matrix))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map),p.alphaMap&&(g.alphaMap.value=p.alphaMap),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);let _;p.map?_=p.map:p.alphaMap&&(_=p.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),g.uvTransform.value.copy(_.matrix))}function l(g,p){p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap)}function c(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===pt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===pt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===pt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===pt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function h(g,p){g.roughness.value=p.roughness,g.metalness.value=p.metalness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap),p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===pt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===pt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),s.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,_){h(g,p),g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap)),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap),p.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),g.clearcoatNormalMap.value=p.clearcoatNormalMap,p.side===pt&&g.clearcoatNormalScale.value.negate())),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap)}function d(g,p){p.matcap&&(g.matcap.value=p.matcap),p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===pt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===pt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function m(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}function v(g,p){p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),g.referencePosition.value.copy(p.referencePosition),g.nearDistance.value=p.nearDistance,g.farDistance.value=p.farDistance}function x(g,p){p.bumpMap&&(g.bumpMap.value=p.bumpMap,g.bumpScale.value=p.bumpScale,p.side===pt&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,g.normalScale.value.copy(p.normalScale),p.side===pt&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function Hv(){const s=ca("canvas");return s.style.display="block",s}function Ot(s={}){const e=s.canvas!==void 0?s.canvas:Hv(),t=s.context!==void 0?s.context:null,n=s.alpha!==void 0?s.alpha:!1,i=s.depth!==void 0?s.depth:!0,r=s.stencil!==void 0?s.stencil:!0,o=s.antialias!==void 0?s.antialias:!1,a=s.premultipliedAlpha!==void 0?s.premultipliedAlpha:!0,l=s.preserveDrawingBuffer!==void 0?s.preserveDrawingBuffer:!1,c=s.powerPreference!==void 0?s.powerPreference:"default",u=s.failIfMajorPerformanceCaveat!==void 0?s.failIfMajorPerformanceCaveat:!1;let h=null,f=null;const d=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=oi,this.physicallyCorrectLights=!1,this.toneMapping=li,this.toneMappingExposure=1;const v=this;let x=!1,g=0,p=0,_=null,y=-1,w=null;const L=new Nt,I=new Nt;let O=null,j=e.width,V=e.height,N=1,T=null,C=null;const U=new Nt(0,0,j,V),q=new Nt(0,0,j,V);let G=!1;const X=[],_e=new xo;let Le=!1,K=!1,te=null;const Re=new Oe,Te=new M,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function wt(){return _===null?N:1}let se=t;function ct(E,H){for(let Z=0;Z<E.length;Z++){const W=E[Z],ne=e.getContext(W,H);if(ne!==null)return ne}return null}try{const E={alpha:n,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${qe}`),e.addEventListener("webglcontextlost",ot,!1),e.addEventListener("webglcontextrestored",Ue,!1),se===null){const H=["webgl2","webgl","experimental-webgl"];if(v.isWebGL1Renderer===!0&&H.shift(),se=ct(H,E),se===null)throw ct(H)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}se.getShaderPrecisionFormat===void 0&&(se.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let Xe,Ge,We,Ct,$,he,me,Ie,we,rt,st,vt,$t,P,A,re,ue,be,ce,tt,Ye,ye,F;function ge(){Xe=new lg(se),Ge=new ng(se,Xe,s),Xe.init(Ge),ye=new gh(se,Xe,Ge),We=new Nv(se,Xe,Ge),X[0]=1029,Ct=new hg(se),$=new Tv,he=new Ov(se,Xe,We,$,Ge,ye,Ct),me=new rg(v),Ie=new ag(v),we=new rp(se,Ge),F=new eg(se,Xe,we,Ge),rt=new cg(se,we,Ct,F),st=new mg(se,rt,we,Ct),ce=new pg(se,Ge,he),re=new ig($),vt=new Sv(v,me,Ie,Xe,Ge,F,re),$t=new Gv($),P=new Av,A=new Iv(Xe,Ge),be=new Qm(v,me,We,st,a),ue=new mh(v,st,Ge),tt=new tg(se,Xe,Ct,Ge),Ye=new ug(se,Xe,Ct,Ge),Ct.programs=vt.programs,v.capabilities=Ge,v.extensions=Xe,v.properties=$,v.renderLists=P,v.shadowMap=ue,v.state=We,v.info=Ct}ge();const pe=new Uv(v,se);this.xr=pe,this.getContext=function(){return se},this.getContextAttributes=function(){return se.getContextAttributes()},this.forceContextLoss=function(){const E=Xe.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=Xe.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(E){E!==void 0&&(N=E,this.setSize(j,V,!1))},this.getSize=function(E){return E.set(j,V)},this.setSize=function(E,H,Z){if(pe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}j=E,V=H,e.width=Math.floor(E*N),e.height=Math.floor(H*N),Z!==!1&&(e.style.width=E+"px",e.style.height=H+"px"),this.setViewport(0,0,E,H)},this.getDrawingBufferSize=function(E){return E.set(j*N,V*N).floor()},this.setDrawingBufferSize=function(E,H,Z){j=E,V=H,N=Z,e.width=Math.floor(E*Z),e.height=Math.floor(H*Z),this.setViewport(0,0,E,H)},this.getCurrentViewport=function(E){return E.copy(L)},this.getViewport=function(E){return E.copy(U)},this.setViewport=function(E,H,Z,W){E.isVector4?U.set(E.x,E.y,E.z,E.w):U.set(E,H,Z,W),We.viewport(L.copy(U).multiplyScalar(N).floor())},this.getScissor=function(E){return E.copy(q)},this.setScissor=function(E,H,Z,W){E.isVector4?q.set(E.x,E.y,E.z,E.w):q.set(E,H,Z,W),We.scissor(I.copy(q).multiplyScalar(N).floor())},this.getScissorTest=function(){return G},this.setScissorTest=function(E){We.setScissorTest(G=E)},this.setOpaqueSort=function(E){T=E},this.setTransparentSort=function(E){C=E},this.getClearColor=function(E){return E.copy(be.getClearColor())},this.setClearColor=function(){be.setClearColor.apply(be,arguments)},this.getClearAlpha=function(){return be.getClearAlpha()},this.setClearAlpha=function(){be.setClearAlpha.apply(be,arguments)},this.clear=function(E,H,Z){let W=0;(E===void 0||E)&&(W|=16384),(H===void 0||H)&&(W|=256),(Z===void 0||Z)&&(W|=1024),se.clear(W)},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",ot,!1),e.removeEventListener("webglcontextrestored",Ue,!1),P.dispose(),A.dispose(),$.dispose(),me.dispose(),Ie.dispose(),st.dispose(),F.dispose(),vt.dispose(),pe.dispose(),pe.removeEventListener("sessionstart",Ri),pe.removeEventListener("sessionend",Pi),te&&(te.dispose(),te=null),Qr.stop()};function ot(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Ue(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const E=Ct.autoReset,H=ue.enabled,Z=ue.autoUpdate,W=ue.needsUpdate,ne=ue.type;ge(),Ct.autoReset=E,ue.enabled=H,ue.autoUpdate=Z,ue.needsUpdate=W,ue.type=ne}function ht(E){const H=E.target;H.removeEventListener("dispose",ht),Se(H)}function Se(E){ut(E),$.remove(E)}function ut(E){const H=$.get(E).programs;H!==void 0&&(H.forEach(function(Z){vt.releaseProgram(Z)}),E.isShaderMaterial&&vt.releaseShaderCache(E))}this.renderBufferDirect=function(E,H,Z,W,ne,nt){H===null&&(H=Ne);const at=ne.isMesh&&ne.matrixWorld.determinant()<0,yt=Vx(E,H,Z,W,ne);We.setMaterial(W,at);let it=Z.index;const Lt=Z.attributes.position;if(it===null){if(Lt===void 0||Lt.count===0)return}else if(it.count===0)return;let xt=1;W.wireframe===!0&&(it=rt.getWireframeAttribute(Z),xt=2),F.setup(ne,W,yt,Z,it);let Et,sn=tt;it!==null&&(Et=we.get(it),sn=Ye,sn.setIndex(Et));const es=it!==null?it.count:Lt.count,no=Z.drawRange.start*xt,It=Z.drawRange.count*xt,Di=nt!==null?nt.start*xt:0,vn=nt!==null?nt.count*xt:1/0,Ii=Math.max(no,Di),Sl=Math.min(es,no+It,Di+vn)-1,Fi=Math.max(0,Sl-Ii+1);if(Fi!==0){if(ne.isMesh)W.wireframe===!0?(We.setLineWidth(W.wireframeLinewidth*wt()),sn.setMode(1)):sn.setMode(4);else if(ne.isLine){let Yi=W.linewidth;Yi===void 0&&(Yi=1),We.setLineWidth(Yi*wt()),ne.isLineSegments?sn.setMode(1):ne.isLineLoop?sn.setMode(2):sn.setMode(3)}else ne.isPoints?sn.setMode(0):ne.isSprite&&sn.setMode(4);if(ne.isInstancedMesh)sn.renderInstances(Ii,Fi,ne.count);else if(Z.isInstancedBufferGeometry){const Yi=Math.min(Z.instanceCount,Z._maxInstanceCount);sn.renderInstances(Ii,Fi,Yi)}else sn.render(Ii,Fi)}},this.compile=function(E,H){f=A.get(E),f.init(),m.push(f),E.traverseVisible(function(Z){Z.isLight&&Z.layers.test(H.layers)&&(f.pushLight(Z),Z.castShadow&&f.pushShadow(Z))}),f.setupLights(v.physicallyCorrectLights),E.traverse(function(Z){const W=Z.material;if(W)if(Array.isArray(W))for(let ne=0;ne<W.length;ne++){const nt=W[ne];ru(nt,E,Z)}else ru(W,E,Z)}),m.pop(),f=null};let jt=null;function Ht(E){jt&&jt(E)}function Ri(){Qr.stop()}function Pi(){Qr.start()}const Qr=new Bu;Qr.setAnimationLoop(Ht),typeof window!="undefined"&&Qr.setContext(window),this.setAnimationLoop=function(E){jt=E,pe.setAnimationLoop(E),E===null?Qr.stop():Qr.start()},pe.addEventListener("sessionstart",Ri),pe.addEventListener("sessionend",Pi),this.render=function(E,H){if(H!==void 0&&H.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;E.autoUpdate===!0&&E.updateMatrixWorld(),H.parent===null&&H.updateMatrixWorld(),pe.enabled===!0&&pe.isPresenting===!0&&(pe.cameraAutoUpdate===!0&&pe.updateCamera(H),H=pe.getCamera()),E.isScene===!0&&E.onBeforeRender(v,E,H,_),f=A.get(E,m.length),f.init(),m.push(f),Re.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),_e.setFromProjectionMatrix(Re),K=this.localClippingEnabled,Le=re.init(this.clippingPlanes,K,H),h=P.get(E,d.length),h.init(),d.push(h),jf(E,H,0,v.sortObjects),h.finish(),v.sortObjects===!0&&h.sort(T,C),Le===!0&&re.beginShadows();const Z=f.state.shadowsArray;if(ue.render(Z,E,H),Le===!0&&re.endShadows(),this.info.autoReset===!0&&this.info.reset(),be.render(h,E),f.setupLights(v.physicallyCorrectLights),H.isArrayCamera){const W=H.cameras;for(let ne=0,nt=W.length;ne<nt;ne++){const at=W[ne];Yf(h,E,at,at.viewport)}}else Yf(h,E,H);_!==null&&(he.updateMultisampleRenderTarget(_),he.updateRenderTargetMipmap(_)),E.isScene===!0&&E.onAfterRender(v,E,H),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1),F.resetDefaultState(),y=-1,w=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function jf(E,H,Z,W){if(E.visible===!1)return;if(E.layers.test(H.layers)){if(E.isGroup)Z=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(H);else if(E.isLight)f.pushLight(E),E.castShadow&&f.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||_e.intersectsSprite(E)){W&&Te.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Re);const at=st.update(E),yt=E.material;yt.visible&&h.push(E,at,yt,Z,Te.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(E.isSkinnedMesh&&E.skeleton.frame!==Ct.render.frame&&(E.skeleton.update(),E.skeleton.frame=Ct.render.frame),!E.frustumCulled||_e.intersectsObject(E))){W&&Te.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Re);const at=st.update(E),yt=E.material;if(Array.isArray(yt)){const it=at.groups;for(let Lt=0,xt=it.length;Lt<xt;Lt++){const Et=it[Lt],sn=yt[Et.materialIndex];sn&&sn.visible&&h.push(E,at,sn,Z,Te.z,Et)}}else yt.visible&&h.push(E,at,yt,Z,Te.z,null)}}const nt=E.children;for(let at=0,yt=nt.length;at<yt;at++)jf(nt[at],H,Z,W)}function Yf(E,H,Z,W){const ne=E.opaque,nt=E.transmissive,at=E.transparent;f.setupLightsView(Z),nt.length>0&&Hx(ne,H,Z),W&&We.viewport(L.copy(W)),ne.length>0&&wl(ne,H,Z),nt.length>0&&wl(nt,H,Z),at.length>0&&wl(at,H,Z)}function Hx(E,H,Z){if(te===null){const at=o===!0&&Ge.isWebGL2===!0?ua:Jn;te=new at(1024,1024,{generateMipmaps:!0,type:ye.convert(_i)!==null?_i:ii,minFilter:Qi,magFilter:Kt,wrapS:xn,wrapT:xn,useRenderToTexture:Xe.has("WEBGL_multisampled_render_to_texture")})}const W=v.getRenderTarget();v.setRenderTarget(te),v.clear();const ne=v.toneMapping;v.toneMapping=li,wl(E,H,Z),v.toneMapping=ne,he.updateMultisampleRenderTarget(te),he.updateRenderTargetMipmap(te),v.setRenderTarget(W)}function wl(E,H,Z){const W=H.isScene===!0?H.overrideMaterial:null;for(let ne=0,nt=E.length;ne<nt;ne++){const at=E[ne],yt=at.object,it=at.geometry,Lt=W===null?at.material:W,xt=at.group;yt.layers.test(Z.layers)&&kx(yt,H,Z,it,Lt,xt)}}function kx(E,H,Z,W,ne,nt){E.onBeforeRender(v,H,Z,W,ne,nt),E.modelViewMatrix.multiplyMatrices(Z.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),ne.onBeforeRender(v,H,Z,W,E,nt),ne.transparent===!0&&ne.side===Ft?(ne.side=pt,ne.needsUpdate=!0,v.renderBufferDirect(Z,H,W,ne,E,nt),ne.side=Q,ne.needsUpdate=!0,v.renderBufferDirect(Z,H,W,ne,E,nt),ne.side=Ft):v.renderBufferDirect(Z,H,W,ne,E,nt),E.onAfterRender(v,H,Z,W,ne,nt)}function ru(E,H,Z){H.isScene!==!0&&(H=Ne);const W=$.get(E),ne=f.state.lights,nt=f.state.shadowsArray,at=ne.state.version,yt=vt.getParameters(E,ne.state,nt,H,Z),it=vt.getProgramCacheKey(yt);let Lt=W.programs;W.environment=E.isMeshStandardMaterial?H.environment:null,W.fog=H.fog,W.envMap=(E.isMeshStandardMaterial?Ie:me).get(E.envMap||W.environment),Lt===void 0&&(E.addEventListener("dispose",ht),Lt=new Map,W.programs=Lt);let xt=Lt.get(it);if(xt!==void 0){if(W.currentProgram===xt&&W.lightsStateVersion===at)return Jf(E,yt),xt}else yt.uniforms=vt.getUniforms(E),E.onBuild(Z,yt,v),E.onBeforeCompile(yt,v),xt=vt.acquireProgram(yt,it),Lt.set(it,xt),W.uniforms=yt.uniforms;const Et=W.uniforms;(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Et.clippingPlanes=re.uniform),Jf(E,yt),W.needsLights=qx(E),W.lightsStateVersion=at,W.needsLights&&(Et.ambientLightColor.value=ne.state.ambient,Et.lightProbe.value=ne.state.probe,Et.directionalLights.value=ne.state.directional,Et.directionalLightShadows.value=ne.state.directionalShadow,Et.spotLights.value=ne.state.spot,Et.spotLightShadows.value=ne.state.spotShadow,Et.rectAreaLights.value=ne.state.rectArea,Et.ltc_1.value=ne.state.rectAreaLTC1,Et.ltc_2.value=ne.state.rectAreaLTC2,Et.pointLights.value=ne.state.point,Et.pointLightShadows.value=ne.state.pointShadow,Et.hemisphereLights.value=ne.state.hemi,Et.directionalShadowMap.value=ne.state.directionalShadowMap,Et.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,Et.spotShadowMap.value=ne.state.spotShadowMap,Et.spotShadowMatrix.value=ne.state.spotShadowMatrix,Et.pointShadowMap.value=ne.state.pointShadowMap,Et.pointShadowMatrix.value=ne.state.pointShadowMatrix);const sn=xt.getUniforms(),es=mr.seqWithValue(sn.seq,Et);return W.currentProgram=xt,W.uniformsList=es,xt}function Jf(E,H){const Z=$.get(E);Z.outputEncoding=H.outputEncoding,Z.instancing=H.instancing,Z.skinning=H.skinning,Z.morphTargets=H.morphTargets,Z.morphNormals=H.morphNormals,Z.morphTargetsCount=H.morphTargetsCount,Z.numClippingPlanes=H.numClippingPlanes,Z.numIntersection=H.numClipIntersection,Z.vertexAlphas=H.vertexAlphas,Z.vertexTangents=H.vertexTangents,Z.toneMapping=H.toneMapping}function Vx(E,H,Z,W,ne){H.isScene!==!0&&(H=Ne),he.resetTextureUnits();const nt=H.fog,at=W.isMeshStandardMaterial?H.environment:null,yt=_===null?v.outputEncoding:_.texture.encoding,it=(W.isMeshStandardMaterial?Ie:me).get(W.envMap||at),Lt=W.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,xt=!!W.normalMap&&!!Z.attributes.tangent,Et=!!Z.morphAttributes.position,sn=!!Z.morphAttributes.normal,es=Z.morphAttributes.position?Z.morphAttributes.position.length:0,no=W.toneMapped?v.toneMapping:li,It=$.get(W),Di=f.state.lights;if(Le===!0&&(K===!0||E!==w)){const mi=E===w&&W.id===y;re.setState(W,E,mi)}let vn=!1;W.version===It.__version?(It.needsLights&&It.lightsStateVersion!==Di.state.version||It.outputEncoding!==yt||ne.isInstancedMesh&&It.instancing===!1||!ne.isInstancedMesh&&It.instancing===!0||ne.isSkinnedMesh&&It.skinning===!1||!ne.isSkinnedMesh&&It.skinning===!0||It.envMap!==it||W.fog&&It.fog!==nt||It.numClippingPlanes!==void 0&&(It.numClippingPlanes!==re.numPlanes||It.numIntersection!==re.numIntersection)||It.vertexAlphas!==Lt||It.vertexTangents!==xt||It.morphTargets!==Et||It.morphNormals!==sn||It.toneMapping!==no||Ge.isWebGL2===!0&&It.morphTargetsCount!==es)&&(vn=!0):(vn=!0,It.__version=W.version);let Ii=It.currentProgram;vn===!0&&(Ii=ru(W,H,ne));let Sl=!1,Fi=!1,Yi=!1;const Fn=Ii.getUniforms(),Wo=It.uniforms;if(We.useProgram(Ii.program)&&(Sl=!0,Fi=!0,Yi=!0),W.id!==y&&(y=W.id,Fi=!0),Sl||w!==E){if(Fn.setValue(se,"projectionMatrix",E.projectionMatrix),Ge.logarithmicDepthBuffer&&Fn.setValue(se,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),w!==E&&(w=E,Fi=!0,Yi=!0),W.isShaderMaterial||W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshStandardMaterial||W.envMap){const mi=Fn.map.cameraPosition;mi!==void 0&&mi.setValue(se,Te.setFromMatrixPosition(E.matrixWorld))}(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&Fn.setValue(se,"isOrthographic",E.isOrthographicCamera===!0),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial||W.isShadowMaterial||ne.isSkinnedMesh)&&Fn.setValue(se,"viewMatrix",E.matrixWorldInverse)}if(ne.isSkinnedMesh){Fn.setOptional(se,ne,"bindMatrix"),Fn.setOptional(se,ne,"bindMatrixInverse");const mi=ne.skeleton;mi&&(Ge.floatVertexTextures?(mi.boneTexture===null&&mi.computeBoneTexture(),Fn.setValue(se,"boneTexture",mi.boneTexture,he),Fn.setValue(se,"boneTextureSize",mi.boneTextureSize)):Fn.setOptional(se,mi,"boneMatrices"))}return!!Z&&(Z.morphAttributes.position!==void 0||Z.morphAttributes.normal!==void 0)&&ce.update(ne,Z,W,Ii),(Fi||It.receiveShadow!==ne.receiveShadow)&&(It.receiveShadow=ne.receiveShadow,Fn.setValue(se,"receiveShadow",ne.receiveShadow)),Fi&&(Fn.setValue(se,"toneMappingExposure",v.toneMappingExposure),It.needsLights&&Wx(Wo,Yi),nt&&W.fog&&$t.refreshFogUniforms(Wo,nt),$t.refreshMaterialUniforms(Wo,W,N,V,te),mr.upload(se,It.uniformsList,Wo,he)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(mr.upload(se,It.uniformsList,Wo,he),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&Fn.setValue(se,"center",ne.center),Fn.setValue(se,"modelViewMatrix",ne.modelViewMatrix),Fn.setValue(se,"normalMatrix",ne.normalMatrix),Fn.setValue(se,"modelMatrix",ne.matrixWorld),Ii}function Wx(E,H){E.ambientLightColor.needsUpdate=H,E.lightProbe.needsUpdate=H,E.directionalLights.needsUpdate=H,E.directionalLightShadows.needsUpdate=H,E.pointLights.needsUpdate=H,E.pointLightShadows.needsUpdate=H,E.spotLights.needsUpdate=H,E.spotLightShadows.needsUpdate=H,E.rectAreaLights.needsUpdate=H,E.hemisphereLights.needsUpdate=H}function qx(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(E,H,Z){$.get(E.texture).__webglTexture=H,$.get(E.depthTexture).__webglTexture=Z;const W=$.get(E);W.__hasExternalTextures=!0,W.__hasExternalTextures&&(W.__autoAllocateDepthBuffer=Z===void 0,W.__autoAllocateDepthBuffer||E.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),E.useRenderToTexture=!1,E.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(E,H){const Z=$.get(E);Z.__webglFramebuffer=H,Z.__useDefaultFramebuffer=H===void 0},this.setRenderTarget=function(E,H=0,Z=0){_=E,g=H,p=Z;let W=!0;if(E){const it=$.get(E);it.__useDefaultFramebuffer!==void 0?(We.bindFramebuffer(36160,null),W=!1):it.__webglFramebuffer===void 0?he.setupRenderTarget(E):it.__hasExternalTextures&&he.rebindTextures(E,$.get(E.texture).__webglTexture,$.get(E.depthTexture).__webglTexture)}let ne=null,nt=!1,at=!1;if(E){const it=E.texture;(it.isDataTexture3D||it.isDataTexture2DArray)&&(at=!0);const Lt=$.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(ne=Lt[H],nt=!0):E.useRenderbuffer?ne=$.get(E).__webglMultisampledFramebuffer:ne=Lt,L.copy(E.viewport),I.copy(E.scissor),O=E.scissorTest}else L.copy(U).multiplyScalar(N).floor(),I.copy(q).multiplyScalar(N).floor(),O=G;if(We.bindFramebuffer(36160,ne)&&Ge.drawBuffers&&W){let it=!1;if(E)if(E.isWebGLMultipleRenderTargets){const Lt=E.texture;if(X.length!==Lt.length||X[0]!==36064){for(let xt=0,Et=Lt.length;xt<Et;xt++)X[xt]=36064+xt;X.length=Lt.length,it=!0}}else(X.length!==1||X[0]!==36064)&&(X[0]=36064,X.length=1,it=!0);else(X.length!==1||X[0]!==1029)&&(X[0]=1029,X.length=1,it=!0);it&&(Ge.isWebGL2?se.drawBuffers(X):Xe.get("WEBGL_draw_buffers").drawBuffersWEBGL(X))}if(We.viewport(L),We.scissor(I),We.setScissorTest(O),nt){const it=$.get(E.texture);se.framebufferTexture2D(36160,36064,34069+H,it.__webglTexture,Z)}else if(at){const it=$.get(E.texture),Lt=H||0;se.framebufferTextureLayer(36160,36064,it.__webglTexture,Z||0,Lt)}y=-1},this.readRenderTargetPixels=function(E,H,Z,W,ne,nt,at){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let yt=$.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&at!==void 0&&(yt=yt[at]),yt){We.bindFramebuffer(36160,yt);try{const it=E.texture,Lt=it.format,xt=it.type;if(Lt!==on&&ye.convert(Lt)!==se.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Et=xt===_i&&(Xe.has("EXT_color_buffer_half_float")||Ge.isWebGL2&&Xe.has("EXT_color_buffer_float"));if(xt!==ii&&ye.convert(xt)!==se.getParameter(35738)&&!(xt===ri&&(Ge.isWebGL2||Xe.has("OES_texture_float")||Xe.has("WEBGL_color_buffer_float")))&&!Et){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se.checkFramebufferStatus(36160)===36053?H>=0&&H<=E.width-W&&Z>=0&&Z<=E.height-ne&&se.readPixels(H,Z,W,ne,ye.convert(Lt),ye.convert(xt),nt):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const it=_!==null?$.get(_).__webglFramebuffer:null;We.bindFramebuffer(36160,it)}}},this.copyFramebufferToTexture=function(E,H,Z=0){if(H.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const W=Math.pow(2,-Z),ne=Math.floor(H.image.width*W),nt=Math.floor(H.image.height*W);he.setTexture2D(H,0),se.copyTexSubImage2D(3553,Z,0,0,E.x,E.y,ne,nt),We.unbindTexture()},this.copyTextureToTexture=function(E,H,Z,W=0){const ne=H.image.width,nt=H.image.height,at=ye.convert(Z.format),yt=ye.convert(Z.type);he.setTexture2D(Z,0),se.pixelStorei(37440,Z.flipY),se.pixelStorei(37441,Z.premultiplyAlpha),se.pixelStorei(3317,Z.unpackAlignment),H.isDataTexture?se.texSubImage2D(3553,W,E.x,E.y,ne,nt,at,yt,H.image.data):H.isCompressedTexture?se.compressedTexSubImage2D(3553,W,E.x,E.y,H.mipmaps[0].width,H.mipmaps[0].height,at,H.mipmaps[0].data):se.texSubImage2D(3553,W,E.x,E.y,at,yt,H.image),W===0&&Z.generateMipmaps&&se.generateMipmap(3553),We.unbindTexture()},this.copyTextureToTexture3D=function(E,H,Z,W,ne=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const nt=E.max.x-E.min.x+1,at=E.max.y-E.min.y+1,yt=E.max.z-E.min.z+1,it=ye.convert(W.format),Lt=ye.convert(W.type);let xt;if(W.isDataTexture3D)he.setTexture3D(W,0),xt=32879;else if(W.isDataTexture2DArray)he.setTexture2DArray(W,0),xt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}se.pixelStorei(37440,W.flipY),se.pixelStorei(37441,W.premultiplyAlpha),se.pixelStorei(3317,W.unpackAlignment);const Et=se.getParameter(3314),sn=se.getParameter(32878),es=se.getParameter(3316),no=se.getParameter(3315),It=se.getParameter(32877),Di=Z.isCompressedTexture?Z.mipmaps[0]:Z.image;se.pixelStorei(3314,Di.width),se.pixelStorei(32878,Di.height),se.pixelStorei(3316,E.min.x),se.pixelStorei(3315,E.min.y),se.pixelStorei(32877,E.min.z),Z.isDataTexture||Z.isDataTexture3D?se.texSubImage3D(xt,ne,H.x,H.y,H.z,nt,at,yt,it,Lt,Di.data):Z.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),se.compressedTexSubImage3D(xt,ne,H.x,H.y,H.z,nt,at,yt,it,Di.data)):se.texSubImage3D(xt,ne,H.x,H.y,H.z,nt,at,yt,it,Lt,Di),se.pixelStorei(3314,Et),se.pixelStorei(32878,sn),se.pixelStorei(3316,es),se.pixelStorei(3315,no),se.pixelStorei(32877,It),ne===0&&W.generateMipmaps&&se.generateMipmap(xt),We.unbindTexture()},this.initTexture=function(E){he.setTexture2D(E,0),We.unbindTexture()},this.resetState=function(){g=0,p=0,_=null,We.reset(),F.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ot.prototype.isWebGLRenderer=!0;class vh extends Ot{}vh.prototype.isWebGL1Renderer=!0;class wo{constructor(e,t=25e-5){this.name="",this.color=new Me(e),this.density=t}clone(){return new wo(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}wo.prototype.isFogExp2=!0;class So{constructor(e,t=1,n=1e3){this.name="",this.color=new Me(e),this.near=t,this.far=n}clone(){return new So(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}So.prototype.isFog=!0;class ka extends bt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}ka.prototype.isScene=!0;class zr{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=gs,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Yn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Yn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Yn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}zr.prototype.isInterleavedBuffer=!0;const cn=new M;class gr{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)cn.x=this.getX(t),cn.y=this.getY(t),cn.z=this.getZ(t),cn.applyMatrix4(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)cn.x=this.getX(t),cn.y=this.getY(t),cn.z=this.getZ(t),cn.applyNormalMatrix(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)cn.x=this.getX(t),cn.y=this.getY(t),cn.z=this.getZ(t),cn.transformDirection(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new Tt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new gr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}gr.prototype.isInterleavedBufferAttribute=!0;class Va extends bn{constructor(e){super(),this.type="SpriteMaterial",this.color=new Me(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}Va.prototype.isSpriteMaterial=!0;let Us;const To=new M,Gs=new M,Hs=new M,ks=new ee,Eo=new ee,yh=new Oe,Wa=new M,Ao=new M,qa=new M,xh=new ee,hc=new ee,_h=new ee;class Xa extends bt{constructor(e){if(super(),this.type="Sprite",Us===void 0){Us=new $e;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new zr(t,5);Us.setIndex([0,1,2,0,2,3]),Us.setAttribute("position",new gr(n,3,0,!1)),Us.setAttribute("uv",new gr(n,2,3,!1))}this.geometry=Us,this.material=e!==void 0?e:new Va,this.center=new ee(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Gs.setFromMatrixScale(this.matrixWorld),yh.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Hs.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Gs.multiplyScalar(-Hs.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Za(Wa.set(-.5,-.5,0),Hs,o,Gs,i,r),Za(Ao.set(.5,-.5,0),Hs,o,Gs,i,r),Za(qa.set(.5,.5,0),Hs,o,Gs,i,r),xh.set(0,0),hc.set(1,0),_h.set(1,1);let a=e.ray.intersectTriangle(Wa,Ao,qa,!1,To);if(a===null&&(Za(Ao.set(-.5,.5,0),Hs,o,Gs,i,r),hc.set(0,1),a=e.ray.intersectTriangle(Wa,qa,Ao,!1,To),a===null))return;const l=e.ray.origin.distanceTo(To);l<e.near||l>e.far||t.push({distance:l,point:To.clone(),uv:ln.getUV(To,Wa,Ao,qa,xh,hc,_h,new ee),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}Xa.prototype.isSprite=!0;function Za(s,e,t,n,i,r){ks.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Eo.x=r*ks.x-i*ks.y,Eo.y=i*ks.x+r*ks.y):Eo.copy(ks),s.copy(e),s.x+=Eo.x,s.y+=Eo.y,s.applyMatrix4(yh)}const ja=new M,bh=new M;class Mh extends bt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){ja.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(ja);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ja.setFromMatrixPosition(e.matrixWorld),bh.setFromMatrixPosition(this.matrixWorld);const n=ja.distanceTo(bh)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,r=n.length;i<r;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const wh=new M,Sh=new Nt,Th=new Nt,kv=new M,Eh=new Oe;class Ya extends pn{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Oe,this.bindMatrixInverse=new Oe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Nt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,i=this.geometry;Sh.fromBufferAttribute(i.attributes.skinIndex,e),Th.fromBufferAttribute(i.attributes.skinWeight,e),wh.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=Th.getComponent(r);if(o!==0){const a=Sh.getComponent(r);Eh.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(kv.copy(wh).applyMatrix4(Eh),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}Ya.prototype.isSkinnedMesh=!0;class Ja extends bt{constructor(){super(),this.type="Bone"}}Ja.prototype.isBone=!0;class Ur extends dn{constructor(e=null,t=1,n=1,i,r,o,a,l,c=Kt,u=Kt,h,f){super(null,o,a,l,c,u,i,r,h,f),this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Ur.prototype.isDataTexture=!0;const Ah=new Oe,Vv=new Oe;class $a{constructor(e=[],t=[]){this.uuid=Yn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Oe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Oe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];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 e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:Vv;Ah.multiplyMatrices(a,t[r]),Ah.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new $a(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=uu(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Ur(t,e,e,on,ri);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const r=e.bones[n];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new Ja),this.bones.push(o),this.boneInverses.push(new Oe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const o=t[i];e.bones.push(o.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class Gr extends Tt{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}Gr.prototype.isInstancedBufferAttribute=!0;const Ch=new Oe,Lh=new Oe,Ka=[],Co=new pn;class fc extends pn{constructor(e,t,n){super(e,t),this.instanceMatrix=new Gr(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Co.geometry=this.geometry,Co.material=this.material,Co.material!==void 0)for(let r=0;r<i;r++){this.getMatrixAt(r,Ch),Lh.multiplyMatrices(n,Ch),Co.matrixWorld=Lh,Co.raycast(e,Ka);for(let o=0,a=Ka.length;o<a;o++){const l=Ka[o];l.instanceId=r,l.object=this,t.push(l)}Ka.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Gr(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}fc.prototype.isInstancedMesh=!0;class Sn extends bn{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Me(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}Sn.prototype.isLineBasicMaterial=!0;const Rh=new M,Ph=new M,Dh=new Oe,dc=new cr,Qa=new ar;class Xi extends bt{constructor(e=new $e,t=new Sn){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,r=t.count;i<r;i++)Rh.fromBufferAttribute(t,i-1),Ph.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Rh.distanceTo(Ph);e.setAttribute("lineDistance",new Fe(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Qa.copy(n.boundingSphere),Qa.applyMatrix4(i),Qa.radius+=r,e.ray.intersectsSphere(Qa)===!1)return;Dh.copy(i).invert(),dc.copy(e.ray).applyMatrix4(Dh);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,u=new M,h=new M,f=new M,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const m=n.index,x=n.attributes.position;if(m!==null){const g=Math.max(0,o.start),p=Math.min(m.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){const w=m.getX(_),L=m.getX(_+1);if(c.fromBufferAttribute(x,w),u.fromBufferAttribute(x,L),dc.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const O=e.ray.origin.distanceTo(f);O<e.near||O>e.far||t.push({distance:O,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),p=Math.min(x.count,o.start+o.count);for(let _=g,y=p-1;_<y;_+=d){if(c.fromBufferAttribute(x,_),u.fromBufferAttribute(x,_+1),dc.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(f);L<e.near||L>e.far||t.push({distance:L,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Xi.prototype.isLine=!0;const Ih=new M,Fh=new M;class Vn extends Xi{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,r=t.count;i<r;i+=2)Ih.fromBufferAttribute(t,i),Fh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Ih.distanceTo(Fh);e.setAttribute("lineDistance",new Fe(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Vn.prototype.isLineSegments=!0;class pc extends Xi{constructor(e,t){super(e,t),this.type="LineLoop"}}pc.prototype.isLineLoop=!0;class Hr extends bn{constructor(e){super(),this.type="PointsMaterial",this.color=new Me(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}}Hr.prototype.isPointsMaterial=!0;const Bh=new Oe,mc=new cr,el=new ar,tl=new M;class Lo extends bt{constructor(e=new $e,t=new Hr){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),el.copy(n.boundingSphere),el.applyMatrix4(i),el.radius+=r,e.ray.intersectsSphere(el)===!1)return;Bh.copy(i).invert(),mc.copy(e.ray).applyMatrix4(Bh);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){const c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,v=d;m<v;m++){const x=c.getX(m);tl.fromBufferAttribute(h,x),Nh(tl,x,l,i,e,t,this)}}else{const f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,v=d;m<v;m++)tl.fromBufferAttribute(h,m),Nh(tl,m,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r<o;r++){const a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Lo.prototype.isPoints=!0;function Nh(s,e,t,n,i,r,o){const a=mc.distanceSqToPoint(s);if(a<t){const l=new M;mc.closestPointToPoint(s,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Oh extends dn{constructor(e,t,n,i,r,o,a,l,c){super(e,t,n,i,r,o,a,l,c),this.format=a!==void 0?a:bi,this.minFilter=o!==void 0?o:en,this.magFilter=r!==void 0?r:en,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Oh.prototype.isVideoTexture=!0;class zh extends dn{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=Kt,this.minFilter=Kt,this.generateMipmaps=!1,this.needsUpdate=!0}}zh.prototype.isFramebufferTexture=!0;class gc extends dn{constructor(e,t,n,i,r,o,a,l,c,u,h,f){super(null,o,a,l,c,u,i,r,h,f),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}gc.prototype.isCompressedTexture=!0;class Uh extends dn{constructor(e,t,n,i,r,o,a,l,c){super(e,t,n,i,r,o,a,l,c),this.needsUpdate=!0}}Uh.prototype.isCanvasTexture=!0;class Vs extends $e{constructor(e=1,t=8,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],o=[],a=[],l=[],c=new M,u=new ee;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const d=n+h/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Fe(o,3)),this.setAttribute("normal",new Fe(a,3)),this.setAttribute("uv",new Fe(l,2))}static fromJSON(e){return new Vs(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vr extends $e{constructor(e=1,t=1,n=1,i=8,r=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),r=Math.floor(r);const u=[],h=[],f=[],d=[];let m=0;const v=[],x=n/2;let g=0;p(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Fe(h,3)),this.setAttribute("normal",new Fe(f,3)),this.setAttribute("uv",new Fe(d,2));function p(){const y=new M,w=new M;let L=0;const I=(t-e)/n;for(let O=0;O<=r;O++){const j=[],V=O/r,N=V*(t-e)+e;for(let T=0;T<=i;T++){const C=T/i,U=C*l+a,q=Math.sin(U),G=Math.cos(U);w.x=N*q,w.y=-V*n+x,w.z=N*G,h.push(w.x,w.y,w.z),y.set(q,I,G).normalize(),f.push(y.x,y.y,y.z),d.push(C,1-V),j.push(m++)}v.push(j)}for(let O=0;O<i;O++)for(let j=0;j<r;j++){const V=v[j][O],N=v[j+1][O],T=v[j+1][O+1],C=v[j][O+1];u.push(V,N,C),u.push(N,T,C),L+=6}c.addGroup(g,L,0),g+=L}function _(y){const w=m,L=new ee,I=new M;let O=0;const j=y===!0?e:t,V=y===!0?1:-1;for(let T=1;T<=i;T++)h.push(0,x*V,0),f.push(0,V,0),d.push(.5,.5),m++;const N=m;for(let T=0;T<=i;T++){const U=T/i*l+a,q=Math.cos(U),G=Math.sin(U);I.x=j*G,I.y=x*V,I.z=j*q,h.push(I.x,I.y,I.z),f.push(0,V,0),L.x=q*.5+.5,L.y=G*.5*V+.5,d.push(L.x,L.y),m++}for(let T=0;T<i;T++){const C=w+T,U=N+T;y===!0?u.push(U,U+1,C):u.push(U+1,U,C),O+=3}c.addGroup(g,O,y===!0?1:2),g+=O}}static fromJSON(e){return new vr(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ws extends vr{constructor(e=1,t=1,n=8,i=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Ws(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ti extends $e{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],o=[];a(i),c(n),u(),this.setAttribute("position",new Fe(r,3)),this.setAttribute("normal",new Fe(r.slice(),3)),this.setAttribute("uv",new Fe(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(p){const _=new M,y=new M,w=new M;for(let L=0;L<t.length;L+=3)d(t[L+0],_),d(t[L+1],y),d(t[L+2],w),l(_,y,w,p)}function l(p,_,y,w){const L=w+1,I=[];for(let O=0;O<=L;O++){I[O]=[];const j=p.clone().lerp(y,O/L),V=_.clone().lerp(y,O/L),N=L-O;for(let T=0;T<=N;T++)T===0&&O===L?I[O][T]=j:I[O][T]=j.clone().lerp(V,T/N)}for(let O=0;O<L;O++)for(let j=0;j<2*(L-O)-1;j++){const V=Math.floor(j/2);j%2===0?(f(I[O][V+1]),f(I[O+1][V]),f(I[O][V])):(f(I[O][V+1]),f(I[O+1][V+1]),f(I[O+1][V]))}}function c(p){const _=new M;for(let y=0;y<r.length;y+=3)_.x=r[y+0],_.y=r[y+1],_.z=r[y+2],_.normalize().multiplyScalar(p),r[y+0]=_.x,r[y+1]=_.y,r[y+2]=_.z}function u(){const p=new M;for(let _=0;_<r.length;_+=3){p.x=r[_+0],p.y=r[_+1],p.z=r[_+2];const y=x(p)/2/Math.PI+.5,w=g(p)/Math.PI+.5;o.push(y,1-w)}m(),h()}function h(){for(let p=0;p<o.length;p+=6){const _=o[p+0],y=o[p+2],w=o[p+4],L=Math.max(_,y,w),I=Math.min(_,y,w);L>.9&&I<.1&&(_<.2&&(o[p+0]+=1),y<.2&&(o[p+2]+=1),w<.2&&(o[p+4]+=1))}}function f(p){r.push(p.x,p.y,p.z)}function d(p,_){const y=p*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function m(){const p=new M,_=new M,y=new M,w=new M,L=new ee,I=new ee,O=new ee;for(let j=0,V=0;j<r.length;j+=9,V+=6){p.set(r[j+0],r[j+1],r[j+2]),_.set(r[j+3],r[j+4],r[j+5]),y.set(r[j+6],r[j+7],r[j+8]),L.set(o[V+0],o[V+1]),I.set(o[V+2],o[V+3]),O.set(o[V+4],o[V+5]),w.copy(p).add(_).add(y).divideScalar(3);const N=x(w);v(L,V+0,p,N),v(I,V+2,_,N),v(O,V+4,y,N)}}function v(p,_,y,w){w<0&&p.x===1&&(o[_]=p.x-1),y.x===0&&y.z===0&&(o[_]=w/2/Math.PI+.5)}function x(p){return Math.atan2(p.z,-p.x)}function g(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}static fromJSON(e){return new Ti(e.vertices,e.indices,e.radius,e.details)}}class qs extends Ti{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new qs(e.radius,e.detail)}}const nl=new M,il=new M,vc=new M,rl=new ln;class yc extends $e{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(Lr*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},d=[];for(let m=0;m<l;m+=3){o?(c[0]=o.getX(m),c[1]=o.getX(m+1),c[2]=o.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:v,b:x,c:g}=rl;if(v.fromBufferAttribute(a,c[0]),x.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),rl.getNormal(vc),h[0]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,h[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,h[2]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let p=0;p<3;p++){const _=(p+1)%3,y=h[p],w=h[_],L=rl[u[p]],I=rl[u[_]],O=`${y}_${w}`,j=`${w}_${y}`;j in f&&f[j]?(vc.dot(f[j].normal)<=r&&(d.push(L.x,L.y,L.z),d.push(I.x,I.y,I.z)),f[j]=null):O in f||(f[O]={index0:c[p],index1:c[_],normal:vc.clone()})}}for(const m in f)if(f[m]){const{index0:v,index1:x}=f[m];nl.fromBufferAttribute(a,v),il.fromBufferAttribute(a,x),d.push(nl.x,nl.y,nl.z),d.push(il.x,il.y,il.z)}this.setAttribute("position",new Fe(d,3))}}}class ei{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,l=r-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(r-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),l=t||(o.isVector2?new ee:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new M,i=[],r=[],o=[],a=new M,l=new Oe;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new M)}r[0]=new M,o[0]=new M;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),f<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Ln(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(i[d],r[d])}if(t===!0){let d=Math.acos(Ln(r[0].dot(r[e]),-1,1));d/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(d=-d);for(let m=1;m<=e;m++)r[m].applyMatrix4(l.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],r[m])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ro extends ei{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new ee,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(o?r=0:r=i),this.aClockwise===!0&&!o&&(r===i?r=-i:r=r-i);const a=this.aStartAngle+e*r;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}Ro.prototype.isEllipseCurve=!0;class xc extends Ro{constructor(e,t,n,i,r,o){super(e,t,n,n,i,r,o),this.type="ArcCurve"}}xc.prototype.isArcCurve=!0;function _c(){let s=0,e=0,t=0,n=0;function i(r,o,a,l){s=r,e=a,t=-3*r+3*o-2*a-l,n=2*r-2*o+a+l}return{initCatmullRom:function(r,o,a,l,c){i(o,a,c*(a-r),c*(l-o))},initNonuniformCatmullRom:function(r,o,a,l,c,u,h){let f=(o-r)/c-(a-r)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,i(o,a,f,d)},calc:function(r){const o=r*r,a=o*r;return s+e*r+t*o+n*a}}}const sl=new M,bc=new _c,Mc=new _c,wc=new _c;class Sc extends ei{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new M){const n=t,i=this.points,r=i.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%r]:(sl.subVectors(i[0],i[1]).add(i[0]),c=sl);const h=i[a%r],f=i[(a+1)%r];if(this.closed||a+2<r?u=i[(a+2)%r]:(sl.subVectors(i[r-1],i[r-2]).add(i[r-1]),u=sl),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(f),d),x=Math.pow(f.distanceToSquared(u),d);v<1e-4&&(v=1),m<1e-4&&(m=v),x<1e-4&&(x=v),bc.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,v,x),Mc.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,v,x),wc.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,v,x)}else this.curveType==="catmullrom"&&(bc.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Mc.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),wc.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return n.set(bc.calc(l),Mc.calc(l),wc.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new M().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}Sc.prototype.isCatmullRomCurve3=!0;function Gh(s,e,t,n,i){const r=(n-e)*.5,o=(i-t)*.5,a=s*s,l=s*a;return(2*t-2*n+r+o)*l+(-3*t+3*n-2*r-o)*a+r*s+t}function Wv(s,e){const t=1-s;return t*t*e}function qv(s,e){return 2*(1-s)*s*e}function Xv(s,e){return s*s*e}function Po(s,e,t,n){return Wv(s,e)+qv(s,t)+Xv(s,n)}function Zv(s,e){const t=1-s;return t*t*t*e}function jv(s,e){const t=1-s;return 3*t*t*s*e}function Yv(s,e){return 3*(1-s)*s*s*e}function Jv(s,e){return s*s*s*e}function Do(s,e,t,n,i){return Zv(s,e)+jv(s,t)+Yv(s,n)+Jv(s,i)}class ol extends ei{constructor(e=new ee,t=new ee,n=new ee,i=new ee){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ee){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Do(e,i.x,r.x,o.x,a.x),Do(e,i.y,r.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}ol.prototype.isCubicBezierCurve=!0;class Tc extends ei{constructor(e=new M,t=new M,n=new M,i=new M){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new M){const n=t,i=this.v0,r=this.v1,o=this.v2,a=this.v3;return n.set(Do(e,i.x,r.x,o.x,a.x),Do(e,i.y,r.y,o.y,a.y),Do(e,i.z,r.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Tc.prototype.isCubicBezierCurve3=!0;class Io extends ei{constructor(e=new ee,t=new ee){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ee){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new ee;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Io.prototype.isLineCurve=!0;class Hh extends ei{constructor(e=new M,t=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class al extends ei{constructor(e=new ee,t=new ee,n=new ee){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ee){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Po(e,i.x,r.x,o.x),Po(e,i.y,r.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}al.prototype.isQuadraticBezierCurve=!0;class ll extends ei{constructor(e=new M,t=new M,n=new M){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){const n=t,i=this.v0,r=this.v1,o=this.v2;return n.set(Po(e,i.x,r.x,o.x),Po(e,i.y,r.y,o.y),Po(e,i.z,r.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}ll.prototype.isQuadraticBezierCurve3=!0;class cl extends ei{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new ee){const n=t,i=this.points,r=(i.length-1)*e,o=Math.floor(r),a=r-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Gh(a,l.x,c.x,u.x,h.x),Gh(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ee().fromArray(i))}return this}}cl.prototype.isSplineCurve=!0;var Ec=Object.freeze({__proto__:null,ArcCurve:xc,CatmullRomCurve3:Sc,CubicBezierCurve:ol,CubicBezierCurve3:Tc,EllipseCurve:Ro,LineCurve:Io,LineCurve3:Hh,QuadraticBezierCurve:al,QuadraticBezierCurve3:ll,SplineCurve:cl});class kh extends ei{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Io(t,e))}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const o=i[r]-n,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Ec[i.type]().fromJSON(i))}return this}}class Fo extends kh{constructor(e){super(),this.type="Path",this.currentPoint=new ee,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Io(this.currentPoint.clone(),new ee(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new al(this.currentPoint.clone(),new ee(e,t),new ee(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,o){const a=new ol(this.currentPoint.clone(),new ee(e,t),new ee(n,i),new ee(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new cl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,r,o),this}absarc(e,t,n,i,r,o){return this.absellipse(e,t,n,n,i,r,o),this}ellipse(e,t,n,i,r,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,r,o,a,l),this}absellipse(e,t,n,i,r,o,a,l){const c=new Ro(e,t,n,i,r,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ei extends Fo{constructor(e){super(e),this.uuid=Yn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new Fo().fromJSON(i))}return this}}const $v={triangulate:function(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=Vh(s,0,i,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,l,c,u,h,f,d;if(n&&(r=ny(s,e,r,t)),s.length>80*t){a=c=s[0],l=u=s[1];for(let m=t;m<i;m+=t)h=s[m],f=s[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return Bo(r,o,t,a,l,d),o}};function Vh(s,e,t,n,i){let r,o;if(i===dy(s,e,t,n)>0)for(r=e;r<t;r+=n)o=Xh(r,s[r],s[r+1],o);else for(r=t-n;r>=e;r-=n)o=Xh(r,s[r],s[r+1],o);return o&&ul(o,o.next)&&(Oo(o),o=o.next),o}function yr(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(ul(t,t.next)||tn(t.prev,t,t.next)===0)){if(Oo(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Bo(s,e,t,n,i,r,o){if(!s)return;!o&&r&&ay(s,n,i,r);let a=s,l,c;for(;s.prev!==s.next;){if(l=s.prev,c=s.next,r?Qv(s,n,i,r):Kv(s)){e.push(l.i/t),e.push(s.i/t),e.push(c.i/t),Oo(s),s=c.next,a=c.next;continue}if(s=c,s===a){o?o===1?(s=ey(yr(s),e,t),Bo(s,e,t,n,i,r,2)):o===2&&ty(s,e,t,n,i,r):Bo(yr(s),e,t,n,i,r,1);break}}}function Kv(s){const e=s.prev,t=s,n=s.next;if(tn(e,t,n)>=0)return!1;let i=s.next.next;for(;i!==s.prev;){if(Xs(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&tn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Qv(s,e,t,n){const i=s.prev,r=s,o=s.next;if(tn(i,r,o)>=0)return!1;const a=i.x<r.x?i.x<o.x?i.x:o.x:r.x<o.x?r.x:o.x,l=i.y<r.y?i.y<o.y?i.y:o.y:r.y<o.y?r.y:o.y,c=i.x>r.x?i.x>o.x?i.x:o.x:r.x>o.x?r.x:o.x,u=i.y>r.y?i.y>o.y?i.y:o.y:r.y>o.y?r.y:o.y,h=Ac(a,l,e,t,n),f=Ac(c,u,e,t,n);let d=s.prevZ,m=s.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==s.prev&&d!==s.next&&Xs(i.x,i.y,r.x,r.y,o.x,o.y,d.x,d.y)&&tn(d.prev,d,d.next)>=0||(d=d.prevZ,m!==s.prev&&m!==s.next&&Xs(i.x,i.y,r.x,r.y,o.x,o.y,m.x,m.y)&&tn(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==s.prev&&d!==s.next&&Xs(i.x,i.y,r.x,r.y,o.x,o.y,d.x,d.y)&&tn(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==s.prev&&m!==s.next&&Xs(i.x,i.y,r.x,r.y,o.x,o.y,m.x,m.y)&&tn(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function ey(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!ul(i,r)&&Wh(i,n,n.next,r)&&No(i,r)&&No(r,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(r.i/t),Oo(n),Oo(n.next),n=s=r),n=n.next}while(n!==s);return yr(n)}function ty(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&uy(o,a)){let l=qh(o,a);o=yr(o,o.next),l=yr(l,l.next),Bo(o,e,t,n,i,r),Bo(l,e,t,n,i,r);return}a=a.next}o=o.next}while(o!==s)}function ny(s,e,t,n){const i=[];let r,o,a,l,c;for(r=0,o=e.length;r<o;r++)a=e[r]*n,l=r<o-1?e[r+1]*n:s.length,c=Vh(s,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(cy(c));for(i.sort(iy),r=0;r<i.length;r++)ry(i[r],t),t=yr(t,t.next);return t}function iy(s,e){return s.x-e.x}function ry(s,e){if(e=sy(s,e),e){const t=qh(e,s);yr(e,e.next),yr(t,t.next)}}function sy(s,e){let t=e;const n=s.x,i=s.y;let r=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>r){if(r=f,f===n){if(i===t.y)return t;if(i===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===r)return o;const a=o,l=o.x,c=o.y;let u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&Xs(i<c?n:r,i,l,c,i<c?r:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),No(t,s)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&oy(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function oy(s,e){return tn(s.prev,s,e.prev)<0&&tn(e.next,s,s.next)<0}function ay(s,e,t,n){let i=s;do i.z===null&&(i.z=Ac(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,ly(i)}function ly(s){let e,t,n,i,r,o,a,l,c=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,c*=2}while(o>1);return s}function Ac(s,e,t,n,i){return s=32767*(s-t)*i,e=32767*(e-n)*i,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function cy(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Xs(s,e,t,n,i,r,o,a){return(i-o)*(e-a)-(s-o)*(r-a)>=0&&(s-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(r-a)-(i-o)*(n-a)>=0}function uy(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!hy(s,e)&&(No(s,e)&&No(e,s)&&fy(s,e)&&(tn(s.prev,s,e.prev)||tn(s,e.prev,e))||ul(s,e)&&tn(s.prev,s,s.next)>0&&tn(e.prev,e,e.next)>0)}function tn(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function ul(s,e){return s.x===e.x&&s.y===e.y}function Wh(s,e,t,n){const i=fl(tn(s,e,t)),r=fl(tn(s,e,n)),o=fl(tn(t,n,s)),a=fl(tn(t,n,e));return!!(i!==r&&o!==a||i===0&&hl(s,t,e)||r===0&&hl(s,n,e)||o===0&&hl(t,s,n)||a===0&&hl(t,e,n))}function hl(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function fl(s){return s>0?1:s<0?-1:0}function hy(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&Wh(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function No(s,e){return tn(s.prev,s,s.next)<0?tn(s,e,s.next)>=0&&tn(s,s.prev,e)>=0:tn(s,e,s.prev)<0||tn(s,s.next,e)<0}function fy(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function qh(s,e){const t=new Cc(s.i,s.x,s.y),n=new Cc(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function Xh(s,e,t,n){const i=new Cc(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Oo(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Cc(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dy(s,e,t,n){let i=0;for(let r=e,o=t-n;r<t;r+=n)i+=(s[o]-s[r])*(s[r+1]+s[o+1]),o=r;return i}class Ai{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return Ai.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];Zh(e),jh(n,e);let o=e.length;t.forEach(Zh);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,jh(n,t[l]);const a=$v.triangulate(n,i);for(let l=0;l<a.length;l+=3)r.push(a.slice(l,l+3));return r}}function Zh(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function jh(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Ci extends $e{constructor(e=new Ei([new ee(.5,.5),new ee(-.5,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Fe(i,3)),this.setAttribute("uv",new Fe(r,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,p=t.UVGenerator!==void 0?t.UVGenerator:py;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let _,y=!1,w,L,I,O;g&&(_=g.getSpacedPoints(u),y=!0,f=!1,w=g.computeFrenetFrames(u,!1),L=new M,I=new M,O=new M),f||(x=0,d=0,m=0,v=0);const j=a.extractPoints(c);let V=j.shape;const N=j.holes;if(!Ai.isClockWise(V)){V=V.reverse();for(let $=0,he=N.length;$<he;$++){const me=N[$];Ai.isClockWise(me)&&(N[$]=me.reverse())}}const C=Ai.triangulateShape(V,N),U=V;for(let $=0,he=N.length;$<he;$++){const me=N[$];V=V.concat(me)}function q($,he,me){return he||console.error("THREE.ExtrudeGeometry: vec does not exist"),he.clone().multiplyScalar(me).add($)}const G=V.length,X=C.length;function _e($,he,me){let Ie,we,rt;const st=$.x-he.x,vt=$.y-he.y,$t=me.x-$.x,P=me.y-$.y,A=st*st+vt*vt,re=st*P-vt*$t;if(Math.abs(re)>Number.EPSILON){const ue=Math.sqrt(A),be=Math.sqrt($t*$t+P*P),ce=he.x-vt/ue,tt=he.y+st/ue,Ye=me.x-P/be,ye=me.y+$t/be,F=((Ye-ce)*P-(ye-tt)*$t)/(st*P-vt*$t);Ie=ce+st*F-$.x,we=tt+vt*F-$.y;const ge=Ie*Ie+we*we;if(ge<=2)return new ee(Ie,we);rt=Math.sqrt(ge/2)}else{let ue=!1;st>Number.EPSILON?$t>Number.EPSILON&&(ue=!0):st<-Number.EPSILON?$t<-Number.EPSILON&&(ue=!0):Math.sign(vt)===Math.sign(P)&&(ue=!0),ue?(Ie=-vt,we=st,rt=Math.sqrt(A)):(Ie=st,we=vt,rt=Math.sqrt(A/2))}return new ee(Ie/rt,we/rt)}const Le=[];for(let $=0,he=U.length,me=he-1,Ie=$+1;$<he;$++,me++,Ie++)me===he&&(me=0),Ie===he&&(Ie=0),Le[$]=_e(U[$],U[me],U[Ie]);const K=[];let te,Re=Le.concat();for(let $=0,he=N.length;$<he;$++){const me=N[$];te=[];for(let Ie=0,we=me.length,rt=we-1,st=Ie+1;Ie<we;Ie++,rt++,st++)rt===we&&(rt=0),st===we&&(st=0),te[Ie]=_e(me[Ie],me[rt],me[st]);K.push(te),Re=Re.concat(te)}for(let $=0;$<x;$++){const he=$/x,me=d*Math.cos(he*Math.PI/2),Ie=m*Math.sin(he*Math.PI/2)+v;for(let we=0,rt=U.length;we<rt;we++){const st=q(U[we],Le[we],Ie);ct(st.x,st.y,-me)}for(let we=0,rt=N.length;we<rt;we++){const st=N[we];te=K[we];for(let vt=0,$t=st.length;vt<$t;vt++){const P=q(st[vt],te[vt],Ie);ct(P.x,P.y,-me)}}}const Te=m+v;for(let $=0;$<G;$++){const he=f?q(V[$],Re[$],Te):V[$];y?(I.copy(w.normals[0]).multiplyScalar(he.x),L.copy(w.binormals[0]).multiplyScalar(he.y),O.copy(_[0]).add(I).add(L),ct(O.x,O.y,O.z)):ct(he.x,he.y,0)}for(let $=1;$<=u;$++)for(let he=0;he<G;he++){const me=f?q(V[he],Re[he],Te):V[he];y?(I.copy(w.normals[$]).multiplyScalar(me.x),L.copy(w.binormals[$]).multiplyScalar(me.y),O.copy(_[$]).add(I).add(L),ct(O.x,O.y,O.z)):ct(me.x,me.y,h/u*$)}for(let $=x-1;$>=0;$--){const he=$/x,me=d*Math.cos(he*Math.PI/2),Ie=m*Math.sin(he*Math.PI/2)+v;for(let we=0,rt=U.length;we<rt;we++){const st=q(U[we],Le[we],Ie);ct(st.x,st.y,h+me)}for(let we=0,rt=N.length;we<rt;we++){const st=N[we];te=K[we];for(let vt=0,$t=st.length;vt<$t;vt++){const P=q(st[vt],te[vt],Ie);y?ct(P.x,P.y+_[u-1].y,_[u-1].x+me):ct(P.x,P.y,h+me)}}}Ne(),wt();function Ne(){const $=i.length/3;if(f){let he=0,me=G*he;for(let Ie=0;Ie<X;Ie++){const we=C[Ie];Xe(we[2]+me,we[1]+me,we[0]+me)}he=u+x*2,me=G*he;for(let Ie=0;Ie<X;Ie++){const we=C[Ie];Xe(we[0]+me,we[1]+me,we[2]+me)}}else{for(let he=0;he<X;he++){const me=C[he];Xe(me[2],me[1],me[0])}for(let he=0;he<X;he++){const me=C[he];Xe(me[0]+G*u,me[1]+G*u,me[2]+G*u)}}n.addGroup($,i.length/3-$,0)}function wt(){const $=i.length/3;let he=0;se(U,he),he+=U.length;for(let me=0,Ie=N.length;me<Ie;me++){const we=N[me];se(we,he),he+=we.length}n.addGroup($,i.length/3-$,1)}function se($,he){let me=$.length;for(;--me>=0;){const Ie=me;let we=me-1;we<0&&(we=$.length-1);for(let rt=0,st=u+x*2;rt<st;rt++){const vt=G*rt,$t=G*(rt+1),P=he+Ie+vt,A=he+we+vt,re=he+we+$t,ue=he+Ie+$t;Ge(P,A,re,ue)}}}function ct($,he,me){l.push($),l.push(he),l.push(me)}function Xe($,he,me){We($),We(he),We(me);const Ie=i.length/3,we=p.generateTopUV(n,i,Ie-3,Ie-2,Ie-1);Ct(we[0]),Ct(we[1]),Ct(we[2])}function Ge($,he,me,Ie){We($),We(he),We(Ie),We(he),We(me),We(Ie);const we=i.length/3,rt=p.generateSideWallUV(n,i,we-6,we-3,we-2,we-1);Ct(rt[0]),Ct(rt[1]),Ct(rt[3]),Ct(rt[1]),Ct(rt[2]),Ct(rt[3])}function We($){i.push(l[$*3+0]),i.push(l[$*3+1]),i.push(l[$*3+2])}function Ct($){r.push($.x),r.push($.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return my(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const a=t[e.shapes[r]];n.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Ec[i.type]().fromJSON(i)),new Ci(n,e.options)}}const py={generateTopUV:function(s,e,t,n,i){const r=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new ee(r,o),new ee(a,l),new ee(c,u)]},generateSideWallUV:function(s,e,t,n,i,r){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],f=e[i*3],d=e[i*3+1],m=e[i*3+2],v=e[r*3],x=e[r*3+1],g=e[r*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new ee(o,1-l),new ee(c,1-h),new ee(f,1-m),new ee(v,1-g)]:[new ee(a,1-l),new ee(u,1-h),new ee(d,1-m),new ee(x,1-g)]}};function my(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Zs extends Ti{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zs(e.radius,e.detail)}}class js extends $e{constructor(e=[new ee(0,.5),new ee(.5,0),new ee(0,-.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Ln(i,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,h=new M,f=new ee,d=new M,m=new M,v=new M;let x=0,g=0;for(let p=0;p<=e.length-1;p++)switch(p){case 0:x=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-x,d.z=g*0,v.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:x=e[p+1].x-e[p].x,g=e[p+1].y-e[p].y,d.x=g*1,d.y=-x,d.z=g*0,m.copy(d),d.x+=v.x,d.y+=v.y,d.z+=v.z,d.normalize(),l.push(d.x,d.y,d.z),v.copy(m)}for(let p=0;p<=t;p++){const _=n+p*u*i,y=Math.sin(_),w=Math.cos(_);for(let L=0;L<=e.length-1;L++){h.x=e[L].x*y,h.y=e[L].y,h.z=e[L].x*w,o.push(h.x,h.y,h.z),f.x=p/t,f.y=L/(e.length-1),a.push(f.x,f.y);const I=l[3*L+0]*y,O=l[3*L+1],j=l[3*L+0]*w;c.push(I,O,j)}}for(let p=0;p<t;p++)for(let _=0;_<e.length-1;_++){const y=_+p*e.length,w=y,L=y+e.length,I=y+e.length+1,O=y+1;r.push(w,L,O),r.push(L,I,O)}this.setIndex(r),this.setAttribute("position",new Fe(o,3)),this.setAttribute("uv",new Fe(a,2)),this.setAttribute("normal",new Fe(c,3))}static fromJSON(e){return new js(e.points,e.segments,e.phiStart,e.phiLength)}}class kr extends Ti{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new kr(e.radius,e.detail)}}class Ys extends $e{constructor(e=.5,t=1,n=8,i=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/i,d=new M,m=new ee;for(let v=0;v<=i;v++){for(let x=0;x<=n;x++){const g=r+x/n*o;d.x=h*Math.cos(g),d.y=h*Math.sin(g),l.push(d.x,d.y,d.z),c.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,u.push(m.x,m.y)}h+=f}for(let v=0;v<i;v++){const x=v*(n+1);for(let g=0;g<n;g++){const p=g+x,_=p,y=p+n+1,w=p+n+2,L=p+1;a.push(_,y,L),a.push(y,w,L)}}this.setIndex(a),this.setAttribute("position",new Fe(l,3)),this.setAttribute("normal",new Fe(c,3)),this.setAttribute("uv",new Fe(u,2))}static fromJSON(e){return new Ys(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Vr extends $e{constructor(e=new Ei([new ee(0,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new Fe(i,3)),this.setAttribute("normal",new Fe(r,3)),this.setAttribute("uv",new Fe(o,2));function c(u){const h=i.length/3,f=u.extractPoints(t);let d=f.shape;const m=f.holes;Ai.isClockWise(d)===!1&&(d=d.reverse());for(let x=0,g=m.length;x<g;x++){const p=m[x];Ai.isClockWise(p)===!0&&(m[x]=p.reverse())}const v=Ai.triangulateShape(d,m);for(let x=0,g=m.length;x<g;x++){const p=m[x];d=d.concat(p)}for(let x=0,g=d.length;x<g;x++){const p=d[x];i.push(p.x,p.y,0),r.push(0,0,1),o.push(p.x,p.y)}for(let x=0,g=v.length;x<g;x++){const p=v[x],_=p[0]+h,y=p[1]+h,w=p[2]+h;n.push(_,y,w),l+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return gy(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const o=t[e.shapes[i]];n.push(o)}return new Vr(n,e.curveSegments)}}function gy(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Wr extends $e{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new M,f=new M,d=[],m=[],v=[],x=[];for(let g=0;g<=n;g++){const p=[],_=g/n;let y=0;g==0&&o==0?y=.5/t:g==n&&l==Math.PI&&(y=-.5/t);for(let w=0;w<=t;w++){const L=w/t;h.x=-e*Math.cos(i+L*r)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(i+L*r)*Math.sin(o+_*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),v.push(f.x,f.y,f.z),x.push(L+y,1-_),p.push(c++)}u.push(p)}for(let g=0;g<n;g++)for(let p=0;p<t;p++){const _=u[g][p+1],y=u[g][p],w=u[g+1][p],L=u[g+1][p+1];(g!==0||o>0)&&d.push(_,y,L),(g!==n-1||l<Math.PI)&&d.push(y,w,L)}this.setIndex(d),this.setAttribute("position",new Fe(m,3)),this.setAttribute("normal",new Fe(v,3)),this.setAttribute("uv",new Fe(x,2))}static fromJSON(e){return new Wr(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Js extends Ti{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Js(e.radius,e.detail)}}class $s extends $e{constructor(e=1,t=.4,n=8,i=6,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],u=new M,h=new M,f=new M;for(let d=0;d<=n;d++)for(let m=0;m<=i;m++){const v=m/i*r,x=d/n*Math.PI*2;h.x=(e+t*Math.cos(x))*Math.cos(v),h.y=(e+t*Math.cos(x))*Math.sin(v),h.z=t*Math.sin(x),a.push(h.x,h.y,h.z),u.x=e*Math.cos(v),u.y=e*Math.sin(v),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(m/i),c.push(d/n)}for(let d=1;d<=n;d++)for(let m=1;m<=i;m++){const v=(i+1)*d+m-1,x=(i+1)*(d-1)+m-1,g=(i+1)*(d-1)+m,p=(i+1)*d+m;o.push(v,x,p),o.push(x,g,p)}this.setIndex(o),this.setAttribute("position",new Fe(a,3)),this.setAttribute("normal",new Fe(l,3)),this.setAttribute("uv",new Fe(c,2))}static fromJSON(e){return new $s(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Ks extends $e{constructor(e=1,t=.4,n=64,i=8,r=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:o},n=Math.floor(n),i=Math.floor(i);const a=[],l=[],c=[],u=[],h=new M,f=new M,d=new M,m=new M,v=new M,x=new M,g=new M;for(let _=0;_<=n;++_){const y=_/n*r*Math.PI*2;p(y,r,o,e,d),p(y+.01,r,o,e,m),x.subVectors(m,d),g.addVectors(m,d),v.crossVectors(x,g),g.crossVectors(v,x),v.normalize(),g.normalize();for(let w=0;w<=i;++w){const L=w/i*Math.PI*2,I=-t*Math.cos(L),O=t*Math.sin(L);h.x=d.x+(I*g.x+O*v.x),h.y=d.y+(I*g.y+O*v.y),h.z=d.z+(I*g.z+O*v.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(_/n),u.push(w/i)}}for(let _=1;_<=n;_++)for(let y=1;y<=i;y++){const w=(i+1)*(_-1)+(y-1),L=(i+1)*_+(y-1),I=(i+1)*_+y,O=(i+1)*(_-1)+y;a.push(w,L,O),a.push(L,I,O)}this.setIndex(a),this.setAttribute("position",new Fe(l,3)),this.setAttribute("normal",new Fe(c,3)),this.setAttribute("uv",new Fe(u,2));function p(_,y,w,L,I){const O=Math.cos(_),j=Math.sin(_),V=w/y*_,N=Math.cos(V);I.x=L*(2+N)*.5*O,I.y=L*(2+N)*j*.5,I.z=L*Math.sin(V)*.5}}static fromJSON(e){return new Ks(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Qs extends $e{constructor(e=new ll(new M(-1,-1,0),new M(-1,1,0),new M(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const o=e.computeFrenetFrames(t,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new M,l=new M,c=new ee;let u=new M;const h=[],f=[],d=[],m=[];v(),this.setIndex(m),this.setAttribute("position",new Fe(h,3)),this.setAttribute("normal",new Fe(f,3)),this.setAttribute("uv",new Fe(d,2));function v(){for(let _=0;_<t;_++)x(_);x(r===!1?t:0),p(),g()}function x(_){u=e.getPointAt(_/t,u);const y=o.normals[_],w=o.binormals[_];for(let L=0;L<=i;L++){const I=L/i*Math.PI*2,O=Math.sin(I),j=-Math.cos(I);l.x=j*y.x+O*w.x,l.y=j*y.y+O*w.y,l.z=j*y.z+O*w.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=i;y++){const w=(i+1)*(_-1)+(y-1),L=(i+1)*_+(y-1),I=(i+1)*_+y,O=(i+1)*(_-1)+y;m.push(w,L,O),m.push(L,I,O)}}function p(){for(let _=0;_<=t;_++)for(let y=0;y<=i;y++)c.x=_/t,c.y=y/i,d.push(c.x,c.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Qs(new Ec[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Lc extends $e{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new M,r=new M;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,d=h.count;for(let m=f,v=f+d;m<v;m+=3)for(let x=0;x<3;x++){const g=a.getX(m+x),p=a.getX(m+(x+1)%3);i.fromBufferAttribute(o,g),r.fromBufferAttribute(o,p),Yh(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),r.fromBufferAttribute(o,h),Yh(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new Fe(t,3))}}}function Yh(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var Jh=Object.freeze({__proto__:null,BoxGeometry:Wi,BoxBufferGeometry:Wi,CircleGeometry:Vs,CircleBufferGeometry:Vs,ConeGeometry:Ws,ConeBufferGeometry:Ws,CylinderGeometry:vr,CylinderBufferGeometry:vr,DodecahedronGeometry:qs,DodecahedronBufferGeometry:qs,EdgesGeometry:yc,ExtrudeGeometry:Ci,ExtrudeBufferGeometry:Ci,IcosahedronGeometry:Zs,IcosahedronBufferGeometry:Zs,LatheGeometry:js,LatheBufferGeometry:js,OctahedronGeometry:kr,OctahedronBufferGeometry:kr,PlaneGeometry:Fr,PlaneBufferGeometry:Fr,PolyhedronGeometry:Ti,PolyhedronBufferGeometry:Ti,RingGeometry:Ys,RingBufferGeometry:Ys,ShapeGeometry:Vr,ShapeBufferGeometry:Vr,SphereGeometry:Wr,SphereBufferGeometry:Wr,TetrahedronGeometry:Js,TetrahedronBufferGeometry:Js,TorusGeometry:$s,TorusBufferGeometry:$s,TorusKnotGeometry:Ks,TorusKnotBufferGeometry:Ks,TubeGeometry:Qs,TubeBufferGeometry:Qs,WireframeGeometry:Lc});class Rc extends bn{constructor(e){super(),this.type="ShadowMaterial",this.color=new Me(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Rc.prototype.isShadowMaterial=!0;class dl extends bn{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Me(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 Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}dl.prototype.isMeshStandardMaterial=!0;class Pc extends dl{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ee(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ln(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Me(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Me(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Me(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Pc.prototype.isMeshPhysicalMaterial=!0;class Dc extends bn{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Me(16777215),this.specular=new Me(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Dc.prototype.isMeshPhongMaterial=!0;class Ic extends bn{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Me(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Ic.prototype.isMeshToonMaterial=!0;class Fc extends bn{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}Fc.prototype.isMeshNormalMaterial=!0;class Bc extends bn{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new Me(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Bc.prototype.isMeshLambertMaterial=!0;class Nc extends bn{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Me(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cr,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}Nc.prototype.isMeshMatcapMaterial=!0;class Oc extends Sn{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}Oc.prototype.isLineDashedMaterial=!0;var vy=Object.freeze({__proto__:null,ShadowMaterial:Rc,SpriteMaterial:Va,RawShaderMaterial:Fs,ShaderMaterial:qi,PointsMaterial:Hr,MeshPhysicalMaterial:Pc,MeshStandardMaterial:dl,MeshPhongMaterial:Dc,MeshToonMaterial:Ic,MeshNormalMaterial:Fc,MeshLambertMaterial:Bc,MeshDepthMaterial:Ua,MeshDistanceMaterial:Ga,MeshBasicMaterial:Vi,MeshMatcapMaterial:Nc,LineDashedMaterial:Oc,LineBasicMaterial:Sn,Material:bn});const Jt={arraySlice:function(s,e,t){return Jt.isTypedArray(s)?new s.constructor(s.subarray(e,t!==void 0?t:s.length)):s.slice(e,t)},convertArray:function(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)},isTypedArray:function(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)},getKeyframeOrder:function(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let l=0;l!==e;++l)i[o++]=s[a+l]}return i},flattenJSON:function(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)},subclip:function(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let l=0;l<r.tracks.length;++l){const c=r.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){const m=c.times[d]*i;if(!(m<t||m>=n)){h.push(c.times[d]);for(let v=0;v<u;++v)f.push(c.values[d*u+v])}}h.length!==0&&(c.times=Jt.convertArray(h,c.times.constructor),c.values=Jt.convertArray(f,c.values.constructor),o.push(c))}r.tracks=o;let a=1/0;for(let l=0;l<r.tracks.length;++l)a>r.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l<r.tracks.length;++l)r.tracks[l].shift(-1*a);return r.resetDuration(),r},makeClipAdditive:function(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=e/n;for(let o=0;o<i;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=s.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);const m=a.times.length-1;let v;if(r<=a.times[0]){const g=u,p=h-u;v=Jt.arraySlice(a.values,g,p)}else if(r>=a.times[m]){const g=m*h+u,p=g+h-u;v=Jt.arraySlice(a.values,g,p)}else{const g=a.createInterpolant(),p=u,_=h-u;g.evaluate(r),v=Jt.arraySlice(g.resultBuffer,p,_)}l==="quaternion"&&new Rn().fromArray(v).normalize().conjugate().toArray(v);const x=c.times.length;for(let g=0;g<x;++g){const p=g*d+f;if(l==="quaternion")Rn.multiplyQuaternionsFlat(c.values,p,v,0,c.values,p);else{const _=d-f*2;for(let y=0;y<_;++y)c.values[p+y]-=v[y]}}}return s.blendMode=co,s}};class Zi{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(n=2,r=a);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=r,r=t[--n-1],e>=r)break t}o=n,n=0;break n}break e}for(;n<o;){const a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let o=0;o!==i;++o)t[o]=n[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Zi.prototype.beforeStart_=Zi.prototype.copySampleValue_,Zi.prototype.afterEnd_=Zi.prototype.copySampleValue_;class $h extends Zi{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Zn,endingEnd:Zn}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,o=e+1,a=i[r],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case jn:r=e,a=2*t-n;break;case Pn:r=i.length-2,a=t+i[r]-i[r+1];break;default:r=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case jn:o=e,l=2*n-t;break;case Pn:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(n-t)/(i-t),v=m*m,x=v*m,g=-f*x+2*f*v-f*m,p=(1+f)*x+(-1.5-2*f)*v+(-.5+f)*m+1,_=(-1-d)*x+(1.5+d)*v+.5*m,y=d*x-d*v;for(let w=0;w!==a;++w)r[w]=g*o[u+w]+p*o[c+w]+_*o[l+w]+y*o[h+w];return r}}class zc extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let f=0;f!==a;++f)r[f]=o[c+f]*h+o[l+f]*u;return r}}class Kh extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class di{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Jt.convertArray(t,this.TimeBufferType),this.values=Jt.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Jt.convertArray(e.times,Array),values:Jt.convertArray(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Kh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new zc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $h(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case kn:t=this.InterpolantFactoryMethodDiscrete;break;case zn:t=this.InterpolantFactoryMethodLinear;break;case An:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return kn;case this.InterpolantFactoryMethodLinear:return zn;case this.InterpolantFactoryMethodSmooth:return An}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<e;)++r;for(;o!==-1&&n[o]>t;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=Jt.arraySlice(n,r,o),this.values=Jt.arraySlice(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&Jt.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=Jt.arraySlice(this.times),t=Jt.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===An,r=e.length-1;let o=1;for(let a=1;a<r;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*n,f=h-n,d=h+n;for(let m=0;m!==n;++m){const v=t[h+m];if(v!==t[f+m]||v!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*n,f=o*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++o}}if(r>0){e[o]=e[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Jt.arraySlice(e,0,o),this.values=Jt.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=Jt.arraySlice(this.times,0),t=Jt.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}di.prototype.TimeBufferType=Float32Array,di.prototype.ValueBufferType=Float32Array,di.prototype.DefaultInterpolation=zn;class qr extends di{}qr.prototype.ValueTypeName="bool",qr.prototype.ValueBufferType=Array,qr.prototype.DefaultInterpolation=kn,qr.prototype.InterpolantFactoryMethodLinear=void 0,qr.prototype.InterpolantFactoryMethodSmooth=void 0;class Uc extends di{}Uc.prototype.ValueTypeName="color";class zo extends di{}zo.prototype.ValueTypeName="number";class Qh extends Zi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Rn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class eo extends di{InterpolantFactoryMethodLinear(e){return new Qh(this.times,this.values,this.getValueSize(),e)}}eo.prototype.ValueTypeName="quaternion",eo.prototype.DefaultInterpolation=zn,eo.prototype.InterpolantFactoryMethodSmooth=void 0;class Xr extends di{}Xr.prototype.ValueTypeName="string",Xr.prototype.ValueBufferType=Array,Xr.prototype.DefaultInterpolation=kn,Xr.prototype.InterpolantFactoryMethodLinear=void 0,Xr.prototype.InterpolantFactoryMethodSmooth=void 0;class Uo extends di{}Uo.prototype.ValueTypeName="vector";class Go{constructor(e,t=-1,n,i=ir){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Yn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(xy(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(di.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a<r;a++){let l=[],c=[];l.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);const u=Jt.getKeyframeOrder(l);l=Jt.sortedArray(l,1,u),c=Jt.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(r),c.push(c[0])),o.push(new zo(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(r);if(u&&u.length>1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,m,v){if(d.length!==0){const x=[],g=[];Jt.flattenJSON(d,x,g,m),x.length!==0&&v.push(new h(f,x,g))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let v=0;v<f[m].morphTargets.length;v++)d[f[m].morphTargets[v]]=-1;for(const v in d){const x=[],g=[];for(let p=0;p!==f[m].morphTargets.length;++p){const _=f[m];x.push(_.time),g.push(_.morphTarget===v?1:0)}i.push(new zo(".morphTargetInfluence["+v+"]",x,g))}l=d.length*(o||1)}else{const d=".bones["+t[h].name+"]";n(Uo,d+".position",f,"pos",i),n(eo,d+".quaternion",f,"rot",i),n(Uo,d+".scale",f,"scl",i)}}return i.length===0?null:new this(r,l,i,a)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function yy(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return zo;case"vector":case"vector2":case"vector3":case"vector4":return Uo;case"color":return Uc;case"quaternion":return eo;case"bool":case"boolean":return qr;case"string":return Xr}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function xy(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=yy(s.type);if(s.times===void 0){const t=[],n=[];Jt.flattenJSON(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Zr={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class Gc{constructor(e,t,n){const i=this;let r=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,r===!1&&i.onStart!==void 0&&i.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}}const ef=new Gc;class Gn{constructor(e){this.manager=e!==void 0?e:ef,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const ji={};class Li extends Gn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Zr.get(e);if(r!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(ji[e]!==void 0){ji[e].push({onLoad:t,onProgress:n,onError:i});return}ji[e]=[],ji[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||a.body.getReader===void 0)return a;const l=ji[e],c=a.body.getReader(),u=a.headers.get("Content-Length"),h=u?parseInt(u):0,f=h!==0;let d=0;const m=new ReadableStream({start(v){x();function x(){c.read().then(({done:g,value:p})=>{if(g)v.close();else{d+=p.byteLength;const _=new ProgressEvent("progress",{lengthComputable:f,loaded:d,total:h});for(let y=0,w=l.length;y<w;y++){const L=l[y];L.onProgress&&L.onProgress(_)}v.enqueue(p),x()}})}}});return new Response(m)}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{switch(this.responseType){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(l=>new DOMParser().parseFromString(l,this.mimeType));case"json":return a.json();default:return a.text()}}).then(a=>{Zr.add(e,a);const l=ji[e];delete ji[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onLoad&&h.onLoad(a)}}).catch(a=>{const l=ji[e];if(l===void 0)throw this.manager.itemError(e),a;delete ji[e];for(let c=0,u=l.length;c<u;c++){const h=l[c];h.onError&&h.onError(a)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class _y extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Li(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=Go.parse(e[n]);t.push(i)}return t}}class by extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=[],a=new gc,l=new Li(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(r.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const d=r.parse(f,!0);o[h]={width:d.width,height:d.height,format:d.format,mipmaps:d.mipmaps},c+=1,c===6&&(d.mipmapCount===1&&(a.minFilter=en),a.image=o,a.format=d.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=r.parse(h,!0);if(f.isCubemap){const d=f.mipmaps.length/f.mipmapCount;for(let m=0;m<d;m++){o[m]={mipmaps:[]};for(let v=0;v<f.mipmapCount;v++)o[m].mipmaps.push(f.mipmaps[m*f.mipmapCount+v]),o[m].format=f.format,o[m].width=f.width,o[m].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=en),a.format=f.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}}class Ho extends Gn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Zr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=ca("img");function l(){u(),Zr.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(h){u(),i&&i(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class tf extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=new Ds,o=new Ho(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){r.images[c]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return r}}class nf extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Ur,a=new Li(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(l){const c=r.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:xn,o.wrapT=c.wrapT!==void 0?c.wrapT:xn,o.magFilter=c.magFilter!==void 0?c.magFilter:en,o.minFilter=c.minFilter!==void 0?c.minFilter:en,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Qi),c.mipmapCount===1&&(o.minFilter=en),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},n,i),o}}class rf extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=new dn,o=new Ho(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class pi extends bt{constructor(e,t=1){super(),this.type="Light",this.color=new Me(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}pi.prototype.isLight=!0;class Hc extends pi{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.groundColor=new Me(t)}copy(e){return pi.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Hc.prototype.isHemisphereLight=!0;const sf=new Oe,of=new M,af=new M;class kc{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ee(512,512),this.map=null,this.mapPass=null,this.matrix=new Oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xo,this._frameExtents=new ee(1,1),this._viewportCount=1,this._viewports=[new Nt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;of.setFromMatrixPosition(e.matrixWorld),t.position.copy(of),af.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(af),t.updateMatrixWorld(),sf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sf),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class lf extends kc{constructor(){super(new wn(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=ho*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}lf.prototype.isSpotLightShadow=!0;class Vc extends pi{constructor(e,t,n=0,i=Math.PI/3,r=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.target=new bt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.shadow=new lf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Vc.prototype.isSpotLight=!0;const cf=new Oe,ko=new M,Wc=new M;class uf extends kc{constructor(){super(new wn(90,1,.5,500)),this._frameExtents=new ee(4,2),this._viewportCount=6,this._viewports=[new Nt(2,1,1,1),new Nt(0,1,1,1),new Nt(3,1,1,1),new Nt(1,1,1,1),new Nt(3,0,1,1),new Nt(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),ko.setFromMatrixPosition(e.matrixWorld),n.position.copy(ko),Wc.copy(n.position),Wc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Wc),n.updateMatrixWorld(),i.makeTranslation(-ko.x,-ko.y,-ko.z),cf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cf)}}uf.prototype.isPointLightShadow=!0;class qc extends pi{constructor(e,t,n=0,i=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new uf}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}qc.prototype.isPointLight=!0;class hf extends kc{constructor(){super(new _o(-5,5,5,-5,.5,500))}}hf.prototype.isDirectionalLightShadow=!0;class Xc extends pi{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(bt.DefaultUp),this.updateMatrix(),this.target=new bt,this.shadow=new hf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Xc.prototype.isDirectionalLight=!0;class Zc extends pi{constructor(e,t){super(e,t),this.type="AmbientLight"}}Zc.prototype.isAmbientLight=!0;class jc extends pi{constructor(e,t,n=10,i=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}jc.prototype.isRectAreaLight=!0;class Yc{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(n*r)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*n*r),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}Yc.prototype.isSphericalHarmonics3=!0;class Vo extends pi{constructor(e=new Yc,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Vo.prototype.isLightProbe=!0;class ff extends Gn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,o=new Li(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",r),t[r]}const i=new vy[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Me().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new Me().setHex(o.value);break;case"v2":i.uniforms[r].value=new ee().fromArray(o.value);break;case"v3":i.uniforms[r].value=new M().fromArray(o.value);break;case"v4":i.uniforms[r].value=new Nt().fromArray(o.value);break;case"m3":i.uniforms[r].value=new gn().fromArray(o.value);break;case"m4":i.uniforms[r].value=new Oe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new ee().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ee().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class pl{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Jc extends $e{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}Jc.prototype.isInstancedBufferGeometry=!0;class df extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Li(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(d,m){if(t[m]!==void 0)return t[m];const x=d.interleavedBuffers[m],g=r(d,x.buffer),p=ys(x.type,g),_=new zr(p,x.stride);return _.uuid=x.uuid,t[m]=_,_}function r(d,m){if(n[m]!==void 0)return n[m];const x=d.arrayBuffers[m],g=new Uint32Array(x).buffer;return n[m]=g,g}const o=e.isInstancedBufferGeometry?new Jc:new $e,a=e.data.index;if(a!==void 0){const d=ys(a.type,a.array);o.setIndex(new Tt(d,1))}const l=e.data.attributes;for(const d in l){const m=l[d];let v;if(m.isInterleavedBufferAttribute){const x=i(e.data,m.data);v=new gr(x,m.itemSize,m.offset,m.normalized)}else{const x=ys(m.type,m.array),g=m.isInstancedBufferAttribute?Gr:Tt;v=new g(x,m.itemSize,m.normalized)}m.name!==void 0&&(v.name=m.name),m.usage!==void 0&&v.setUsage(m.usage),m.updateRange!==void 0&&(v.updateRange.offset=m.updateRange.offset,v.updateRange.count=m.updateRange.count),o.setAttribute(d,v)}const c=e.data.morphAttributes;if(c)for(const d in c){const m=c[d],v=[];for(let x=0,g=m.length;x<g;x++){const p=m[x];let _;if(p.isInterleavedBufferAttribute){const y=i(e.data,p.data);_=new gr(y,p.itemSize,p.offset,p.normalized)}else{const y=ys(p.type,p.array);_=new Tt(y,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),v.push(_)}o.morphAttributes[d]=v}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){const v=h[d];o.addGroup(v.start,v.count,v.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const d=new M;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new ar(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class My extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=this.path===""?pl.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Li(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(c,t)},n,i)}loadAsync(e,t){return io(this,null,function*(){const n=this,i=this.path===""?pl.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new Li(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const o=yield r.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return yield n.parseAsync(a)})}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,r,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}parseAsync(e){return io(this,null,function*(){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=yield this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,r),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l})}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new Ei().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=new $a().fromJSON(e[r],i);n[a.uuid]=a}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new df;for(let r=0,o=e.length;r<o;r++){let a;const l=e[r];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in Jh?a=Jh[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const r=new ff;r.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];if(l.type==="MultiMaterial"){const c=[];for(let u=0;u<l.materials.length;u++){const h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=r.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=r.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],r=Go.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function o(l){return n.manager.itemStart(l),r.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:ys(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Gc(t);r=new Ho(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){i[h.uuid]=[];for(let d=0,m=f.length;d<m;d++){const v=f[d],x=a(v);x!==null&&(x instanceof HTMLImageElement?i[h.uuid].push(x):i[h.uuid].push(new Ur(x.data,x.width,x.height)))}}else{const d=a(h.url);d!==null&&(i[h.uuid]=d)}}}return i}parseImagesAsync(e){return io(this,null,function*(){const t=this,n={};let i;function r(o){return io(this,null,function*(){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return yield i.loadAsync(l)}else return o.data?{data:ys(o.type,o.data),width:o.width,height:o.height}:null})}if(e!==void 0&&e.length>0){i=new Ho(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){const f=c[u],d=yield r(f);d!==null&&(d instanceof HTMLImageElement?n[l.uuid].push(d):n[l.uuid].push(new Ur(d.data,d.width,d.height)))}}else{const u=yield r(l.url);u!==null&&(n[l.uuid]=u)}}}return n})}parseTextures(e,t){function n(r,o){return typeof r=="number"?r:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",r),o[r])}const i={};if(e!==void 0)for(let r=0,o=e.length;r<o;r++){const a=e[r];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l;const c=t[a.image];Array.isArray(c)?(l=new Ds(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new Ur(c.data,c.width,c.height):l=new dn(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,wy)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],pf),l.wrapT=n(a.wrap[1],pf)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,mf)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,mf)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,r){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const d=[];for(let m=0,v=f.length;m<v;m++){const x=f[m];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),d.push(n[x])}return d}return n[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),n[f]}}function c(f){return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),i[f]}let u,h;switch(e.type){case"Scene":o=new ka,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Me(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new So(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new wo(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new wn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new _o(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Zc(e.color,e.intensity);break;case"DirectionalLight":o=new Xc(e.color,e.intensity);break;case"PointLight":o=new qc(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new jc(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Vc(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Hc(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Vo().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new Ya(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new pn(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,d=e.instanceMatrix,m=e.instanceColor;o=new fc(u,h,f),o.instanceMatrix=new Gr(new Float32Array(d.array),16),m!==void 0&&(o.instanceColor=new Gr(new Float32Array(m.array),m.itemSize));break;case"LOD":o=new Mh;break;case"Line":o=new Xi(a(e.geometry),l(e.material));break;case"LineLoop":o=new pc(a(e.geometry),l(e.material));break;case"LineSegments":o=new Vn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new Lo(a(e.geometry),l(e.material));break;case"Sprite":o=new Xa(l(e.material));break;case"Group":o=new Or;break;case"Bone":o=new Ja;break;default:o=new bt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let d=0;d<f.length;d++)o.add(this.parseObject(f[d],t,n,i,r))}if(e.animations!==void 0){const f=e.animations;for(let d=0;d<f.length;d++){const m=f[d];o.animations.push(r[m])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let d=0;d<f.length;d++){const m=f[d],v=o.getObjectByProperty("uuid",m.object);v!==void 0&&o.addLevel(v,m.distance)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}const wy={UVMapping:rs,CubeReflectionMapping:Bi,CubeRefractionMapping:Ni,EquirectangularReflectionMapping:yn,EquirectangularRefractionMapping:Mr,CubeUVReflectionMapping:wr,CubeUVRefractionMapping:Ki},pf={RepeatWrapping:Sr,ClampToEdgeWrapping:xn,MirroredRepeatWrapping:yi},mf={NearestFilter:Kt,NearestMipmapNearestFilter:ss,NearestMipmapLinearFilter:os,LinearFilter:en,LinearMipmapNearestFilter:xi,LinearMipmapLinearFilter:Qi};class gf extends Gn{constructor(e){super(e),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=Zr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){Zr.add(e,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){i&&i(l),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}gf.prototype.isImageBitmapLoader=!0;let ml;const $c={getContext:function(){return ml===void 0&&(ml=new(window.AudioContext||window.webkitAudioContext)),ml},setContext:function(s){ml=s}};class vf extends Gn{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new Li(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);$c.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}}class yf extends Vo{constructor(e,t,n=1){super(void 0,n);const i=new Me().set(e),r=new Me().set(t),o=new M(i.r,i.g,i.b),a=new M(r.r,r.g,r.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}yf.prototype.isHemisphereLightProbe=!0;class xf extends Vo{constructor(e,t=1){super(void 0,t);const n=new Me().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}xf.prototype.isAmbientLightProbe=!0;const _f=new Oe,bf=new Oe,jr=new Oe;class Sy{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new wn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new wn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,jr.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(Lr*t.fov*.5)/t.zoom;let a,l;bf.elements[12]=-i,_f.elements[12]=i,a=-o*t.aspect+r,l=o*t.aspect+r,jr.elements[0]=2*t.near/(l-a),jr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(jr),a=-o*t.aspect-r,l=o*t.aspect-r,jr.elements[0]=2*t.near/(l-a),jr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(jr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(bf),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_f)}}class Mf{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=wf(),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 e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=wf();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function wf(){return(typeof performance=="undefined"?Date:performance).now()}const Yr=new M,Sf=new Rn,Ty=new M,Jr=new M;class Ey extends bt{constructor(){super(),this.type="AudioListener",this.context=$c.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Mf}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Yr,Sf,Ty),Jr.set(0,0,-1).applyQuaternion(Sf),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Yr.x,i),t.positionY.linearRampToValueAtTime(Yr.y,i),t.positionZ.linearRampToValueAtTime(Yr.z,i),t.forwardX.linearRampToValueAtTime(Jr.x,i),t.forwardY.linearRampToValueAtTime(Jr.y,i),t.forwardZ.linearRampToValueAtTime(Jr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Yr.x,Yr.y,Yr.z),t.setOrientation(Jr.x,Jr.y,Jr.z,n.x,n.y,n.z)}}class Kc extends bt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const $r=new M,Tf=new Rn,Ay=new M,Kr=new M;class Cy extends Kc{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose($r,Tf,Ay),Kr.set(0,0,1).applyQuaternion(Tf);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime($r.x,n),t.positionY.linearRampToValueAtTime($r.y,n),t.positionZ.linearRampToValueAtTime($r.z,n),t.orientationX.linearRampToValueAtTime(Kr.x,n),t.orientationY.linearRampToValueAtTime(Kr.y,n),t.orientationZ.linearRampToValueAtTime(Kr.z,n)}else t.setPosition($r.x,$r.y,$r.z),t.setOrientation(Kr.x,Kr.y,Kr.z)}}class Ef{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class Af{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,o;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[r+a]=n[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(n,r,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-r,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Rn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;Rn.multiplyQuaternionsFlat(e,o,e,t,e,n),Rn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Qc="\\[\\]\\.:\\/",Ly=new RegExp("["+Qc+"]","g"),eu="[^"+Qc+"]",Ry="[^"+Qc.replace("\\.","")+"]",Py=/((?:WC+[\/:])*)/.source.replace("WC",eu),Dy=/(WCOD+)?/.source.replace("WCOD",Ry),Iy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eu),Fy=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eu),By=new RegExp("^"+Py+Dy+Iy+Fy+"$"),Ny=["material","materials","bones"];class Oy{constructor(e,t,n){const i=n||At.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class At{constructor(e,t,n){this.path=t,this.parsedPath=n||At.parseTrackName(t),this.node=At.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new At.Composite(e,t,n):new At(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Ly,"")}static parseTrackName(e){const t=By.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);Ny.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let o=0;o<r.length;o++){const a=r[o];if(a.name===t||a.uuid===t)return a;const l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=At.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}At.Composite=Oy,At.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},At.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},At.prototype.GetterByBindingType=[At.prototype._getValue_direct,At.prototype._getValue_array,At.prototype._getValue_arrayElement,At.prototype._getValue_toArray],At.prototype.SetterByBindingTypeAndVersioning=[[At.prototype._setValue_direct,At.prototype._setValue_direct_setNeedsUpdate,At.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[At.prototype._setValue_array,At.prototype._setValue_array_setNeedsUpdate,At.prototype._setValue_array_setMatrixWorldNeedsUpdate],[At.prototype._setValue_arrayElement,At.prototype._setValue_arrayElement_setNeedsUpdate,At.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[At.prototype._setValue_fromArray,At.prototype._setValue_fromArray_setNeedsUpdate,At.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Cf{constructor(){this.uuid=Yn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,o=r.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],d=f.uuid;let m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let v=0,x=o;v!==x;++v)r[v].push(new At(f,n[v],i[v]))}else if(m<c){a=e[m];const v=--c,x=e[v];t[x.uuid]=m,e[m]=x,t[d]=v,e[v]=f;for(let g=0,p=o;g!==p;++g){const _=r[g],y=_[v];let w=_[m];_[m]=y,w===void 0&&(w=new At(f,n[g],i[g])),_[v]=w}}else e[m]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=r){const h=r++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=i;d!==m;++d){const v=n[d],x=v[h],g=v[u];v[u]=x,v[h]=g}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<r){const f=--r,d=e[f],m=--o,v=e[m];t[d.uuid]=h,e[h]=d,t[v.uuid]=f,e[f]=v,e.pop();for(let x=0,g=i;x!==g;++x){const p=n[x],_=p[f],y=p[m];p[h]=_,p[f]=y,p.pop()}}else{const f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,v=i;m!==v;++m){const x=n[m];x[h]=x[f],x.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let f=u,d=l.length;f!==d;++f){const m=l[f];h[f]=new At(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}Cf.prototype.isAnimationObjectGroup=!0;class zy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:Zn,endingEnd:Zn};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ms,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case co:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case ir:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===On;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===ps){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=jn,i.endingEnd=jn):(e?i.endingStart=this.zeroSlopeAtStart?jn:Zn:i.endingStart=Pn,t?i.endingEnd=this.zeroSlopeAtEnd?jn:Zn:i.endingEnd=Pn)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=n,this}}class Lf extends rr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==r;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;m=new Af(At.create(n,d,v),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new zc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let o=typeof e=="string"?Go.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=ir),l!==void 0){const h=l.actionByRoot[r];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new zy(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,r),u}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?Go.findByName(n,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){const o=r.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,r=i[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}Lf.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class gl{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new gl(this.value.clone===void 0?this.value:this.value.clone())}}class Rf extends zr{constructor(e,t,n=1){super(e,t),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}Rf.prototype.isInstancedInterleavedBuffer=!0;class Pf{constructor(e,t,n,i,r){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}Pf.prototype.isGLBufferAttribute=!0;class Uy{constructor(e,t,n=0,i=1/0){this.ray=new cr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new va,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return tu(e,this,n,t),n.sort(Df),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)tu(e[i],this,n,t);return n.sort(Df),n}}function Df(s,e){return s.distance-e.distance}function tu(s,e,t,n){if(s.layers.test(e.layers)&&s.raycast(e,t),n===!0){const i=s.children;for(let r=0,o=i.length;r<o;r++)tu(i[r],e,t,!0)}}class Gy{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ln(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Hy{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const If=new ee;class to{constructor(e=new ee(1/0,1/0),t=new ee(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=If.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return If.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}to.prototype.isBox2=!0;const Ff=new M,vl=new M;class Bf{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Ff.subVectors(e,this.start),vl.subVectors(this.end,this.start);const n=vl.dot(vl);let r=vl.dot(Ff)/n;return t&&(r=Ln(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Nf=new M;class ky extends bt{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new $e,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new Fe(i,3));const r=new Sn({fog:!1,toneMapped:!1});this.cone=new Vn(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Nf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nf),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const xr=new M,yl=new Oe,nu=new Oe;class Of extends Vn{constructor(e){const t=zf(e),n=new $e,i=[],r=[],o=new Me(0,0,1),a=new Me(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}n.setAttribute("position",new Fe(i,3)),n.setAttribute("color",new Fe(r,3));const l=new Sn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");nu.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(yl.multiplyMatrices(nu,a.matrixWorld),xr.setFromMatrixPosition(yl),i.setXYZ(o,xr.x,xr.y,xr.z),yl.multiplyMatrices(nu,a.parent.matrixWorld),xr.setFromMatrixPosition(yl),i.setXYZ(o+1,xr.x,xr.y,xr.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function zf(s){const e=[];s&&s.isBone&&e.push(s);for(let t=0;t<s.children.length;t++)e.push.apply(e,zf(s.children[t]));return e}class Vy extends pn{constructor(e,t,n){const i=new Wr(t,4,2),r=new Vi({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Wy=new M,Uf=new Me,Gf=new Me;class qy extends bt{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new kr(t);i.rotateY(Math.PI*.5),this.material=new Vi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),o=new Float32Array(r.count*3);i.setAttribute("color",new Tt(o,3)),this.add(new pn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Uf.copy(this.light.color),Gf.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?Uf:Gf;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(Wy.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Hf extends Vn{constructor(e=10,t=10,n=4473924,i=8947848){n=new Me(n),i=new Me(i);const r=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);const v=f===r?n:i;v.toArray(c,d),d+=3,v.toArray(c,d),d+=3,v.toArray(c,d),d+=3,v.toArray(c,d),d+=3}const u=new $e;u.setAttribute("position",new Fe(l,3)),u.setAttribute("color",new Fe(c,3));const h=new Sn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}class Xy extends Vn{constructor(e=10,t=16,n=8,i=64,r=4473924,o=8947848){r=new Me(r),o=new Me(o);const a=[],l=[];for(let h=0;h<=t;h++){const f=h/t*(Math.PI*2),d=Math.sin(f)*e,m=Math.cos(f)*e;a.push(0,0,0),a.push(d,0,m);const v=h&1?r:o;l.push(v.r,v.g,v.b),l.push(v.r,v.g,v.b)}for(let h=0;h<=n;h++){const f=h&1?r:o,d=e-e/n*h;for(let m=0;m<i;m++){let v=m/i*(Math.PI*2),x=Math.sin(v)*d,g=Math.cos(v)*d;a.push(x,0,g),l.push(f.r,f.g,f.b),v=(m+1)/i*(Math.PI*2),x=Math.sin(v)*d,g=Math.cos(v)*d,a.push(x,0,g),l.push(f.r,f.g,f.b)}}const c=new $e;c.setAttribute("position",new Fe(a,3)),c.setAttribute("color",new Fe(l,3));const u=new Sn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}}const kf=new M,xl=new M,Vf=new M;class Zy extends bt{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new $e;i.setAttribute("position",new Fe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Sn({fog:!1,toneMapped:!1});this.lightPlane=new Xi(i,r),this.add(this.lightPlane),i=new $e,i.setAttribute("position",new Fe([0,0,0,0,0,1],3)),this.targetLine=new Xi(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){kf.setFromMatrixPosition(this.light.matrixWorld),xl.setFromMatrixPosition(this.light.target.matrixWorld),Vf.subVectors(xl,kf),this.lightPlane.lookAt(xl),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(xl),this.targetLine.scale.z=Vf.length()}}const _l=new M,rn=new yo;class jy extends Vn{constructor(e){const t=new $e,n=new Sn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],o={},a=new Me(16755200),l=new Me(16711680),c=new Me(43775),u=new Me(16777215),h=new Me(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,v,x){d(m,x),d(v,x)}function d(m,v){i.push(0,0,0),r.push(v.r,v.g,v.b),o[m]===void 0&&(o[m]=[]),o[m].push(i.length/3-1)}t.setAttribute("position",new Fe(i,3)),t.setAttribute("color",new Fe(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;rn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),un("c",t,e,rn,0,0,-1),un("t",t,e,rn,0,0,1),un("n1",t,e,rn,-n,-i,-1),un("n2",t,e,rn,n,-i,-1),un("n3",t,e,rn,-n,i,-1),un("n4",t,e,rn,n,i,-1),un("f1",t,e,rn,-n,-i,1),un("f2",t,e,rn,n,-i,1),un("f3",t,e,rn,-n,i,1),un("f4",t,e,rn,n,i,1),un("u1",t,e,rn,n*.7,i*1.1,-1),un("u2",t,e,rn,-n*.7,i*1.1,-1),un("u3",t,e,rn,0,i*2,-1),un("cf1",t,e,rn,-n,0,1),un("cf2",t,e,rn,n,0,1),un("cf3",t,e,rn,0,-i,1),un("cf4",t,e,rn,0,i,1),un("cn1",t,e,rn,-n,0,-1),un("cn2",t,e,rn,n,0,-1),un("cn3",t,e,rn,0,-i,-1),un("cn4",t,e,rn,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function un(s,e,t,n,i,r,o){_l.set(i,r,o).unproject(n);const a=e[s];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],_l.x,_l.y,_l.z)}}const bl=new $n;class Wf extends Vn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),r=new $e;r.setIndex(new Tt(n,1)),r.setAttribute("position",new Tt(i,3)),super(r,new Sn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&bl.setFromObject(this.object),bl.isEmpty())return;const t=bl.min,n=bl.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Vn.prototype.copy.call(this,e),this.object=e.object,this}}class Yy extends Vn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new $e;r.setIndex(new Tt(n,1)),r.setAttribute("position",new Fe(i,3)),super(r,new Sn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class Jy extends Xi{constructor(e,t=1,n=16776960){const i=n,r=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],o=new $e;o.setAttribute("position",new Fe(r,3)),o.computeBoundingSphere(),super(o,new Sn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new $e;l.setAttribute("position",new Fe(a,3)),l.computeBoundingSphere(),this.add(new pn(l,new Vi({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?pt:Q,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}const qf=new M;let Ml,iu;class $y extends bt{constructor(e=new M(0,0,1),t=new M(0,0,0),n=1,i=16776960,r=n*.2,o=r*.2){super(),this.type="ArrowHelper",Ml===void 0&&(Ml=new $e,Ml.setAttribute("position",new Fe([0,0,0,0,1,0],3)),iu=new vr(0,.5,1,5,1),iu.translate(0,-.5,0)),this.position.copy(t),this.line=new Xi(Ml,new Sn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pn(iu,new Vi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{qf.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(qf,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Xf extends Vn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new $e;i.setAttribute("position",new Fe(t,3)),i.setAttribute("color",new Fe(n,3));const r=new Sn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new Me,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Ky{constructor(){this.type="ShapePath",this.color=new Me,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Fo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(p){const _=[];for(let y=0,w=p.length;y<w;y++){const L=p[y],I=new Ei;I.curves=L.curves,_.push(I)}return _}function i(p,_){const y=_.length;let w=!1;for(let L=y-1,I=0;I<y;L=I++){let O=_[L],j=_[I],V=j.x-O.x,N=j.y-O.y;if(Math.abs(N)>Number.EPSILON){if(N<0&&(O=_[I],V=-V,j=_[L],N=-N),p.y<O.y||p.y>j.y)continue;if(p.y===O.y){if(p.x===O.x)return!0}else{const T=N*(p.x-O.x)-V*(p.y-O.y);if(T===0)return!0;if(T<0)continue;w=!w}}else{if(p.y!==O.y)continue;if(j.x<=p.x&&p.x<=O.x||O.x<=p.x&&p.x<=j.x)return!0}}return w}const r=Ai.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c;const u=[];if(o.length===1)return l=o[0],c=new Ei,c.curves=l.curves,u.push(c),u;let h=!r(o[0].getPoints());h=e?!h:h;const f=[],d=[];let m=[],v=0,x;d[v]=void 0,m[v]=[];for(let p=0,_=o.length;p<_;p++)l=o[p],x=l.getPoints(),a=r(x),a=e?!a:a,a?(!h&&d[v]&&v++,d[v]={s:new Ei,p:x},d[v].s.curves=l.curves,h&&v++,m[v]=[]):m[v].push({h:l,p:x[0]});if(!d[0])return n(o);if(d.length>1){let p=!1;const _=[];for(let y=0,w=d.length;y<w;y++)f[y]=[];for(let y=0,w=d.length;y<w;y++){const L=m[y];for(let I=0;I<L.length;I++){const O=L[I];let j=!0;for(let V=0;V<d.length;V++)i(O.p,d[V].p)&&(y!==V&&_.push({froms:y,tos:V,hole:I}),j?(j=!1,f[V].push(O)):p=!0);j&&f[y].push(O)}}_.length>0&&(p||(m=f))}let g;for(let p=0,_=d.length;p<_;p++){c=d[p].s,u.push(c),g=m[p];for(let y=0,w=g.length;y<w;y++)c.holes.push(g[y].h)}return u}}const Zf=new Float32Array(1),Qy=new Int32Array(Zf.buffer);class ex{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),Zf[0]=e;const t=Qy[0];let n=t>>16&32768,i=t>>12&2047;const r=t>>23&255;return r<103?n:r>142?(n|=31744,n|=(r==255?0:1)&&t&8388607,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=i&1,n)}}const tx=0,nx=1,ix=0,rx=1,sx=2;function ox(s){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),s}function ax(s=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),s.isMultiMaterial=!0,s.materials=s,s.clone=function(){return s.slice()},s}function lx(s,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Lo(s,e)}function cx(s){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Xa(s)}function ux(s,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Lo(s,e)}function hx(s){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Hr(s)}function fx(s){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Hr(s)}function dx(s){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Hr(s)}function px(s,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new M(s,e,t)}function mx(s,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Tt(s,e).setUsage(vs)}function gx(s,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Eu(s,e)}function vx(s,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Au(s,e)}function yx(s,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Cu(s,e)}function xx(s,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Lu(s,e)}function _x(s,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ba(s,e)}function bx(s,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ru(s,e)}function Mx(s,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Ma(s,e)}function wx(s,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Fe(s,e)}function Sx(s,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Du(s,e)}ei.create=function(s,e){return console.log("THREE.Curve.create() has been deprecated"),s.prototype=Object.create(ei.prototype),s.prototype.constructor=s,s.prototype.getPoint=e,s},Fo.prototype.fromPoints=function(s){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(s)};function Tx(s){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Xf(s)}function Ex(s,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Wf(s,e)}function Ax(s,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Vn(new yc(s.geometry),new Sn({color:e!==void 0?e:16777215}))}Hf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Of.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function Cx(s,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Vn(new Lc(s.geometry),new Sn({color:e!==void 0?e:16777215}))}Gn.prototype.extractUrlBase=function(s){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),pl.extractUrlBase(s)},Gn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};function Lx(s){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Li(s)}function Rx(s){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new nf(s)}to.prototype.center=function(s){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(s)},to.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},to.prototype.isIntersectionBox=function(s){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)},to.prototype.size=function(s){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(s)},$n.prototype.center=function(s){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(s)},$n.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},$n.prototype.isIntersectionBox=function(s){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)},$n.prototype.isIntersectionSphere=function(s){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(s)},$n.prototype.size=function(s){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(s)},ar.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},xo.prototype.setFromMatrix=function(s){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(s)},Bf.prototype.center=function(s){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(s)},gn.prototype.flattenToArrayOffset=function(s,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(s,e)},gn.prototype.multiplyVector3=function(s){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),s.applyMatrix3(this)},gn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},gn.prototype.applyToBufferAttribute=function(s){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),s.applyMatrix3(this)},gn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},gn.prototype.getInverse=function(s){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(s).invert()},Oe.prototype.extractPosition=function(s){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(s)},Oe.prototype.flattenToArrayOffset=function(s,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(s,e)},Oe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)},Oe.prototype.setRotationFromQuaternion=function(s){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(s)},Oe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Oe.prototype.multiplyVector3=function(s){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)},Oe.prototype.multiplyVector4=function(s){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)},Oe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Oe.prototype.rotateAxis=function(s){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),s.transformDirection(this)},Oe.prototype.crossVector=function(s){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)},Oe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Oe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Oe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Oe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Oe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Oe.prototype.applyToBufferAttribute=function(s){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),s.applyMatrix4(this)},Oe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Oe.prototype.makeFrustum=function(s,e,t,n,i,r){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(s,e,n,t,i,r)},Oe.prototype.getInverse=function(s){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(s).invert()},wi.prototype.isIntersectionLine=function(s){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(s)},Rn.prototype.multiplyVector3=function(s){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),s.applyQuaternion(this)},Rn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},cr.prototype.isIntersectionBox=function(s){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(s)},cr.prototype.isIntersectionPlane=function(s){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(s)},cr.prototype.isIntersectionSphere=function(s){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(s)},ln.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},ln.prototype.barycoordFromPoint=function(s,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(s,e)},ln.prototype.midpoint=function(s){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(s)},ln.prototypenormal=function(s){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(s)},ln.prototype.plane=function(s){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(s)},ln.barycoordFromPoint=function(s,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ln.getBarycoord(s,e,t,n,i)},ln.normal=function(s,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ln.getNormal(s,e,t,n)},Ei.prototype.extractAllPoints=function(s){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(s)},Ei.prototype.extrude=function(s){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ci(this,s)},Ei.prototype.makeGeometry=function(s){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Vr(this,s)},ee.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)},ee.prototype.distanceToManhattan=function(s){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(s)},ee.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},M.prototype.getPositionFromMatrix=function(s){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(s)},M.prototype.getScaleFromMatrix=function(s){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(s)},M.prototype.getColumnFromMatrix=function(s,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,s)},M.prototype.applyProjection=function(s){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(s)},M.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)},M.prototype.distanceToManhattan=function(s){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(s)},M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Nt.prototype.fromAttribute=function(s,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(s,e,t)},Nt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},bt.prototype.getChildByName=function(s){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(s)},bt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},bt.prototype.translate=function(s,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,s)},bt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},bt.prototype.applyMatrix=function(s){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(s)},Object.defineProperties(bt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(s){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=s}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),pn.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(pn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),uo},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ya.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},wn.prototype.setLens=function(s,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(s)},Object.defineProperties(pi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(s){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=s}},shadowCameraLeft:{set:function(s){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=s}},shadowCameraRight:{set:function(s){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=s}},shadowCameraTop:{set:function(s){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=s}},shadowCameraBottom:{set:function(s){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=s}},shadowCameraNear:{set:function(s){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=s}},shadowCameraFar:{set:function(s){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=s}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(s){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=s}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(s){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=s}},shadowMapHeight:{set:function(s){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=s}}}),Object.defineProperties(Tt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===vs},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(vs)}}}),Tt.prototype.setDynamic=function(s){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(s===!0?vs:gs),this},Tt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Tt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},$e.prototype.addIndex=function(s){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(s)},$e.prototype.addAttribute=function(s,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(s,new Tt(arguments[1],arguments[2]))):s==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(s,e)},$e.prototype.addDrawCall=function(s,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(s,e)},$e.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},$e.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},$e.prototype.removeAttribute=function(s){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(s)},$e.prototype.applyMatrix=function(s){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(s)},Object.defineProperties($e.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),zr.prototype.setDynamic=function(s){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(s===!0?vs:gs),this},zr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Ci.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Ci.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Ci.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ka.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},gl.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(bn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Me}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(s){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=s===et}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(s){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=s}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(qi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(s){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=s}}}),Ot.prototype.clearTarget=function(s,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(s),this.clear(e,t,n)},Ot.prototype.animate=function(s){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(s)},Ot.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Ot.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Ot.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Ot.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Ot.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Ot.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Ot.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Ot.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Ot.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Ot.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Ot.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Ot.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Ot.prototype.enableScissorTest=function(s){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(s)},Ot.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Ot.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Ot.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Ot.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Ot.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Ot.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Ot.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Ot.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Ot.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Ot.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Ot.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(s){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=s}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(s){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=s}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(s){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=s===!0?Ar:oi}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(mh.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});function Px(s,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Da(s,t)}Object.defineProperties(Jn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(s){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=s}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(s){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=s}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(s){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=s}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(s){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=s}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(s){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=s}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(s){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=s}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(s){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=s}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(s){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=s}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(s){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=s}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(s){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=s}}}),Kc.prototype.load=function(s){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new vf().load(s,function(n){e.setBuffer(n)}),this},Ef.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Pa.prototype.updateCubeMap=function(s,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(s,e)},Pa.prototype.clear=function(s,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(s,e,t,n)},Rr.crossOrigin=void 0,Rr.loadTexture=function(s,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new rf;i.setCrossOrigin(this.crossOrigin);const r=i.load(s,t,void 0,n);return e&&(r.mapping=e),r},Rr.loadTextureCube=function(s,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new tf;i.setCrossOrigin(this.crossOrigin);const r=i.load(s,t,void 0,n);return e&&(r.mapping=e),r},Rr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Rr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function Dx(){console.error("THREE.CanvasRenderer has been removed")}function Ix(){console.error("THREE.JSONLoader has been removed.")}const Fx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Bx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function Nx(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new $e}function Ox(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new $e}function zx(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function Ux(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function Gx(){console.error("THREE.ImmediateRenderObject has been removed.")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:qe}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=qe)},77:function(Je,Ze,Ce){var qe=ft=>{var Ke={};return Ce.d(Ke,ft),Ke},He=ft=>()=>ft;Je.exports=qe({get:()=>td.get,set:()=>td.set})},568:function(Je,Ze,Ce){Ce.d(Ze,{Z:function(){return He}});function qe(ft,Ke,lt,_t,ke,Mt,Vt){try{var Wt=ft[Mt](Vt),dt=Wt.value}catch(Q){lt(Q);return}Wt.done?Ke(dt):Promise.resolve(dt).then(_t,ke)}function He(ft){return function(){var Ke=this,lt=arguments;return new Promise(function(_t,ke){var Mt=ft.apply(Ke,lt);function Vt(dt){qe(Mt,_t,ke,Vt,Wt,"next",dt)}function Wt(dt){qe(Mt,_t,ke,Vt,Wt,"throw",dt)}Vt(void 0)})}}},924:function(Je,Ze,Ce){Ce.d(Ze,{Z:function(){return qe}});function qe(He,ft,Ke){return ft in He?Object.defineProperty(He,ft,{value:Ke,enumerable:!0,configurable:!0,writable:!0}):He[ft]=Ke,He}},42:function(Je,Ze,Ce){Ce.d(Ze,{Z:function(){return He}});var qe=Ce(924);function He(ft){for(var Ke=1;Ke<arguments.length;Ke++){var lt=arguments[Ke]!=null?arguments[Ke]:{},_t=Object.keys(lt);typeof Object.getOwnPropertySymbols=="function"&&(_t=_t.concat(Object.getOwnPropertySymbols(lt).filter(function(ke){return Object.getOwnPropertyDescriptor(lt,ke).enumerable}))),_t.forEach(function(ke){(0,qe.Z)(ft,ke,lt[ke])})}return ft}}},rd={};function zt(Je){var Ze=rd[Je];if(Ze!==void 0)return Ze.exports;var Ce=rd[Je]={exports:{}};return i0[Je](Ce,Ce.exports,zt),Ce.exports}(function(){zt.n=function(Je){var Ze=Je&&Je.__esModule?function(){return Je.default}:function(){return Je};return zt.d(Ze,{a:Ze}),Ze}})(),function(){zt.d=function(Je,Ze){for(var Ce in Ze)zt.o(Ze,Ce)&&!zt.o(Je,Ce)&&Object.defineProperty(Je,Ce,{enumerable:!0,get:Ze[Ce]})}}(),function(){zt.o=function(Je,Ze){return Object.prototype.hasOwnProperty.call(Je,Ze)}}(),function(){zt.r=function(Je){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Je,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Je,"__esModule",{value:!0})}}();var ti={};(function(){zt.d(ti,{Ei:function(){return ao},Yo:function(){return oa},Ee:function(){return gi},x1:function(){return El},VJ:function(){return Wn},r7:function(){return is},XA:function(){return ro},NB:function(){return Xo},xv:function(){return Qe},nk:function(){return qo},JX:function(){return lo},TQ:function(){return os}});function Je(b,D){if(!(b instanceof D))throw new TypeError("Cannot call a class as a function")}function Ze(b,D){return Ze=Object.setPrototypeOf||function(B,z){return B.__proto__=z,B},Ze(b,D)}function Ce(b,D){return Ze(b,D)}function qe(b,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");b.prototype=Object.create(D&&D.prototype,{constructor:{value:b,writable:!0,configurable:!0}}),D&&Ce(b,D)}var He=zt(42);function ft(b,D){var R=Object.keys(b);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(b);D&&(B=B.filter(function(z){return Object.getOwnPropertyDescriptor(b,z).enumerable})),R.push.apply(R,B)}return R}function Ke(b,D){return D=D!=null?D:{},Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(D)):ft(Object(D)).forEach(function(R){Object.defineProperty(b,R,Object.getOwnPropertyDescriptor(D,R))}),b}function lt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(b){return!1}}function _t(b){return _t=Object.setPrototypeOf?Object.getPrototypeOf:function(R){return R.__proto__||Object.getPrototypeOf(R)},_t(b)}function ke(b){return _t(b)}function Mt(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function Vt(b){return b&&b.constructor===Symbol?"symbol":typeof b}function Wt(b,D){return D&&(Vt(D)==="object"||typeof D=="function")?D:Mt(b)}function dt(b){var D=lt();return function(){var B=ke(b),z;if(D){var S=ke(this).constructor;z=Reflect.construct(B,arguments,S)}else z=B.apply(this,arguments);return Wt(this,z)}}var Q=zt(212);function pt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}function Ft(b,D,R){return pt()?Ft=Reflect.construct:Ft=function(z,S,k){var Y=[null];Y.push.apply(Y,S);var oe=Function.bind.apply(z,Y),ae=new oe;return k&&Ce(ae,k.prototype),ae},Ft.apply(null,arguments)}function et(b,D,R){return Ft.apply(null,arguments)}function kt(b,D){for(var R=0;R<D.length;R++){var B=D[R];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(b,B.key,B)}}function mt(b,D,R){return D&&kt(b.prototype,D),R&&kt(b,R),b}function Bt(b,D){(D==null||D>b.length)&&(D=b.length);for(var R=0,B=new Array(D);R<D;R++)B[R]=b[R];return B}function mn(b){if(Array.isArray(b))return Bt(b)}function Qt(b){if(typeof Symbol!="undefined"&&b[Symbol.iterator]!=null||b["@@iterator"]!=null)return Array.from(b)}function qt(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xt(b,D){if(!!b){if(typeof b=="string")return Bt(b,D);var R=Object.prototype.toString.call(b).slice(8,-1);if(R==="Object"&&b.constructor&&(R=b.constructor.name),R==="Map"||R==="Set")return Array.from(R);if(R==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(R))return Bt(b,D)}}function Pt(b){return mn(b)||Qt(b)||Xt(b)||qt()}var nn=zt(484);function Hn(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R={};return R.promise=new Promise(function(B,z){R.resolve=B,R.reject=z}),b&&(R.promise=(0,nn.Z)(R.promise,D)),R}var ni=b=>{var D={};return zt.d(D,b),D},St=b=>()=>b,Ut=ni({CSS2DObject:()=>Yx.CSS2DObject}),Ji=b=>{var D={};return zt.d(D,b),D},_r=b=>()=>b,$i=Ji({CSS3DObject:()=>nd.CSS3DObject,CSS3DSprite:()=>nd.CSS3DSprite}),le=zt(90),ie=function(b){b&&((0,le.wf)(b),b.children.forEach(function(D){D.userData.BaseObject_||ie(D)}))},ve=function(){"use strict";function b(){Je(this,b),this.objecttype__="BaseObject",this.userData={},this.pm=Hn(),this.visible=!1}var D=b.prototype;return D.init=function(){},D.create=function(){},D.render=function(){},D.update=function(B,z){},D.resize=function(B,z){},D.show=function(){return this.object3d&&(this.object3d.visible=!0),this.visible=!0,this},D.hide=function(){return this.object3d&&(this.object3d.visible=!1),this.visible=!1,this},D.isVisible=function(){return this.visible},D.createMesh=function(){for(var B=arguments.length,z=new Array(B),S=0;S<B;S++)z[S]=arguments[S];return this.object3d=et(Q.Mesh,Pt(z)),this},D.createGroup=function(){return this.object3d=new Q.Group,this},D.createPoints=function(){for(var B=arguments.length,z=new Array(B),S=0;S<B;S++)z[S]=arguments[S];return this.object3d=et(Q.Points,Pt(z)),this},D.createCSS2DObject=function(B){return this.object3d=new Ut.CSS2DObject(B),this},D.createCSS3DObject=function(B){return this.object3d=new $i.CSS3DObject(B),this},D.createCSS3DSprite=function(B){return this.object3d=new $i.CSS3DSprite(B),this},D.createSprite=function(B){return this.object3d=new Q.Sprite(B),this},D.add=function(){for(var B=arguments.length,z=new Array(B),S=0;S<B;S++)z[S]=arguments[S];var k;return(k=this.object3d).add.apply(k,Pt(z)),this},D.remove=function(){for(var B=arguments.length,z=new Array(B),S=0;S<B;S++)z[S]=arguments[S];var k;return(k=this.object3d).remove.apply(k,Pt(z)),this},D.getSize=function(){var B=new Q.Box3().setFromObject(this.object3d);return{min:B.min,max:B.max,size:B.getSize(new Q.Vector3)}},D.traverse=function(B){B(this),this.children.forEach(function(z){z.traverse(B)})},D.dispose=function(){ie(this.object3d)},mt(b,[{key:"parent",get:function(){var B=this.object3d.parent;return(B==null?void 0:B.userData.BaseObject_)||this.pencil.scene}},{key:"children",get:function(){return this.object3d.children.map(function(B){return B.userData.BaseObject_}).filter(function(B){return!!B})}}]),b}(),Qe=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.width=0,S.canvas=document.createElement("canvas"),S.options=(0,He.Z)({},{scale:.5,fontSize:28,fontFamily:"system-ui,-apple-system,BlinkMacSystemFont,sans-serif",fontWeight:"normal",flipX:!1,sprite:!1,sizeAttenuation:!0},z),S}var B=R.prototype;return B.create=function(){var S=this.options,k=S.position,Y=S.lookAt,oe=S.sprite,ae=S.text,fe=S.sizeAttenuation;if(oe){var de=new Q.Sprite(new Q.SpriteMaterial({transparent:!0,sizeAttenuation:fe}));this.object3d=de}else{var Ee=new Q.MeshBasicMaterial({side:Q.DoubleSide,transparent:!0}),De=new Q.PlaneGeometry(1,1,1,1);this.createMesh(De,Ee)}this.object3d.position.copy(k),Y&&this.object3d.lookAt(Y),this.setText(ae)},B.setText=function(S,k){var Y=(0,He.Z)(Ke((0,He.Z)({},this.options),{text:S}),k||{}),oe=Y.text,ae=Y.fontSize,fe=Y.fontFamily,de=Y.fontWeight,Ee=Y.flipX,De=Y.scale,Pe=this.canvas;Pe.width=ae*oe.length*2,Pe.height=ae;var Ae=Pe.getContext("2d");Ae.font="".concat(de," ").concat(ae,"px/1 ").concat(fe);var J=Ae.measureText(oe).width;Pe.width=J,this.width=J,Ae=Pe.getContext("2d"),Ae.clearRect(0,0,Pe.width,Pe.height),Ee&&Ae.scale(-1,1),Ae.font="".concat(de," ").concat(ae,"px/1 ").concat(fe),Ae.textBaseline="middle",Ae.fillStyle="#ffffff",Ae.fillText(oe,Ee?J*-1:0,Pe.height/2),Ae.restore();var je=new Q.Texture(Pe);je.anisotropy=16,je.needsUpdate=!0;var Ve=this.object3d;Ve.material.map&&Ve.material.map.dispose(),Ve.material.map=je,Ve.material.needsUpdate=!0,Ve.scale.set(je.image.width*De,je.image.height*De,1)},R}(ve),ze=zt(568),Yt=zt(666),Rt=zt.n(Yt),hn=+Q.REVISION<144,Tn=hn?"ExtrudeBufferGeometry":"ExtrudeGeometry",fn=hn?"PlaneBufferGeometry":"PlaneGeometry",gi=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.options=z,S}var B=R.prototype;return B.getMaterial=function(){var S=this;return(0,ze.Z)(Rt().mark(function k(){var Y,oe,ae,fe,de,Ee,De,Pe,Ae,J;return Rt().wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:return Y=S.options,oe=Y.transparent,ae=Y.blending,fe=Y.src,de=Y.depthWrite,Ee=Y.alphaTest,De=Y.sprite,Pe=Y.sizeAttenuation,Ve.next=3,new Q.TextureLoader().loadAsync(fe);case 3:return Ae=Ve.sent,J=De?new Q.SpriteMaterial({map:Ae,transparent:oe!=null?oe:!1,blending:ae!=null?ae:Q.NormalBlending,depthWrite:de!=null?de:!0,alphaTest:Ee!=null?Ee:0,sizeAttenuation:Pe!=null?Pe:!0}):new Q.MeshBasicMaterial({map:Ae,transparent:oe!=null?oe:!1,blending:ae!=null?ae:Q.NormalBlending,depthWrite:de!=null?de:!0,alphaTest:Ee!=null?Ee:0}),Ve.abrupt("return",J);case 6:case"end":return Ve.stop()}},k)}))()},B.create=function(){var S=this;return(0,ze.Z)(Rt().mark(function k(){var Y,oe,ae,fe,de,Ee,De,Pe;return Rt().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:if(Y=S.options,oe=Y.scale,ae=Y.position,fe=Y.src,de=Y.cache,Ee=Y.sprite,!(de&&!de.get(fe))){J.next=7;break}return de.init(fe),J.next=5,S.getMaterial();case 5:De=J.sent,de.set(fe,De);case 7:if(!de){J.next=13;break}return J.next=10,de.get(fe);case 10:J.t0=J.sent,J.next=16;break;case 13:return J.next=15,S.getMaterial();case 15:J.t0=J.sent;case 16:Pe=J.t0,S.texture=Pe.map,Ee?S.createSprite(Pe):S.createMesh(new Q[fn](1,1),Pe),oe&&S.setScale(oe),ae&&S.object3d.position.copy(ae);case 21:case"end":return J.stop()}},k)}))()},B.setScale=function(S){this.object3d.scale.set(this.texture.image.width*S,this.texture.image.height*S,1)},R}(ve);function vi(b,D){for(;!Object.prototype.hasOwnProperty.call(b,D)&&(b=ke(b),b!==null););return b}function Bn(b,D,R){return typeof Reflect!="undefined"&&Reflect.get?Bn=Reflect.get:Bn=function(z,S,k){var Y=vi(z,S);if(!!Y){var oe=Object.getOwnPropertyDescriptor(Y,S);return oe.get?oe.get.call(k||z):oe.value}},Bn(b,D,R)}function ts(b,D,R){return Bn(b,D,R)}var qo=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.options=(0,He.Z)({},{autoPlay:!0,loop:!0},z),S}var B=R.prototype;return B.getMaterial=function(){var S=this.options,k=S.src,Y=S.transparent,oe=S.blending,ae=S.depthWrite,fe=S.format,de=S.autoPlay,Ee=S.loop,De=S.alphaTest,Pe=S.sprite,Ae=Hn(),J=document.createElement("video");return J.addEventListener("loadedmetadata",function(){var je=new Q.VideoTexture(J);je.format=fe!=null?fe:Q.RGBAFormat,je.needsUpdate=!0;var Ve=Pe?new Q.SpriteMaterial({map:je,transparent:Y!=null?Y:!1,blending:oe!=null?oe:Q.NormalBlending,depthWrite:ae!=null?ae:!0,alphaTest:De!=null?De:0}):new Q.MeshBasicMaterial({map:je,transparent:Y!=null?Y:!1,blending:oe!=null?oe:Q.NormalBlending,depthWrite:ae!=null?ae:!0,alphaTest:De!=null?De:0});Ae.resolve(Ve)},!1),J.src=k,J.muted=!0,J.autoplay=de,J.loop=Ee,J.preload="auto",Ae.promise},B.create=function(){var S=this;return(0,ze.Z)(Rt().mark(function k(){var Y,oe,ae,fe,de,Ee,De,Pe;return Rt().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:if(Y=S.options,oe=Y.scale,ae=Y.position,fe=Y.src,de=Y.cache,Ee=Y.sprite,!(de&&!de.get(fe))){J.next=7;break}return de.init(fe),J.next=5,S.getMaterial();case 5:De=J.sent,de.set(fe,De);case 7:if(!de){J.next=13;break}return J.next=10,de.get(fe);case 10:J.t0=J.sent,J.next=16;break;case 13:return J.next=15,S.getMaterial();case 15:J.t0=J.sent;case 16:Pe=J.t0,S.video=Pe.map.image,Ee?S.createSprite(Pe):S.createMesh(new Q[fn](1,1),Pe),oe&&S.setScale(oe),ae&&S.object3d.position.copy(ae);case 21:case"end":return J.stop()}},k)}))()},B.setScale=function(S){this.object3d.scale.set(this.video.videoWidth*S,this.video.videoHeight*S,1)},B.render=function(){var S=this.options.autoPlay;S&&this.video.play()},B.dispose=function(){this.video.pause(),this.video.src="",this.video.load(),ts(ke(R.prototype),"dispose",this).call(this)},R}(ve),br=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.options=(0,He.Z)({},{event:"click"},z),S}var B=R.prototype;return B.create=function(){var S=this.options,k=S.position,Y=S.children,oe=S.handler,ae=S.event,fe=S.zIndexFix,de=document.createElement("div");this.element=de,de.appendChild(Y),this.createCSS2DObject(de),k&&this.object3d.position.copy(k),oe&&ae&&this.clickTarge.forEach(function(Ee){Ee.addEventListener(ae,oe)}),fe&&(this.object3d.userData.zIndexFix=fe)},B.getMaterial=function(S){return(0,ze.Z)(Rt().mark(function k(){var Y,oe,ae,fe;return Rt().wrap(function(Ee){for(;;)switch(Ee.prev=Ee.next){case 0:return Y=document.createElement("canvas"),Y.width=256,Y.height=256,oe=Y.getContext("2d"),oe.fillStyle="#ff0000",oe.fillRect(0,0,256,256),ae=new Q.CanvasTexture(Y),fe=new Q.SpriteMaterial({map:ae,opacity:S?1:0,transparent:!0,alphaTest:.1,sizeAttenuation:!1}),Ee.abrupt("return",fe);case 9:case"end":return Ee.stop()}},k)}))()},B.createPickObject=function(S){var k=S.show,Y=k===void 0?!1:k,oe=S.scale,ae=oe===void 0?new Q.Vector3(1,1,1):oe,fe=S.position,de=fe===void 0?new Q.Vector3(0,0,0):fe,Ee=S.cache,De=this;return(0,ze.Z)(Rt().mark(function Pe(){var Ae,J,je,Ve;return Rt().wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(Ae="node-create-pick-object",!(Ee&&!Ee.get(Ae))){Be.next=7;break}return Ee.init(Ae),Be.next=5,De.getMaterial(Y);case 5:J=Be.sent,Ee.set(Ae,J);case 7:if(!Ee){Be.next=13;break}return Be.next=10,Ee.get(Ae);case 10:Be.t0=Be.sent,Be.next=16;break;case 13:return Be.next=15,De.getMaterial(Y);case 15:Be.t0=Be.sent;case 16:je=Be.t0,Ve=new Q.Sprite(je),Ve.scale.set(je.map.image.width*ae.x,je.map.image.height*ae.y,1),Ve.position.copy(de),De.add(Ve),De.pickObject=Ve;case 22:case"end":return Be.stop()}},Pe)}))()},B.dispose=function(){var S=this.options,k=S.handler,Y=S.event;k&&Y&&this.clickTarge.forEach(function(oe){oe.removeEventListener(Y,k)}),ts(ke(R.prototype),"dispose",this).call(this)},mt(R,[{key:"clickTarge",get:function(){var S=this,k=this.options.eventTarge;if(k){var Y=k.map(function(oe){return Pt(S.element.querySelectorAll(oe))}).flat();return Y}return[this.element]}}]),R}(ve),Xo=br,Zo=`
|
|
3047
|
+
`.concat(Q.ShaderChunk.logdepthbuf_pars_vertex,`
|
|
3048
|
+
`).concat(Q.ShaderChunk.fog_pars_vertex,`
|
|
3049
|
+
attribute vec3 previous;
|
|
3050
|
+
attribute vec3 next;
|
|
3051
|
+
attribute float side;
|
|
3052
|
+
attribute float width;
|
|
3053
|
+
attribute float counters;
|
|
3054
|
+
|
|
3055
|
+
uniform vec2 resolution;
|
|
3056
|
+
uniform float lineWidth;
|
|
3057
|
+
uniform vec3 color;
|
|
3058
|
+
uniform float opacity;
|
|
3059
|
+
uniform float sizeAttenuation;
|
|
3060
|
+
uniform vec2 offset;
|
|
3061
|
+
uniform float time;
|
|
3062
|
+
uniform vec3 lightColor;
|
|
3063
|
+
uniform vec2 uCenter;
|
|
3064
|
+
uniform float size;
|
|
3065
|
+
uniform float speed;
|
|
3066
|
+
uniform float lightWidth;
|
|
3067
|
+
uniform float lineLightAnimation;
|
|
3068
|
+
|
|
3069
|
+
varying vec2 vUV;
|
|
3070
|
+
varying vec4 vColor;
|
|
3071
|
+
varying float vCounters;
|
|
3072
|
+
|
|
3073
|
+
vec2 fix(vec4 i,float aspect){
|
|
3074
|
+
|
|
3075
|
+
vec2 res=i.xy/i.w;
|
|
3076
|
+
res.x*=aspect;
|
|
3077
|
+
vCounters=counters;
|
|
3078
|
+
return res;
|
|
3079
|
+
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
void main(){
|
|
3083
|
+
|
|
3084
|
+
float aspect=resolution.x/resolution.y;
|
|
3085
|
+
float pixelWidthRatio=1./(resolution.x*projectionMatrix[0][0]);
|
|
3086
|
+
|
|
3087
|
+
if (lineLightAnimation == 1.0) {
|
|
3088
|
+
vec2 vWorld=position.xy;
|
|
3089
|
+
float r_time=mod(time/(speed*size),2.);
|
|
3090
|
+
float l=distance(vWorld, uCenter)/size;
|
|
3091
|
+
float r_opacity=smoothstep(r_time-lightWidth*2.,r_time-lightWidth,l)-smoothstep(r_time-lightWidth,r_time,l);
|
|
3092
|
+
vColor=vec4(mix(color,lightColor,r_opacity),opacity);
|
|
3093
|
+
} else {
|
|
3094
|
+
vColor=vec4(color,opacity);
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
vUV=uv+offset;
|
|
3099
|
+
|
|
3100
|
+
mat4 m=projectionMatrix*modelViewMatrix;
|
|
3101
|
+
vec4 finalPosition=m*vec4(position,1.);
|
|
3102
|
+
vec4 prevPos=m*vec4(previous,1.);
|
|
3103
|
+
vec4 nextPos=m*vec4(next,1.);
|
|
3104
|
+
|
|
3105
|
+
vec2 currentP=fix(finalPosition,aspect);
|
|
3106
|
+
vec2 prevP=fix(prevPos,aspect);
|
|
3107
|
+
vec2 nextP=fix(nextPos,aspect);
|
|
3108
|
+
|
|
3109
|
+
float pixelWidth=finalPosition.w*pixelWidthRatio;
|
|
3110
|
+
float w=1.8*pixelWidth*lineWidth*width;
|
|
3111
|
+
|
|
3112
|
+
if(sizeAttenuation==1.){
|
|
3113
|
+
w=1.8*lineWidth*width;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
vec2 dir;
|
|
3117
|
+
if(nextP==currentP)dir=normalize(currentP-prevP);
|
|
3118
|
+
else if(prevP==currentP)dir=normalize(nextP-currentP);
|
|
3119
|
+
else{
|
|
3120
|
+
vec2 dir1=normalize(currentP-prevP);
|
|
3121
|
+
vec2 dir2=normalize(nextP-currentP);
|
|
3122
|
+
dir=normalize(dir1+dir2);
|
|
3123
|
+
|
|
3124
|
+
vec2 perp=vec2(-dir1.y,dir1.x);
|
|
3125
|
+
vec2 miter=vec2(-dir.y,dir.x);
|
|
3126
|
+
//w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );
|
|
3127
|
+
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
//vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;
|
|
3131
|
+
vec2 normal=vec2(-dir.y,dir.x);
|
|
3132
|
+
normal.x/=aspect;
|
|
3133
|
+
normal*=.5*w;
|
|
3134
|
+
|
|
3135
|
+
vec4 offset=vec4(normal*side,0.,1.);
|
|
3136
|
+
finalPosition.xy+=offset.xy;
|
|
3137
|
+
|
|
3138
|
+
gl_Position=finalPosition;
|
|
3139
|
+
`).concat(Q.ShaderChunk.logdepthbuf_vertex,`
|
|
3140
|
+
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
3141
|
+
`).concat(Q.ShaderChunk.fog_vertex,`
|
|
3142
|
+
}
|
|
3143
|
+
`),li=`
|
|
3144
|
+
`.concat(Q.ShaderChunk.fog_pars_fragment,`
|
|
3145
|
+
`).concat(Q.ShaderChunk.logdepthbuf_pars_fragment,`
|
|
3146
|
+
|
|
3147
|
+
|
|
3148
|
+
uniform sampler2D map;
|
|
3149
|
+
uniform sampler2D alphaMap;
|
|
3150
|
+
uniform float useMap;
|
|
3151
|
+
uniform float useAlphaMap;
|
|
3152
|
+
uniform float useDash;
|
|
3153
|
+
uniform float dashArray;
|
|
3154
|
+
uniform float dashOffset;
|
|
3155
|
+
uniform float dashRatio;
|
|
3156
|
+
uniform float visibility;
|
|
3157
|
+
uniform float alphaTest;
|
|
3158
|
+
uniform vec2 repeat;
|
|
3159
|
+
|
|
3160
|
+
varying vec2 vUV;
|
|
3161
|
+
varying vec4 vColor;
|
|
3162
|
+
varying float vCounters;
|
|
3163
|
+
|
|
3164
|
+
void main() {
|
|
3165
|
+
`).concat(Q.ShaderChunk.logdepthbuf_fragment,`
|
|
3166
|
+
vec4 c = vColor;
|
|
3167
|
+
if( useMap == 1. ) c *= texture2D( map, vUV * repeat );
|
|
3168
|
+
if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;
|
|
3169
|
+
if( c.a < alphaTest ) discard;
|
|
3170
|
+
if( useDash == 1. ){
|
|
3171
|
+
c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
|
|
3172
|
+
}
|
|
3173
|
+
gl_FragColor = c;
|
|
3174
|
+
gl_FragColor.a *= step(vCounters, visibility);
|
|
3175
|
+
`).concat(Q.ShaderChunk.fog_fragment,`
|
|
3176
|
+
}
|
|
3177
|
+
`),Wn=function(b){"use strict";qe(R,b);var D=dt(R);function R(){Je(this,R);var B;return B=D.call(this),B.isMeshLine=!0,B.type="MeshLine",B.positions=[],B.previous=[],B.next=[],B.side=[],B.width=[],B.indices_array=[],B.uvs=[],B.counters=[],B._points=[],B._geom=null,B.widthCallback=null,B.matrixWorld=new Q.Matrix4,Object.defineProperties(Mt(B),{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(S){this.setGeometry(S,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(S){this.setPoints(S,this.widthCallback)}}}),B}return R}(Q.BufferGeometry);Wn.prototype.setMatrixWorld=function(b){this.matrixWorld=b},Wn.prototype.setGeometry=function(b,D){this._geometry=b,this.setPoints(b.getAttribute("position").array,D)},Wn.prototype.setPoints=function(b,D){if(!(b instanceof Float32Array)&&!(b instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=b,this.widthCallback=D,this.positions=[],this.counters=[],b.length&&b[0]instanceof Q.Vector3)for(var R=0;R<b.length;R++){var B=b[R],z=R/b.length;this.positions.push(B.x,B.y,B.z),this.positions.push(B.x,B.y,B.z),this.counters.push(z),this.counters.push(z)}else for(var R=0;R<b.length;R+=3){var z=R/b.length;this.positions.push(b[R],b[R+1],b[R+2]),this.positions.push(b[R],b[R+1],b[R+2]),this.counters.push(z),this.counters.push(z)}this.process()};function ro(b,D){var R=new Q.Matrix4,B=new Q.Ray,z=new Q.Sphere,S=new Q.Vector3,k=this.geometry;if(k.boundingSphere||k.computeBoundingSphere(),z.copy(k.boundingSphere),z.applyMatrix4(this.matrixWorld),b.ray.intersectSphere(z,S)!==!1){R.copy(this.matrixWorld).invert(),B.copy(b.ray).applyMatrix4(R);var Y=new Q.Vector3,oe=new Q.Vector3,ae=new Q.Vector3,fe=this instanceof Q.LineSegments?2:1,de=k.index,Ee=k.attributes;if(de!==null)for(var De=de.array,Pe=Ee.position.array,Ae=Ee.width.array,J=0,je=De.length-1;J<je;J+=fe){var Ve=De[J],Dt=De[J+1];Y.fromArray(Pe,Ve*3),oe.fromArray(Pe,Dt*3);var Be=Ae[Math.floor(J/3)]!==void 0?Ae[Math.floor(J/3)]:1,Gt=b.params.Line.threshold+this.material.lineWidth*Be/2,_n=Gt*Gt,Nn=B.distanceSqToSegment(Y,oe,S,ae);if(!(Nn>_n)){S.applyMatrix4(this.matrixWorld);var En=b.ray.origin.distanceTo(S);En<b.near||En>b.far||(D.push({distance:En,point:ae.clone().applyMatrix4(this.matrixWorld),index:J,face:null,faceIndex:null,object:this}),J=je)}}}}Wn.prototype.raycast=ro,Wn.prototype.compareV3=function(b,D){var R=b*6,B=D*6;return this.positions[R]===this.positions[B]&&this.positions[R+1]===this.positions[B+1]&&this.positions[R+2]===this.positions[B+2]},Wn.prototype.copyV3=function(b){var D=b*6;return[this.positions[D],this.positions[D+1],this.positions[D+2]]},Wn.prototype.process=function(){var b=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var D,R;this.compareV3(0,b-1)?R=this.copyV3(b-2):R=this.copyV3(0),this.previous.push(R[0],R[1],R[2]),this.previous.push(R[0],R[1],R[2]);for(var B=0;B<b;B++){if(this.side.push(1),this.side.push(-1),this.widthCallback?D=this.widthCallback(B/(b-1)):D=1,this.width.push(D),this.width.push(D),this.uvs.push(B/(b-1),0),this.uvs.push(B/(b-1),1),B<b-1){R=this.copyV3(B),this.previous.push(R[0],R[1],R[2]),this.previous.push(R[0],R[1],R[2]);var z=B*2;this.indices_array.push(z,z+1,z+2),this.indices_array.push(z+2,z+1,z+3)}B>0&&(R=this.copyV3(B),this.next.push(R[0],R[1],R[2]),this.next.push(R[0],R[1],R[2]))}this.compareV3(b-1,0)?R=this.copyV3(1):R=this.copyV3(b-1),this.next.push(R[0],R[1],R[2]),this.next.push(R[0],R[1],R[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new Q.BufferAttribute(new Float32Array(this.positions),3),previous:new Q.BufferAttribute(new Float32Array(this.previous),3),next:new Q.BufferAttribute(new Float32Array(this.next),3),side:new Q.BufferAttribute(new Float32Array(this.side),1),width:new Q.BufferAttribute(new Float32Array(this.width),1),uv:new Q.BufferAttribute(new Float32Array(this.uvs),2),index:new Q.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new Q.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function ns(b,D,R,B,z){var S;if(b=b.subarray||b.slice?b:b.buffer,R=R.subarray||R.slice?R:R.buffer,b=D?b.subarray?b.subarray(D,z&&D+z):b.slice(D,z&&D+z):b,R.set)R.set(b,B);else for(S=0;S<b.length;S++)R[S+B]=b[S];return R}Wn.prototype.advance=function(b){var D=this._attributes.position.array,R=this._attributes.previous.array,B=this._attributes.next.array,z=D.length;ns(D,0,R,0,z),ns(D,6,D,0,z-6),D[z-6]=b.x,D[z-5]=b.y,D[z-4]=b.z,D[z-3]=b.x,D[z-2]=b.y,D[z-1]=b.z,ns(D,6,B,0,z-6),B[z-6]=b.x,B[z-5]=b.y,B[z-4]=b.z,B[z-3]=b.x,B[z-2]=b.y,B[z-1]=b.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},Q.ShaderChunk.meshline_vert=Zo,Q.ShaderChunk.meshline_frag=li;var is=function(b){"use strict";qe(R,b);var D=dt(R);function R(B){Je(this,R);var z;return z=D.call(this,{uniforms:Object.assign({},Q.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Q.Color(16777215)},opacity:{value:1},resolution:{value:new Q.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new Q.Vector2(1,1)},offset:{value:new Q.Vector2(1,1)},lineLightAnimation:{value:1},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new Q.Vector2(0,0)},lightColor:{value:new Q.Color(16777215)}}),vertexShader:Q.ShaderChunk.meshline_vert,fragmentShader:Q.ShaderChunk.meshline_frag}),z.isMeshLineMaterial=!0,z.type="MeshLineMaterial",Object.defineProperties(Mt(z),{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(k){this.uniforms.lineWidth.value=k}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(k){this.uniforms.lineLightAnimation.value=k}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(k){this.uniforms.map.value=k}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(k){this.uniforms.useMap.value=k}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(k){this.uniforms.alphaMap.value=k}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(k){this.uniforms.useAlphaMap.value=k}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(k){this.uniforms.color.value=k}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(k){this.uniforms.lightColor.value=k}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(k){this.uniforms.time.value=k}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(k){this.uniforms.uCenter.value=k}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(k){this.uniforms.size.value=k}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(k){this.uniforms.opacity.value=k}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(k){this.uniforms.resolution.value.copy(k)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(k){this.uniforms.sizeAttenuation.value=k}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(k){this.uniforms.dashArray.value=k,this.useDash=k!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(k){this.uniforms.dashOffset.value=k}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(k){this.uniforms.dashRatio.value=k}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(k){this.uniforms.useDash.value=k}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(k){this.uniforms.visibility.value=k}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(k){this.uniforms.alphaTest.value=k}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(k){this.uniforms.repeat.value.copy(k)}}}),z.setValues(B),z}return R}(Q.ShaderMaterial);is.prototype.copy=function(b){return Q.ShaderMaterial.prototype.copy.call(this,b),this.lineWidth=b.lineWidth,this.map=b.map,this.useMap=b.useMap,this.alphaMap=b.alphaMap,this.useAlphaMap=b.useAlphaMap,this.color.copy(b.color),this.opacity=b.opacity,this.resolution.copy(b.resolution),this.sizeAttenuation=b.sizeAttenuation,this.dashArray.copy(b.dashArray),this.dashOffset.copy(b.dashOffset),this.dashRatio.copy(b.dashRatio),this.useDash=b.useDash,this.visibility=b.visibility,this.alphaTest=b.alphaTest,this.repeat.copy(b.repeat),this};function jo(b,D){if(b==null)return{};var R={},B=Object.keys(b),z,S;for(S=0;S<B.length;S++)z=B[S],!(D.indexOf(z)>=0)&&(R[z]=b[z]);return R}function rs(b,D){if(b==null)return{};var R=jo(b,D),B,z;if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(b);for(z=0;z<S.length;z++)B=S[z],!(D.indexOf(B)>=0)&&(!Object.prototype.propertyIsEnumerable.call(b,B)||(R[B]=b[B]))}return R}function Bi(b){if(Array.isArray(b))return b}function Ni(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function yn(b,D){return Bi(b)||Qt(b,D)||Xt(b,D)||Ni()}var Mr=b=>{var D={};return zt.d(D,b),D},wr=b=>()=>b,Ki=Mr({animate:()=>id.animate,linear:()=>id.linear}),Sr=b=>{var D={};return zt.d(D,b),D},xn=b=>()=>b,yi=Sr({mergeBufferGeometries:()=>Jx.mergeBufferGeometries});function Kt(b){var D=b.setPointWidth,R=b.nodes,B=new Q.BufferGeometry,z=new Wn;return B.setFromPoints(R),z.setGeometry(B,D),z}var ss={color:new Q.Color("#ffffff"),lineWidth:1},El=function(b){"use strict";qe(R,b);var D=dt(R);function R(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Je(this,R);var S;return S=D.call(this),S.options=(0,He.Z)({},ss,z),S}var B=R.prototype;return B.create=function(){var S=this.options,k=S.duration,Y=S.delay,oe=S.onComplete,ae=S.setPointWidth,fe=S.key,de=S.nodes,Ee=S.nodesArr,De=S.geometry,Pe=S.geometryArr,Ae=S.useGroups,J=rs(S,["duration","delay","onComplete","setPointWidth","key","nodes","nodesArr","geometry","geometryArr","useGroups"]),je=this.pencil.getSize(),Ve=je.width,Dt=je.height,Be=new is(Ke((0,He.Z)({},J),{resolution:new Q.Vector2(Ve,Dt)}));this.material=Be;var Gt=De;if(!Gt&&de)Gt=Kt({nodes:de,setPointWidth:ae});else if(!Gt&&Ee)Gt=yi.mergeBufferGeometries(Ee.map(function(Nn){return Kt({nodes:Nn,setPointWidth:ae})}),Ae!=null?Ae:!1);else if(!Gt&&Pe&&Pe.length>1)Gt=yi.mergeBufferGeometries(Pe,Ae!=null?Ae:!1);else if(!Gt&&Pe&&Pe.length===1){var _n;_n=yn(Pe,1),Gt=_n[0]}this.createMesh(Gt,Be)},B.resize=function(S,k){this.material.uniforms.resolution.value.set(S,k)},B.animate=function(){var S=this.options,k=S.duration,Y=S.delay,oe=S.onComplete,ae=this.material.uniforms.offset,fe=Y!=null?Y:0,de=(0,Ki.animate)({from:ae.value,to:{x:0},duration:k!=null?k:1e3,elapsed:-fe,repeat:1/0,onComplete:oe,ease:Ki.linear,onUpdate:function(Ee){ae.value.x=Ee.x}});this.tween=de},B.dispose=function(){var S;ts(ke(R.prototype),"dispose",this).call(this),(S=this.tween)===null||S===void 0||S.stop()},R}(ve);function os(b){var D=b.worker,R=b.workerKey,B=b.coordinatesArr,z=b.lineWidth,S=b.projection,k=b.cacheVersion;return new Promise(function(Y,oe){D.postMessage({coordinatesArr:B,lineWidth:z,projection:S,workerKey:R},{cb:function(ae){try{var fe=new Q.BufferGeometry;Object.keys(ae).forEach(function(de){de==="index"?fe.setIndex(new Q.BufferAttribute(ae[de].array,ae[de].itemSize)):fe.setAttribute(de,new Q.BufferAttribute(ae[de].array,ae[de].itemSize))}),Y(fe)}catch(de){D.postMessage({delCache:!0,workerKey:R},{cb:oe,cacheVersion:k})}},cacheVersion:k})})}var Al=b=>{var D={};return zt.d(D,b),D},en=b=>()=>b,xi=Al({extent:()=>su.extent,mean:()=>su.mean,merge:()=>su.merge}),Cl=b=>{var D={};return zt.d(D,b),D},Qi=b=>()=>b,so=Cl({default:()=>$x.default}),ii=b=>{var D={};return zt.d(D,b),D},Ll=b=>()=>b,Yo=ii({default:()=>Kx.default});function er(b,D){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,B=(90-D)*Math.PI/180,z=(90-b)*Math.PI/180;return[R*Math.sin(B)*Math.cos(z),R*Math.cos(B),R*Math.sin(B)*Math.sin(z)]}var Jo=b=>{var D={};return zt.d(D,b),D},as=b=>()=>b,ri=Jo({default:()=>Qx.default}),_i=b=>{var D={};return zt.d(D,b),D},Rl=b=>()=>b,$o=_i({default:()=>e0.default}),Ko=b=>{var D={};return zt.d(D,b),D},tr=b=>()=>b,nr=Ko({geoBounds:()=>Tl.geoBounds,geoContains:()=>Tl.geoContains,geoDistance:()=>Tl.geoDistance,geoInterpolate:()=>Tl.geoInterpolate}),bi=b=>{var D={};return zt.d(D,b),D},on=b=>()=>b,Qo=bi({geoVoronoi:()=>t0.geoVoronoi}),ea=b=>{var D={};return zt.d(D,b),D},Oi=b=>()=>b,Mi=ea({scaleLinear:()=>n0.scaleLinear});function ta(b,D){return b.map(function(R){var B=[],z;return R.forEach(function(S){if(z){var k=(0,nr.geoDistance)(S,z)*180/Math.PI;if(k>D)for(var Y=(0,nr.geoInterpolate)(z,S),oe=1/Math.ceil(k/D),ae=oe;ae<1;)B.push(Y(ae)),ae+=oe}B.push(z=S)}),B})}function na(b){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=D.minLng,B=D.maxLng,z=D.minLat,S=D.maxLat,k=Math.round(Math.pow(360/b,2)/Math.PI),Y=(1+Math.sqrt(5))/2,oe=function(J){return J/Y*360%360-180},ae=function(J){return Math.acos(2*J/k-1)/Math.PI*180-90},fe=function(J){return k*(Math.cos((J+90)*Math.PI/180)+1)/2},de=[S!==void 0?Math.ceil(fe(S)):0,z!==void 0?Math.floor(fe(z)):k-1],Ee=R===void 0&&B===void 0?function(){return!0}:R===void 0?function(J){return J<=B}:B===void 0?function(J){return J>=R}:B>=R?function(J){return J>=R&&J<=B}:function(J){return J>=R||J<=B},De=[],Pe=de[0];Pe<=de[1];Pe++){var Ae=oe(Pe);Ee(Ae)&&De.push([Ae,ae(Pe)])}return De}function ls(b,D){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return R?(0,nr.geoContains)(D,b):(0,$o.default)(b,D)}function ia(b,D){var R={type:"Polygon",coordinates:b},B=yn((0,nr.geoBounds)(R),2),z=yn(B[0],2),S=z[0],k=z[1],Y=yn(B[1],2),oe=Y[0],ae=Y[1];if(Math.min(Math.abs(oe-S),Math.abs(ae-k))<D)return[];var fe=S>oe||ae>=89||k<=-89;return na(D,{minLng:S,maxLng:oe,minLat:k,maxLat:ae}).filter(function(de){return ls(de,R,fe)})}function ra(b){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=D.resolution,B=R===void 0?1/0:R,z=ta(b,B),S=(0,xi.merge)(z),k=ia(b,B),Y=Pt(S).concat(Pt(k)),oe={type:"Polygon",coordinates:b},ae=yn((0,nr.geoBounds)(oe),2),fe=yn(ae[0],2),de=fe[0],Ee=fe[1],De=yn(ae[1],2),Pe=De[0],Ae=De[1],J=de>Pe||Ae>=89||Ee<=-89,je=[];if(J){var Ve=(0,Qo.geoVoronoi)(Y).triangles(),Dt=new Map(Y.map(function(On,kn){var zn=yn(On,2),An=zn[0],Zn=zn[1];return["".concat(An,"-").concat(Zn),kn]}));Ve.features.forEach(function(On){var kn,zn=On.geometry.coordinates[0].slice(0,3).reverse(),An=[];if(zn.forEach(function(jn){var Pn=yn(jn,2),ir=Pn[0],co=Pn[1],uo="".concat(ir,"-").concat(co);Dt.has(uo)&&An.push(Dt.get(uo))}),An.length===3){if(An.some(function(jn){return jn<S.length})){var Zn=On.properties.circumcenter;if(!ls(Zn,oe,J))return}(kn=je).push.apply(kn,Pt(An))}})}else if(k.length)for(var En=function(On,kn){var zn,An=[2,1,0].map(function(Pn){return qn.triangles[On+Pn]}),Zn=An.map(function(Pn){return Y[Pn]});if(An.some(function(Pn){return Pn<S.length})){var jn=[0,1].map(function(Pn){return(0,xi.mean)(Zn,function(ir){return ir[Pn]})});if(!ls(jn,oe,J))return"continue"}(zn=je).push.apply(zn,Pt(An))},qn=ri.default.from(Y),Xn=0,si=qn.triangles.length;Xn<si;Xn+=3)En(Xn,si);else{var Be=so.default.flatten(z),Gt=Be.vertices,_n=Be.holes,Nn=_n===void 0?[]:_n;je=(0,so.default)(Gt,Nn,2)}var Er=(0,Mi.scaleLinear)((0,xi.extent)(Y,function(On){return On[0]}),[0,1]),an=(0,Mi.scaleLinear)((0,xi.extent)(Y,function(On){return On[1]}),[0,1]),ps=Y.map(function(On){var kn=yn(On,2),zn=kn[0],An=kn[1];return[Er(zn),an(An)]}),ms={points:Y,indices:je,uvs:ps};return{contour:z,triangles:ms}}var sa=ra,cs=new Q.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function Tr(b,D){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,B=b.map(function(z){return z.map(function(S){var k=yn(S,2),Y=k[0],oe=k[1];return R?er(Y,oe,D):[Y,oe,D]})});return so.default.flatten(B)}function us(b,D,R){for(var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,z=Tr(b,D,B),S=z.vertices,k=z.holes,Y=Tr(b,R,B),oe=Y.vertices,ae=(0,xi.merge)([oe,S]),fe=Math.round(oe.length/3),de=new Set(k),Ee=0,De=[],Pe=0;Pe<fe;Pe++){var Ae=Pe+1;if(Ae===fe)Ae=Ee;else if(de.has(Ae)){var J=Ae;Ae=Ee,Ee=J}De.push(Pe,Pe+fe,Ae+fe),De.push(Ae+fe,Ae,Pe)}for(var je=[],Ve=1;Ve>=0;Ve--)for(var Dt=0;Dt<fe;Dt+=1)je.push(Dt/(fe-1),Ve);return{indices:De,vertices:ae,uvs:je,topVerts:oe}}function hs(b,D,R){var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,z=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return{indices:B?b.indices:b.indices.slice().reverse(),vertices:Tr([b.points],D,z).vertices,uvs:R}}var oo=function(b){"use strict";qe(R,b);var D=dt(R);function R(B){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Je(this,R);var S;S=D.call(this),S.type="PolygonBufferGeometry",S.parameters=(0,He.Z)({},{polygonGeoJson:B,startHeight:0,endHeight:1,closedBottom:!0,closedTop:!0,includeSides:!0,curvatureResolution:5,cartesian:!0,userDataRsoOffset:0},z);var k=S.parameters,Y=k.startHeight,oe=k.endHeight,ae=k.closedBottom,fe=k.closedTop,de=k.includeSides,Ee=k.curvatureResolution,De=k.cartesian,Pe=k.userDataRsoOffset;(0,Yo.default)(B[0])||B[0].reverse();var Ae=sa(B,{resolution:Ee}),J=Ae.contour,je=Ae.triangles,Ve=(0,xi.merge)(je.uvs),Dt=[],Be=[],Gt=[],_n=0,Nn=function(qn){var Xn=Math.round(Dt.length/3),si=Gt.length;Dt=Dt.concat(qn.vertices),Be=Be.concat(qn.uvs),Gt=Gt.concat(Xn?qn.indices.map(function(Er){return Er+Xn}):qn.indices),S.addGroup(si,Gt.length-si,_n++)};if(de){var En=us(J,Y,oe,De);Nn(En),S.userData.rso=Pe?us(J,Y,oe+Pe,De):En}return ae&&Nn(hs(je,Y,Ve,!1,De)),fe&&Nn(hs(je,oe,Ve,!0,De)),S.setIndex(Gt),S[cs]("position",new Q.Float32BufferAttribute(Dt,3)),S[cs]("uv",new Q.Float32BufferAttribute(Be,2)),S.computeVertexNormals(),S}return R}(Q.BufferGeometry),ao=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.options=(0,He.Z)({},{geojson:[[[]]],startHeight:0,height:5,closedBottom:!0,closedTop:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},z),S}var B=R.prototype;return B.create=function(){var S=this.options,k=S.startHeight,Y=S.height,oe=S.closedBottom,ae=S.closedTop,fe=S.curvatureResolution,de=S.userDataRsoOffset,Ee=S.cartesian,De=new oo(this.options.geojson,{startHeight:k,endHeight:k+Y,closedBottom:oe,closedTop:ae,curvatureResolution:fe,cartesian:Ee,userDataRsoOffset:de});this.createMesh(De,this.options.material)},R}(ve),fs=zt(705);function ds(b){var D=b.split,R=b.depth,B=b.points,z=new Q[Tn](new Q.Shape(B),{depth:R,bevelEnabled:!1,UVGenerator:(0,fs.y)({split:D})});return(0,fs.C)(),z}var oa=function(b){"use strict";qe(R,b);var D=dt(R);function R(z){Je(this,R);var S;return S=D.call(this),S.options=Ke((0,He.Z)({depth:1},z),{materialOptions:(0,He.Z)({},{split:.1},z.materialOptions||{})}),S}var B=R.prototype;return B.create=function(){var S=this;return(0,ze.Z)(Rt().mark(function k(){var Y,oe,ae,fe,de,Ee,De,Pe,Ae,J,je,Ve,Dt,Be,Gt,_n,Nn,En,qn,Xn,si;return Rt().wrap(function(an){for(;;)switch(an.prev=an.next){case 0:if(Y=S.options,oe=Y.points,ae=Y.pointsArr,fe=Y.useGroups,de=Y.depth,Ee=Y.geometry,De=Y.geometryArr,Pe=Y.material,Ae=Y.materialOptions,J=Y.cache,je=0,Ve=Array.isArray(de)?de:[de],Dt=Pe,Be=Ee,!(!Dt&&Ae)){an.next=25;break}if(je=Ae.split,Gt=Ae.topColor,_n=Ae.sideColor,Nn=Ae.sideMap,En="ExtrudePolygonMaterial:".concat(_n||Nn).concat(Gt||""),!(J&&!J.get(En))){an.next=15;break}return J.init(En),an.next=13,S.getMaterial(Ae);case 13:qn=an.sent,J.set(En,qn);case 15:if(!J){an.next=21;break}return an.next=18,J.get(En);case 18:an.t0=an.sent,an.next=24;break;case 21:return an.next=23,S.getMaterial(Ae);case 23:an.t0=an.sent;case 24:Dt=an.t0;case 25:!Be&&oe?Be=ds({points:oe,depth:Ve[0],split:je}):!Be&&ae?Be=yi.mergeBufferGeometries(ae.map(function(ps,ms){return ds({points:ps,depth:(Xn=Ve[ms])!==null&&Xn!==void 0?Xn:Ve[0],split:je})}),fe!=null?fe:!1):!Be&&De&&De.length>1?Be=yi.mergeBufferGeometries(De,fe!=null?fe:!1):!Be&&De&&De.length===1&&(si=yn(De,1),Be=si[0]),S.createMesh(Be,Dt);case 27:case"end":return an.stop()}},k)}))()},B.getMaterial=function(S){var k=this,Y=S.topColor,oe=S.sideColor,ae=S.sideMap,fe=S.type,de=S.parameters,Ee=S.createCanvasObjectURL,De=S.split,Pe=S.maxAnisotropy;return new Promise(function(Ae){var J=ae?document.createElement("img"):{src:"",onload:function(){},width:1024,height:1024};J.onload=function(){var je=De,Ve=document.createElement("canvas"),Dt=Ve.getContext("2d");Ve.height=J.height/(1-je),Ve.width=J.width,je&&Y&&(Dt.fillStyle=Y,Dt.fillRect(0,0,J.width,Ve.height*je)),ae&&J instanceof HTMLImageElement?Dt.drawImage(J,0,Ve.height*je,J.width,J.height):oe&&(Dt.fillStyle=oe,Dt.fillRect(0,Ve.height*je,J.width,J.height)),Ee&&Ve.toBlob(function(_n){console.log(URL.createObjectURL(_n))});var Be=new Q.CanvasTexture(Ve);Be.anisotropy=Pe||k.pencil.renderer.capabilities.getMaxAnisotropy();var Gt=new Q[fe||"MeshBasicMaterial"]((0,He.Z)({map:Be},de||{}));Ae(Gt)},ae?J.src=ae:J instanceof HTMLImageElement||J.onload()})},B.setMaterialColor=function(S){var k=this;return(0,ze.Z)(Rt().mark(function Y(){var oe,ae,fe,de,Ee,De,Pe,Ae,J,je,Ve;return Rt().wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(oe=k.options,ae=oe.materialOptions,fe=oe.cache,de=ae.sideColor,Ee=ae.sideMap,De=ae.topColor,Pe=S.sideColor,Ae=S.topColor,!(Ae||Pe)){Be.next=22;break}if(J="ExtrudePolygonMaterial:".concat(Pe||de||Ee||"").concat(Ae||De||""),!(fe&&!fe.get(J))){Be.next=11;break}return fe.init(J),Be.next=9,k.getMaterial((0,He.Z)({},ae,S));case 9:je=Be.sent,fe.set(J,je);case 11:if(!fe){Be.next=17;break}return Be.next=14,fe.get(J);case 14:Be.t0=Be.sent,Be.next=20;break;case 17:return Be.next=19,k.getMaterial((0,He.Z)({},ae,S));case 19:Be.t0=Be.sent;case 20:Ve=Be.t0,k.object3d.material=Ve;case 22:case"end":return Be.stop()}},Y)}))()},R}(ve);function lo(b){var D=b.worker,R=b.workerKey,B=b.coordinatesArr,z=b.depth,S=b.split,k=b.projection,Y=b.cacheVersion;return new Promise(function(oe,ae){D.postMessage({coordinatesArr:B,depth:z,split:S!=null?S:.1,projection:k,workerKey:R},{cb:function(fe){try{var de=new Q.BufferGeometry;Object.keys(fe).forEach(function(Ee){de.setAttribute(Ee,new Q.BufferAttribute(fe[Ee].array,fe[Ee].itemSize))}),oe(de)}catch(Ee){D.postMessage({delCache:!0,workerKey:R},{cb:ae,cacheVersion:Y})}},cacheVersion:Y})})}})();var r0=ti.Ei,s0=ti.Yo,o0=ti.Ee,a0=ti.x1,l0=ti.VJ,c0=ti.r7,u0=ti.XA,h0=ti.NB,f0=ti.xv,d0=ti.nk,p0=ti.JX,m0=ti.TQ;export{r0 as ConicPolygon,s0 as ExtrudePolygon,o0 as Image,a0 as Line,l0 as MeshLine,c0 as MeshLineMaterial,u0 as MeshLineRaycast,h0 as Node,f0 as Text,d0 as Video,p0 as getExtrudePolygonGeometry,m0 as getLineGeometry};
|