@realsee/five 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/five/index.js +3 -3
- package/five/index.mjs +4 -4
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/index.js +13 -2934
- package/plugins/index.mjs +1276 -20876
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +13 -2934
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +3 -3
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
package/umd/five-plugins.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 10/
|
|
5
|
-
* Version: 6.2.
|
|
4
|
+
* Generated: 10/31/2024
|
|
5
|
+
* Version: 6.2.1
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,13 +252,13 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/(function(
|
|
255
|
+
*/(function(G,he){typeof exports=="object"&&typeof module!="undefined"?he(exports,require("@realsee/five"),require("three"),require("three/examples/jsm/controls/OrbitControls"),require("three/examples/jsm/renderers/CSS3DRenderer"),require("@realsee/five/plugins")):typeof define=="function"&&define.amd?define(["exports","@realsee/five","three","three/examples/jsm/controls/OrbitControls","three/examples/jsm/renderers/CSS3DRenderer","@realsee/five/plugins"],he):(G=typeof globalThis!="undefined"?globalThis:G||self,he(G.FiveSDK_Plugins={},G.FiveSDK,G.THREE,G.THREE.OrbitControls,G.THREE.CSS3DRenderer,G.FiveSDK_Plugins))})(this,function(G,he,Ot,Nt,ze,St){"use strict";function kt(c){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const n in c)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(c,n);Object.defineProperty(o,n,a.get?a:{enumerable:!0,get:()=>c[n]})}}return o.default=c,Object.freeze(o)}const g=kt(Ot);function Ft(c){return/^https?:\/\/|^\/\//.test(c)||/^data:/.test(c)}function Dt(c,o){return Ft(o)?o:"".concat(c).concat(o)}G.BasePlugin=void 0,function(c){var o=function(){function n(a,t){this.hooks=new he.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=a,t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}return n.prototype.getCurrentState=function(){return this.state},n.prototype.absoluteUrl=function(a){return Dt(this.staticPrefix,a)},n}();c.Controller=o}(G.BasePlugin||(G.BasePlugin={}));var We=function(c,o){return We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(n[t]=a[t])},We(c,o)};function Ie(c,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");We(c,o);function n(){this.constructor=c}c.prototype=o===null?Object.create(o):(n.prototype=o.prototype,new n)}var W=function(){return W=Object.assign||function(o){for(var n,a=1,t=arguments.length;a<t;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(o[l]=n[l])}return o},W.apply(this,arguments)};function xe(c,o,n,a){function t(l){return l instanceof n?l:new n(function(h){h(l)})}return new(n||(n=Promise))(function(l,h){function u(y){try{p(a.next(y))}catch(T){h(T)}}function m(y){try{p(a.throw(y))}catch(T){h(T)}}function p(y){y.done?l(y.value):t(y.value).then(u,m)}p((a=a.apply(c,o||[])).next())})}function Oe(c,o){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,t,l,h=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return h.next=u(0),h.throw=u(1),h.return=u(2),typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function u(p){return function(y){return m([p,y])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;h&&(h=0,p[0]&&(n=0)),n;)try{if(a=1,t&&(l=p[0]&2?t.return:p[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,p[1])).done)return l;switch(t=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,t=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){n.label=p[1];break}if(p[0]===6&&n.label<l[1]){n.label=l[1],l=p;break}if(l&&n.label<l[2]){n.label=l[2],n.ops.push(p);break}l[2]&&n.ops.pop(),n.trys.pop();continue}p=o.call(c,n)}catch(y){p=[6,y],t=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function ot(c,o,n){if(n||arguments.length===2)for(var a=0,t=o.length,l;a<t;a++)(l||!(a in o))&&(l||(l=Array.prototype.slice.call(o,0,a)),l[a]=o[a]);return c.concat(l||Array.prototype.slice.call(o))}typeof SuppressedError=="function"&&SuppressedError;function Ut(c){return new Promise(function(o,n){var a=new Image;a.onload=function(){a.onload=a.onerror=function(){},o(a)},a.onerror=function(t){a.onload=a.onerror=function(){},n(t)},a.crossOrigin="",a.src=c})}var Rt=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),qe=typeof performance!="undefined"?function(){return Rt+performance.now()}:function(){return Date.now()};function Ne(c,o,n){return c+(o-c)*n}function Bt(c,o,n,a){var t=(o*n+2*c)/Math.pow(n,3),l=-(2*o*n+3*c)/Math.pow(n,2),h=o,u=c;return t*Math.pow(a,3)+l*Math.pow(a,2)+h*a+u}function Lt(c,o,n,a){var t=(o*n+2*c)/Math.pow(n,3),l=-(2*o*n+3*c)/Math.pow(n,2),h=o;return 3*t*Math.pow(a,2)+2*l*a+h}function Vt(c,o,n,a){var t=a[1]-a[0];return c=Se(c,a),o=Se(o,a),o-c>t/2?Ne(c+t,o,n):c-o>t/2?Ne(c-t,o,n):Ne(c,o,n)}function Se(c,o){var n=o[1]-o[0];return c<o[0]?Se(c+n,o):c>=o[1]?Se(c-n,o):c}function Gt(c,o,n,a){return a?Vt(c,o,n,a):Ne(c,o,n)}var st=function(){function c(o){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=qe(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var n in o){var a=o[n];typeof a=="number"?(this.value[n]=a,this.config[n]={circle:!1}):(this.value[n]=a.value,this.config[n]={circle:a.circle})}this.keyframes=[{progress:0,value:W({},this.value)},{progress:1,value:W({},this.value)}]}return c.prototype.getProgress=function(o){var n=o-this.startTime;return n<0?0:n>=this.duration?1:1-Bt(1,this.startVelocity,this.duration,n)},c.prototype.getValue=function(o){for(var n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>o){var a=this.keyframes[n-1],t=this.keyframes[n],l={};for(var h in this.config){var u=(o-a.progress)/(t.progress-a.progress);l[h]=Gt(a.value[h],t.value[h],u,this.config[h].circle)}return l}return W({},this.keyframes[this.keyframes.length-1].value)},c.prototype.getProgressVelocity=function(o){var n=o-this.startTime;return n>=this.duration?0:Lt(1,this.startVelocity,this.duration,n)},c.prototype.update=function(o){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(o))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},c.prototype.getKeyFrameSegment=function(o){for(var n=this.getProgress(o),a=1;a<this.keyframes.length;a++)if(this.keyframes[a].progress>n)return[this.keyframes[a-1],this.keyframes[a]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},c.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},c.prototype.set=function(o,n,a,t){var l;a===void 0&&(a=0),isNaN(n)&&(n=0),isNaN(a)&&(a=0),t=t!=null?t:qe();var h=this.getProgress(t),u=this.getValue(h),m={};for(var p in this.config)m[p]=(l=o[p])!==null&&l!==void 0?l:u[p];var y=[{progress:0,value:u},{progress:1,value:m}];return this.setKeyframes(y,n,a,t)},c.prototype.setKeyframes=function(o,n,a,t){var l=this;if(a===void 0&&(a=0),o.length<2)throw new Error("keyframes invalid.");return isNaN(n)&&(n=0),isNaN(a)&&(a=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(h,u){t=t!=null?t:qe(),l.progress=0,l.ended=!1,l.startTime=t,l.startVelocity=a,l.keyframes=o,l.duration=n,n===0?(l.progress=1,l.value=W({},o[o.length-1].value)):l.value=W({},o[0].value),l.callbacks=[h,u]})},c.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},c}(),Ht=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],Yt=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],jt=`
|
|
256
256
|
varying vec2 vUv;
|
|
257
257
|
void main() {
|
|
258
258
|
vUv = uv;
|
|
259
259
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
260
260
|
}
|
|
261
|
-
`,
|
|
261
|
+
`,Xt=`
|
|
262
262
|
varying vec2 vUv;
|
|
263
263
|
uniform sampler2D map;
|
|
264
264
|
uniform vec4 color;
|
|
@@ -304,7 +304,7 @@ void main() {
|
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
`,
|
|
307
|
+
`,zt=function(c){Ie(o,c);function o(n,a){var t=c.call(this,n)||this;t.canvas=document.createElement("canvas"),t.group=new g.Group,t.wrapper=document.createElement("div"),t.style=document.createElement("style"),t.itemMaskMesh=function(){var u=new g.Mesh(new g.SphereBufferGeometry(1,60,40),new g.ShaderMaterial({vertexShader:jt,fragmentShader:Xt,uniforms:{map:{value:new g.Texture},color:{value:new g.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return u.renderOrder=-3,u.geometry.rotateY(-Math.PI/2),u.geometry.scale(-1,1,1),u}(),t.onFivePanoArrived=function(u){t.state.mode==="mask"&&t.loadPanoMask(u)},t.onFiveWantsMoveToPano=function(u){t.state.mode==="box"&&t.select()},t.loadPanoMask=function(u){return xe(t,void 0,void 0,function(){var m,p,y,T,M,N,C,F,H,O;return Oe(this,function(z){switch(z.label){case 0:return m=this,p=m.five,y=m.canvas,T=m.itemMaskMesh,M=m.data,N=y.getContext("2d"),C=p.observers[u],F=(O=M==null?void 0:M.object_mask_list.find(function(Z){return Z.derived_id===String(C.derivedId)}))===null||O===void 0?void 0:O.object_mask_url,F?[4,Ut(F)]:[2];case 1:return H=z.sent(),y.width=H.width,y.height=H.height,N==null||N.drawImage(H,0,0,H.width,H.height),T.material.uniforms.map.value.image=H,T.material.uniforms.map.value.minFilter=g.LinearFilter,T.material.uniforms.map.value.needsUpdate=!0,T.position.copy(C.position),T.quaternion.copy(C.quaternion),p.scene.add(T),p.needsRender=!0,[2]}})})},t.onFiveMouseMove=function(u){var m;if(t.state.mode==="mask"&&t.five.state.mode==="Panorama"){var p=t,y=p.five,T=p.itemMaskMesh,M=y.observers[y.state.panoIndex],N=(m=u.pointers[0])===null||m===void 0?void 0:m.raycaster;if(N){var C=N.intersectObjects(t.group.children.filter(function(F){return F.userData.visible_viewpoint.includes(String(M.derivedId))}),!0)[0];C?T.material.uniforms.color.value=C.object.userData.color:T.material.uniforms.color.value=new g.Vector4(0,0,0,1)}}},t.onFiveTapGesture=function(u){var m=t.five,p=m.observers[m.state.panoIndex];if(u){var y=u.intersectObjects(t.group.children.filter(function(N){return N.userData.visible_viewpoint.includes(String(p.derivedId))}),!0)[0];if(y){t.select(y.object.name),t.stopAnimation&&t.stopAnimation(),t.tapPosition=y.point,t.changeTapScreenPosition();var T=new st({opacity:0,scale:0,shadow:2}),M=new st({opacity:0,scale:0,shadow:2});return T.setKeyframes(Ht,1e3),M.setKeyframes(Yt,1e3),t.stopAnimation=he.AnimationFrameLoop.shared.add(function(N,C){var F,H=T.update(N),O=M.update(N);t.wrapper.firstChild.style.opacity="".concat(T.value.opacity),t.wrapper.firstChild.style.transform="scale(".concat(T.value.scale,")"),t.wrapper.firstChild.style.boxShadow="0 0 0 ".concat(T.value.shadow,"px #fff"),t.wrapper.lastChild.style.opacity="".concat(M.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(M.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(M.value.shadow,"px #fff"),H&&O&&((F=t.stopAnimation)===null||F===void 0||F.call(t),t.stopAnimation=void 0,m.getElement().parentElement.removeChild(t.wrapper))},!1,0,10),m.getElement().parentElement.appendChild(t.wrapper),!1}}},t.changeTapScreenPosition=function(){if(t.tapPosition){var u=t.tapPosition.clone().project(t.five.camera),m=(u.x+1)/2,p=-(u.y-1)/2;t.wrapper.style.opacity=u.z>0&&u.z<1?"1":"0",t.wrapper.style.transform="translate(".concat(m*100,"%, ").concat(p*100,"%)")}},t.onFiveCameraUpdate=function(u){t.changeTapScreenPosition()},t.dispose=function(){t.disable()},t.five=n;var l={enabled:!0,visible:!0,mode:"box",selectedId:null,selectAll:!1};t.state=Object.assign(l,a==null?void 0:a.initialState);var h=W({},a==null?void 0:a.config);return t._config=h,t.group.rotateX(Math.PI),t.wrapper.className="ItemMaskPlugin",t.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',t.style.innerHTML=`
|
|
308
308
|
.ItemMaskPlugin {
|
|
309
309
|
position: absolute;
|
|
310
310
|
top: 0;
|
|
@@ -322,7 +322,7 @@ void main() {
|
|
|
322
322
|
border-radius: 50%;
|
|
323
323
|
box-shadow: 0px 0px 0px 2px #fff;
|
|
324
324
|
}
|
|
325
|
-
`,
|
|
325
|
+
`,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return W({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(n,a){var t=this.state;this.state=W(W({},this.state),n),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:a})},o.prototype.load=function(n){return xe(this,void 0,void 0,function(){var a,t,l=this;return Oe(this,function(h){return this.data=n,a=n.data_list.map(function(u){var m,p=u.position.end.map(function(V){return Number(V)}),y=u.position.start.map(function(V){return Number(V)}),T=Math.abs(p[0]-y[0]),M=Math.abs(p[1]-y[1]),N=Math.abs(p[2]-y[2]),C=p[0]/2+y[0]/2,F=p[1]/2+y[1]/2,H=p[2]/2+y[2]/2,O=new g.Vector3(C,F,H),z=new g.BoxBufferGeometry(T,M,N),Z=new g.ShaderMaterial({vertexShader:`
|
|
326
326
|
varying vec2 vUv;
|
|
327
327
|
void main() {
|
|
328
328
|
vUv = uv;
|
|
@@ -347,2934 +347,13 @@ void main() {
|
|
|
347
347
|
gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
`,side:
|
|
350
|
+
`,side:g.DoubleSide,visible:l.state.selectedId==="".concat(u.category_name).concat(u.index),uniforms:{opacity:{value:l.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),f=new g.Mesh(z,Z);return f.position.copy(O),f.name="".concat(u.category_name).concat(u.index),f.userData.color=new((m=g.Vector4).bind.apply(m,ot(ot([void 0],u.mask_color.map(function(V){return V/255}).reverse(),!1),[1],!1))),f.userData.visible_viewpoint=Object.keys(u.visible_viewpoint),f}),(t=this.group).add.apply(t,a),[2]})})},o.prototype.setState=function(n,a){a===void 0&&(a={});var t=this.state,l=a.userAction!==void 0?a.userAction:!0;if(this.updateState(n,l),n.enabled!==void 0&&t.enabled!==n.enabled){var h={userAction:l};n.enabled?this._enable(h):this._disable(h)}},o.prototype.setMode=function(n){this.updateState({mode:n},!1),n==="mask"?(this.group.children.forEach(function(a){a.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):n==="box"&&(this.itemMaskMesh.material.uniforms.color.value=new g.Vector4(0,0,0,1),this.group.children.forEach(function(a){a.material.uniforms.opacity.value=1}),this.five.needsRender=!0)},o.prototype.select=function(n,a){var t=this,l;this.updateState({selectedId:n!=null?n:null},(l=a==null?void 0:a.userAction)!==null&&l!==void 0?l:!1),this.group.children.forEach(function(h){h.material.visible=t.state.selectAll||h.name===n}),this.five.needsRender=!0},o.prototype.selectAll=function(n){n===void 0&&(n=!0),this.updateState({selectAll:!!n},!1),this.select()},o.prototype._enable=function(n){this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("gesture.mousemove",this.onFiveMouseMove),this.five.on("wantsTapGesture",this.onFiveTapGesture),this.five.on("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)},o.prototype._disable=function(n){this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("gesture.mousemove",this.onFiveMouseMove),this.five.off("wantsTapGesture",this.onFiveTapGesture),this.five.off("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)},o.prototype.enable=function(n){var a;if(!this.state.enabled){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(n){var a;if(this.state.enabled!==!1){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o}(G.BasePlugin.Controller),Wt=function(c,o){return new zt(c,o)};/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
351
351
|
* http://hammerjs.github.io/
|
|
352
352
|
*
|
|
353
353
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
354
|
-
* Licensed under the MIT license */var
|
|
355
|
-
`+
|
|
356
|
-
`;return function(){var Q=new Error("get-stack-trace"),ge=Q&&Q.stack?Q.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Xe=e.console&&(e.console.warn||e.console.log);return Xe&&Xe.call(e.console,U,ge),w.apply(this,arguments)}}var m;typeof Object.assign!="function"?m=function(M){if(M===r||M===null)throw new TypeError("Cannot convert undefined or null to object");for(var P=Object(M),U=1;U<arguments.length;U++){var Q=arguments[U];if(Q!==r&&Q!==null)for(var ge in Q)Q.hasOwnProperty(ge)&&(P[ge]=Q[ge])}return P}:m=Object.assign;var g=d(function(M,P,U){for(var Q=Object.keys(P),ge=0;ge<Q.length;)(!U||U&&M[Q[ge]]===r)&&(M[Q[ge]]=P[Q[ge]]),ge++;return M},"extend","Use `assign`."),y=d(function(M,P){return g(M,P,!0)},"merge","Use `assign`.");function p(w,M,P){var U=M.prototype,Q;Q=w.prototype=Object.create(U),Q.constructor=w,Q._super=U,P&&m(Q,P)}function v(w,M){return function(){return w.apply(M,arguments)}}function _(w,M){return typeof w==o?w.apply(M&&M[0]||r,M):w}function x(w,M){return w===r?M:w}function b(w,M,P){f(O(M),function(U){w.addEventListener(U,P,!1)})}function T(w,M,P){f(O(M),function(U){w.removeEventListener(U,P,!1)})}function C(w,M){for(;w;){if(w==M)return!0;w=w.parentNode}return!1}function N(w,M){return w.indexOf(M)>-1}function O(w){return w.trim().split(/\s+/g)}function J(w,M,P){if(w.indexOf&&!P)return w.indexOf(M);for(var U=0;U<w.length;){if(P&&w[U][P]==M||!P&&w[U]===M)return U;U++}return-1}function F(w){return Array.prototype.slice.call(w,0)}function B(w,M,P){for(var U=[],Q=[],ge=0;ge<w.length;){var Xe=w[ge][M];J(Q,Xe)<0&&U.push(w[ge]),Q[ge]=Xe,ge++}return U=U.sort(function(Xt,vt){return Xt[M]>vt[M]}),U}function V(w,M){for(var P,U,Q=M[0].toUpperCase()+M.slice(1),ge=0;ge<i.length;){if(P=i[ge],U=P?P+Q:M,U in w)return U;ge++}return r}var Y=1;function D(){return Y++}function z(w){var M=w.ownerDocument||w;return M.defaultView||M.parentWindow||e}var k=/mobile|tablet|ip(ad|hone|od)|android/i,q="ontouchstart"in e,Z=V(e,"PointerEvent")!==r,ee=q&&k.test(navigator.userAgent),te="touch",oe="pen",Pe="mouse",be="kinect",re=25,G=1,Be=2,xe=4,Te=8,ue=1,$=2,Ce=4,Ye=8,Qe=16,nt=$|Ce,$e=Ye|Qe,A=nt|$e,L=["x","y"],ne=["clientX","clientY"];function K(w,M){var P=this;this.manager=w,this.callback=M,this.element=w.element,this.target=w.options.inputTarget,this.domHandler=function(U){_(w.options.enable,[w])&&P.handler(U)},this.init()}K.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(z(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(z(this.element),this.evWin,this.domHandler)}};function Fe(w){var M,P=w.options.inputClass;return P?M=P:Z?M=Dt:ee?M=j:q?M=Ae:M=it,new M(w,ye)}function ye(w,M,P){var U=P.pointers.length,Q=P.changedPointers.length,ge=M&G&&U-Q===0,Xe=M&(xe|Te)&&U-Q===0;P.isFirst=!!ge,P.isFinal=!!Xe,ge&&(w.session={}),P.eventType=M,R(w,P),w.emit("hammer.input",P),w.recognize(P),w.session.prevInput=P}function R(w,M){var P=w.session,U=M.pointers,Q=U.length;P.firstInput||(P.firstInput=me(M)),Q>1&&!P.firstMultiple?P.firstMultiple=me(M):Q===1&&(P.firstMultiple=!1);var ge=P.firstInput,Xe=P.firstMultiple,St=Xe?Xe.center:ge.center,Xt=M.center=ie(U);M.timeStamp=l(),M.deltaTime=M.timeStamp-ge.timeStamp,M.angle=I(St,Xt),M.distance=Re(St,Xt),he(P,M),M.offsetDirection=pe(M.deltaX,M.deltaY);var vt=Se(M.deltaTime,M.deltaX,M.deltaY);M.overallVelocityX=vt.x,M.overallVelocityY=vt.y,M.overallVelocity=c(vt.x)>c(vt.y)?vt.x:vt.y,M.scale=Xe?Me(Xe.pointers,U):1,M.rotation=Xe?we(Xe.pointers,U):0,M.maxPointers=P.prevInput?M.pointers.length>P.prevInput.maxPointers?M.pointers.length:P.prevInput.maxPointers:M.pointers.length,fe(P,M);var Cn=w.element;C(M.srcEvent.target,Cn)&&(Cn=M.srcEvent.target),M.target=Cn}function he(w,M){var P=M.center,U=w.offsetDelta||{},Q=w.prevDelta||{},ge=w.prevInput||{};(M.eventType===G||ge.eventType===xe)&&(Q=w.prevDelta={x:ge.deltaX||0,y:ge.deltaY||0},U=w.offsetDelta={x:P.x,y:P.y}),M.deltaX=Q.x+(P.x-U.x),M.deltaY=Q.y+(P.y-U.y)}function fe(w,M){var P=w.lastInterval||M,U=M.timeStamp-P.timeStamp,Q,ge,Xe,St;if(M.eventType!=Te&&(U>re||P.velocity===r)){var Xt=M.deltaX-P.deltaX,vt=M.deltaY-P.deltaY,Cn=Se(U,Xt,vt);ge=Cn.x,Xe=Cn.y,Q=c(Cn.x)>c(Cn.y)?Cn.x:Cn.y,St=pe(Xt,vt),w.lastInterval=M}else Q=P.velocity,ge=P.velocityX,Xe=P.velocityY,St=P.direction;M.velocity=Q,M.velocityX=ge,M.velocityY=Xe,M.direction=St}function me(w){for(var M=[],P=0;P<w.pointers.length;)M[P]={clientX:s(w.pointers[P].clientX),clientY:s(w.pointers[P].clientY)},P++;return{timeStamp:l(),pointers:M,center:ie(M),deltaX:w.deltaX,deltaY:w.deltaY}}function ie(w){var M=w.length;if(M===1)return{x:s(w[0].clientX),y:s(w[0].clientY)};for(var P=0,U=0,Q=0;Q<M;)P+=w[Q].clientX,U+=w[Q].clientY,Q++;return{x:s(P/M),y:s(U/M)}}function Se(w,M,P){return{x:M/w||0,y:P/w||0}}function pe(w,M){return w===M?ue:c(w)>=c(M)?w<0?$:Ce:M<0?Ye:Qe}function Re(w,M,P){P||(P=L);var U=M[P[0]]-w[P[0]],Q=M[P[1]]-w[P[1]];return Math.sqrt(U*U+Q*Q)}function I(w,M,P){P||(P=L);var U=M[P[0]]-w[P[0]],Q=M[P[1]]-w[P[1]];return Math.atan2(Q,U)*180/Math.PI}function we(w,M){return I(M[1],M[0],ne)+I(w[1],w[0],ne)}function Me(w,M){return Re(M[0],M[1],ne)/Re(w[0],w[1],ne)}var Ve={mousedown:G,mousemove:Be,mouseup:xe},Ee="mousedown",Ze="mousemove mouseup";function it(){this.evEl=Ee,this.evWin=Ze,this.pressed=!1,K.apply(this,arguments)}p(it,K,{handler:function(M){var P=Ve[M.type];P&G&&(M.button===0||M.button===2)&&(this.pressed=!0),P&Be&&M.which!==1&&(P=xe),this.pressed&&(P&xe&&(this.pressed=!1),this.callback(this.manager,P,{pointers:[M],changedPointers:[M],pointerType:Pe,srcEvent:M}))}});var pt={pointerdown:G,pointermove:Be,pointerup:xe,pointercancel:Te,pointerout:Te},Ht={2:te,3:oe,4:Pe,5:be},at="pointerdown",Pt="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(at="MSPointerDown",Pt="MSPointerMove MSPointerUp MSPointerCancel");function Dt(){this.evEl=at,this.evWin=Pt,K.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}p(Dt,K,{handler:function(M){var P=this.store,U=!1,Q=!1,ge=M.type.toLowerCase().replace("ms",""),Xe=pt[ge],St=Ht[M.pointerType]||M.pointerType,Xt=St==te,vt=J(P,M.pointerId,"pointerId");Xe&G&&(M.button===0||M.button===2||Xt)?vt<0&&(P.push(M),vt=P.length-1):Xe&(xe|Te)?U=!0:!Xt&&M.buttons===0&&(U=!0,Q=!0,Xe=pt.pointerup),!(vt<0)&&(Q||(P[vt]=M),this.callback(this.manager,Xe,{pointers:P,changedPointers:[M],pointerType:St,srcEvent:P[vt]}),U&&P.splice(vt,1))}});var Kt={touchstart:G,touchmove:Be,touchend:xe,touchcancel:Te},Ii="touchstart",Ni="touchstart touchmove touchend touchcancel";function Br(){this.evTarget=Ii,this.evWin=Ni,this.started=!1,K.apply(this,arguments)}p(Br,K,{handler:function(M){var P=Kt[M.type];if(P===G&&(this.started=!0),!!this.started){var U=S.call(this,M,P);P&(xe|Te)&&U[0].length-U[1].length===0&&(this.started=!1),this.callback(this.manager,P,{pointers:U[0],changedPointers:U[1],pointerType:te,srcEvent:M})}}});function S(w,M){var P=F(w.touches),U=F(w.changedTouches);return M&(xe|Te)&&(P=B(P.concat(U),"identifier")),[P,U]}var W={touchstart:G,touchmove:Be,touchend:xe,touchcancel:Te},H="touchstart touchmove touchend touchcancel";function j(){this.evTarget=H,this.targetIds={},K.apply(this,arguments)}p(j,K,{handler:function(M){var P=W[M.type],U=se.call(this,M,P);U&&this.callback(this.manager,P,{pointers:U[0],changedPointers:U[1],pointerType:te,srcEvent:M})}});function se(w,M){var P=F(w.touches),U=this.targetIds;if(M&(G|Be)&&P.length===1)return U[P[0].identifier]=!0,[P,P];var Q,ge,Xe=F(w.changedTouches),St=[],Xt=this.target;if(ge=P.filter(function(vt){return C(vt.target,Xt)}),M===G)for(Q=0;Q<ge.length;)U[ge[Q].identifier]=!0,Q++;for(Q=0;Q<Xe.length;)U[Xe[Q].identifier]&&St.push(Xe[Q]),M&(xe|Te)&&delete U[Xe[Q].identifier],Q++;if(St.length)return[B(ge.concat(St),"identifier"),St]}var Ge=2500,Ie=25;function Ae(){K.apply(this,arguments);var w=v(this.handler,this);this.touch=new j(this.manager,w),this.mouse=new it(this.manager,w),this.primaryTouch=null,this.lastTouches=[]}p(Ae,K,{handler:function(M,P,U){var Q=U.pointerType==te,ge=U.pointerType==Pe;if(!(ge&&U.sourceCapabilities&&U.sourceCapabilities.firesTouchEvents)){if(Q)Ue.call(this,P,U);else if(ge&&ct.call(this,U))return;this.callback(M,P,U)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ue(w,M){w&G?(this.primaryTouch=M.changedPointers[0].identifier,He.call(this,M)):w&(xe|Te)&&He.call(this,M)}function He(w){var M=w.changedPointers[0];if(M.identifier===this.primaryTouch){var P={x:M.clientX,y:M.clientY};this.lastTouches.push(P);var U=this.lastTouches,Q=function(){var ge=U.indexOf(P);ge>-1&&U.splice(ge,1)};setTimeout(Q,Ge)}}function ct(w){for(var M=w.srcEvent.clientX,P=w.srcEvent.clientY,U=0;U<this.lastTouches.length;U++){var Q=this.lastTouches[U],ge=Math.abs(M-Q.x),Xe=Math.abs(P-Q.y);if(ge<=Ie&&Xe<=Ie)return!0}return!1}var Ke=a?V(a.style,"touchAction"):r,Je=Ke!==r,ze="compute",qe="auto",yt="manipulation",Tt="none",xt="pan-x",vn="pan-y",st=ja();function Xn(w,M){this.manager=w,this.set(M)}Xn.prototype={set:function(w){w==ze&&(w=this.compute()),Je&&this.manager.element.style&&st[w]&&(this.manager.element.style[Ke]=w),this.actions=w.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var w=[];return f(this.manager.recognizers,function(M){_(M.options.enable,[M])&&(w=w.concat(M.getTouchAction()))}),mr(w.join(" "))},preventDefaults:function(w){var M=w.srcEvent,P=w.offsetDirection;if(this.manager.session.prevented){M.preventDefault();return}var U=this.actions,Q=N(U,Tt)&&!st[Tt],ge=N(U,vn)&&!st[vn],Xe=N(U,xt)&&!st[xt];if(Q){var St=w.pointers.length===1,Xt=w.distance<2,vt=w.deltaTime<250;if(St&&Xt&&vt)return}if(!(Xe&&ge)&&(Q||ge&&P&nt||Xe&&P&$e))return this.preventSrc(M)},preventSrc:function(w){this.manager.session.prevented=!0,w.preventDefault()}};function mr(w){if(N(w,Tt))return Tt;var M=N(w,xt),P=N(w,vn);return M&&P?Tt:M||P?M?xt:vn:N(w,yt)?yt:qe}function ja(){if(!Je)return!1;var w={},M=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(P){w[P]=M?e.CSS.supports("touch-action",P):!0}),w}var Fi=1,an=2,Bi=4,gr=8,jn=gr,qa=16,Pn=32;function qn(w){this.options=m({},this.defaults,w||{}),this.id=D(),this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Fi,this.simultaneous={},this.requireFail=[]}qn.prototype={defaults:{},set:function(w){return m(this.options,w),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(w){if(h(w,"recognizeWith",this))return this;var M=this.simultaneous;return w=Rs(w,this),M[w.id]||(M[w.id]=w,w.recognizeWith(this)),this},dropRecognizeWith:function(w){return h(w,"dropRecognizeWith",this)?this:(w=Rs(w,this),delete this.simultaneous[w.id],this)},requireFailure:function(w){if(h(w,"requireFailure",this))return this;var M=this.requireFail;return w=Rs(w,this),J(M,w)===-1&&(M.push(w),w.requireFailure(this)),this},dropRequireFailure:function(w){if(h(w,"dropRequireFailure",this))return this;w=Rs(w,this);var M=J(this.requireFail,w);return M>-1&&this.requireFail.splice(M,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(w){return!!this.simultaneous[w.id]},emit:function(w){var M=this,P=this.state;function U(Q){M.manager.emit(Q,w)}P<gr&&U(M.options.event+mf(P)),U(M.options.event),w.additionalEvent&&U(w.additionalEvent),P>=gr&&U(M.options.event+mf(P))},tryEmit:function(w){if(this.canEmit())return this.emit(w);this.state=Pn},canEmit:function(){for(var w=0;w<this.requireFail.length;){if(!(this.requireFail[w].state&(Pn|Fi)))return!1;w++}return!0},recognize:function(w){var M=m({},w);if(!_(this.options.enable,[this,M])){this.reset(),this.state=Pn;return}this.state&(jn|qa|Pn)&&(this.state=Fi),this.state=this.process(M),this.state&(an|Bi|gr|qa)&&this.tryEmit(M)},process:function(w){},getTouchAction:function(){},reset:function(){}};function mf(w){return w&qa?"cancel":w&gr?"end":w&Bi?"move":w&an?"start":""}function gf(w){return w==Qe?"down":w==Ye?"up":w==$?"left":w==Ce?"right":""}function Rs(w,M){var P=M.manager;return P?P.get(w):w}function mn(){qn.apply(this,arguments)}p(mn,qn,{defaults:{pointers:1},attrTest:function(w){var M=this.options.pointers;return M===0||w.pointers.length===M},process:function(w){var M=this.state,P=w.eventType,U=M&(an|Bi),Q=this.attrTest(w);return U&&(P&Te||!Q)?M|qa:U||Q?P&xe?M|gr:M&an?M|Bi:an:Pn}});function Os(){mn.apply(this,arguments),this.pX=null,this.pY=null}p(Os,mn,{defaults:{event:"pan",threshold:10,pointers:1,direction:A},getTouchAction:function(){var w=this.options.direction,M=[];return w&nt&&M.push(vn),w&$e&&M.push(xt),M},directionTest:function(w){var M=this.options,P=!0,U=w.distance,Q=w.direction,ge=w.deltaX,Xe=w.deltaY;return Q&M.direction||(M.direction&nt?(Q=ge===0?ue:ge<0?$:Ce,P=ge!=this.pX,U=Math.abs(w.deltaX)):(Q=Xe===0?ue:Xe<0?Ye:Qe,P=Xe!=this.pY,U=Math.abs(w.deltaY))),w.direction=Q,P&&U>M.threshold&&Q&M.direction},attrTest:function(w){return mn.prototype.attrTest.call(this,w)&&(this.state&an||!(this.state&an)&&this.directionTest(w))},emit:function(w){this.pX=w.deltaX,this.pY=w.deltaY;var M=gf(w.direction);M&&(w.additionalEvent=this.options.event+M),this._super.emit.call(this,w)}});function Cc(){mn.apply(this,arguments)}p(Cc,mn,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Tt]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.scale-1)>this.options.threshold||this.state&an)},emit:function(w){if(w.scale!==1){var M=w.scale<1?"in":"out";w.additionalEvent=this.options.event+M}this._super.emit.call(this,w)}});function Rc(){qn.apply(this,arguments),this._timer=null,this._input=null}p(Rc,qn,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[qe]},process:function(w){var M=this.options,P=w.pointers.length===M.pointers,U=w.distance<M.threshold,Q=w.deltaTime>M.time;if(this._input=w,!U||!P||w.eventType&(xe|Te)&&!Q)this.reset();else if(w.eventType&G)this.reset(),this._timer=u(function(){this.state=jn,this.tryEmit()},M.time,this);else if(w.eventType&xe)return jn;return Pn},reset:function(){clearTimeout(this._timer)},emit:function(w){this.state===jn&&(w&&w.eventType&xe?this.manager.emit(this.options.event+"up",w):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Oc(){mn.apply(this,arguments)}p(Oc,mn,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Tt]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.rotation)>this.options.threshold||this.state&an)}});function Dc(){mn.apply(this,arguments)}p(Dc,mn,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:nt|$e,pointers:1},getTouchAction:function(){return Os.prototype.getTouchAction.call(this)},attrTest:function(w){var M=this.options.direction,P;return M&(nt|$e)?P=w.overallVelocity:M&nt?P=w.overallVelocityX:M&$e&&(P=w.overallVelocityY),this._super.attrTest.call(this,w)&&M&w.offsetDirection&&w.distance>this.options.threshold&&w.maxPointers==this.options.pointers&&c(P)>this.options.velocity&&w.eventType&xe},emit:function(w){var M=gf(w.offsetDirection);M&&this.manager.emit(this.options.event+M,w),this.manager.emit(this.options.event,w)}});function Ds(){qn.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}p(Ds,qn,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[yt]},process:function(w){var M=this.options,P=w.pointers.length===M.pointers,U=w.distance<M.threshold,Q=w.deltaTime<M.time;if(this.reset(),w.eventType&G&&this.count===0)return this.failTimeout();if(U&&Q&&P){if(w.eventType!=xe)return this.failTimeout();var ge=this.pTime?w.timeStamp-this.pTime<M.interval:!0,Xe=!this.pCenter||Re(this.pCenter,w.center)<M.posThreshold;this.pTime=w.timeStamp,this.pCenter=w.center,!Xe||!ge?this.count=1:this.count+=1,this._input=w;var St=this.count%M.taps;if(St===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=jn,this.tryEmit()},M.interval,this),an):jn}return Pn},failTimeout:function(){return this._timer=u(function(){this.state=Pn},this.options.interval,this),Pn},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==jn&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Ui(w,M){return M=M||{},M.recognizers=x(M.recognizers,Ui.defaults.preset),new Ic(w,M)}Ui.VERSION="2.0.7",Ui.defaults={domEvents:!1,touchAction:ze,enable:!0,inputTarget:null,inputClass:null,preset:[[Oc,{enable:!1}],[Cc,{enable:!1},["rotate"]],[Dc,{direction:nt}],[Os,{direction:nt},["swipe"]],[Ds],[Ds,{event:"doubletap",taps:2},["tap"]],[Rc]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var T0=1,yf=2;function Ic(w,M){this.options=m({},Ui.defaults,M||{}),this.options.inputTarget=this.options.inputTarget||w,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=w,this.input=Fe(this),this.touchAction=new Xn(this,this.options.touchAction),xf(this,!0),f(this.options.recognizers,function(P){var U=this.add(new P[0](P[1]));P[2]&&U.recognizeWith(P[2]),P[3]&&U.requireFailure(P[3])},this)}Ic.prototype={set:function(w){return m(this.options,w),w.touchAction&&this.touchAction.update(),w.inputTarget&&(this.input.destroy(),this.input.target=w.inputTarget,this.input.init()),this},stop:function(w){this.session.stopped=w?yf:T0},recognize:function(w){var M=this.session;if(!M.stopped){this.touchAction.preventDefaults(w);var P,U=this.recognizers,Q=M.curRecognizer;(!Q||Q&&Q.state&jn)&&(Q=M.curRecognizer=null);for(var ge=0;ge<U.length;)P=U[ge],M.stopped!==yf&&(!Q||P==Q||P.canRecognizeWith(Q))?P.recognize(w):P.reset(),!Q&&P.state&(an|Bi|gr)&&(Q=M.curRecognizer=P),ge++}},get:function(w){if(w instanceof qn)return w;for(var M=this.recognizers,P=0;P<M.length;P++)if(M[P].options.event==w)return M[P];return null},add:function(w){if(h(w,"add",this))return this;var M=this.get(w.options.event);return M&&this.remove(M),this.recognizers.push(w),w.manager=this,this.touchAction.update(),w},remove:function(w){if(h(w,"remove",this))return this;if(w=this.get(w),w){var M=this.recognizers,P=J(M,w);P!==-1&&(M.splice(P,1),this.touchAction.update())}return this},on:function(w,M){if(w!==r&&M!==r){var P=this.handlers;return f(O(w),function(U){P[U]=P[U]||[],P[U].push(M)}),this}},off:function(w,M){if(w!==r){var P=this.handlers;return f(O(w),function(U){M?P[U]&&P[U].splice(J(P[U],M),1):delete P[U]}),this}},emit:function(w,M){this.options.domEvents&&S0(w,M);var P=this.handlers[w]&&this.handlers[w].slice();if(!(!P||!P.length)){M.type=w,M.preventDefault=function(){M.srcEvent.preventDefault()};for(var U=0;U<P.length;)P[U](M),U++}},destroy:function(){this.element&&xf(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function xf(w,M){var P=w.element;if(P.style){var U;f(w.options.cssProps,function(Q,ge){U=V(P.style,ge),M?(w.oldCssProps[U]=P.style[U],P.style[U]=Q):P.style[U]=w.oldCssProps[U]||""}),M||(w.oldCssProps={})}}function S0(w,M){var P=t.createEvent("Event");P.initEvent(w,!0,!0),P.gesture=M,M.target.dispatchEvent(P)}return m(Ui,{INPUT_START:G,INPUT_MOVE:Be,INPUT_END:xe,INPUT_CANCEL:Te,STATE_POSSIBLE:Fi,STATE_BEGAN:an,STATE_CHANGED:Bi,STATE_ENDED:gr,STATE_RECOGNIZED:jn,STATE_CANCELLED:qa,STATE_FAILED:Pn,DIRECTION_NONE:ue,DIRECTION_LEFT:$,DIRECTION_RIGHT:Ce,DIRECTION_UP:Ye,DIRECTION_DOWN:Qe,DIRECTION_HORIZONTAL:nt,DIRECTION_VERTICAL:$e,DIRECTION_ALL:A,Manager:Ic,Input:K,TouchAction:Xn,TouchInput:j,MouseInput:it,PointerEventInput:Dt,TouchMouseInput:Ae,SingleTouchInput:Br,Recognizer:qn,AttrRecognizer:mn,Tap:Ds,Pan:Os,Swipe:Dc,Pinch:Cc,Rotate:Oc,Press:Rc,on:b,off:T,each:f,merge:y,extend:g,assign:m,inherit:p,bindFn:v,prefixed:V}),Ui}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52)),Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e}),Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype||Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let n=1;n<arguments.length;n++){const r=arguments[n];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t});const Bf="117",Yn={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Uf=0,Bc=1,zf=2,Uc=1,Gf=2,zi=3,Gi=0,At=1,$a=2,zc=1,Jn=0,Hi=1,Gc=2,Hc=3,Vc=4,Hf=5,Ur=100,Vf=101,kf=102,kc=103,Wc=104,Wf=200,Xf=201,jf=202,qf=203,Xc=204,jc=205,Yf=206,Zf=207,Jf=208,Qf=209,Kf=210,$f=0,ed=1,td=2,Bs=3,nd=4,rd=5,id=6,ad=7,eo=0,od=1,sd=2,Vi=0,qc=1,ld=2,cd=3,ud=4,hd=5,Us=300,zs=301,Gs=302,Yc=303,Hs=304,Zc=305,ki=306,Vs=307,to=1e3,Vt=1001,no=1002,_t=1003,ks=1004,Ws=1005,It=1006,Jc=1007,ro=1008,Wi=1009,fd=1010,dd=1011,io=1012,pd=1013,ao=1014,Qn=1015,oo=1016,vd=1017,md=1018,gd=1019,Xi=1020,yd=1021,xr=1022,on=1023,xd=1024,_d=1025,bd=on,zr=1026,ji=1027,wd=1028,Md=1029,Ed=1030,Td=1031,Sd=1032,Ad=1033,Qc=33776,Kc=33777,$c=33778,eu=33779,tu=35840,nu=35841,ru=35842,iu=35843,Ld=36196,au=37492,ou=37496,Pd=37808,Cd=37809,Rd=37810,Od=37811,Dd=37812,Id=37813,Nd=37814,Fd=37815,Bd=37816,Ud=37817,zd=37818,Gd=37819,Hd=37820,Vd=37821,kd=36492,Wd=37840,Xd=37841,jd=37842,qd=37843,Yd=37844,Zd=37845,Jd=37846,Qd=37847,Kd=37848,$d=37849,ep=37850,tp=37851,np=37852,rp=37853,ip=2200,ap=2201,op=2202,so=2300,lo=2301,Xs=2302,Gr=2400,Hr=2401,co=2402,js=2500,su=2501,sp=0,kt=3e3,uo=3001,qs=3007,Ys=3002,lp=3003,lu=3004,cu=3005,uu=3006,cp=3200,up=3201,Vr=0,hp=1,Zs=7680,fp=519,ho=35044,qi=35048;function sn(){}Object.assign(sn.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners,r=n[e];if(r!==void 0){var i=r.indexOf(t);i!==-1&&r.splice(i,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners,n=t[e.type];if(n!==void 0){e.target=this;for(var r=n.slice(0),i=0,a=r.length;i<a;i++)r[i].call(this,e)}}}});for(var Rt=[],Yi=0;Yi<256;Yi++)Rt[Yi]=(Yi<16?"0":"")+Yi.toString(16);var ke={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=Rt[e&255]+Rt[e>>8&255]+Rt[e>>16&255]+Rt[e>>24&255]+"-"+Rt[t&255]+Rt[t>>8&255]+"-"+Rt[t>>16&15|64]+Rt[t>>24&255]+"-"+Rt[n&63|128]+Rt[n>>8&255]+"-"+Rt[n>>16&255]+Rt[n>>24&255]+Rt[r&255]+Rt[r>>8&255]+Rt[r>>16&255]+Rt[r>>24&255];return i.toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ke.DEG2RAD},radToDeg:function(e){return e*ke.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)===0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),h=a((t-r)/2),f=o((t-r)/2),d=a((r-t)/2),m=o((r-t)/2);switch(i){case"XYX":e.set(s*u,c*h,c*f,s*l);break;case"YZY":e.set(c*f,s*u,c*h,s*l);break;case"ZXZ":e.set(c*h,c*f,s*u,s*l);break;case"XZX":e.set(s*u,c*m,c*d,s*l);break;case"YXY":e.set(c*d,s*u,c*m,s*l);break;case"ZYZ":e.set(c*m,c*d,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};function X(e,t){this.x=e||0,this.y=t||0}Object.defineProperties(X.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(X.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(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:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(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:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(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:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(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:function(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:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){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:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(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:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}});function Ut(){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.")}Object.assign(Ut.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var 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:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var 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:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],f=n[5],d=n[8],m=r[0],g=r[3],y=r[6],p=r[1],v=r[4],_=r[7],x=r[2],b=r[5],T=r[8];return i[0]=a*m+o*p+s*x,i[3]=a*g+o*v+s*b,i[6]=a*y+o*_+s*T,i[1]=c*m+l*p+u*x,i[4]=c*g+l*v+u*b,i[7]=c*y+l*_+u*T,i[2]=h*m+f*p+d*x,i[5]=h*g+f*v+d*b,i[8]=h*y+f*_+d*T,this},multiplyScalar:function(e){var 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:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],f=n[8],d=f*c-l*h,m=l*u-f*s,g=h*s-c*u,y=i*d+a*m+o*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);var p=1/y;return r[0]=d*p,r[1]=(o*h-f*a)*p,r[2]=(l*a-o*c)*p,r[3]=m*p,r[4]=(f*i-o*u)*p,r[5]=(o*s-l*i)*p,r[6]=g*p,r[7]=(a*u-h*i)*p,r[8]=(c*i-a*s)*p,this},transpose:function(){var e,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:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var 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:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var 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:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var 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}});var kr,_r={getDataURL:function(e){var t;if(typeof HTMLCanvasElement=="undefined")return e.src;if(e instanceof HTMLCanvasElement)t=e;else{kr===void 0&&(kr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),kr.width=e.width,kr.height=e.height;var n=kr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=kr}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},dp=0;function ot(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,"id",{value:dp++}),this.uuid=ke.generateUUID(),this.name="",this.image=e!==void 0?e:ot.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=t!==void 0?t:ot.DEFAULT_MAPPING,this.wrapS=n!==void 0?n:Vt,this.wrapT=r!==void 0?r:Vt,this.magFilter=i!==void 0?i:It,this.minFilter=a!==void 0?a:ro,this.anisotropy=c!==void 0?c:1,this.format=o!==void 0?o:on,this.internalFormat=null,this.type=s!==void 0?s:Wi,this.offset=new X(0,0),this.repeat=new X(1,1),this.center=new X(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l!==void 0?l:kt,this.version=0,this.onUpdate=null}ot.DEFAULT_IMAGE=void 0,ot.DEFAULT_MAPPING=Us,ot.prototype=Object.assign(Object.create(sn.prototype),{constructor:ot,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(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},toJSON:function(e){var t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var 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){var r=this.image;if(r.uuid===void 0&&(r.uuid=ke.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(_r.getDataURL(r[a]))}else i=_r.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping!==Us)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case to:e.x=e.x-Math.floor(e.x);break;case Vt:e.x=e.x<0?0:1;break;case no: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 to:e.y=e.y-Math.floor(e.y);break;case Vt:e.y=e.y<0?0:1;break;case no: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}}),Object.defineProperty(ot.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});function et(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r!==void 0?r:1}Object.defineProperties(et.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(et.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(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:function(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:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(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:function(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:function(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:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var 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:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],h=s[1],f=s[5],d=s[9],m=s[2],g=s[6],y=s[10];if(Math.abs(l-h)<a&&Math.abs(u-m)<a&&Math.abs(d-g)<a){if(Math.abs(l+h)<o&&Math.abs(u+m)<o&&Math.abs(d+g)<o&&Math.abs(c+f+y-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var p=(c+1)/2,v=(f+1)/2,_=(y+1)/2,x=(l+h)/4,b=(u+m)/4,T=(d+g)/4;return p>v&&p>_?p<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(p),r=x/n,i=b/n):v>_?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=x/r,i=T/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=b/i,r=T/i),this.set(n,r,i,t),this}var C=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(h-l)*(h-l));return Math.abs(C)<.001&&(C=1),this.x=(g-d)/C,this.y=(u-m)/C,this.z=(h-l)/C,this.w=Math.acos((c+f+y-1)/2),this},min:function(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:function(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:function(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:function(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:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){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:function(){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:function(){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:function(){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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(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:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(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:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}});function $t(e,t,n){this.width=e,this.height=t,this.scissor=new et(0,0,e,t),this.scissorTest=!1,this.viewport=new et(0,0,e,t),n=n||{},this.texture=new ot(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:It,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!0,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}$t.prototype=Object.assign(Object.create(sn.prototype),{constructor:$t,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function hu(e,t,n){$t.call(this,e,t,n),this.samples=4}hu.prototype=Object.assign(Object.create($t.prototype),{constructor:hu,isWebGLMultisampleRenderTarget:!0,copy:function(e){return $t.prototype.copy.call(this,e),this.samples=e.samples,this}});function bt(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r!==void 0?r:1}Object.assign(bt,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],f=i[a+1],d=i[a+2],m=i[a+3];if(u!==m||s!==h||c!==f||l!==d){var g=1-o,y=s*h+c*f+l*d+u*m,p=y>=0?1:-1,v=1-y*y;if(v>Number.EPSILON){var _=Math.sqrt(v),x=Math.atan2(_,y*p);g=Math.sin(g*x)/_,o=Math.sin(o*x)/_}var b=o*p;if(s=s*g+h*b,c=c*g+f*b,l=l*g+d*b,u=u*g+m*b,g===1-o){var T=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=T,c*=T,l*=T,u*=T}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],h=i[a+1],f=i[a+2],d=i[a+3];return e[t]=o*d+l*u+s*f-c*h,e[t+1]=s*d+l*h+c*u-o*f,e[t+2]=c*d+l*f+o*h-s*u,e[t+3]=l*d-o*u-s*h-c*f,e}}),Object.defineProperties(bt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(bt.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),f=s(r/2),d=s(i/2);switch(a){case"XYZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"YXZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"ZXY":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"ZYX":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"YZX":this._x=h*l*u+c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u-h*f*d;break;case"XZY":this._x=h*l*u-c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u+h*f*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],h=n+o+u,f;return h>0?(f=.5/Math.sqrt(h+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(ke.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var 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:function(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:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*h+this._w*f,this._x=n*h+this._x*f,this._y=r*h+this._y*f,this._z=i*h+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(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:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Js=new E,fu=new bt;function E(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(E.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(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:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(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:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(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:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(fu.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(fu.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(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:function(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:function(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:function(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:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){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:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(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:function(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:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Js.copy(this).projectOnVector(e),this.sub(Js)},reflect:function(e){return this.sub(Js.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(ke.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(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:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Wr=new E,ln=new We,pp=new E(0,0,0),vp=new E(1,1,1),Kn=new E,fo=new E,jt=new E;function We(){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.")}Object.assign(We.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,h,f,d,m,g){var y=this.elements;return y[0]=e,y[4]=t,y[8]=n,y[12]=r,y[1]=i,y[5]=a,y[9]=o,y[13]=s,y[2]=c,y[6]=l,y[10]=u,y[14]=h,y[3]=f,y[7]=d,y[11]=m,y[15]=g,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new We().fromArray(this.elements)},copy:function(e){var 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:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(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:function(e){var t=this.elements,n=e.elements,r=1/Wr.setFromMatrixColumn(e,0).length(),i=1/Wr.setFromMatrixColumn(e,1).length(),a=1/Wr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order==="XYZ"){var h=a*l,f=a*u,d=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+d*c,t[5]=h-m*c,t[9]=-o*s,t[2]=m-h*c,t[6]=d+f*c,t[10]=a*s}else if(e.order==="YXZ"){var g=s*l,y=s*u,p=c*l,v=c*u;t[0]=g+v*o,t[4]=p*o-y,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=y*o-p,t[6]=v+g*o,t[10]=a*s}else if(e.order==="ZXY"){var g=s*l,y=s*u,p=c*l,v=c*u;t[0]=g-v*o,t[4]=-a*u,t[8]=p+y*o,t[1]=y+p*o,t[5]=a*l,t[9]=v-g*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order==="ZYX"){var h=a*l,f=a*u,d=o*l,m=o*u;t[0]=s*l,t[4]=d*c-f,t[8]=h*c+m,t[1]=s*u,t[5]=m*c+h,t[9]=f*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order==="YZX"){var _=a*s,x=a*c,b=o*s,T=o*c;t[0]=s*l,t[4]=T-_*u,t[8]=b*u+x,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=x*u+b,t[10]=_-T*u}else if(e.order==="XZY"){var _=a*s,x=a*c,b=o*s,T=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=_*u+T,t[5]=a*l,t[9]=x*u-b,t[2]=b*u-x,t[6]=o*l,t[10]=T*u+_}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(pp,e,vp)},lookAt:function(e,t,n){var r=this.elements;return jt.subVectors(e,t),jt.lengthSq()===0&&(jt.z=1),jt.normalize(),Kn.crossVectors(n,jt),Kn.lengthSq()===0&&(Math.abs(n.z)===1?jt.x+=1e-4:jt.z+=1e-4,jt.normalize(),Kn.crossVectors(n,jt)),Kn.normalize(),fo.crossVectors(jt,Kn),r[0]=Kn.x,r[4]=fo.x,r[8]=jt.x,r[1]=Kn.y,r[5]=fo.y,r[9]=jt.y,r[2]=Kn.z,r[6]=fo.z,r[10]=jt.z,this},multiply:function(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:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],f=n[13],d=n[2],m=n[6],g=n[10],y=n[14],p=n[3],v=n[7],_=n[11],x=n[15],b=r[0],T=r[4],C=r[8],N=r[12],O=r[1],J=r[5],F=r[9],B=r[13],V=r[2],Y=r[6],D=r[10],z=r[14],k=r[3],q=r[7],Z=r[11],ee=r[15];return i[0]=a*b+o*O+s*V+c*k,i[4]=a*T+o*J+s*Y+c*q,i[8]=a*C+o*F+s*D+c*Z,i[12]=a*N+o*B+s*z+c*ee,i[1]=l*b+u*O+h*V+f*k,i[5]=l*T+u*J+h*Y+f*q,i[9]=l*C+u*F+h*D+f*Z,i[13]=l*N+u*B+h*z+f*ee,i[2]=d*b+m*O+g*V+y*k,i[6]=d*T+m*J+g*Y+y*q,i[10]=d*C+m*F+g*D+y*Z,i[14]=d*N+m*B+g*z+y*ee,i[3]=p*b+v*O+_*V+x*k,i[7]=p*T+v*J+_*Y+x*q,i[11]=p*C+v*F+_*D+x*Z,i[15]=p*N+v*B+_*z+x*ee,this},multiplyScalar:function(e){var 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:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],f=e[14],d=e[3],m=e[7],g=e[11],y=e[15];return d*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*f-n*s*f)+m*(+t*s*f-t*c*h+i*a*h-r*a*f+r*c*l-i*s*l)+g*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+y*(-r*o*l-t*s*u+t*o*h+r*a*u-n*a*h+n*s*l)},transpose:function(){var e=this.elements,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:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],f=r[8],d=r[9],m=r[10],g=r[11],y=r[12],p=r[13],v=r[14],_=r[15],x=d*v*h-p*m*h+p*u*g-l*v*g-d*u*_+l*m*_,b=y*m*h-f*v*h-y*u*g+c*v*g+f*u*_-c*m*_,T=f*p*h-y*d*h+y*l*g-c*p*g-f*l*_+c*d*_,C=y*d*u-f*p*u-y*l*m+c*p*m+f*l*v-c*d*v,N=i*x+a*b+o*T+s*C;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var O=1/N;return n[0]=x*O,n[1]=(p*m*s-d*v*s-p*o*g+a*v*g+d*o*_-a*m*_)*O,n[2]=(l*v*s-p*u*s+p*o*h-a*v*h-l*o*_+a*u*_)*O,n[3]=(d*u*s-l*m*s-d*o*h+a*m*h+l*o*g-a*u*g)*O,n[4]=b*O,n[5]=(f*v*s-y*m*s+y*o*g-i*v*g-f*o*_+i*m*_)*O,n[6]=(y*u*s-c*v*s-y*o*h+i*v*h+c*o*_-i*u*_)*O,n[7]=(c*m*s-f*u*s+f*o*h-i*m*h-c*o*g+i*u*g)*O,n[8]=T*O,n[9]=(y*d*s-f*p*s-y*a*g+i*p*g+f*a*_-i*d*_)*O,n[10]=(c*p*s-y*l*s+y*a*h-i*p*h-c*a*_+i*l*_)*O,n[11]=(f*l*s-c*d*s-f*a*h+i*d*h+c*a*g-i*l*g)*O,n[12]=C*O,n[13]=(f*p*o-y*d*o+y*a*m-i*p*m-f*a*v+i*d*v)*O,n[14]=(y*l*o-c*p*o-y*a*u+i*p*u+c*a*v-i*l*v)*O,n[15]=(c*d*o-f*l*o+f*a*u-i*d*u-c*a*m+i*l*m)*O,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var 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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var 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:function(e){var 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:function(e){var 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:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,h=i*c,f=i*l,d=i*u,m=a*l,g=a*u,y=o*u,p=s*c,v=s*l,_=s*u,x=n.x,b=n.y,T=n.z;return r[0]=(1-(m+y))*x,r[1]=(f+_)*x,r[2]=(d-v)*x,r[3]=0,r[4]=(f-_)*b,r[5]=(1-(h+y))*b,r[6]=(g+p)*b,r[7]=0,r[8]=(d+v)*T,r[9]=(g-p)*T,r[10]=(1-(h+m))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=Wr.set(r[0],r[1],r[2]).length(),a=Wr.set(r[4],r[5],r[6]).length(),o=Wr.set(r[8],r[9],r[10]).length(),s=this.determinant();s<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],ln.copy(this);var c=1/i,l=1/a,u=1/o;return ln.elements[0]*=c,ln.elements[1]*=c,ln.elements[2]*=c,ln.elements[4]*=l,ln.elements[5]*=l,ln.elements[6]*=l,ln.elements[8]*=u,ln.elements[9]*=u,ln.elements[10]*=u,t.setFromRotationMatrix(ln),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,h=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var 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}});var du=new We,pu=new bt;function Xr(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||Xr.DefaultOrder}Xr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Xr.DefaultOrder="XYZ",Object.defineProperties(Xr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(Xr.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=ke.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t=t||this._order,t){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(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!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return du.makeRotationFromQuaternion(e),this.setFromRotationMatrix(du,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return pu.setFromEuler(this),this.setFromQuaternion(pu,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(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:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new E(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});function Qs(){this.mask=1}Object.assign(Qs.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}});let mp=0;const vu=new E,jr=new bt,Rn=new We,po=new E,Zi=new E,gp=new E,yp=new bt,mu=new E(1,0,0),gu=new E(0,1,0),yu=new E(0,0,1),xp={type:"added"},_p={type:"removed"};function ae(){Object.defineProperty(this,"id",{value:mp++}),this.uuid=ke.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ae.DefaultUp.clone();var e=new E,t=new Xr,n=new bt,r=new E(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),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:r},modelViewMatrix:{value:new We},normalMatrix:{value:new Ut}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=ae.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}ae.DefaultUp=new E(0,1,0),ae.DefaultMatrixAutoUpdate=!0,ae.prototype=Object.assign(Object.create(sn.prototype),{constructor:ae,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return jr.setFromAxisAngle(e,t),this.quaternion.multiply(jr),this},rotateOnWorldAxis:function(e,t){return jr.setFromAxisAngle(e,t),this.quaternion.premultiply(jr),this},rotateX:function(e){return this.rotateOnAxis(mu,e)},rotateY:function(e){return this.rotateOnAxis(gu,e)},rotateZ:function(e){return this.rotateOnAxis(yu,e)},translateOnAxis:function(e,t){return vu.copy(e).applyQuaternion(this.quaternion),this.position.add(vu.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(mu,e)},translateY:function(e){return this.translateOnAxis(gu,e)},translateZ:function(e){return this.translateOnAxis(yu,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(Rn.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?po.copy(e):po.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Zi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Rn.lookAt(Zi,po,this.up):Rn.lookAt(po,Zi,this.up),this.quaternion.setFromRotationMatrix(Rn),r&&(Rn.extractRotation(r.matrixWorld),jr.setFromRotationMatrix(Rn),this.quaternion.premultiply(jr.inverse()))},add:function(e){if(arguments.length>1){for(var 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(xp)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(_p)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),Rn.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Rn),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n],a=i.getObjectByProperty(e,t);if(a!==void 0)return a}},getWorldPosition:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new E),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new bt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Zi,e,gp),e},getWorldScale:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Zi,yp,e),e},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(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);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var 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)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(y,p){return y[p.uuid]===void 0&&(y[p.uuid]=p.toJSON(e)),p.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var h=g(e.geometries),f=g(e.materials),d=g(e.textures),m=g(e.images),o=g(e.shapes);h.length>0&&(n.geometries=h),f.length>0&&(n.materials=f),d.length>0&&(n.textures=d),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function g(y){var p=[];for(var v in y){var _=y[v];delete _.metadata,p.push(_)}return p}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),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(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}});function Ji(){ae.call(this),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}))}Ji.prototype=Object.assign(Object.create(ae.prototype),{constructor:Ji,isScene:!0,copy:function(e,t){return ae.prototype.copy.call(this,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:function(e){var t=ae.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var On=[new E,new E,new E,new E,new E,new E,new E,new E],Qi=new E,Ks=new gn,qr=new E,Yr=new E,Zr=new E,$n=new E,er=new E,br=new E,Ki=new E,vo=new E,mo=new E,wr=new E;function gn(e,t){this.min=e!==void 0?e:new E(1/0,1/0,1/0),this.max=t!==void 0?t:new E(-1/0,-1/0,-1/0)}Object.assign(gn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Qi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Ks.copy(t.boundingBox),Ks.applyMatrix4(e.matrixWorld),this.union(Ks));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(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:function(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:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new E),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:function(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:function(e){return this.clampPoint(e.center,Qi),Qi.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var 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:function(e){if(this.isEmpty())return!1;this.getCenter(Ki),vo.subVectors(this.max,Ki),qr.subVectors(e.a,Ki),Yr.subVectors(e.b,Ki),Zr.subVectors(e.c,Ki),$n.subVectors(Yr,qr),er.subVectors(Zr,Yr),br.subVectors(qr,Zr);var t=[0,-$n.z,$n.y,0,-er.z,er.y,0,-br.z,br.y,$n.z,0,-$n.x,er.z,0,-er.x,br.z,0,-br.x,-$n.y,$n.x,0,-er.y,er.x,0,-br.y,br.x,0];return!$s(t,qr,Yr,Zr,vo)||(t=[1,0,0,0,1,0,0,0,1],!$s(t,qr,Yr,Zr,vo))?!1:(mo.crossVectors($n,er),t=[mo.x,mo.y,mo.z],$s(t,qr,Yr,Zr,vo))},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new E),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=Qi.copy(e).clamp(this.min,this.max);return t.sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Qi).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(On[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),On[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),On[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),On[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),On[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),On[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),On[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),On[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(On),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});function $s(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){wr.fromArray(e,a);var s=i.x*Math.abs(wr.x)+i.y*Math.abs(wr.y)+i.z*Math.abs(wr.z),c=t.dot(wr),l=n.dot(wr),u=r.dot(wr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}var bp=new gn;function Dn(e,t){this.center=e!==void 0?e:new E,this.radius=t!==void 0?t:-1}Object.assign(Dn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t!==void 0?n.copy(t):bp.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new E),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new gn),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var In=new E,el=new E,go=new E,tr=new E,tl=new E,yo=new E,nl=new E;function Jr(e,t){this.origin=e!==void 0?e:new E,this.direction=t!==void 0?t:new E(0,0,-1)}Object.assign(Jr.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new E),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,In)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new E),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=In.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(In.copy(this.direction).multiplyScalar(t).add(this.origin),In.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){el.copy(e).add(t).multiplyScalar(.5),go.copy(t).sub(e).normalize(),tr.copy(this.origin).sub(el);var i=e.distanceTo(t)*.5,a=-this.direction.dot(go),o=tr.dot(this.direction),s=-tr.dot(go),c=tr.lengthSq(),l=Math.abs(1-a*a),u,h,f,d;if(l>0)if(u=a*s-o,h=a*o-s,d=i*l,u>=0)if(h>=-d)if(h<=d){var m=1/l;u*=m,h*=m,f=u*(u+a*h+2*o)+h*(a*u+h+2*s)+c}else h=i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;else h=-i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;else h<=-d?(u=Math.max(0,-(-a*i+o)),h=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+h*(h+2*s)+c):h<=d?(u=0,h=Math.min(Math.max(-i,-s),i),f=h*(h+2*s)+c):(u=Math.max(0,-(a*i+o)),h=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+h*(h+2*s)+c);else h=a>0?-i:i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(go).multiplyScalar(h).add(el),f},intersectSphere:function(e,t){In.subVectors(e.center,this.origin);var n=In.dot(this.direction),r=In.dot(In)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(t===0)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,In)!==null},intersectTriangle:function(e,t,n,r,i){tl.subVectors(t,e),yo.subVectors(n,e),nl.crossVectors(tl,yo);var a=this.direction.dot(nl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;tr.subVectors(this.origin,e);var s=o*this.direction.dot(yo.crossVectors(tr,yo));if(s<0)return null;var c=o*this.direction.dot(tl.cross(tr));if(c<0||s+c>a)return null;var l=-o*tr.dot(nl);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var rl=new E,wp=new E,Mp=new Ut;function yn(e,t){this.normal=e!==void 0?e:new E(1,0,0),this.constant=t!==void 0?t:0}Object.assign(yn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=rl.subVectors(n,t).cross(wp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new E),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new E);var n=e.delta(rl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new E),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Mp.getNormalMatrix(e),r=this.coplanarPoint(rl).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var cn=new E,Nn=new E,il=new E,Fn=new E,Qr=new E,Kr=new E,xu=new E,al=new E,ol=new E,sl=new E;function Ot(e,t,n){this.a=e!==void 0?e:new E,this.b=t!==void 0?t:new E,this.c=n!==void 0?n:new E}Object.assign(Ot,{getNormal:function(e,t,n,r){r===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new E),r.subVectors(n,t),cn.subVectors(e,t),r.cross(cn);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){cn.subVectors(r,t),Nn.subVectors(n,t),il.subVectors(e,t);var a=cn.dot(cn),o=cn.dot(Nn),s=cn.dot(il),c=Nn.dot(Nn),l=Nn.dot(il),u=a*c-o*o;if(i===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new E),u===0)return i.set(-2,-1,-1);var h=1/u,f=(c*s-o*l)*h,d=(a*l-o*s)*h;return i.set(1-f-d,d,f)},containsPoint:function(e,t,n,r){return Ot.getBarycoord(e,t,n,r,Fn),Fn.x>=0&&Fn.y>=0&&Fn.x+Fn.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Fn),s.set(0,0),s.addScaledVector(i,Fn.x),s.addScaledVector(a,Fn.y),s.addScaledVector(o,Fn.z),s},isFrontFacing:function(e,t,n,r){return cn.subVectors(n,t),Nn.subVectors(e,t),cn.cross(Nn).dot(r)<0}}),Object.assign(Ot.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return cn.subVectors(this.c,this.b),Nn.subVectors(this.a,this.b),cn.cross(Nn).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new E),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Ot.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new yn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Ot.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return Ot.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return Ot.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Ot.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new E);var n=this.a,r=this.b,i=this.c,a,o;Qr.subVectors(r,n),Kr.subVectors(i,n),al.subVectors(e,n);var s=Qr.dot(al),c=Kr.dot(al);if(s<=0&&c<=0)return t.copy(n);ol.subVectors(e,r);var l=Qr.dot(ol),u=Kr.dot(ol);if(l>=0&&u<=l)return t.copy(r);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Qr,a);sl.subVectors(e,i);var f=Qr.dot(sl),d=Kr.dot(sl);if(d>=0&&f<=d)return t.copy(i);var m=f*c-s*d;if(m<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Kr,o);var g=l*d-f*u;if(g<=0&&u-l>=0&&f-d>=0)return xu.subVectors(i,r),o=(u-l)/(u-l+(f-d)),t.copy(r).addScaledVector(xu,o);var y=1/(g+m+h);return a=m*y,o=h*y,t.copy(n).addScaledVector(Qr,a).addScaledVector(Kr,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var _u={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},un={h:0,s:0,l:0},xo={h:0,s:0,l:0};function de(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function ll(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function cl(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ul(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}Object.assign(de.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(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:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=ke.euclideanModulo(e,1),t=ke.clamp(t,0,1),n=ke.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=ll(i,r,e+1/3),this.g=ll(i,r,e),this.b=ll(i,r,e-1/3)}return this},setStyle:function(e){function t(h){h!==void 0&&parseFloat(h)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=_u[e];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=cl(e.r),this.g=cl(e.g),this.b=cl(e.b),this},copyLinearToSRGB:function(e){return this.r=ul(e.r),this.g=ul(e.g),this.b=ul(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(un),un.h+=e,un.s+=t,un.l+=n,this.setHSL(un.h,un.s,un.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(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:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(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},lerpHSL:function(e,t){this.getHSL(un),e.getHSL(xo);var n=ke.lerp(un.h,xo.h,t),r=ke.lerp(un.s,xo.s,t),i=ke.lerp(un.l,xo.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),de.NAMES=_u;function _o(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new E,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new de,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a!==void 0?a:0}Object.assign(_o.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Ep=0;function Oe(){Object.defineProperty(this,"id",{value:Ep++}),this.uuid=ke.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=Hi,this.side=Gi,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Xc,this.blendDst=jc,this.blendEquation=Ur,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Bs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=fp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zs,this.stencilZFail=Zs,this.stencilZPass=Zs,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Oe.prototype=Object.assign(Object.create(sn.prototype),{constructor:Oe,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var 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===zc;continue}var r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});var 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&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),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.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),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.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Hi&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==Gi&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,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.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.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function r(o){var s=[];for(var c in o){var l=o[c];delete l.metadata,s.push(l)}return s}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,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;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Oe.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});function hn(e){Oe.call(this),this.type="MeshBasicMaterial",this.color=new de(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=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}hn.prototype=Object.create(Oe.prototype),hn.prototype.constructor=hn,hn.prototype.isMeshBasicMaterial=!0,hn.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var rt=new E;function De(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=ho,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(De.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(De.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(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:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new de),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new X),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new E),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new et),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)rt.x=this.getX(t),rt.y=this.getY(t),rt.z=this.getZ(t),rt.applyMatrix3(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)rt.x=this.getX(t),rt.y=this.getY(t),rt.z=this.getZ(t),rt.applyMatrix4(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)rt.x=this.getX(t),rt.y=this.getY(t),rt.z=this.getZ(t),rt.applyNormalMatrix(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)rt.x=this.getX(t),rt.y=this.getY(t),rt.z=this.getZ(t),rt.transformDirection(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});function hl(e,t,n){De.call(this,new Int8Array(e),t,n)}hl.prototype=Object.create(De.prototype),hl.prototype.constructor=hl;function fl(e,t,n){De.call(this,new Uint8Array(e),t,n)}fl.prototype=Object.create(De.prototype),fl.prototype.constructor=fl;function dl(e,t,n){De.call(this,new Uint8ClampedArray(e),t,n)}dl.prototype=Object.create(De.prototype),dl.prototype.constructor=dl;function pl(e,t,n){De.call(this,new Int16Array(e),t,n)}pl.prototype=Object.create(De.prototype),pl.prototype.constructor=pl;function $i(e,t,n){De.call(this,new Uint16Array(e),t,n)}$i.prototype=Object.create(De.prototype),$i.prototype.constructor=$i;function vl(e,t,n){De.call(this,new Int32Array(e),t,n)}vl.prototype=Object.create(De.prototype),vl.prototype.constructor=vl;function ea(e,t,n){De.call(this,new Uint32Array(e),t,n)}ea.prototype=Object.create(De.prototype),ea.prototype.constructor=ea;function ce(e,t,n){De.call(this,new Float32Array(e),t,n)}ce.prototype=Object.create(De.prototype),ce.prototype.constructor=ce;function ml(e,t,n){De.call(this,new Float64Array(e),t,n)}ml.prototype=Object.create(De.prototype),ml.prototype.constructor=ml;function bu(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Object.assign(bu.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(var l=0;l<h;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var d=e.skinIndices,m=e.skinWeights,g=d.length===n.length,y=m.length===n.length;n.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var l=0;l<t.length;l++){var p=t[l];this.vertices.push(n[p.a],n[p.b],n[p.c]);var v=p.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var _=p.normal;this.normals.push(_,_,_)}var x=p.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var b=p.color;this.colors.push(b,b,b)}if(i===!0){var T=r[0][l];T!==void 0?this.uvs.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new X,new X,new X))}if(a===!0){var T=r[1][l];T!==void 0?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new X,new X,new X))}for(var C=0;C<s;C++){var N=o[C].vertices;c[C].data.push(N[p.a],N[p.b],N[p.c])}for(var C=0;C<h;C++){var O=u[C].vertexNormals[l];f[C].data.push(O.a,O.b,O.c)}g&&this.skinIndices.push(d[p.a],d[p.b],d[p.c]),y&&this.skinWeights.push(m[p.a],m[p.b],m[p.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}});function wu(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}var Tp=1,xn=new We,gl=new ae,$r=new E,qt=new gn,ta=new gn,wt=new E;function ve(){Object.defineProperty(this,"id",{value:Tp+=2}),this.uuid=ke.generateUUID(),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={}}ve.prototype=Object.assign(Object.create(sn.prototype),{constructor:ve,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(wu(e)>65535?ea:$i)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n!==void 0?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new Ut().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var 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},rotateX:function(e){return xn.makeRotationX(e),this.applyMatrix4(xn),this},rotateY:function(e){return xn.makeRotationY(e),this.applyMatrix4(xn),this},rotateZ:function(e){return xn.makeRotationZ(e),this.applyMatrix4(xn),this},translate:function(e,t,n){return xn.makeTranslation(e,t,n),this.applyMatrix4(xn),this},scale:function(e,t,n){return xn.makeScale(e,t,n),this.applyMatrix4(xn),this},lookAt:function(e){return gl.lookAt(e),gl.updateMatrix(),this.applyMatrix4(gl.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($r).negate(),this.translate($r.x,$r.y,$r.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new ce(t.vertices.length*3,3),r=new ce(t.colors.length*3,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new ce(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new ce(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new bu().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute("position",new De(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute("normal",new De(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute("color",new De(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute("uv",new De(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute("uv2",new De(a,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var o in e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],f=new ce(h.data.length*3,3);f.name=h.name,s.push(f.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new ce(e.skinIndices.length*4,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new ce(e.skinWeights.length*4,4);this.setAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new gn);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];qt.setFromBufferAttribute(i),this.morphTargetsRelative?(wt.addVectors(this.boundingBox.min,qt.min),this.boundingBox.expandByPoint(wt),wt.addVectors(this.boundingBox.max,qt.max),this.boundingBox.expandByPoint(wt)):(this.boundingBox.expandByPoint(qt.min),this.boundingBox.expandByPoint(qt.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:function(){this.boundingSphere===null&&(this.boundingSphere=new Dn);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(qt.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];ta.setFromBufferAttribute(a),this.morphTargetsRelative?(wt.addVectors(qt.min,ta.min),qt.expandByPoint(wt),wt.addVectors(qt.max,ta.max),qt.expandByPoint(wt)):(qt.expandByPoint(ta.min),qt.expandByPoint(ta.max))}qt.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)wt.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(wt));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)wt.fromBufferAttribute(a,c),s&&($r.fromBufferAttribute(e,c),wt.add($r)),o=Math.max(o,n.distanceToSquared(wt));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute("normal",new De(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new E,h=new E,f=new E,d=new E,m=new E;if(e)for(var g=e.array,i=0,a=e.count;i<a;i+=3)s=g[i+0]*3,c=g[i+1]*3,l=g[i+2]*3,u.fromArray(n,s),h.fromArray(n,c),f.fromArray(n,l),d.subVectors(f,h),m.subVectors(u,h),d.cross(m),o[s]+=d.x,o[s+1]+=d.y,o[s+2]+=d.z,o[c]+=d.x,o[c+1]+=d.y,o[c+2]+=d.z,o[l]+=d.x,o[l+1]+=d.y,o[l+2]+=d.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),f.fromArray(n,i+6),d.subVectors(f,h),m.subVectors(u,h),d.cross(m),o[i]=d.x,o[i+1]=d.y,o[i+2]=d.z,o[i+3]=d.x,o[i+4]=d.y,o[i+5]=d.z,o[i+6]=d.x,o[i+7]=d.y,o[i+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(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."));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r],a=i.array,o=e.attributes[r],s=o.array,c=o.itemSize*t,l=Math.min(s.length,a.length-c),u=0,h=c;u<l;u++,h++)a[h]=s[u];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)wt.x=e.getX(t),wt.y=e.getY(t),wt.z=e.getZ(t),wt.normalize(),e.setXYZ(t,wt.x,wt.y,wt.z)},toNonIndexed:function(){function e(g,y){for(var p=g.array,v=g.itemSize,_=g.normalized,x=new p.constructor(y.length*v),b=0,T=0,C=0,N=y.length;C<N;C++){b=y[C]*v;for(var O=0;O<v;O++)x[T++]=p[b++]}return new De(x,v,_)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new ve,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,h=l.length;u<h;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,d=f.length;u<d;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var 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){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==""&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],h=0,f=l.length;h<f;h++){var a=l[h],o=a.toJSON();a.name!==""&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new ve().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Mu=new We,Mr=new Jr,yl=new Dn,nr=new E,rr=new E,ir=new E,xl=new E,_l=new E,bl=new E,bo=new E,wo=new E,Mo=new E,ei=new X,ti=new X,ni=new X,na=new E,Eo=new E;function ut(e,t){ae.call(this),this.type="Mesh",this.geometry=e!==void 0?e:new ve,this.material=t!==void 0?t:new hn,this.updateMorphTargets()}ut.prototype=Object.assign(Object.create(ae.prototype),{constructor:ut,isMesh:!0,copy:function(e){return ae.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),yl.copy(n.boundingSphere),yl.applyMatrix4(i),e.ray.intersectsSphere(yl)!==!1&&(Mu.getInverse(i),Mr.copy(e.ray).applyMatrix4(Mu),!(n.boundingBox!==null&&Mr.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,h=n.morphAttributes.position,f=n.morphTargetsRelative,d=n.attributes.uv,m=n.attributes.uv2,g=n.groups,y=n.drawRange,p,v,_,x,b,T,C,N;if(l!==null)if(Array.isArray(r))for(p=0,_=g.length;p<_;p++)for(b=g[p],T=r[b.materialIndex],C=Math.max(b.start,y.start),N=Math.min(b.start+b.count,y.start+y.count),v=C,x=N;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=To(this,T,e,Mr,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=b.materialIndex,t.push(a));else for(C=Math.max(0,y.start),N=Math.min(l.count,y.start+y.count),p=C,_=N;p<_;p+=3)o=l.getX(p),s=l.getX(p+1),c=l.getX(p+2),a=To(this,r,e,Mr,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(p/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(p=0,_=g.length;p<_;p++)for(b=g[p],T=r[b.materialIndex],C=Math.max(b.start,y.start),N=Math.min(b.start+b.count,y.start+y.count),v=C,x=N;v<x;v+=3)o=v,s=v+1,c=v+2,a=To(this,T,e,Mr,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=b.materialIndex,t.push(a));else for(C=Math.max(0,y.start),N=Math.min(u.count,y.start+y.count),p=C,_=N;p<_;p+=3)o=p,s=p+1,c=p+2,a=To(this,r,e,Mr,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(p/3),t.push(a))}else if(n.isGeometry){var O,J,F,B=Array.isArray(r),V=n.vertices,Y=n.faces,D,z=n.faceVertexUvs[0];z.length>0&&(D=z);for(var k=0,q=Y.length;k<q;k++){var Z=Y[k],ee=B?r[Z.materialIndex]:r;if(ee!==void 0&&(O=V[Z.a],J=V[Z.b],F=V[Z.c],a=Eu(this,ee,e,Mr,O,J,F,na),a)){if(D&&D[k]){var te=D[k];ei.copy(te[0]),ti.copy(te[1]),ni.copy(te[2]),a.uv=Ot.getUV(na,O,J,F,ei,ti,ni,new X)}a.face=Z,a.faceIndex=k,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function Eu(e,t,n,r,i,a,o,s){var c;if(t.side===At?c=r.intersectTriangle(o,a,i,!0,s):c=r.intersectTriangle(i,a,o,t.side!==$a,s),c===null)return null;Eo.copy(s),Eo.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(Eo);return l<n.near||l>n.far?null:{distance:l,point:Eo.clone(),object:e}}function To(e,t,n,r,i,a,o,s,c,l,u,h){nr.fromBufferAttribute(i,l),rr.fromBufferAttribute(i,u),ir.fromBufferAttribute(i,h);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){bo.set(0,0,0),wo.set(0,0,0),Mo.set(0,0,0);for(var d=0,m=a.length;d<m;d++){var g=f[d],y=a[d];g!==0&&(xl.fromBufferAttribute(y,l),_l.fromBufferAttribute(y,u),bl.fromBufferAttribute(y,h),o?(bo.addScaledVector(xl,g),wo.addScaledVector(_l,g),Mo.addScaledVector(bl,g)):(bo.addScaledVector(xl.sub(nr),g),wo.addScaledVector(_l.sub(rr),g),Mo.addScaledVector(bl.sub(ir),g)))}nr.add(bo),rr.add(wo),ir.add(Mo)}e.isSkinnedMesh&&(e.boneTransform(l,nr),e.boneTransform(u,rr),e.boneTransform(h,ir));var p=Eu(e,t,n,r,nr,rr,ir,na);if(p){s&&(ei.fromBufferAttribute(s,l),ti.fromBufferAttribute(s,u),ni.fromBufferAttribute(s,h),p.uv=Ot.getUV(na,nr,rr,ir,ei,ti,ni,new X)),c&&(ei.fromBufferAttribute(c,l),ti.fromBufferAttribute(c,u),ni.fromBufferAttribute(c,h),p.uv2=Ot.getUV(na,nr,rr,ir,ei,ti,ni,new X));var v=new _o(l,u,h);Ot.getNormal(nr,rr,ir,v.normal),p.face=v}return p}var Sp=0,_n=new We,wl=new ae,So=new E;function Ne(){Object.defineProperty(this,"id",{value:Sp+=2}),this.uuid=ke.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Ne.prototype=Object.assign(Object.create(sn.prototype),{constructor:Ne,isGeometry:!0,applyMatrix4:function(e){for(var t=new Ut().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){var i=this.vertices[n];i.applyMatrix4(e)}for(var n=0,r=this.faces.length;n<r;n++){var a=this.faces[n];a.normal.applyMatrix3(t).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return _n.makeRotationX(e),this.applyMatrix4(_n),this},rotateY:function(e){return _n.makeRotationY(e),this.applyMatrix4(_n),this},rotateZ:function(e){return _n.makeRotationZ(e),this.applyMatrix4(_n),this},translate:function(e,t,n){return _n.makeTranslation(e,t,n),this.applyMatrix4(_n),this},scale:function(e,t,n){return _n.makeScale(e,t,n),this.applyMatrix4(_n),this},lookAt:function(e){return wl.lookAt(e),wl.updateMatrix(),this.applyMatrix4(wl.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index!==null?e.index.array:void 0,r=e.attributes;if(r.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=r.position.array,a=r.normal!==void 0?r.normal.array:void 0,o=r.color!==void 0?r.color.array:void 0,s=r.uv!==void 0?r.uv.array:void 0,c=r.uv2!==void 0?r.uv2.array:void 0;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new E().fromArray(i,l)),o!==void 0&&t.colors.push(new de().fromArray(o,l));function u(p,v,_,x){var b=o===void 0?[]:[t.colors[p].clone(),t.colors[v].clone(),t.colors[_].clone()],T=a===void 0?[]:[new E().fromArray(a,p*3),new E().fromArray(a,v*3),new E().fromArray(a,_*3)],C=new _o(p,v,_,T,b,x);t.faces.push(C),s!==void 0&&t.faceVertexUvs[0].push([new X().fromArray(s,p*2),new X().fromArray(s,v*2),new X().fromArray(s,_*2)]),c!==void 0&&t.faceVertexUvs[1].push([new X().fromArray(c,p*2),new X().fromArray(c,v*2),new X().fromArray(c,_*2)])}var h=e.groups;if(h.length>0)for(var l=0;l<h.length;l++)for(var f=h[l],d=f.start,m=f.count,g=d,y=d+m;g<y;g+=3)n!==void 0?u(n[g],n[g+1],n[g+2],f.materialIndex):u(g,g+1,g+2,f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(So).negate(),this.translate(So.x,So.y,So.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new We;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new E,t=new E,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o;for(o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new E;if(e){var s,c,l,u=new E,h=new E;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new Ne;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,l,u;for(n=0,r=this.faces.length;n<r;n++)l=new E,u={a:new E,b:new E,c:new E},o.push(l),s.push(u)}var c=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var l,u;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],l=c.faceNormals[n],u=c.vertexNormals[n],l.copy(i.normal),u.a.copy(i.vertexNormals[0]),u.b.copy(i.vertexNormals[1]),u.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new gn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new Ut().getNormalMatrix(t));for(var h=0,f=o.length;h<f;h++){var d=o[h],m=d.clone();t!==void 0&&m.applyMatrix4(t),a.push(m)}for(var h=0,f=u.length;h<f;h++)l.push(u[h].clone());for(h=0,f=c.length;h<f;h++){var g=c[h],y,p,v,_=g.vertexNormals,x=g.vertexColors;y=new _o(g.a+i,g.b+i,g.c+i),y.normal.copy(g.normal),r!==void 0&&y.normal.applyMatrix3(r).normalize();for(var b=0,T=_.length;b<T;b++)p=_[b].clone(),r!==void 0&&p.applyMatrix3(r).normalize(),y.vertexNormals.push(p);y.color.copy(g.color);for(var b=0,T=x.length;b<T;b++)v=x[b],y.vertexColors.push(v.clone());y.materialIndex=g.materialIndex+n,s.push(y)}for(var h=0,f=e.faceVertexUvs.length;h<f;h++){var C=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(var b=0,T=C.length;b<T;b++){for(var N=C[b],O=[],J=0,F=N.length;J<F;J++)O.push(N[J].clone());this.faceVertexUvs[h].push(O)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=4,o=Math.pow(10,a),s,c,l,u,h,f;for(s=0,c=this.vertices.length;s<c;s++)r=this.vertices[s],i=Math.round(r.x*o)+"_"+Math.round(r.y*o)+"_"+Math.round(r.z*o),e[i]===void 0?(e[i]=s,t.push(this.vertices[s]),n[s]=t.length-1):n[s]=n[e[i]];var d=[];for(s=0,c=this.faces.length;s<c;s++){l=this.faces[s],l.a=n[l.a],l.b=n[l.b],l.c=n[l.c],u=[l.a,l.b,l.c];for(var m=0;m<3;m++)if(u[m]===u[(m+1)%3]){d.push(s);break}}for(s=d.length-1;s>=0;s--){var g=d[s];for(this.faces.splice(g,1),h=0,f=this.faceVertexUvs.length;h<f;h++)this.faceVertexUvs[h].splice(g,1)}var y=this.vertices.length-t.length;return this.vertices=t,y},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new E(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(l,u){return l.materialIndex-u.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},h=[],f={},i=0;i<this.faces.length;i++){var d=this.faces[i],m=!0,g=!1,y=this.faceVertexUvs[0][i]!==void 0,p=d.normal.length()>0,v=d.vertexNormals.length>0,_=d.color.r!==1||d.color.g!==1||d.color.b!==1,x=d.vertexColors.length>0,b=0;if(b=O(b,0,0),b=O(b,1,m),b=O(b,2,g),b=O(b,3,y),b=O(b,4,p),b=O(b,5,v),b=O(b,6,_),b=O(b,7,x),o.push(b),o.push(d.a,d.b,d.c),o.push(d.materialIndex),y){var T=this.faceVertexUvs[0][i];o.push(B(T[0]),B(T[1]),B(T[2]))}if(p&&o.push(J(d.normal)),v){var C=d.vertexNormals;o.push(J(C[0]),J(C[1]),J(C[2]))}if(_&&o.push(F(d.color)),x){var N=d.vertexColors;o.push(F(N[0]),F(N[1]),F(N[2]))}}function O(V,Y,D){return D?V|1<<Y:V&~(1<<Y)}function J(V){var Y=V.x.toString()+V.y.toString()+V.z.toString();return c[Y]!==void 0||(c[Y]=s.length/3,s.push(V.x,V.y,V.z)),c[Y]}function F(V){var Y=V.r.toString()+V.g.toString()+V.b.toString();return u[Y]!==void 0||(u[Y]=l.length,l.push(V.getHex())),u[Y]}function B(V){var Y=V.x.toString()+V.y.toString();return f[Y]!==void 0||(f[Y]=h.length/2,h.push(V.x,V.y)),f[Y]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return new Ne().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],f=[];for(a=0,o=h.length;a<o;a++){var d=h[a];f.push(d.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var g={};if(g.name=m[t].name,m[t].vertices!==void 0)for(g.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)g.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(g.normals=[],r=0,i=m[t].normals.length;r<i;r++)g.normals.push(m[t].normals[r].clone());this.morphTargets.push(g)}var y=e.morphNormals;for(t=0,n=y.length;t<n;t++){var p={};if(y[t].vertexNormals!==void 0)for(p.vertexNormals=[],r=0,i=y[t].vertexNormals.length;r<i;r++){var v=y[t].vertexNormals[r],_={};_.a=v.a.clone(),_.b=v.b.clone(),_.c=v.c.clone(),p.vertexNormals.push(_)}if(y[t].faceNormals!==void 0)for(p.faceNormals=[],r=0,i=y[t].faceNormals.length;r<i;r++)p.faceNormals.push(y[t].faceNormals[r].clone());this.morphNormals.push(p)}var x=e.skinWeights;for(t=0,n=x.length;t<n;t++)this.skinWeights.push(x[t].clone());var b=e.skinIndices;for(t=0,n=b.length;t<n;t++)this.skinIndices.push(b[t].clone());var T=e.lineDistances;for(t=0,n=T.length;t<n;t++)this.lineDistances.push(T[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var N=e.boundingSphere;return N!==null&&(this.boundingSphere=N.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Ap extends Ne{constructor(t,n,r,i,a,o){super(),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:o},this.fromBufferGeometry(new Ao(t,n,r,i,a,o)),this.mergeVertices()}}class Ao extends ve{constructor(t,n,r,i,a,o){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:o};const s=this;t=t||1,n=n||1,r=r||1,i=Math.floor(i)||1,a=Math.floor(a)||1,o=Math.floor(o)||1;const c=[],l=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,r,n,t,o,a,0),m("z","y","x",1,-1,r,n,-t,o,a,1),m("x","z","y",1,1,t,r,n,i,o,2),m("x","z","y",1,-1,t,r,-n,i,o,3),m("x","y","z",1,-1,t,n,r,i,a,4),m("x","y","z",-1,-1,t,n,-r,i,a,5),this.setIndex(c),this.setAttribute("position",new ce(l,3)),this.setAttribute("normal",new ce(u,3)),this.setAttribute("uv",new ce(h,2));function m(g,y,p,v,_,x,b,T,C,N,O){const J=x/C,F=b/N,B=x/2,V=b/2,Y=T/2,D=C+1,z=N+1;let k=0,q=0;const Z=new E;for(let ee=0;ee<z;ee++){const te=ee*F-V;for(let oe=0;oe<D;oe++){const Pe=oe*J-B;Z[g]=Pe*v,Z[y]=te*_,Z[p]=Y,l.push(Z.x,Z.y,Z.z),Z[g]=0,Z[y]=0,Z[p]=T>0?1:-1,u.push(Z.x,Z.y,Z.z),h.push(oe/C),h.push(1-ee/N),k+=1}}for(let ee=0;ee<N;ee++)for(let te=0;te<C;te++){const oe=f+te+D*ee,Pe=f+te+D*(ee+1),be=f+(te+1)+D*(ee+1),re=f+(te+1)+D*ee;c.push(oe,Pe,re),c.push(Pe,be,re),q+=6}s.addGroup(d,q,O),d+=q,f+=k}}}function ri(e){var t={};for(var n in e){t[n]={};for(var r in e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function Nt(e){for(var t={},n=0;n<e.length;n++){var r=ri(e[n]);for(var i in r)t[i]=r[i]}return t}var Lp={clone:ri,merge:Nt},Pp=`void main() {
|
|
357
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
358
|
-
}`,Cp=`void main() {
|
|
359
|
-
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
360
|
-
}`;function Wt(e){Oe.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Pp,this.fragmentShader=Cp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!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,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}Wt.prototype=Object.create(Oe.prototype),Wt.prototype.constructor=Wt,Wt.prototype.isShaderMaterial=!0,Wt.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ri(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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},Wt.prototype.toJSON=function(e){var t=Oe.prototype.toJSON.call(this,e);t.uniforms={};for(var n in this.uniforms){var r=this.uniforms[n],i=r.value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)this.extensions[o]===!0&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t};function Bn(){ae.call(this),this.type="Camera",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We}Bn.prototype=Object.assign(Object.create(ae.prototype),{constructor:Bn,isCamera:!0,copy:function(e,t){return ae.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ae.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){ae.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}});function Et(e,t,n,r){Bn.call(this),this.type="PerspectiveCamera",this.fov=e!==void 0?e:50,this.zoom=1,this.near=n!==void 0?n:.1,this.far=r!==void 0?r:2e3,this.focus=10,this.aspect=t!==void 0?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Et.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Et,isPerspectiveCamera:!0,copy:function(e,t){return Bn.prototype.copy.call(this,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:function(e){var t=.5*this.getFilmHeight()/e;this.fov=ke.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(ke.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return ke.RAD2DEG*2*Math.atan(Math.tan(ke.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){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=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(ke.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ae.prototype.toJSON.call(this,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}});var ii=90,ai=1;function ra(e,t,n){if(ae.call(this),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;var r=new Et(ii,ai,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(1,0,0)),this.add(r);var i=new Et(ii,ai,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new E(-1,0,0)),this.add(i);var a=new Et(ii,ai,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new E(0,1,0)),this.add(a);var o=new Et(ii,ai,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new E(0,-1,0)),this.add(o);var s=new Et(ii,ai,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new E(0,0,1)),this.add(s);var c=new Et(ii,ai,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c),this.update=function(l,u){this.parent===null&&this.updateMatrixWorld();var h=l.xr.enabled,f=l.getRenderTarget();l.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,l.setRenderTarget(n,0),l.render(u,r),l.setRenderTarget(n,1),l.render(u,i),l.setRenderTarget(n,2),l.render(u,a),l.setRenderTarget(n,3),l.render(u,o),l.setRenderTarget(n,4),l.render(u,s),n.texture.generateMipmaps=d,l.setRenderTarget(n,5),l.render(u,c),l.setRenderTarget(f),l.xr.enabled=h},this.clear=function(l,u,h,f){for(var d=l.getRenderTarget(),m=0;m<6;m++)l.setRenderTarget(n,m),l.clear(u,h,f);l.setRenderTarget(d)}}ra.prototype=Object.create(ae.prototype),ra.prototype.constructor=ra;function ia(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),$t.call(this,e,e,t)}ia.prototype=Object.create($t.prototype),ia.prototype.constructor=ia,ia.prototype.isWebGLCubeRenderTarget=!0,ia.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Ji,r={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {"," return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {"," vWorldDirection = transformDirection( position, modelMatrix );"," #include <begin_vertex>"," #include <project_vertex>","}"].join(`
|
|
361
|
-
`),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {"," vec3 direction = normalize( vWorldDirection );"," vec2 sampleUV = equirectUv( direction );"," gl_FragColor = texture2D( tEquirect, sampleUV );","}"].join(`
|
|
362
|
-
`)},i=new Wt({type:"CubemapFromEquirect",uniforms:ri(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:At,blending:Jn});i.uniforms.tEquirect.value=t;var a=new ut(new Ao(5,5,5),i);n.add(a);var o=new ra(1,10,this);return o.update(e,n),a.geometry.dispose(),a.material.dispose(),this};function oi(e,t,n,r,i,a,o,s,c,l,u,h){ot.call(this,null,a,o,s,c,l,r,i,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c!==void 0?c:_t,this.minFilter=l!==void 0?l:_t,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}oi.prototype=Object.create(ot.prototype),oi.prototype.constructor=oi,oi.prototype.isDataTexture=!0;var si=new Dn,Lo=new E;function aa(e,t,n,r,i,a){this.planes=[e!==void 0?e:new yn,t!==void 0?t:new yn,n!==void 0?n:new yn,r!==void 0?r:new yn,i!==void 0?i:new yn,a!==void 0?a:new yn]}Object.assign(aa.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],f=n[9],d=n[10],m=n[11],g=n[12],y=n[13],p=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-h,v-g).normalize(),t[1].setComponents(o+r,u+s,m+h,v+g).normalize(),t[2].setComponents(o+i,u+c,m+f,v+y).normalize(),t[3].setComponents(o-i,u-c,m-f,v-y).normalize(),t[4].setComponents(o-a,u-l,m-d,v-p).normalize(),t[5].setComponents(o+a,u+l,m+d,v+p).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),si.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(si)},intersectsSprite:function(e){return si.center.set(0,0,0),si.radius=.7071067811865476,si.applyMatrix4(e.matrixWorld),this.intersectsSphere(si)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){var a=t[i].distanceToPoint(n);if(a<r)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(Lo.x=r.normal.x>0?e.max.x:e.min.x,Lo.y=r.normal.y>0?e.max.y:e.min.y,Lo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Lo)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var le={common:{diffuse:{value:new de(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ut},uv2Transform:{value:new Ut},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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 X(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 de(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new de(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ut}},sprite:{diffuse:{value:new de(15658734)},opacity:{value:1},center:{value:new X(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ut}}};function Tu(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(i){n=i},setContext:function(i){e=i}}}function Rp(e,t){var n=t.isWebGL2,r=new WeakMap;function i(l,u){var h=l.array,f=l.usage,d=e.createBuffer();e.bindBuffer(u,d),e.bufferData(u,h,f),l.onUploadCallback();var m=5126;return h instanceof Float32Array?m=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?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&&(m=5121),{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function a(l,u,h){var f=u.array,d=u.updateRange;e.bindBuffer(h,l),d.count===-1?e.bufferSubData(h,0,f):(n?e.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):e.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),r.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);var u=r.get(l);u&&(e.deleteBuffer(u.buffer),r.delete(l))}function c(l,u){l.isInterleavedBufferAttribute&&(l=l.data);var h=r.get(l);h===void 0?r.set(l,i(l,u)):h.version<l.version&&(a(h.buffer,l,u),h.version=l.version)}return{get:o,remove:s,update:c}}function Po(e,t,n,r){Ne.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new li(e,t,n,r)),this.mergeVertices()}Po.prototype=Object.create(Ne.prototype),Po.prototype.constructor=Po;function li(e,t,n,r){ve.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,h=t/s,f,d,m=[],g=[],y=[],p=[];for(d=0;d<l;d++){var v=d*h-a;for(f=0;f<c;f++){var _=f*u-i;g.push(_,-v,0),y.push(0,0,1),p.push(f/o),p.push(1-d/s)}}for(d=0;d<s;d++)for(f=0;f<o;f++){var x=f+c*d,b=f+c*(d+1),T=f+1+c*(d+1),C=f+1+c*d;m.push(x,b,C),m.push(b,T,C)}this.setIndex(m),this.setAttribute("position",new ce(g,3)),this.setAttribute("normal",new ce(y,3)),this.setAttribute("uv",new ce(p,2))}li.prototype=Object.create(ve.prototype),li.prototype.constructor=li;var Op=`#ifdef USE_ALPHAMAP
|
|
363
|
-
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
364
|
-
#endif`,Dp=`#ifdef USE_ALPHAMAP
|
|
365
|
-
uniform sampler2D alphaMap;
|
|
366
|
-
#endif`,Ip=`#ifdef ALPHATEST
|
|
367
|
-
if ( diffuseColor.a < ALPHATEST ) discard;
|
|
368
|
-
#endif`,Np=`#ifdef USE_AOMAP
|
|
369
|
-
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
370
|
-
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
371
|
-
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
372
|
-
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
373
|
-
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
|
|
374
|
-
#endif
|
|
375
|
-
#endif`,Fp=`#ifdef USE_AOMAP
|
|
376
|
-
uniform sampler2D aoMap;
|
|
377
|
-
uniform float aoMapIntensity;
|
|
378
|
-
#endif`,Bp="vec3 transformed = vec3( position );",Up=`vec3 objectNormal = vec3( normal );
|
|
379
|
-
#ifdef USE_TANGENT
|
|
380
|
-
vec3 objectTangent = vec3( tangent.xyz );
|
|
381
|
-
#endif`,zp=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
|
|
382
|
-
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
|
383
|
-
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
|
384
|
-
vec4 r = roughness * c0 + c1;
|
|
385
|
-
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
|
386
|
-
return vec2( -1.04, 1.04 ) * a004 + r.zw;
|
|
387
|
-
}
|
|
388
|
-
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
389
|
-
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
|
390
|
-
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
391
|
-
if( cutoffDistance > 0.0 ) {
|
|
392
|
-
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
393
|
-
}
|
|
394
|
-
return distanceFalloff;
|
|
395
|
-
#else
|
|
396
|
-
if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
|
397
|
-
return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
|
398
|
-
}
|
|
399
|
-
return 1.0;
|
|
400
|
-
#endif
|
|
401
|
-
}
|
|
402
|
-
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
|
|
403
|
-
return RECIPROCAL_PI * diffuseColor;
|
|
404
|
-
}
|
|
405
|
-
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
|
|
406
|
-
float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
|
|
407
|
-
return ( 1.0 - specularColor ) * fresnel + specularColor;
|
|
408
|
-
}
|
|
409
|
-
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
|
|
410
|
-
float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
|
|
411
|
-
vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
|
|
412
|
-
return Fr * fresnel + F0;
|
|
413
|
-
}
|
|
414
|
-
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
415
|
-
float a2 = pow2( alpha );
|
|
416
|
-
float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
417
|
-
float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
418
|
-
return 1.0 / ( gl * gv );
|
|
419
|
-
}
|
|
420
|
-
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
421
|
-
float a2 = pow2( alpha );
|
|
422
|
-
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
423
|
-
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
424
|
-
return 0.5 / max( gv + gl, EPSILON );
|
|
425
|
-
}
|
|
426
|
-
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
427
|
-
float a2 = pow2( alpha );
|
|
428
|
-
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
429
|
-
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
430
|
-
}
|
|
431
|
-
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
|
|
432
|
-
float alpha = pow2( roughness );
|
|
433
|
-
vec3 halfDir = normalize( incidentLight.direction + viewDir );
|
|
434
|
-
float dotNL = saturate( dot( normal, incidentLight.direction ) );
|
|
435
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
436
|
-
float dotNH = saturate( dot( normal, halfDir ) );
|
|
437
|
-
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
|
|
438
|
-
vec3 F = F_Schlick( specularColor, dotLH );
|
|
439
|
-
float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
440
|
-
float D = D_GGX( alpha, dotNH );
|
|
441
|
-
return F * ( G * D );
|
|
442
|
-
}
|
|
443
|
-
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
444
|
-
const float LUT_SIZE = 64.0;
|
|
445
|
-
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
446
|
-
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
447
|
-
float dotNV = saturate( dot( N, V ) );
|
|
448
|
-
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
449
|
-
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
450
|
-
return uv;
|
|
451
|
-
}
|
|
452
|
-
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
453
|
-
float l = length( f );
|
|
454
|
-
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
455
|
-
}
|
|
456
|
-
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
457
|
-
float x = dot( v1, v2 );
|
|
458
|
-
float y = abs( x );
|
|
459
|
-
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
460
|
-
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
461
|
-
float v = a / b;
|
|
462
|
-
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
463
|
-
return cross( v1, v2 ) * theta_sintheta;
|
|
464
|
-
}
|
|
465
|
-
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
466
|
-
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
467
|
-
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
468
|
-
vec3 lightNormal = cross( v1, v2 );
|
|
469
|
-
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
470
|
-
vec3 T1, T2;
|
|
471
|
-
T1 = normalize( V - N * dot( V, N ) );
|
|
472
|
-
T2 = - cross( N, T1 );
|
|
473
|
-
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
|
474
|
-
vec3 coords[ 4 ];
|
|
475
|
-
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
476
|
-
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
477
|
-
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
478
|
-
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
479
|
-
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
480
|
-
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
481
|
-
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
482
|
-
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
483
|
-
vec3 vectorFormFactor = vec3( 0.0 );
|
|
484
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
485
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
486
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
487
|
-
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
488
|
-
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
489
|
-
return vec3( result );
|
|
490
|
-
}
|
|
491
|
-
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
|
|
492
|
-
float dotNV = saturate( dot( normal, viewDir ) );
|
|
493
|
-
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
494
|
-
return specularColor * brdf.x + brdf.y;
|
|
495
|
-
}
|
|
496
|
-
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
497
|
-
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
498
|
-
vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
|
|
499
|
-
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
500
|
-
vec3 FssEss = F * brdf.x + brdf.y;
|
|
501
|
-
float Ess = brdf.x + brdf.y;
|
|
502
|
-
float Ems = 1.0 - Ess;
|
|
503
|
-
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
504
|
-
singleScatter += FssEss;
|
|
505
|
-
multiScatter += Fms * Ems;
|
|
506
|
-
}
|
|
507
|
-
float G_BlinnPhong_Implicit( ) {
|
|
508
|
-
return 0.25;
|
|
509
|
-
}
|
|
510
|
-
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
511
|
-
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
512
|
-
}
|
|
513
|
-
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
|
|
514
|
-
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
|
|
515
|
-
float dotNH = saturate( dot( geometry.normal, halfDir ) );
|
|
516
|
-
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
|
|
517
|
-
vec3 F = F_Schlick( specularColor, dotLH );
|
|
518
|
-
float G = G_BlinnPhong_Implicit( );
|
|
519
|
-
float D = D_BlinnPhong( shininess, dotNH );
|
|
520
|
-
return F * ( G * D );
|
|
521
|
-
}
|
|
522
|
-
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
|
|
523
|
-
return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
|
|
524
|
-
}
|
|
525
|
-
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
|
|
526
|
-
return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
|
|
527
|
-
}
|
|
528
|
-
#if defined( USE_SHEEN )
|
|
529
|
-
float D_Charlie(float roughness, float NoH) {
|
|
530
|
-
float invAlpha = 1.0 / roughness;
|
|
531
|
-
float cos2h = NoH * NoH;
|
|
532
|
-
float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
|
|
533
|
-
}
|
|
534
|
-
float V_Neubelt(float NoV, float NoL) {
|
|
535
|
-
return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
|
|
536
|
-
}
|
|
537
|
-
vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
|
|
538
|
-
vec3 N = geometry.normal;
|
|
539
|
-
vec3 V = geometry.viewDir;
|
|
540
|
-
vec3 H = normalize( V + L );
|
|
541
|
-
float dotNH = saturate( dot( N, H ) );
|
|
542
|
-
return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
|
|
543
|
-
}
|
|
544
|
-
#endif`,Gp=`#ifdef USE_BUMPMAP
|
|
545
|
-
uniform sampler2D bumpMap;
|
|
546
|
-
uniform float bumpScale;
|
|
547
|
-
vec2 dHdxy_fwd() {
|
|
548
|
-
vec2 dSTdx = dFdx( vUv );
|
|
549
|
-
vec2 dSTdy = dFdy( vUv );
|
|
550
|
-
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
|
551
|
-
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
|
552
|
-
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
|
553
|
-
return vec2( dBx, dBy );
|
|
554
|
-
}
|
|
555
|
-
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
|
|
556
|
-
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
|
557
|
-
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
|
558
|
-
vec3 vN = surf_norm;
|
|
559
|
-
vec3 R1 = cross( vSigmaY, vN );
|
|
560
|
-
vec3 R2 = cross( vN, vSigmaX );
|
|
561
|
-
float fDet = dot( vSigmaX, R1 );
|
|
562
|
-
fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
563
|
-
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
564
|
-
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
565
|
-
}
|
|
566
|
-
#endif`,Hp=`#if NUM_CLIPPING_PLANES > 0
|
|
567
|
-
vec4 plane;
|
|
568
|
-
#pragma unroll_loop_start
|
|
569
|
-
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
570
|
-
plane = clippingPlanes[ i ];
|
|
571
|
-
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
572
|
-
}
|
|
573
|
-
#pragma unroll_loop_end
|
|
574
|
-
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
575
|
-
bool clipped = true;
|
|
576
|
-
#pragma unroll_loop_start
|
|
577
|
-
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
578
|
-
plane = clippingPlanes[ i ];
|
|
579
|
-
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
580
|
-
}
|
|
581
|
-
#pragma unroll_loop_end
|
|
582
|
-
if ( clipped ) discard;
|
|
583
|
-
#endif
|
|
584
|
-
#endif`,Vp=`#if NUM_CLIPPING_PLANES > 0
|
|
585
|
-
varying vec3 vClipPosition;
|
|
586
|
-
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
587
|
-
#endif`,kp=`#if NUM_CLIPPING_PLANES > 0
|
|
588
|
-
varying vec3 vClipPosition;
|
|
589
|
-
#endif`,Wp=`#if NUM_CLIPPING_PLANES > 0
|
|
590
|
-
vClipPosition = - mvPosition.xyz;
|
|
591
|
-
#endif`,Xp=`#ifdef USE_COLOR
|
|
592
|
-
diffuseColor.rgb *= vColor;
|
|
593
|
-
#endif`,jp=`#ifdef USE_COLOR
|
|
594
|
-
varying vec3 vColor;
|
|
595
|
-
#endif`,qp=`#ifdef USE_COLOR
|
|
596
|
-
varying vec3 vColor;
|
|
597
|
-
#endif`,Yp=`#ifdef USE_COLOR
|
|
598
|
-
vColor.xyz = color.xyz;
|
|
599
|
-
#endif`,Zp=`#define PI 3.14159265359
|
|
600
|
-
#define PI2 6.28318530718
|
|
601
|
-
#define PI_HALF 1.5707963267949
|
|
602
|
-
#define RECIPROCAL_PI 0.31830988618
|
|
603
|
-
#define RECIPROCAL_PI2 0.15915494
|
|
604
|
-
#define LOG2 1.442695
|
|
605
|
-
#define EPSILON 1e-6
|
|
606
|
-
#ifndef saturate
|
|
607
|
-
#define saturate(a) clamp( a, 0.0, 1.0 )
|
|
608
|
-
#endif
|
|
609
|
-
#define whiteComplement(a) ( 1.0 - saturate( a ) )
|
|
610
|
-
float pow2( const in float x ) { return x*x; }
|
|
611
|
-
float pow3( const in float x ) { return x*x*x; }
|
|
612
|
-
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
613
|
-
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
|
614
|
-
highp float rand( const in vec2 uv ) {
|
|
615
|
-
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
616
|
-
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
617
|
-
return fract(sin(sn) * c);
|
|
618
|
-
}
|
|
619
|
-
#ifdef HIGH_PRECISION
|
|
620
|
-
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
621
|
-
#else
|
|
622
|
-
float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
623
|
-
float precisionSafeLength( vec3 v ) {
|
|
624
|
-
float maxComponent = max3( abs( v ) );
|
|
625
|
-
return length( v / maxComponent ) * maxComponent;
|
|
626
|
-
}
|
|
627
|
-
#endif
|
|
628
|
-
struct IncidentLight {
|
|
629
|
-
vec3 color;
|
|
630
|
-
vec3 direction;
|
|
631
|
-
bool visible;
|
|
632
|
-
};
|
|
633
|
-
struct ReflectedLight {
|
|
634
|
-
vec3 directDiffuse;
|
|
635
|
-
vec3 directSpecular;
|
|
636
|
-
vec3 indirectDiffuse;
|
|
637
|
-
vec3 indirectSpecular;
|
|
638
|
-
};
|
|
639
|
-
struct GeometricContext {
|
|
640
|
-
vec3 position;
|
|
641
|
-
vec3 normal;
|
|
642
|
-
vec3 viewDir;
|
|
643
|
-
#ifdef CLEARCOAT
|
|
644
|
-
vec3 clearcoatNormal;
|
|
645
|
-
#endif
|
|
646
|
-
};
|
|
647
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
648
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
649
|
-
}
|
|
650
|
-
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
|
651
|
-
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
|
652
|
-
}
|
|
653
|
-
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
654
|
-
float distance = dot( planeNormal, point - pointOnPlane );
|
|
655
|
-
return - distance * planeNormal + point;
|
|
656
|
-
}
|
|
657
|
-
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
658
|
-
return sign( dot( point - pointOnPlane, planeNormal ) );
|
|
659
|
-
}
|
|
660
|
-
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
|
|
661
|
-
return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
|
|
662
|
-
}
|
|
663
|
-
mat3 transposeMat3( const in mat3 m ) {
|
|
664
|
-
mat3 tmp;
|
|
665
|
-
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
|
666
|
-
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
|
667
|
-
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
|
668
|
-
return tmp;
|
|
669
|
-
}
|
|
670
|
-
float linearToRelativeLuminance( const in vec3 color ) {
|
|
671
|
-
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
|
672
|
-
return dot( weights, color.rgb );
|
|
673
|
-
}
|
|
674
|
-
bool isPerspectiveMatrix( mat4 m ) {
|
|
675
|
-
return m[ 2 ][ 3 ] == - 1.0;
|
|
676
|
-
}
|
|
677
|
-
vec2 equirectUv( in vec3 dir ) {
|
|
678
|
-
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
679
|
-
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
680
|
-
return vec2( u, v );
|
|
681
|
-
}`,Jp=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
682
|
-
#define cubeUV_maxMipLevel 8.0
|
|
683
|
-
#define cubeUV_minMipLevel 4.0
|
|
684
|
-
#define cubeUV_maxTileSize 256.0
|
|
685
|
-
#define cubeUV_minTileSize 16.0
|
|
686
|
-
float getFace(vec3 direction) {
|
|
687
|
-
vec3 absDirection = abs(direction);
|
|
688
|
-
float face = -1.0;
|
|
689
|
-
if (absDirection.x > absDirection.z) {
|
|
690
|
-
if (absDirection.x > absDirection.y)
|
|
691
|
-
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
692
|
-
else
|
|
693
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
694
|
-
} else {
|
|
695
|
-
if (absDirection.z > absDirection.y)
|
|
696
|
-
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
697
|
-
else
|
|
698
|
-
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
699
|
-
}
|
|
700
|
-
return face;
|
|
701
|
-
}
|
|
702
|
-
vec2 getUV(vec3 direction, float face) {
|
|
703
|
-
vec2 uv;
|
|
704
|
-
if (face == 0.0) {
|
|
705
|
-
uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {
|
|
706
|
-
uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {
|
|
707
|
-
uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {
|
|
708
|
-
uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {
|
|
709
|
-
uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {
|
|
710
|
-
uv = vec2(direction.x, direction.y) / abs(direction.z); }
|
|
711
|
-
return 0.5 * (uv + 1.0);
|
|
712
|
-
}
|
|
713
|
-
vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
|
|
714
|
-
float face = getFace(direction);
|
|
715
|
-
float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
|
|
716
|
-
mipInt = max(mipInt, cubeUV_minMipLevel);
|
|
717
|
-
float faceSize = exp2(mipInt);
|
|
718
|
-
float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
|
|
719
|
-
vec2 uv = getUV(direction, face) * (faceSize - 1.0);
|
|
720
|
-
vec2 f = fract(uv);
|
|
721
|
-
uv += 0.5 - f;
|
|
722
|
-
if (face > 2.0) {
|
|
723
|
-
uv.y += faceSize;
|
|
724
|
-
face -= 3.0;
|
|
725
|
-
}
|
|
726
|
-
uv.x += face * faceSize;
|
|
727
|
-
if(mipInt < cubeUV_maxMipLevel){
|
|
728
|
-
uv.y += 2.0 * cubeUV_maxTileSize;
|
|
729
|
-
}
|
|
730
|
-
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
|
|
731
|
-
uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
|
|
732
|
-
uv *= texelSize;
|
|
733
|
-
vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
734
|
-
uv.x += texelSize;
|
|
735
|
-
vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
736
|
-
uv.y += texelSize;
|
|
737
|
-
vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
738
|
-
uv.x -= texelSize;
|
|
739
|
-
vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
740
|
-
vec3 tm = mix(tl, tr, f.x);
|
|
741
|
-
vec3 bm = mix(bl, br, f.x);
|
|
742
|
-
return mix(tm, bm, f.y);
|
|
743
|
-
}
|
|
744
|
-
#define r0 1.0
|
|
745
|
-
#define v0 0.339
|
|
746
|
-
#define m0 -2.0
|
|
747
|
-
#define r1 0.8
|
|
748
|
-
#define v1 0.276
|
|
749
|
-
#define m1 -1.0
|
|
750
|
-
#define r4 0.4
|
|
751
|
-
#define v4 0.046
|
|
752
|
-
#define m4 2.0
|
|
753
|
-
#define r5 0.305
|
|
754
|
-
#define v5 0.016
|
|
755
|
-
#define m5 3.0
|
|
756
|
-
#define r6 0.21
|
|
757
|
-
#define v6 0.0038
|
|
758
|
-
#define m6 4.0
|
|
759
|
-
float roughnessToMip(float roughness) {
|
|
760
|
-
float mip = 0.0;
|
|
761
|
-
if (roughness >= r1) {
|
|
762
|
-
mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
|
|
763
|
-
} else if (roughness >= r4) {
|
|
764
|
-
mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
|
|
765
|
-
} else if (roughness >= r5) {
|
|
766
|
-
mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
|
|
767
|
-
} else if (roughness >= r6) {
|
|
768
|
-
mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
|
|
769
|
-
} else {
|
|
770
|
-
mip = -2.0 * log2(1.16 * roughness); }
|
|
771
|
-
return mip;
|
|
772
|
-
}
|
|
773
|
-
vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {
|
|
774
|
-
float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);
|
|
775
|
-
float mipF = fract(mip);
|
|
776
|
-
float mipInt = floor(mip);
|
|
777
|
-
vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);
|
|
778
|
-
if (mipF == 0.0) {
|
|
779
|
-
return vec4(color0, 1.0);
|
|
780
|
-
} else {
|
|
781
|
-
vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);
|
|
782
|
-
return vec4(mix(color0, color1, mipF), 1.0);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
#endif`,Qp=`vec3 transformedNormal = objectNormal;
|
|
786
|
-
#ifdef USE_INSTANCING
|
|
787
|
-
mat3 m = mat3( instanceMatrix );
|
|
788
|
-
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
789
|
-
transformedNormal = m * transformedNormal;
|
|
790
|
-
#endif
|
|
791
|
-
transformedNormal = normalMatrix * transformedNormal;
|
|
792
|
-
#ifdef FLIP_SIDED
|
|
793
|
-
transformedNormal = - transformedNormal;
|
|
794
|
-
#endif
|
|
795
|
-
#ifdef USE_TANGENT
|
|
796
|
-
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
797
|
-
#ifdef FLIP_SIDED
|
|
798
|
-
transformedTangent = - transformedTangent;
|
|
799
|
-
#endif
|
|
800
|
-
#endif`,Kp=`#ifdef USE_DISPLACEMENTMAP
|
|
801
|
-
uniform sampler2D displacementMap;
|
|
802
|
-
uniform float displacementScale;
|
|
803
|
-
uniform float displacementBias;
|
|
804
|
-
#endif`,$p=`#ifdef USE_DISPLACEMENTMAP
|
|
805
|
-
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
|
806
|
-
#endif`,ev=`#ifdef USE_EMISSIVEMAP
|
|
807
|
-
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
|
808
|
-
emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
|
|
809
|
-
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
810
|
-
#endif`,tv=`#ifdef USE_EMISSIVEMAP
|
|
811
|
-
uniform sampler2D emissiveMap;
|
|
812
|
-
#endif`,nv="gl_FragColor = linearToOutputTexel( gl_FragColor );",rv=`
|
|
813
|
-
vec4 LinearToLinear( in vec4 value ) {
|
|
814
|
-
return value;
|
|
815
|
-
}
|
|
816
|
-
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
|
|
817
|
-
return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
|
|
818
|
-
}
|
|
819
|
-
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
|
|
820
|
-
return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
|
|
821
|
-
}
|
|
822
|
-
vec4 sRGBToLinear( in vec4 value ) {
|
|
823
|
-
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 );
|
|
824
|
-
}
|
|
825
|
-
vec4 LinearTosRGB( in vec4 value ) {
|
|
826
|
-
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 );
|
|
827
|
-
}
|
|
828
|
-
vec4 RGBEToLinear( in vec4 value ) {
|
|
829
|
-
return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
|
|
830
|
-
}
|
|
831
|
-
vec4 LinearToRGBE( in vec4 value ) {
|
|
832
|
-
float maxComponent = max( max( value.r, value.g ), value.b );
|
|
833
|
-
float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
|
|
834
|
-
return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
|
|
835
|
-
}
|
|
836
|
-
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
|
|
837
|
-
return vec4( value.rgb * value.a * maxRange, 1.0 );
|
|
838
|
-
}
|
|
839
|
-
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
|
|
840
|
-
float maxRGB = max( value.r, max( value.g, value.b ) );
|
|
841
|
-
float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
|
|
842
|
-
M = ceil( M * 255.0 ) / 255.0;
|
|
843
|
-
return vec4( value.rgb / ( M * maxRange ), M );
|
|
844
|
-
}
|
|
845
|
-
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
|
|
846
|
-
return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
|
|
847
|
-
}
|
|
848
|
-
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
|
|
849
|
-
float maxRGB = max( value.r, max( value.g, value.b ) );
|
|
850
|
-
float D = max( maxRange / maxRGB, 1.0 );
|
|
851
|
-
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
|
|
852
|
-
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
|
|
853
|
-
}
|
|
854
|
-
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
|
|
855
|
-
vec4 LinearToLogLuv( in vec4 value ) {
|
|
856
|
-
vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
|
|
857
|
-
Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
|
|
858
|
-
vec4 vResult;
|
|
859
|
-
vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
|
|
860
|
-
float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
|
|
861
|
-
vResult.w = fract( Le );
|
|
862
|
-
vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
|
|
863
|
-
return vResult;
|
|
864
|
-
}
|
|
865
|
-
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
|
|
866
|
-
vec4 LogLuvToLinear( in vec4 value ) {
|
|
867
|
-
float Le = value.z * 255.0 + value.w;
|
|
868
|
-
vec3 Xp_Y_XYZp;
|
|
869
|
-
Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
|
|
870
|
-
Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
|
|
871
|
-
Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
|
|
872
|
-
vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
|
|
873
|
-
return vec4( max( vRGB, 0.0 ), 1.0 );
|
|
874
|
-
}`,iv=`#ifdef USE_ENVMAP
|
|
875
|
-
#ifdef ENV_WORLDPOS
|
|
876
|
-
vec3 cameraToFrag;
|
|
877
|
-
|
|
878
|
-
if ( isOrthographic ) {
|
|
879
|
-
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
880
|
-
} else {
|
|
881
|
-
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
882
|
-
}
|
|
883
|
-
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
884
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
885
|
-
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
886
|
-
#else
|
|
887
|
-
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
888
|
-
#endif
|
|
889
|
-
#else
|
|
890
|
-
vec3 reflectVec = vReflect;
|
|
891
|
-
#endif
|
|
892
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
893
|
-
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
|
894
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
895
|
-
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
|
896
|
-
#elif defined( ENVMAP_TYPE_EQUIREC )
|
|
897
|
-
reflectVec = normalize( reflectVec );
|
|
898
|
-
vec2 sampleUV = equirectUv( reflectVec );
|
|
899
|
-
vec4 envColor = texture2D( envMap, sampleUV );
|
|
900
|
-
#elif defined( ENVMAP_TYPE_SPHERE )
|
|
901
|
-
reflectVec = normalize( reflectVec );
|
|
902
|
-
vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
|
|
903
|
-
vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
|
|
904
|
-
#else
|
|
905
|
-
vec4 envColor = vec4( 0.0 );
|
|
906
|
-
#endif
|
|
907
|
-
#ifndef ENVMAP_TYPE_CUBE_UV
|
|
908
|
-
envColor = envMapTexelToLinear( envColor );
|
|
909
|
-
#endif
|
|
910
|
-
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
911
|
-
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
912
|
-
#elif defined( ENVMAP_BLENDING_MIX )
|
|
913
|
-
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
914
|
-
#elif defined( ENVMAP_BLENDING_ADD )
|
|
915
|
-
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
916
|
-
#endif
|
|
917
|
-
#endif`,av=`#ifdef USE_ENVMAP
|
|
918
|
-
uniform float envMapIntensity;
|
|
919
|
-
uniform float flipEnvMap;
|
|
920
|
-
uniform int maxMipLevel;
|
|
921
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
922
|
-
uniform samplerCube envMap;
|
|
923
|
-
#else
|
|
924
|
-
uniform sampler2D envMap;
|
|
925
|
-
#endif
|
|
926
|
-
|
|
927
|
-
#endif`,ov=`#ifdef USE_ENVMAP
|
|
928
|
-
uniform float reflectivity;
|
|
929
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
|
930
|
-
#define ENV_WORLDPOS
|
|
931
|
-
#endif
|
|
932
|
-
#ifdef ENV_WORLDPOS
|
|
933
|
-
varying vec3 vWorldPosition;
|
|
934
|
-
uniform float refractionRatio;
|
|
935
|
-
#else
|
|
936
|
-
varying vec3 vReflect;
|
|
937
|
-
#endif
|
|
938
|
-
#endif`,sv=`#ifdef USE_ENVMAP
|
|
939
|
-
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
|
940
|
-
#define ENV_WORLDPOS
|
|
941
|
-
#endif
|
|
942
|
-
#ifdef ENV_WORLDPOS
|
|
943
|
-
|
|
944
|
-
varying vec3 vWorldPosition;
|
|
945
|
-
#else
|
|
946
|
-
varying vec3 vReflect;
|
|
947
|
-
uniform float refractionRatio;
|
|
948
|
-
#endif
|
|
949
|
-
#endif`,lv=`#ifdef USE_ENVMAP
|
|
950
|
-
#ifdef ENV_WORLDPOS
|
|
951
|
-
vWorldPosition = worldPosition.xyz;
|
|
952
|
-
#else
|
|
953
|
-
vec3 cameraToVertex;
|
|
954
|
-
if ( isOrthographic ) {
|
|
955
|
-
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
956
|
-
} else {
|
|
957
|
-
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
958
|
-
}
|
|
959
|
-
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
960
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
961
|
-
vReflect = reflect( cameraToVertex, worldNormal );
|
|
962
|
-
#else
|
|
963
|
-
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
964
|
-
#endif
|
|
965
|
-
#endif
|
|
966
|
-
#endif`,cv=`#ifdef USE_FOG
|
|
967
|
-
fogDepth = -mvPosition.z;
|
|
968
|
-
#endif`,uv=`#ifdef USE_FOG
|
|
969
|
-
varying float fogDepth;
|
|
970
|
-
#endif`,hv=`#ifdef USE_FOG
|
|
971
|
-
#ifdef FOG_EXP2
|
|
972
|
-
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
|
|
973
|
-
#else
|
|
974
|
-
float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
|
|
975
|
-
#endif
|
|
976
|
-
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
977
|
-
#endif`,fv=`#ifdef USE_FOG
|
|
978
|
-
uniform vec3 fogColor;
|
|
979
|
-
varying float fogDepth;
|
|
980
|
-
#ifdef FOG_EXP2
|
|
981
|
-
uniform float fogDensity;
|
|
982
|
-
#else
|
|
983
|
-
uniform float fogNear;
|
|
984
|
-
uniform float fogFar;
|
|
985
|
-
#endif
|
|
986
|
-
#endif`,dv=`#ifdef USE_GRADIENTMAP
|
|
987
|
-
uniform sampler2D gradientMap;
|
|
988
|
-
#endif
|
|
989
|
-
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
990
|
-
float dotNL = dot( normal, lightDirection );
|
|
991
|
-
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
992
|
-
#ifdef USE_GRADIENTMAP
|
|
993
|
-
return texture2D( gradientMap, coord ).rgb;
|
|
994
|
-
#else
|
|
995
|
-
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
|
996
|
-
#endif
|
|
997
|
-
}`,pv=`#ifdef USE_LIGHTMAP
|
|
998
|
-
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
999
|
-
reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
1000
|
-
#endif`,vv=`#ifdef USE_LIGHTMAP
|
|
1001
|
-
uniform sampler2D lightMap;
|
|
1002
|
-
uniform float lightMapIntensity;
|
|
1003
|
-
#endif`,mv=`vec3 diffuse = vec3( 1.0 );
|
|
1004
|
-
GeometricContext geometry;
|
|
1005
|
-
geometry.position = mvPosition.xyz;
|
|
1006
|
-
geometry.normal = normalize( transformedNormal );
|
|
1007
|
-
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
|
1008
|
-
GeometricContext backGeometry;
|
|
1009
|
-
backGeometry.position = geometry.position;
|
|
1010
|
-
backGeometry.normal = -geometry.normal;
|
|
1011
|
-
backGeometry.viewDir = geometry.viewDir;
|
|
1012
|
-
vLightFront = vec3( 0.0 );
|
|
1013
|
-
vIndirectFront = vec3( 0.0 );
|
|
1014
|
-
#ifdef DOUBLE_SIDED
|
|
1015
|
-
vLightBack = vec3( 0.0 );
|
|
1016
|
-
vIndirectBack = vec3( 0.0 );
|
|
1017
|
-
#endif
|
|
1018
|
-
IncidentLight directLight;
|
|
1019
|
-
float dotNL;
|
|
1020
|
-
vec3 directLightColor_Diffuse;
|
|
1021
|
-
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
|
1022
|
-
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
|
|
1023
|
-
#ifdef DOUBLE_SIDED
|
|
1024
|
-
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
|
1025
|
-
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
|
|
1026
|
-
#endif
|
|
1027
|
-
#if NUM_POINT_LIGHTS > 0
|
|
1028
|
-
#pragma unroll_loop_start
|
|
1029
|
-
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1030
|
-
getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
|
|
1031
|
-
dotNL = dot( geometry.normal, directLight.direction );
|
|
1032
|
-
directLightColor_Diffuse = PI * directLight.color;
|
|
1033
|
-
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
1034
|
-
#ifdef DOUBLE_SIDED
|
|
1035
|
-
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
1036
|
-
#endif
|
|
1037
|
-
}
|
|
1038
|
-
#pragma unroll_loop_end
|
|
1039
|
-
#endif
|
|
1040
|
-
#if NUM_SPOT_LIGHTS > 0
|
|
1041
|
-
#pragma unroll_loop_start
|
|
1042
|
-
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1043
|
-
getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
|
|
1044
|
-
dotNL = dot( geometry.normal, directLight.direction );
|
|
1045
|
-
directLightColor_Diffuse = PI * directLight.color;
|
|
1046
|
-
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
1047
|
-
#ifdef DOUBLE_SIDED
|
|
1048
|
-
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
1049
|
-
#endif
|
|
1050
|
-
}
|
|
1051
|
-
#pragma unroll_loop_end
|
|
1052
|
-
#endif
|
|
1053
|
-
#if NUM_DIR_LIGHTS > 0
|
|
1054
|
-
#pragma unroll_loop_start
|
|
1055
|
-
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1056
|
-
getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
|
|
1057
|
-
dotNL = dot( geometry.normal, directLight.direction );
|
|
1058
|
-
directLightColor_Diffuse = PI * directLight.color;
|
|
1059
|
-
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
|
1060
|
-
#ifdef DOUBLE_SIDED
|
|
1061
|
-
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
|
|
1062
|
-
#endif
|
|
1063
|
-
}
|
|
1064
|
-
#pragma unroll_loop_end
|
|
1065
|
-
#endif
|
|
1066
|
-
#if NUM_HEMI_LIGHTS > 0
|
|
1067
|
-
#pragma unroll_loop_start
|
|
1068
|
-
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1069
|
-
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
1070
|
-
#ifdef DOUBLE_SIDED
|
|
1071
|
-
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
|
|
1072
|
-
#endif
|
|
1073
|
-
}
|
|
1074
|
-
#pragma unroll_loop_end
|
|
1075
|
-
#endif`,gv=`uniform bool receiveShadow;
|
|
1076
|
-
uniform vec3 ambientLightColor;
|
|
1077
|
-
uniform vec3 lightProbe[ 9 ];
|
|
1078
|
-
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
1079
|
-
float x = normal.x, y = normal.y, z = normal.z;
|
|
1080
|
-
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
1081
|
-
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
1082
|
-
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
1083
|
-
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
1084
|
-
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
1085
|
-
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
1086
|
-
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
1087
|
-
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
1088
|
-
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
1089
|
-
return result;
|
|
1090
|
-
}
|
|
1091
|
-
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
|
|
1092
|
-
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
|
|
1093
|
-
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
1094
|
-
return irradiance;
|
|
1095
|
-
}
|
|
1096
|
-
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
1097
|
-
vec3 irradiance = ambientLightColor;
|
|
1098
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1099
|
-
irradiance *= PI;
|
|
1100
|
-
#endif
|
|
1101
|
-
return irradiance;
|
|
1102
|
-
}
|
|
1103
|
-
#if NUM_DIR_LIGHTS > 0
|
|
1104
|
-
struct DirectionalLight {
|
|
1105
|
-
vec3 direction;
|
|
1106
|
-
vec3 color;
|
|
1107
|
-
};
|
|
1108
|
-
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
1109
|
-
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1110
|
-
struct DirectionalLightShadow {
|
|
1111
|
-
float shadowBias;
|
|
1112
|
-
float shadowRadius;
|
|
1113
|
-
vec2 shadowMapSize;
|
|
1114
|
-
};
|
|
1115
|
-
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1116
|
-
#endif
|
|
1117
|
-
void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
1118
|
-
directLight.color = directionalLight.color;
|
|
1119
|
-
directLight.direction = directionalLight.direction;
|
|
1120
|
-
directLight.visible = true;
|
|
1121
|
-
}
|
|
1122
|
-
#endif
|
|
1123
|
-
#if NUM_POINT_LIGHTS > 0
|
|
1124
|
-
struct PointLight {
|
|
1125
|
-
vec3 position;
|
|
1126
|
-
vec3 color;
|
|
1127
|
-
float distance;
|
|
1128
|
-
float decay;
|
|
1129
|
-
};
|
|
1130
|
-
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
1131
|
-
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1132
|
-
struct PointLightShadow {
|
|
1133
|
-
float shadowBias;
|
|
1134
|
-
float shadowRadius;
|
|
1135
|
-
vec2 shadowMapSize;
|
|
1136
|
-
float shadowCameraNear;
|
|
1137
|
-
float shadowCameraFar;
|
|
1138
|
-
};
|
|
1139
|
-
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1140
|
-
#endif
|
|
1141
|
-
void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
1142
|
-
vec3 lVector = pointLight.position - geometry.position;
|
|
1143
|
-
directLight.direction = normalize( lVector );
|
|
1144
|
-
float lightDistance = length( lVector );
|
|
1145
|
-
directLight.color = pointLight.color;
|
|
1146
|
-
directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
|
|
1147
|
-
directLight.visible = ( directLight.color != vec3( 0.0 ) );
|
|
1148
|
-
}
|
|
1149
|
-
#endif
|
|
1150
|
-
#if NUM_SPOT_LIGHTS > 0
|
|
1151
|
-
struct SpotLight {
|
|
1152
|
-
vec3 position;
|
|
1153
|
-
vec3 direction;
|
|
1154
|
-
vec3 color;
|
|
1155
|
-
float distance;
|
|
1156
|
-
float decay;
|
|
1157
|
-
float coneCos;
|
|
1158
|
-
float penumbraCos;
|
|
1159
|
-
};
|
|
1160
|
-
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
1161
|
-
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1162
|
-
struct SpotLightShadow {
|
|
1163
|
-
float shadowBias;
|
|
1164
|
-
float shadowRadius;
|
|
1165
|
-
vec2 shadowMapSize;
|
|
1166
|
-
};
|
|
1167
|
-
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1168
|
-
#endif
|
|
1169
|
-
void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
|
|
1170
|
-
vec3 lVector = spotLight.position - geometry.position;
|
|
1171
|
-
directLight.direction = normalize( lVector );
|
|
1172
|
-
float lightDistance = length( lVector );
|
|
1173
|
-
float angleCos = dot( directLight.direction, spotLight.direction );
|
|
1174
|
-
if ( angleCos > spotLight.coneCos ) {
|
|
1175
|
-
float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
1176
|
-
directLight.color = spotLight.color;
|
|
1177
|
-
directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
|
|
1178
|
-
directLight.visible = true;
|
|
1179
|
-
} else {
|
|
1180
|
-
directLight.color = vec3( 0.0 );
|
|
1181
|
-
directLight.visible = false;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
#endif
|
|
1185
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1186
|
-
struct RectAreaLight {
|
|
1187
|
-
vec3 color;
|
|
1188
|
-
vec3 position;
|
|
1189
|
-
vec3 halfWidth;
|
|
1190
|
-
vec3 halfHeight;
|
|
1191
|
-
};
|
|
1192
|
-
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
1193
|
-
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
1194
|
-
#endif
|
|
1195
|
-
#if NUM_HEMI_LIGHTS > 0
|
|
1196
|
-
struct HemisphereLight {
|
|
1197
|
-
vec3 direction;
|
|
1198
|
-
vec3 skyColor;
|
|
1199
|
-
vec3 groundColor;
|
|
1200
|
-
};
|
|
1201
|
-
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
1202
|
-
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
|
|
1203
|
-
float dotNL = dot( geometry.normal, hemiLight.direction );
|
|
1204
|
-
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
1205
|
-
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
1206
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1207
|
-
irradiance *= PI;
|
|
1208
|
-
#endif
|
|
1209
|
-
return irradiance;
|
|
1210
|
-
}
|
|
1211
|
-
#endif`,yv=`#if defined( USE_ENVMAP )
|
|
1212
|
-
#ifdef ENVMAP_MODE_REFRACTION
|
|
1213
|
-
uniform float refractionRatio;
|
|
1214
|
-
#endif
|
|
1215
|
-
vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
|
|
1216
|
-
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
|
|
1217
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
1218
|
-
vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
|
|
1219
|
-
#ifdef TEXTURE_LOD_EXT
|
|
1220
|
-
vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
|
|
1221
|
-
#else
|
|
1222
|
-
vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
|
|
1223
|
-
#endif
|
|
1224
|
-
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
1225
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
1226
|
-
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
|
1227
|
-
#else
|
|
1228
|
-
vec4 envMapColor = vec4( 0.0 );
|
|
1229
|
-
#endif
|
|
1230
|
-
return PI * envMapColor.rgb * envMapIntensity;
|
|
1231
|
-
}
|
|
1232
|
-
float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
|
|
1233
|
-
float maxMIPLevelScalar = float( maxMIPLevel );
|
|
1234
|
-
float sigma = PI * roughness * roughness / ( 1.0 + roughness );
|
|
1235
|
-
float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
|
|
1236
|
-
return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
|
|
1237
|
-
}
|
|
1238
|
-
vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
|
|
1239
|
-
#ifdef ENVMAP_MODE_REFLECTION
|
|
1240
|
-
vec3 reflectVec = reflect( -viewDir, normal );
|
|
1241
|
-
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
|
1242
|
-
#else
|
|
1243
|
-
vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
|
|
1244
|
-
#endif
|
|
1245
|
-
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
1246
|
-
float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
|
|
1247
|
-
#ifdef ENVMAP_TYPE_CUBE
|
|
1248
|
-
vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
|
|
1249
|
-
#ifdef TEXTURE_LOD_EXT
|
|
1250
|
-
vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
|
|
1251
|
-
#else
|
|
1252
|
-
vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
|
|
1253
|
-
#endif
|
|
1254
|
-
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
1255
|
-
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
1256
|
-
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
|
1257
|
-
#elif defined( ENVMAP_TYPE_EQUIREC )
|
|
1258
|
-
vec2 sampleUV = equirectUv( reflectVec );
|
|
1259
|
-
#ifdef TEXTURE_LOD_EXT
|
|
1260
|
-
vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
|
|
1261
|
-
#else
|
|
1262
|
-
vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
|
|
1263
|
-
#endif
|
|
1264
|
-
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
1265
|
-
#elif defined( ENVMAP_TYPE_SPHERE )
|
|
1266
|
-
vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
|
|
1267
|
-
#ifdef TEXTURE_LOD_EXT
|
|
1268
|
-
vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
|
|
1269
|
-
#else
|
|
1270
|
-
vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
|
|
1271
|
-
#endif
|
|
1272
|
-
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
|
|
1273
|
-
#endif
|
|
1274
|
-
return envMapColor.rgb * envMapIntensity;
|
|
1275
|
-
}
|
|
1276
|
-
#endif`,xv=`ToonMaterial material;
|
|
1277
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
1278
|
-
material.specularColor = specular;
|
|
1279
|
-
material.specularShininess = shininess;
|
|
1280
|
-
material.specularStrength = specularStrength;`,_v=`varying vec3 vViewPosition;
|
|
1281
|
-
#ifndef FLAT_SHADED
|
|
1282
|
-
varying vec3 vNormal;
|
|
1283
|
-
#endif
|
|
1284
|
-
struct ToonMaterial {
|
|
1285
|
-
vec3 diffuseColor;
|
|
1286
|
-
vec3 specularColor;
|
|
1287
|
-
float specularShininess;
|
|
1288
|
-
float specularStrength;
|
|
1289
|
-
};
|
|
1290
|
-
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1291
|
-
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
|
1292
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1293
|
-
irradiance *= PI;
|
|
1294
|
-
#endif
|
|
1295
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1296
|
-
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
1297
|
-
}
|
|
1298
|
-
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1299
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1300
|
-
}
|
|
1301
|
-
#define RE_Direct RE_Direct_Toon
|
|
1302
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
1303
|
-
#define Material_LightProbeLOD( material ) (0)`,bv=`BlinnPhongMaterial material;
|
|
1304
|
-
material.diffuseColor = diffuseColor.rgb;
|
|
1305
|
-
material.specularColor = specular;
|
|
1306
|
-
material.specularShininess = shininess;
|
|
1307
|
-
material.specularStrength = specularStrength;`,wv=`varying vec3 vViewPosition;
|
|
1308
|
-
#ifndef FLAT_SHADED
|
|
1309
|
-
varying vec3 vNormal;
|
|
1310
|
-
#endif
|
|
1311
|
-
struct BlinnPhongMaterial {
|
|
1312
|
-
vec3 diffuseColor;
|
|
1313
|
-
vec3 specularColor;
|
|
1314
|
-
float specularShininess;
|
|
1315
|
-
float specularStrength;
|
|
1316
|
-
};
|
|
1317
|
-
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1318
|
-
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
1319
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
1320
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1321
|
-
irradiance *= PI;
|
|
1322
|
-
#endif
|
|
1323
|
-
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1324
|
-
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
1325
|
-
}
|
|
1326
|
-
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1327
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1328
|
-
}
|
|
1329
|
-
#define RE_Direct RE_Direct_BlinnPhong
|
|
1330
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
|
1331
|
-
#define Material_LightProbeLOD( material ) (0)`,Mv=`PhysicalMaterial material;
|
|
1332
|
-
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
1333
|
-
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
|
1334
|
-
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
1335
|
-
material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
|
|
1336
|
-
material.specularRoughness = min( material.specularRoughness, 1.0 );
|
|
1337
|
-
#ifdef REFLECTIVITY
|
|
1338
|
-
material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
|
|
1339
|
-
#else
|
|
1340
|
-
material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
|
|
1341
|
-
#endif
|
|
1342
|
-
#ifdef CLEARCOAT
|
|
1343
|
-
material.clearcoat = clearcoat;
|
|
1344
|
-
material.clearcoatRoughness = clearcoatRoughness;
|
|
1345
|
-
#ifdef USE_CLEARCOATMAP
|
|
1346
|
-
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
|
1347
|
-
#endif
|
|
1348
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1349
|
-
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
|
1350
|
-
#endif
|
|
1351
|
-
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
1352
|
-
material.clearcoatRoughness += geometryRoughness;
|
|
1353
|
-
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
1354
|
-
#endif
|
|
1355
|
-
#ifdef USE_SHEEN
|
|
1356
|
-
material.sheenColor = sheen;
|
|
1357
|
-
#endif`,Ev=`struct PhysicalMaterial {
|
|
1358
|
-
vec3 diffuseColor;
|
|
1359
|
-
float specularRoughness;
|
|
1360
|
-
vec3 specularColor;
|
|
1361
|
-
#ifdef CLEARCOAT
|
|
1362
|
-
float clearcoat;
|
|
1363
|
-
float clearcoatRoughness;
|
|
1364
|
-
#endif
|
|
1365
|
-
#ifdef USE_SHEEN
|
|
1366
|
-
vec3 sheenColor;
|
|
1367
|
-
#endif
|
|
1368
|
-
};
|
|
1369
|
-
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
|
|
1370
|
-
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
|
|
1371
|
-
float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
|
|
1372
|
-
return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
|
|
1373
|
-
}
|
|
1374
|
-
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1375
|
-
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1376
|
-
vec3 normal = geometry.normal;
|
|
1377
|
-
vec3 viewDir = geometry.viewDir;
|
|
1378
|
-
vec3 position = geometry.position;
|
|
1379
|
-
vec3 lightPos = rectAreaLight.position;
|
|
1380
|
-
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
1381
|
-
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
1382
|
-
vec3 lightColor = rectAreaLight.color;
|
|
1383
|
-
float roughness = material.specularRoughness;
|
|
1384
|
-
vec3 rectCoords[ 4 ];
|
|
1385
|
-
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
1386
|
-
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
1387
|
-
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
1388
|
-
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
1389
|
-
vec4 t1 = texture2D( ltc_1, uv );
|
|
1390
|
-
vec4 t2 = texture2D( ltc_2, uv );
|
|
1391
|
-
mat3 mInv = mat3(
|
|
1392
|
-
vec3( t1.x, 0, t1.y ),
|
|
1393
|
-
vec3( 0, 1, 0 ),
|
|
1394
|
-
vec3( t1.z, 0, t1.w )
|
|
1395
|
-
);
|
|
1396
|
-
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
|
1397
|
-
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
1398
|
-
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
1399
|
-
}
|
|
1400
|
-
#endif
|
|
1401
|
-
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1402
|
-
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
|
1403
|
-
vec3 irradiance = dotNL * directLight.color;
|
|
1404
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1405
|
-
irradiance *= PI;
|
|
1406
|
-
#endif
|
|
1407
|
-
#ifdef CLEARCOAT
|
|
1408
|
-
float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
|
1409
|
-
vec3 ccIrradiance = ccDotNL * directLight.color;
|
|
1410
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1411
|
-
ccIrradiance *= PI;
|
|
1412
|
-
#endif
|
|
1413
|
-
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
|
|
1414
|
-
reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
|
|
1415
|
-
#else
|
|
1416
|
-
float clearcoatDHR = 0.0;
|
|
1417
|
-
#endif
|
|
1418
|
-
#ifdef USE_SHEEN
|
|
1419
|
-
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
|
|
1420
|
-
material.specularRoughness,
|
|
1421
|
-
directLight.direction,
|
|
1422
|
-
geometry,
|
|
1423
|
-
material.sheenColor
|
|
1424
|
-
);
|
|
1425
|
-
#else
|
|
1426
|
-
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
|
|
1427
|
-
#endif
|
|
1428
|
-
reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1429
|
-
}
|
|
1430
|
-
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1431
|
-
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
|
|
1432
|
-
}
|
|
1433
|
-
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) {
|
|
1434
|
-
#ifdef CLEARCOAT
|
|
1435
|
-
float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
|
1436
|
-
reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
|
|
1437
|
-
float ccDotNL = ccDotNV;
|
|
1438
|
-
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
|
|
1439
|
-
#else
|
|
1440
|
-
float clearcoatDHR = 0.0;
|
|
1441
|
-
#endif
|
|
1442
|
-
float clearcoatInv = 1.0 - clearcoatDHR;
|
|
1443
|
-
vec3 singleScattering = vec3( 0.0 );
|
|
1444
|
-
vec3 multiScattering = vec3( 0.0 );
|
|
1445
|
-
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
1446
|
-
BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
|
|
1447
|
-
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
|
1448
|
-
reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
|
|
1449
|
-
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
1450
|
-
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
|
1451
|
-
}
|
|
1452
|
-
#define RE_Direct RE_Direct_Physical
|
|
1453
|
-
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
1454
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
1455
|
-
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1456
|
-
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1457
|
-
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1458
|
-
}`,Tv=`
|
|
1459
|
-
GeometricContext geometry;
|
|
1460
|
-
geometry.position = - vViewPosition;
|
|
1461
|
-
geometry.normal = normal;
|
|
1462
|
-
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1463
|
-
#ifdef CLEARCOAT
|
|
1464
|
-
geometry.clearcoatNormal = clearcoatNormal;
|
|
1465
|
-
#endif
|
|
1466
|
-
IncidentLight directLight;
|
|
1467
|
-
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1468
|
-
PointLight pointLight;
|
|
1469
|
-
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1470
|
-
PointLightShadow pointLightShadow;
|
|
1471
|
-
#endif
|
|
1472
|
-
#pragma unroll_loop_start
|
|
1473
|
-
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1474
|
-
pointLight = pointLights[ i ];
|
|
1475
|
-
getPointDirectLightIrradiance( pointLight, geometry, directLight );
|
|
1476
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
|
1477
|
-
pointLightShadow = pointLightShadows[ i ];
|
|
1478
|
-
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1479
|
-
#endif
|
|
1480
|
-
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1481
|
-
}
|
|
1482
|
-
#pragma unroll_loop_end
|
|
1483
|
-
#endif
|
|
1484
|
-
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1485
|
-
SpotLight spotLight;
|
|
1486
|
-
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1487
|
-
SpotLightShadow spotLightShadow;
|
|
1488
|
-
#endif
|
|
1489
|
-
#pragma unroll_loop_start
|
|
1490
|
-
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1491
|
-
spotLight = spotLights[ i ];
|
|
1492
|
-
getSpotDirectLightIrradiance( spotLight, geometry, directLight );
|
|
1493
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1494
|
-
spotLightShadow = spotLightShadows[ i ];
|
|
1495
|
-
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1496
|
-
#endif
|
|
1497
|
-
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1498
|
-
}
|
|
1499
|
-
#pragma unroll_loop_end
|
|
1500
|
-
#endif
|
|
1501
|
-
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1502
|
-
DirectionalLight directionalLight;
|
|
1503
|
-
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1504
|
-
DirectionalLightShadow directionalLightShadow;
|
|
1505
|
-
#endif
|
|
1506
|
-
#pragma unroll_loop_start
|
|
1507
|
-
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1508
|
-
directionalLight = directionalLights[ i ];
|
|
1509
|
-
getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
|
|
1510
|
-
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1511
|
-
directionalLightShadow = directionalLightShadows[ i ];
|
|
1512
|
-
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1513
|
-
#endif
|
|
1514
|
-
RE_Direct( directLight, geometry, material, reflectedLight );
|
|
1515
|
-
}
|
|
1516
|
-
#pragma unroll_loop_end
|
|
1517
|
-
#endif
|
|
1518
|
-
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1519
|
-
RectAreaLight rectAreaLight;
|
|
1520
|
-
#pragma unroll_loop_start
|
|
1521
|
-
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1522
|
-
rectAreaLight = rectAreaLights[ i ];
|
|
1523
|
-
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
|
1524
|
-
}
|
|
1525
|
-
#pragma unroll_loop_end
|
|
1526
|
-
#endif
|
|
1527
|
-
#if defined( RE_IndirectDiffuse )
|
|
1528
|
-
vec3 iblIrradiance = vec3( 0.0 );
|
|
1529
|
-
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1530
|
-
irradiance += getLightProbeIrradiance( lightProbe, geometry );
|
|
1531
|
-
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1532
|
-
#pragma unroll_loop_start
|
|
1533
|
-
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1534
|
-
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
|
|
1535
|
-
}
|
|
1536
|
-
#pragma unroll_loop_end
|
|
1537
|
-
#endif
|
|
1538
|
-
#endif
|
|
1539
|
-
#if defined( RE_IndirectSpecular )
|
|
1540
|
-
vec3 radiance = vec3( 0.0 );
|
|
1541
|
-
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1542
|
-
#endif`,Sv=`#if defined( RE_IndirectDiffuse )
|
|
1543
|
-
#ifdef USE_LIGHTMAP
|
|
1544
|
-
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
1545
|
-
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
1546
|
-
#ifndef PHYSICALLY_CORRECT_LIGHTS
|
|
1547
|
-
lightMapIrradiance *= PI;
|
|
1548
|
-
#endif
|
|
1549
|
-
irradiance += lightMapIrradiance;
|
|
1550
|
-
#endif
|
|
1551
|
-
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1552
|
-
iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
|
|
1553
|
-
#endif
|
|
1554
|
-
#endif
|
|
1555
|
-
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1556
|
-
radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
|
|
1557
|
-
#ifdef CLEARCOAT
|
|
1558
|
-
clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
|
|
1559
|
-
#endif
|
|
1560
|
-
#endif`,Av=`#if defined( RE_IndirectDiffuse )
|
|
1561
|
-
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
|
1562
|
-
#endif
|
|
1563
|
-
#if defined( RE_IndirectSpecular )
|
|
1564
|
-
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
|
1565
|
-
#endif`,Lv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1566
|
-
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1567
|
-
#endif`,Pv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
|
1568
|
-
uniform float logDepthBufFC;
|
|
1569
|
-
varying float vFragDepth;
|
|
1570
|
-
varying float vIsPerspective;
|
|
1571
|
-
#endif`,Cv=`#ifdef USE_LOGDEPTHBUF
|
|
1572
|
-
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1573
|
-
varying float vFragDepth;
|
|
1574
|
-
varying float vIsPerspective;
|
|
1575
|
-
#else
|
|
1576
|
-
uniform float logDepthBufFC;
|
|
1577
|
-
#endif
|
|
1578
|
-
#endif`,Rv=`#ifdef USE_LOGDEPTHBUF
|
|
1579
|
-
#ifdef USE_LOGDEPTHBUF_EXT
|
|
1580
|
-
vFragDepth = 1.0 + gl_Position.w;
|
|
1581
|
-
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1582
|
-
#else
|
|
1583
|
-
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
|
1584
|
-
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
|
1585
|
-
gl_Position.z *= gl_Position.w;
|
|
1586
|
-
}
|
|
1587
|
-
#endif
|
|
1588
|
-
#endif`,Ov=`#ifdef USE_MAP
|
|
1589
|
-
vec4 texelColor = texture2D( map, vUv );
|
|
1590
|
-
texelColor = mapTexelToLinear( texelColor );
|
|
1591
|
-
diffuseColor *= texelColor;
|
|
1592
|
-
#endif`,Dv=`#ifdef USE_MAP
|
|
1593
|
-
uniform sampler2D map;
|
|
1594
|
-
#endif`,Iv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1595
|
-
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1596
|
-
#endif
|
|
1597
|
-
#ifdef USE_MAP
|
|
1598
|
-
vec4 mapTexel = texture2D( map, uv );
|
|
1599
|
-
diffuseColor *= mapTexelToLinear( mapTexel );
|
|
1600
|
-
#endif
|
|
1601
|
-
#ifdef USE_ALPHAMAP
|
|
1602
|
-
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1603
|
-
#endif`,Nv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1604
|
-
uniform mat3 uvTransform;
|
|
1605
|
-
#endif
|
|
1606
|
-
#ifdef USE_MAP
|
|
1607
|
-
uniform sampler2D map;
|
|
1608
|
-
#endif
|
|
1609
|
-
#ifdef USE_ALPHAMAP
|
|
1610
|
-
uniform sampler2D alphaMap;
|
|
1611
|
-
#endif`,Fv=`float metalnessFactor = metalness;
|
|
1612
|
-
#ifdef USE_METALNESSMAP
|
|
1613
|
-
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
|
1614
|
-
metalnessFactor *= texelMetalness.b;
|
|
1615
|
-
#endif`,Bv=`#ifdef USE_METALNESSMAP
|
|
1616
|
-
uniform sampler2D metalnessMap;
|
|
1617
|
-
#endif`,Uv=`#ifdef USE_MORPHNORMALS
|
|
1618
|
-
objectNormal *= morphTargetBaseInfluence;
|
|
1619
|
-
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
|
1620
|
-
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
|
1621
|
-
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1622
|
-
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1623
|
-
#endif`,zv=`#ifdef USE_MORPHTARGETS
|
|
1624
|
-
uniform float morphTargetBaseInfluence;
|
|
1625
|
-
#ifndef USE_MORPHNORMALS
|
|
1626
|
-
uniform float morphTargetInfluences[ 8 ];
|
|
1627
|
-
#else
|
|
1628
|
-
uniform float morphTargetInfluences[ 4 ];
|
|
1629
|
-
#endif
|
|
1630
|
-
#endif`,Gv=`#ifdef USE_MORPHTARGETS
|
|
1631
|
-
transformed *= morphTargetBaseInfluence;
|
|
1632
|
-
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
|
1633
|
-
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
|
1634
|
-
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
|
1635
|
-
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
|
1636
|
-
#ifndef USE_MORPHNORMALS
|
|
1637
|
-
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
|
1638
|
-
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
|
1639
|
-
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
|
1640
|
-
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1641
|
-
#endif
|
|
1642
|
-
#endif`,Hv=`#ifdef FLAT_SHADED
|
|
1643
|
-
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
|
1644
|
-
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
|
1645
|
-
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1646
|
-
#else
|
|
1647
|
-
vec3 normal = normalize( vNormal );
|
|
1648
|
-
#ifdef DOUBLE_SIDED
|
|
1649
|
-
normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
1650
|
-
#endif
|
|
1651
|
-
#ifdef USE_TANGENT
|
|
1652
|
-
vec3 tangent = normalize( vTangent );
|
|
1653
|
-
vec3 bitangent = normalize( vBitangent );
|
|
1654
|
-
#ifdef DOUBLE_SIDED
|
|
1655
|
-
tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
1656
|
-
bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
1657
|
-
#endif
|
|
1658
|
-
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
|
1659
|
-
mat3 vTBN = mat3( tangent, bitangent, normal );
|
|
1660
|
-
#endif
|
|
1661
|
-
#endif
|
|
1662
|
-
#endif
|
|
1663
|
-
vec3 geometryNormal = normal;`,Vv=`#ifdef OBJECTSPACE_NORMALMAP
|
|
1664
|
-
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1665
|
-
#ifdef FLIP_SIDED
|
|
1666
|
-
normal = - normal;
|
|
1667
|
-
#endif
|
|
1668
|
-
#ifdef DOUBLE_SIDED
|
|
1669
|
-
normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
1670
|
-
#endif
|
|
1671
|
-
normal = normalize( normalMatrix * normal );
|
|
1672
|
-
#elif defined( TANGENTSPACE_NORMALMAP )
|
|
1673
|
-
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1674
|
-
mapN.xy *= normalScale;
|
|
1675
|
-
#ifdef USE_TANGENT
|
|
1676
|
-
normal = normalize( vTBN * mapN );
|
|
1677
|
-
#else
|
|
1678
|
-
normal = perturbNormal2Arb( -vViewPosition, normal, mapN );
|
|
1679
|
-
#endif
|
|
1680
|
-
#elif defined( USE_BUMPMAP )
|
|
1681
|
-
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
|
|
1682
|
-
#endif`,kv=`#ifdef USE_NORMALMAP
|
|
1683
|
-
uniform sampler2D normalMap;
|
|
1684
|
-
uniform vec2 normalScale;
|
|
1685
|
-
#endif
|
|
1686
|
-
#ifdef OBJECTSPACE_NORMALMAP
|
|
1687
|
-
uniform mat3 normalMatrix;
|
|
1688
|
-
#endif
|
|
1689
|
-
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
|
1690
|
-
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {
|
|
1691
|
-
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
|
1692
|
-
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
|
1693
|
-
vec2 st0 = dFdx( vUv.st );
|
|
1694
|
-
vec2 st1 = dFdy( vUv.st );
|
|
1695
|
-
float scale = sign( st1.t * st0.s - st0.t * st1.s );
|
|
1696
|
-
vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
|
|
1697
|
-
vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
|
|
1698
|
-
vec3 N = normalize( surf_norm );
|
|
1699
|
-
mat3 tsn = mat3( S, T, N );
|
|
1700
|
-
mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
|
|
1701
|
-
return normalize( tsn * mapN );
|
|
1702
|
-
}
|
|
1703
|
-
#endif`,Wv=`#ifdef CLEARCOAT
|
|
1704
|
-
vec3 clearcoatNormal = geometryNormal;
|
|
1705
|
-
#endif`,Xv=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1706
|
-
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
|
1707
|
-
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1708
|
-
#ifdef USE_TANGENT
|
|
1709
|
-
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
|
1710
|
-
#else
|
|
1711
|
-
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );
|
|
1712
|
-
#endif
|
|
1713
|
-
#endif`,jv=`#ifdef USE_CLEARCOATMAP
|
|
1714
|
-
uniform sampler2D clearcoatMap;
|
|
1715
|
-
#endif
|
|
1716
|
-
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1717
|
-
uniform sampler2D clearcoatRoughnessMap;
|
|
1718
|
-
#endif
|
|
1719
|
-
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1720
|
-
uniform sampler2D clearcoatNormalMap;
|
|
1721
|
-
uniform vec2 clearcoatNormalScale;
|
|
1722
|
-
#endif`,qv=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1723
|
-
return normalize( normal ) * 0.5 + 0.5;
|
|
1724
|
-
}
|
|
1725
|
-
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1726
|
-
return 2.0 * rgb.xyz - 1.0;
|
|
1727
|
-
}
|
|
1728
|
-
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
|
1729
|
-
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
|
1730
|
-
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
|
1731
|
-
const float ShiftRight8 = 1. / 256.;
|
|
1732
|
-
vec4 packDepthToRGBA( const in float v ) {
|
|
1733
|
-
vec4 r = vec4( fract( v * PackFactors ), v );
|
|
1734
|
-
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
|
1735
|
-
}
|
|
1736
|
-
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1737
|
-
return dot( v, UnpackFactors );
|
|
1738
|
-
}
|
|
1739
|
-
vec4 pack2HalfToRGBA( vec2 v ) {
|
|
1740
|
-
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
|
|
1741
|
-
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
|
|
1742
|
-
}
|
|
1743
|
-
vec2 unpackRGBATo2Half( vec4 v ) {
|
|
1744
|
-
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1745
|
-
}
|
|
1746
|
-
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1747
|
-
return ( viewZ + near ) / ( near - far );
|
|
1748
|
-
}
|
|
1749
|
-
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
|
1750
|
-
return linearClipZ * ( near - far ) - near;
|
|
1751
|
-
}
|
|
1752
|
-
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1753
|
-
return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
|
|
1754
|
-
}
|
|
1755
|
-
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
|
1756
|
-
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
|
1757
|
-
}`,Yv=`#ifdef PREMULTIPLIED_ALPHA
|
|
1758
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1759
|
-
#endif`,Zv=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1760
|
-
#ifdef USE_INSTANCING
|
|
1761
|
-
mvPosition = instanceMatrix * mvPosition;
|
|
1762
|
-
#endif
|
|
1763
|
-
mvPosition = modelViewMatrix * mvPosition;
|
|
1764
|
-
gl_Position = projectionMatrix * mvPosition;`,Jv=`#ifdef DITHERING
|
|
1765
|
-
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1766
|
-
#endif`,Qv=`#ifdef DITHERING
|
|
1767
|
-
vec3 dithering( vec3 color ) {
|
|
1768
|
-
float grid_position = rand( gl_FragCoord.xy );
|
|
1769
|
-
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1770
|
-
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1771
|
-
return color + dither_shift_RGB;
|
|
1772
|
-
}
|
|
1773
|
-
#endif`,Kv=`float roughnessFactor = roughness;
|
|
1774
|
-
#ifdef USE_ROUGHNESSMAP
|
|
1775
|
-
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
|
1776
|
-
roughnessFactor *= texelRoughness.g;
|
|
1777
|
-
#endif`,$v=`#ifdef USE_ROUGHNESSMAP
|
|
1778
|
-
uniform sampler2D roughnessMap;
|
|
1779
|
-
#endif`,em=`#ifdef USE_SHADOWMAP
|
|
1780
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1781
|
-
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1782
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1783
|
-
#endif
|
|
1784
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1785
|
-
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1786
|
-
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1787
|
-
#endif
|
|
1788
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1789
|
-
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1790
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1791
|
-
#endif
|
|
1792
|
-
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
1793
|
-
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
|
1794
|
-
}
|
|
1795
|
-
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
|
1796
|
-
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
|
1797
|
-
}
|
|
1798
|
-
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
|
1799
|
-
float occlusion = 1.0;
|
|
1800
|
-
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
1801
|
-
float hard_shadow = step( compare , distribution.x );
|
|
1802
|
-
if (hard_shadow != 1.0 ) {
|
|
1803
|
-
float distance = compare - distribution.x ;
|
|
1804
|
-
float variance = max( 0.00000, distribution.y * distribution.y );
|
|
1805
|
-
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 );
|
|
1806
|
-
}
|
|
1807
|
-
return occlusion;
|
|
1808
|
-
}
|
|
1809
|
-
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1810
|
-
float shadow = 1.0;
|
|
1811
|
-
shadowCoord.xyz /= shadowCoord.w;
|
|
1812
|
-
shadowCoord.z += shadowBias;
|
|
1813
|
-
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
|
1814
|
-
bool inFrustum = all( inFrustumVec );
|
|
1815
|
-
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
|
1816
|
-
bool frustumTest = all( frustumTestVec );
|
|
1817
|
-
if ( frustumTest ) {
|
|
1818
|
-
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1819
|
-
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1820
|
-
float dx0 = - texelSize.x * shadowRadius;
|
|
1821
|
-
float dy0 = - texelSize.y * shadowRadius;
|
|
1822
|
-
float dx1 = + texelSize.x * shadowRadius;
|
|
1823
|
-
float dy1 = + texelSize.y * shadowRadius;
|
|
1824
|
-
float dx2 = dx0 / 2.0;
|
|
1825
|
-
float dy2 = dy0 / 2.0;
|
|
1826
|
-
float dx3 = dx1 / 2.0;
|
|
1827
|
-
float dy3 = dy1 / 2.0;
|
|
1828
|
-
shadow = (
|
|
1829
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
|
1830
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
|
1831
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
|
1832
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
|
1833
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
|
1834
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
|
1835
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
|
1836
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
|
1837
|
-
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
|
1838
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
|
1839
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
|
1840
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
|
1841
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
|
1842
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
|
1843
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
|
1844
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
|
1845
|
-
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
|
1846
|
-
) * ( 1.0 / 17.0 );
|
|
1847
|
-
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
|
1848
|
-
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1849
|
-
float dx = texelSize.x;
|
|
1850
|
-
float dy = texelSize.y;
|
|
1851
|
-
vec2 uv = shadowCoord.xy;
|
|
1852
|
-
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
|
1853
|
-
uv -= f * texelSize;
|
|
1854
|
-
shadow = (
|
|
1855
|
-
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
|
1856
|
-
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
|
1857
|
-
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
|
1858
|
-
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
|
1859
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
|
1860
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
|
1861
|
-
f.x ) +
|
|
1862
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
|
1863
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
|
1864
|
-
f.x ) +
|
|
1865
|
-
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
|
1866
|
-
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
|
1867
|
-
f.y ) +
|
|
1868
|
-
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
|
1869
|
-
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
|
1870
|
-
f.y ) +
|
|
1871
|
-
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
|
1872
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
|
1873
|
-
f.x ),
|
|
1874
|
-
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
|
1875
|
-
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
|
1876
|
-
f.x ),
|
|
1877
|
-
f.y )
|
|
1878
|
-
) * ( 1.0 / 9.0 );
|
|
1879
|
-
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1880
|
-
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1881
|
-
#else
|
|
1882
|
-
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
|
1883
|
-
#endif
|
|
1884
|
-
}
|
|
1885
|
-
return shadow;
|
|
1886
|
-
}
|
|
1887
|
-
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
|
1888
|
-
vec3 absV = abs( v );
|
|
1889
|
-
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
|
1890
|
-
absV *= scaleToCube;
|
|
1891
|
-
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
|
1892
|
-
vec2 planar = v.xy;
|
|
1893
|
-
float almostATexel = 1.5 * texelSizeY;
|
|
1894
|
-
float almostOne = 1.0 - almostATexel;
|
|
1895
|
-
if ( absV.z >= almostOne ) {
|
|
1896
|
-
if ( v.z > 0.0 )
|
|
1897
|
-
planar.x = 4.0 - v.x;
|
|
1898
|
-
} else if ( absV.x >= almostOne ) {
|
|
1899
|
-
float signX = sign( v.x );
|
|
1900
|
-
planar.x = v.z * signX + 2.0 * signX;
|
|
1901
|
-
} else if ( absV.y >= almostOne ) {
|
|
1902
|
-
float signY = sign( v.y );
|
|
1903
|
-
planar.x = v.x + 2.0 * signY + 2.0;
|
|
1904
|
-
planar.y = v.z * signY - 2.0;
|
|
1905
|
-
}
|
|
1906
|
-
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
|
1907
|
-
}
|
|
1908
|
-
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
1909
|
-
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
|
1910
|
-
vec3 lightToPosition = shadowCoord.xyz;
|
|
1911
|
-
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
|
1912
|
-
vec3 bd3D = normalize( lightToPosition );
|
|
1913
|
-
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
|
1914
|
-
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
|
1915
|
-
return (
|
|
1916
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
|
1917
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
|
1918
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
|
1919
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
|
1920
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
|
1921
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
|
1922
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
|
1923
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
|
1924
|
-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
|
1925
|
-
) * ( 1.0 / 9.0 );
|
|
1926
|
-
#else
|
|
1927
|
-
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
|
1928
|
-
#endif
|
|
1929
|
-
}
|
|
1930
|
-
#endif`,tm=`#ifdef USE_SHADOWMAP
|
|
1931
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1932
|
-
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1933
|
-
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1934
|
-
#endif
|
|
1935
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1936
|
-
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1937
|
-
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1938
|
-
#endif
|
|
1939
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1940
|
-
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1941
|
-
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1942
|
-
#endif
|
|
1943
|
-
#endif`,nm=`#ifdef USE_SHADOWMAP
|
|
1944
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1945
|
-
#pragma unroll_loop_start
|
|
1946
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1947
|
-
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
|
|
1948
|
-
}
|
|
1949
|
-
#pragma unroll_loop_end
|
|
1950
|
-
#endif
|
|
1951
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1952
|
-
#pragma unroll_loop_start
|
|
1953
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1954
|
-
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
|
|
1955
|
-
}
|
|
1956
|
-
#pragma unroll_loop_end
|
|
1957
|
-
#endif
|
|
1958
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1959
|
-
#pragma unroll_loop_start
|
|
1960
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1961
|
-
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
|
|
1962
|
-
}
|
|
1963
|
-
#pragma unroll_loop_end
|
|
1964
|
-
#endif
|
|
1965
|
-
#endif`,rm=`float getShadowMask() {
|
|
1966
|
-
float shadow = 1.0;
|
|
1967
|
-
#ifdef USE_SHADOWMAP
|
|
1968
|
-
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1969
|
-
DirectionalLightShadow directionalLight;
|
|
1970
|
-
#pragma unroll_loop_start
|
|
1971
|
-
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
1972
|
-
directionalLight = directionalLightShadows[ i ];
|
|
1973
|
-
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1974
|
-
}
|
|
1975
|
-
#pragma unroll_loop_end
|
|
1976
|
-
#endif
|
|
1977
|
-
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1978
|
-
SpotLightShadow spotLight;
|
|
1979
|
-
#pragma unroll_loop_start
|
|
1980
|
-
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
1981
|
-
spotLight = spotLightShadows[ i ];
|
|
1982
|
-
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
|
1983
|
-
}
|
|
1984
|
-
#pragma unroll_loop_end
|
|
1985
|
-
#endif
|
|
1986
|
-
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1987
|
-
PointLightShadow pointLight;
|
|
1988
|
-
#pragma unroll_loop_start
|
|
1989
|
-
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
1990
|
-
pointLight = pointLightShadows[ i ];
|
|
1991
|
-
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
1992
|
-
}
|
|
1993
|
-
#pragma unroll_loop_end
|
|
1994
|
-
#endif
|
|
1995
|
-
#endif
|
|
1996
|
-
return shadow;
|
|
1997
|
-
}`,im=`#ifdef USE_SKINNING
|
|
1998
|
-
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1999
|
-
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2000
|
-
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2001
|
-
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2002
|
-
#endif`,am=`#ifdef USE_SKINNING
|
|
2003
|
-
uniform mat4 bindMatrix;
|
|
2004
|
-
uniform mat4 bindMatrixInverse;
|
|
2005
|
-
#ifdef BONE_TEXTURE
|
|
2006
|
-
uniform highp sampler2D boneTexture;
|
|
2007
|
-
uniform int boneTextureSize;
|
|
2008
|
-
mat4 getBoneMatrix( const in float i ) {
|
|
2009
|
-
float j = i * 4.0;
|
|
2010
|
-
float x = mod( j, float( boneTextureSize ) );
|
|
2011
|
-
float y = floor( j / float( boneTextureSize ) );
|
|
2012
|
-
float dx = 1.0 / float( boneTextureSize );
|
|
2013
|
-
float dy = 1.0 / float( boneTextureSize );
|
|
2014
|
-
y = dy * ( y + 0.5 );
|
|
2015
|
-
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
|
2016
|
-
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
|
2017
|
-
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
|
2018
|
-
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
|
2019
|
-
mat4 bone = mat4( v1, v2, v3, v4 );
|
|
2020
|
-
return bone;
|
|
2021
|
-
}
|
|
2022
|
-
#else
|
|
2023
|
-
uniform mat4 boneMatrices[ MAX_BONES ];
|
|
2024
|
-
mat4 getBoneMatrix( const in float i ) {
|
|
2025
|
-
mat4 bone = boneMatrices[ int(i) ];
|
|
2026
|
-
return bone;
|
|
2027
|
-
}
|
|
2028
|
-
#endif
|
|
2029
|
-
#endif`,om=`#ifdef USE_SKINNING
|
|
2030
|
-
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2031
|
-
vec4 skinned = vec4( 0.0 );
|
|
2032
|
-
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
2033
|
-
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
2034
|
-
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2035
|
-
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2036
|
-
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2037
|
-
#endif`,sm=`#ifdef USE_SKINNING
|
|
2038
|
-
mat4 skinMatrix = mat4( 0.0 );
|
|
2039
|
-
skinMatrix += skinWeight.x * boneMatX;
|
|
2040
|
-
skinMatrix += skinWeight.y * boneMatY;
|
|
2041
|
-
skinMatrix += skinWeight.z * boneMatZ;
|
|
2042
|
-
skinMatrix += skinWeight.w * boneMatW;
|
|
2043
|
-
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
2044
|
-
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
2045
|
-
#ifdef USE_TANGENT
|
|
2046
|
-
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2047
|
-
#endif
|
|
2048
|
-
#endif`,lm=`float specularStrength;
|
|
2049
|
-
#ifdef USE_SPECULARMAP
|
|
2050
|
-
vec4 texelSpecular = texture2D( specularMap, vUv );
|
|
2051
|
-
specularStrength = texelSpecular.r;
|
|
2052
|
-
#else
|
|
2053
|
-
specularStrength = 1.0;
|
|
2054
|
-
#endif`,cm=`#ifdef USE_SPECULARMAP
|
|
2055
|
-
uniform sampler2D specularMap;
|
|
2056
|
-
#endif`,um=`#if defined( TONE_MAPPING )
|
|
2057
|
-
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2058
|
-
#endif`,hm=`#ifndef saturate
|
|
2059
|
-
#define saturate(a) clamp( a, 0.0, 1.0 )
|
|
2060
|
-
#endif
|
|
2061
|
-
uniform float toneMappingExposure;
|
|
2062
|
-
uniform float toneMappingWhitePoint;
|
|
2063
|
-
vec3 LinearToneMapping( vec3 color ) {
|
|
2064
|
-
return toneMappingExposure * color;
|
|
2065
|
-
}
|
|
2066
|
-
vec3 ReinhardToneMapping( vec3 color ) {
|
|
2067
|
-
color *= toneMappingExposure;
|
|
2068
|
-
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
2069
|
-
}
|
|
2070
|
-
#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
|
|
2071
|
-
vec3 Uncharted2ToneMapping( vec3 color ) {
|
|
2072
|
-
color *= toneMappingExposure;
|
|
2073
|
-
return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
|
|
2074
|
-
}
|
|
2075
|
-
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
|
2076
|
-
color *= toneMappingExposure;
|
|
2077
|
-
color = max( vec3( 0.0 ), color - 0.004 );
|
|
2078
|
-
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
2079
|
-
}
|
|
2080
|
-
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
2081
|
-
color *= toneMappingExposure;
|
|
2082
|
-
return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
|
|
2083
|
-
}`,fm=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
|
2084
|
-
varying vec2 vUv;
|
|
2085
|
-
#endif`,dm=`#ifdef USE_UV
|
|
2086
|
-
#ifdef UVS_VERTEX_ONLY
|
|
2087
|
-
vec2 vUv;
|
|
2088
|
-
#else
|
|
2089
|
-
varying vec2 vUv;
|
|
2090
|
-
#endif
|
|
2091
|
-
uniform mat3 uvTransform;
|
|
2092
|
-
#endif`,pm=`#ifdef USE_UV
|
|
2093
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2094
|
-
#endif`,vm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
2095
|
-
varying vec2 vUv2;
|
|
2096
|
-
#endif`,mm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
2097
|
-
attribute vec2 uv2;
|
|
2098
|
-
varying vec2 vUv2;
|
|
2099
|
-
uniform mat3 uv2Transform;
|
|
2100
|
-
#endif`,gm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
|
2101
|
-
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
|
2102
|
-
#endif`,ym=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
|
|
2103
|
-
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2104
|
-
#ifdef USE_INSTANCING
|
|
2105
|
-
worldPosition = instanceMatrix * worldPosition;
|
|
2106
|
-
#endif
|
|
2107
|
-
worldPosition = modelMatrix * worldPosition;
|
|
2108
|
-
#endif`,xm=`uniform sampler2D t2D;
|
|
2109
|
-
varying vec2 vUv;
|
|
2110
|
-
void main() {
|
|
2111
|
-
vec4 texColor = texture2D( t2D, vUv );
|
|
2112
|
-
gl_FragColor = mapTexelToLinear( texColor );
|
|
2113
|
-
#include <tonemapping_fragment>
|
|
2114
|
-
#include <encodings_fragment>
|
|
2115
|
-
}`,_m=`varying vec2 vUv;
|
|
2116
|
-
uniform mat3 uvTransform;
|
|
2117
|
-
void main() {
|
|
2118
|
-
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2119
|
-
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2120
|
-
}`,bm=`#include <envmap_common_pars_fragment>
|
|
2121
|
-
uniform float opacity;
|
|
2122
|
-
varying vec3 vWorldDirection;
|
|
2123
|
-
#include <cube_uv_reflection_fragment>
|
|
2124
|
-
void main() {
|
|
2125
|
-
vec3 vReflect = vWorldDirection;
|
|
2126
|
-
#include <envmap_fragment>
|
|
2127
|
-
gl_FragColor = envColor;
|
|
2128
|
-
gl_FragColor.a *= opacity;
|
|
2129
|
-
#include <tonemapping_fragment>
|
|
2130
|
-
#include <encodings_fragment>
|
|
2131
|
-
}`,wm=`varying vec3 vWorldDirection;
|
|
2132
|
-
#include <common>
|
|
2133
|
-
void main() {
|
|
2134
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2135
|
-
#include <begin_vertex>
|
|
2136
|
-
#include <project_vertex>
|
|
2137
|
-
gl_Position.z = gl_Position.w;
|
|
2138
|
-
}`,Mm=`#if DEPTH_PACKING == 3200
|
|
2139
|
-
uniform float opacity;
|
|
2140
|
-
#endif
|
|
2141
|
-
#include <common>
|
|
2142
|
-
#include <packing>
|
|
2143
|
-
#include <uv_pars_fragment>
|
|
2144
|
-
#include <map_pars_fragment>
|
|
2145
|
-
#include <alphamap_pars_fragment>
|
|
2146
|
-
#include <logdepthbuf_pars_fragment>
|
|
2147
|
-
#include <clipping_planes_pars_fragment>
|
|
2148
|
-
varying vec2 vHighPrecisionZW;
|
|
2149
|
-
void main() {
|
|
2150
|
-
#include <clipping_planes_fragment>
|
|
2151
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2152
|
-
#if DEPTH_PACKING == 3200
|
|
2153
|
-
diffuseColor.a = opacity;
|
|
2154
|
-
#endif
|
|
2155
|
-
#include <map_fragment>
|
|
2156
|
-
#include <alphamap_fragment>
|
|
2157
|
-
#include <alphatest_fragment>
|
|
2158
|
-
#include <logdepthbuf_fragment>
|
|
2159
|
-
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
|
2160
|
-
#if DEPTH_PACKING == 3200
|
|
2161
|
-
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
2162
|
-
#elif DEPTH_PACKING == 3201
|
|
2163
|
-
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2164
|
-
#endif
|
|
2165
|
-
}`,Em=`#include <common>
|
|
2166
|
-
#include <uv_pars_vertex>
|
|
2167
|
-
#include <displacementmap_pars_vertex>
|
|
2168
|
-
#include <morphtarget_pars_vertex>
|
|
2169
|
-
#include <skinning_pars_vertex>
|
|
2170
|
-
#include <logdepthbuf_pars_vertex>
|
|
2171
|
-
#include <clipping_planes_pars_vertex>
|
|
2172
|
-
varying vec2 vHighPrecisionZW;
|
|
2173
|
-
void main() {
|
|
2174
|
-
#include <uv_vertex>
|
|
2175
|
-
#include <skinbase_vertex>
|
|
2176
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2177
|
-
#include <beginnormal_vertex>
|
|
2178
|
-
#include <morphnormal_vertex>
|
|
2179
|
-
#include <skinnormal_vertex>
|
|
2180
|
-
#endif
|
|
2181
|
-
#include <begin_vertex>
|
|
2182
|
-
#include <morphtarget_vertex>
|
|
2183
|
-
#include <skinning_vertex>
|
|
2184
|
-
#include <displacementmap_vertex>
|
|
2185
|
-
#include <project_vertex>
|
|
2186
|
-
#include <logdepthbuf_vertex>
|
|
2187
|
-
#include <clipping_planes_vertex>
|
|
2188
|
-
vHighPrecisionZW = gl_Position.zw;
|
|
2189
|
-
}`,Tm=`#define DISTANCE
|
|
2190
|
-
uniform vec3 referencePosition;
|
|
2191
|
-
uniform float nearDistance;
|
|
2192
|
-
uniform float farDistance;
|
|
2193
|
-
varying vec3 vWorldPosition;
|
|
2194
|
-
#include <common>
|
|
2195
|
-
#include <packing>
|
|
2196
|
-
#include <uv_pars_fragment>
|
|
2197
|
-
#include <map_pars_fragment>
|
|
2198
|
-
#include <alphamap_pars_fragment>
|
|
2199
|
-
#include <clipping_planes_pars_fragment>
|
|
2200
|
-
void main () {
|
|
2201
|
-
#include <clipping_planes_fragment>
|
|
2202
|
-
vec4 diffuseColor = vec4( 1.0 );
|
|
2203
|
-
#include <map_fragment>
|
|
2204
|
-
#include <alphamap_fragment>
|
|
2205
|
-
#include <alphatest_fragment>
|
|
2206
|
-
float dist = length( vWorldPosition - referencePosition );
|
|
2207
|
-
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2208
|
-
dist = saturate( dist );
|
|
2209
|
-
gl_FragColor = packDepthToRGBA( dist );
|
|
2210
|
-
}`,Sm=`#define DISTANCE
|
|
2211
|
-
varying vec3 vWorldPosition;
|
|
2212
|
-
#include <common>
|
|
2213
|
-
#include <uv_pars_vertex>
|
|
2214
|
-
#include <displacementmap_pars_vertex>
|
|
2215
|
-
#include <morphtarget_pars_vertex>
|
|
2216
|
-
#include <skinning_pars_vertex>
|
|
2217
|
-
#include <clipping_planes_pars_vertex>
|
|
2218
|
-
void main() {
|
|
2219
|
-
#include <uv_vertex>
|
|
2220
|
-
#include <skinbase_vertex>
|
|
2221
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
2222
|
-
#include <beginnormal_vertex>
|
|
2223
|
-
#include <morphnormal_vertex>
|
|
2224
|
-
#include <skinnormal_vertex>
|
|
2225
|
-
#endif
|
|
2226
|
-
#include <begin_vertex>
|
|
2227
|
-
#include <morphtarget_vertex>
|
|
2228
|
-
#include <skinning_vertex>
|
|
2229
|
-
#include <displacementmap_vertex>
|
|
2230
|
-
#include <project_vertex>
|
|
2231
|
-
#include <worldpos_vertex>
|
|
2232
|
-
#include <clipping_planes_vertex>
|
|
2233
|
-
vWorldPosition = worldPosition.xyz;
|
|
2234
|
-
}`,Am=`uniform sampler2D tEquirect;
|
|
2235
|
-
varying vec3 vWorldDirection;
|
|
2236
|
-
#include <common>
|
|
2237
|
-
void main() {
|
|
2238
|
-
vec3 direction = normalize( vWorldDirection );
|
|
2239
|
-
vec2 sampleUV = equirectUv( direction );
|
|
2240
|
-
vec4 texColor = texture2D( tEquirect, sampleUV );
|
|
2241
|
-
gl_FragColor = mapTexelToLinear( texColor );
|
|
2242
|
-
#include <tonemapping_fragment>
|
|
2243
|
-
#include <encodings_fragment>
|
|
2244
|
-
}`,Lm=`varying vec3 vWorldDirection;
|
|
2245
|
-
#include <common>
|
|
2246
|
-
void main() {
|
|
2247
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2248
|
-
#include <begin_vertex>
|
|
2249
|
-
#include <project_vertex>
|
|
2250
|
-
}`,Pm=`uniform vec3 diffuse;
|
|
2251
|
-
uniform float opacity;
|
|
2252
|
-
uniform float dashSize;
|
|
2253
|
-
uniform float totalSize;
|
|
2254
|
-
varying float vLineDistance;
|
|
2255
|
-
#include <common>
|
|
2256
|
-
#include <color_pars_fragment>
|
|
2257
|
-
#include <fog_pars_fragment>
|
|
2258
|
-
#include <logdepthbuf_pars_fragment>
|
|
2259
|
-
#include <clipping_planes_pars_fragment>
|
|
2260
|
-
void main() {
|
|
2261
|
-
#include <clipping_planes_fragment>
|
|
2262
|
-
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2263
|
-
discard;
|
|
2264
|
-
}
|
|
2265
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
2266
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2267
|
-
#include <logdepthbuf_fragment>
|
|
2268
|
-
#include <color_fragment>
|
|
2269
|
-
outgoingLight = diffuseColor.rgb;
|
|
2270
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2271
|
-
#include <tonemapping_fragment>
|
|
2272
|
-
#include <encodings_fragment>
|
|
2273
|
-
#include <fog_fragment>
|
|
2274
|
-
#include <premultiplied_alpha_fragment>
|
|
2275
|
-
}`,Cm=`uniform float scale;
|
|
2276
|
-
attribute float lineDistance;
|
|
2277
|
-
varying float vLineDistance;
|
|
2278
|
-
#include <common>
|
|
2279
|
-
#include <color_pars_vertex>
|
|
2280
|
-
#include <fog_pars_vertex>
|
|
2281
|
-
#include <morphtarget_pars_vertex>
|
|
2282
|
-
#include <logdepthbuf_pars_vertex>
|
|
2283
|
-
#include <clipping_planes_pars_vertex>
|
|
2284
|
-
void main() {
|
|
2285
|
-
vLineDistance = scale * lineDistance;
|
|
2286
|
-
#include <color_vertex>
|
|
2287
|
-
#include <begin_vertex>
|
|
2288
|
-
#include <morphtarget_vertex>
|
|
2289
|
-
#include <project_vertex>
|
|
2290
|
-
#include <logdepthbuf_vertex>
|
|
2291
|
-
#include <clipping_planes_vertex>
|
|
2292
|
-
#include <fog_vertex>
|
|
2293
|
-
}`,Rm=`uniform vec3 diffuse;
|
|
2294
|
-
uniform float opacity;
|
|
2295
|
-
#ifndef FLAT_SHADED
|
|
2296
|
-
varying vec3 vNormal;
|
|
2297
|
-
#endif
|
|
2298
|
-
#include <common>
|
|
2299
|
-
#include <dithering_pars_fragment>
|
|
2300
|
-
#include <color_pars_fragment>
|
|
2301
|
-
#include <uv_pars_fragment>
|
|
2302
|
-
#include <uv2_pars_fragment>
|
|
2303
|
-
#include <map_pars_fragment>
|
|
2304
|
-
#include <alphamap_pars_fragment>
|
|
2305
|
-
#include <aomap_pars_fragment>
|
|
2306
|
-
#include <lightmap_pars_fragment>
|
|
2307
|
-
#include <envmap_common_pars_fragment>
|
|
2308
|
-
#include <envmap_pars_fragment>
|
|
2309
|
-
#include <cube_uv_reflection_fragment>
|
|
2310
|
-
#include <fog_pars_fragment>
|
|
2311
|
-
#include <specularmap_pars_fragment>
|
|
2312
|
-
#include <logdepthbuf_pars_fragment>
|
|
2313
|
-
#include <clipping_planes_pars_fragment>
|
|
2314
|
-
void main() {
|
|
2315
|
-
#include <clipping_planes_fragment>
|
|
2316
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2317
|
-
#include <logdepthbuf_fragment>
|
|
2318
|
-
#include <map_fragment>
|
|
2319
|
-
#include <color_fragment>
|
|
2320
|
-
#include <alphamap_fragment>
|
|
2321
|
-
#include <alphatest_fragment>
|
|
2322
|
-
#include <specularmap_fragment>
|
|
2323
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2324
|
-
#ifdef USE_LIGHTMAP
|
|
2325
|
-
|
|
2326
|
-
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
|
|
2327
|
-
reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
|
|
2328
|
-
#else
|
|
2329
|
-
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
2330
|
-
#endif
|
|
2331
|
-
#include <aomap_fragment>
|
|
2332
|
-
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
2333
|
-
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
2334
|
-
#include <envmap_fragment>
|
|
2335
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2336
|
-
#include <tonemapping_fragment>
|
|
2337
|
-
#include <encodings_fragment>
|
|
2338
|
-
#include <fog_fragment>
|
|
2339
|
-
#include <premultiplied_alpha_fragment>
|
|
2340
|
-
#include <dithering_fragment>
|
|
2341
|
-
}`,Om=`#include <common>
|
|
2342
|
-
#include <uv_pars_vertex>
|
|
2343
|
-
#include <uv2_pars_vertex>
|
|
2344
|
-
#include <envmap_pars_vertex>
|
|
2345
|
-
#include <color_pars_vertex>
|
|
2346
|
-
#include <fog_pars_vertex>
|
|
2347
|
-
#include <morphtarget_pars_vertex>
|
|
2348
|
-
#include <skinning_pars_vertex>
|
|
2349
|
-
#include <logdepthbuf_pars_vertex>
|
|
2350
|
-
#include <clipping_planes_pars_vertex>
|
|
2351
|
-
void main() {
|
|
2352
|
-
#include <uv_vertex>
|
|
2353
|
-
#include <uv2_vertex>
|
|
2354
|
-
#include <color_vertex>
|
|
2355
|
-
#include <skinbase_vertex>
|
|
2356
|
-
#ifdef USE_ENVMAP
|
|
2357
|
-
#include <beginnormal_vertex>
|
|
2358
|
-
#include <morphnormal_vertex>
|
|
2359
|
-
#include <skinnormal_vertex>
|
|
2360
|
-
#include <defaultnormal_vertex>
|
|
2361
|
-
#endif
|
|
2362
|
-
#include <begin_vertex>
|
|
2363
|
-
#include <morphtarget_vertex>
|
|
2364
|
-
#include <skinning_vertex>
|
|
2365
|
-
#include <project_vertex>
|
|
2366
|
-
#include <logdepthbuf_vertex>
|
|
2367
|
-
#include <worldpos_vertex>
|
|
2368
|
-
#include <clipping_planes_vertex>
|
|
2369
|
-
#include <envmap_vertex>
|
|
2370
|
-
#include <fog_vertex>
|
|
2371
|
-
}`,Dm=`uniform vec3 diffuse;
|
|
2372
|
-
uniform vec3 emissive;
|
|
2373
|
-
uniform float opacity;
|
|
2374
|
-
varying vec3 vLightFront;
|
|
2375
|
-
varying vec3 vIndirectFront;
|
|
2376
|
-
#ifdef DOUBLE_SIDED
|
|
2377
|
-
varying vec3 vLightBack;
|
|
2378
|
-
varying vec3 vIndirectBack;
|
|
2379
|
-
#endif
|
|
2380
|
-
#include <common>
|
|
2381
|
-
#include <packing>
|
|
2382
|
-
#include <dithering_pars_fragment>
|
|
2383
|
-
#include <color_pars_fragment>
|
|
2384
|
-
#include <uv_pars_fragment>
|
|
2385
|
-
#include <uv2_pars_fragment>
|
|
2386
|
-
#include <map_pars_fragment>
|
|
2387
|
-
#include <alphamap_pars_fragment>
|
|
2388
|
-
#include <aomap_pars_fragment>
|
|
2389
|
-
#include <lightmap_pars_fragment>
|
|
2390
|
-
#include <emissivemap_pars_fragment>
|
|
2391
|
-
#include <envmap_common_pars_fragment>
|
|
2392
|
-
#include <envmap_pars_fragment>
|
|
2393
|
-
#include <cube_uv_reflection_fragment>
|
|
2394
|
-
#include <bsdfs>
|
|
2395
|
-
#include <lights_pars_begin>
|
|
2396
|
-
#include <fog_pars_fragment>
|
|
2397
|
-
#include <shadowmap_pars_fragment>
|
|
2398
|
-
#include <shadowmask_pars_fragment>
|
|
2399
|
-
#include <specularmap_pars_fragment>
|
|
2400
|
-
#include <logdepthbuf_pars_fragment>
|
|
2401
|
-
#include <clipping_planes_pars_fragment>
|
|
2402
|
-
void main() {
|
|
2403
|
-
#include <clipping_planes_fragment>
|
|
2404
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2405
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2406
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2407
|
-
#include <logdepthbuf_fragment>
|
|
2408
|
-
#include <map_fragment>
|
|
2409
|
-
#include <color_fragment>
|
|
2410
|
-
#include <alphamap_fragment>
|
|
2411
|
-
#include <alphatest_fragment>
|
|
2412
|
-
#include <specularmap_fragment>
|
|
2413
|
-
#include <emissivemap_fragment>
|
|
2414
|
-
#ifdef DOUBLE_SIDED
|
|
2415
|
-
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
|
2416
|
-
#else
|
|
2417
|
-
reflectedLight.indirectDiffuse += vIndirectFront;
|
|
2418
|
-
#endif
|
|
2419
|
-
#include <lightmap_fragment>
|
|
2420
|
-
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
|
|
2421
|
-
#ifdef DOUBLE_SIDED
|
|
2422
|
-
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
|
2423
|
-
#else
|
|
2424
|
-
reflectedLight.directDiffuse = vLightFront;
|
|
2425
|
-
#endif
|
|
2426
|
-
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
|
|
2427
|
-
#include <aomap_fragment>
|
|
2428
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
2429
|
-
#include <envmap_fragment>
|
|
2430
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2431
|
-
#include <tonemapping_fragment>
|
|
2432
|
-
#include <encodings_fragment>
|
|
2433
|
-
#include <fog_fragment>
|
|
2434
|
-
#include <premultiplied_alpha_fragment>
|
|
2435
|
-
#include <dithering_fragment>
|
|
2436
|
-
}`,Im=`#define LAMBERT
|
|
2437
|
-
varying vec3 vLightFront;
|
|
2438
|
-
varying vec3 vIndirectFront;
|
|
2439
|
-
#ifdef DOUBLE_SIDED
|
|
2440
|
-
varying vec3 vLightBack;
|
|
2441
|
-
varying vec3 vIndirectBack;
|
|
2442
|
-
#endif
|
|
2443
|
-
#include <common>
|
|
2444
|
-
#include <uv_pars_vertex>
|
|
2445
|
-
#include <uv2_pars_vertex>
|
|
2446
|
-
#include <envmap_pars_vertex>
|
|
2447
|
-
#include <bsdfs>
|
|
2448
|
-
#include <lights_pars_begin>
|
|
2449
|
-
#include <color_pars_vertex>
|
|
2450
|
-
#include <fog_pars_vertex>
|
|
2451
|
-
#include <morphtarget_pars_vertex>
|
|
2452
|
-
#include <skinning_pars_vertex>
|
|
2453
|
-
#include <shadowmap_pars_vertex>
|
|
2454
|
-
#include <logdepthbuf_pars_vertex>
|
|
2455
|
-
#include <clipping_planes_pars_vertex>
|
|
2456
|
-
void main() {
|
|
2457
|
-
#include <uv_vertex>
|
|
2458
|
-
#include <uv2_vertex>
|
|
2459
|
-
#include <color_vertex>
|
|
2460
|
-
#include <beginnormal_vertex>
|
|
2461
|
-
#include <morphnormal_vertex>
|
|
2462
|
-
#include <skinbase_vertex>
|
|
2463
|
-
#include <skinnormal_vertex>
|
|
2464
|
-
#include <defaultnormal_vertex>
|
|
2465
|
-
#include <begin_vertex>
|
|
2466
|
-
#include <morphtarget_vertex>
|
|
2467
|
-
#include <skinning_vertex>
|
|
2468
|
-
#include <project_vertex>
|
|
2469
|
-
#include <logdepthbuf_vertex>
|
|
2470
|
-
#include <clipping_planes_vertex>
|
|
2471
|
-
#include <worldpos_vertex>
|
|
2472
|
-
#include <envmap_vertex>
|
|
2473
|
-
#include <lights_lambert_vertex>
|
|
2474
|
-
#include <shadowmap_vertex>
|
|
2475
|
-
#include <fog_vertex>
|
|
2476
|
-
}`,Nm=`#define MATCAP
|
|
2477
|
-
uniform vec3 diffuse;
|
|
2478
|
-
uniform float opacity;
|
|
2479
|
-
uniform sampler2D matcap;
|
|
2480
|
-
varying vec3 vViewPosition;
|
|
2481
|
-
#ifndef FLAT_SHADED
|
|
2482
|
-
varying vec3 vNormal;
|
|
2483
|
-
#endif
|
|
2484
|
-
#include <common>
|
|
2485
|
-
#include <dithering_pars_fragment>
|
|
2486
|
-
#include <color_pars_fragment>
|
|
2487
|
-
#include <uv_pars_fragment>
|
|
2488
|
-
#include <map_pars_fragment>
|
|
2489
|
-
#include <alphamap_pars_fragment>
|
|
2490
|
-
#include <fog_pars_fragment>
|
|
2491
|
-
#include <bumpmap_pars_fragment>
|
|
2492
|
-
#include <normalmap_pars_fragment>
|
|
2493
|
-
#include <logdepthbuf_pars_fragment>
|
|
2494
|
-
#include <clipping_planes_pars_fragment>
|
|
2495
|
-
void main() {
|
|
2496
|
-
#include <clipping_planes_fragment>
|
|
2497
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2498
|
-
#include <logdepthbuf_fragment>
|
|
2499
|
-
#include <map_fragment>
|
|
2500
|
-
#include <color_fragment>
|
|
2501
|
-
#include <alphamap_fragment>
|
|
2502
|
-
#include <alphatest_fragment>
|
|
2503
|
-
#include <normal_fragment_begin>
|
|
2504
|
-
#include <normal_fragment_maps>
|
|
2505
|
-
vec3 viewDir = normalize( vViewPosition );
|
|
2506
|
-
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
2507
|
-
vec3 y = cross( viewDir, x );
|
|
2508
|
-
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
2509
|
-
#ifdef USE_MATCAP
|
|
2510
|
-
vec4 matcapColor = texture2D( matcap, uv );
|
|
2511
|
-
matcapColor = matcapTexelToLinear( matcapColor );
|
|
2512
|
-
#else
|
|
2513
|
-
vec4 matcapColor = vec4( 1.0 );
|
|
2514
|
-
#endif
|
|
2515
|
-
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
2516
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2517
|
-
#include <tonemapping_fragment>
|
|
2518
|
-
#include <encodings_fragment>
|
|
2519
|
-
#include <fog_fragment>
|
|
2520
|
-
#include <premultiplied_alpha_fragment>
|
|
2521
|
-
#include <dithering_fragment>
|
|
2522
|
-
}`,Fm=`#define MATCAP
|
|
2523
|
-
varying vec3 vViewPosition;
|
|
2524
|
-
#ifndef FLAT_SHADED
|
|
2525
|
-
varying vec3 vNormal;
|
|
2526
|
-
#endif
|
|
2527
|
-
#include <common>
|
|
2528
|
-
#include <uv_pars_vertex>
|
|
2529
|
-
#include <color_pars_vertex>
|
|
2530
|
-
#include <displacementmap_pars_vertex>
|
|
2531
|
-
#include <fog_pars_vertex>
|
|
2532
|
-
#include <morphtarget_pars_vertex>
|
|
2533
|
-
#include <skinning_pars_vertex>
|
|
2534
|
-
#include <logdepthbuf_pars_vertex>
|
|
2535
|
-
#include <clipping_planes_pars_vertex>
|
|
2536
|
-
void main() {
|
|
2537
|
-
#include <uv_vertex>
|
|
2538
|
-
#include <color_vertex>
|
|
2539
|
-
#include <beginnormal_vertex>
|
|
2540
|
-
#include <morphnormal_vertex>
|
|
2541
|
-
#include <skinbase_vertex>
|
|
2542
|
-
#include <skinnormal_vertex>
|
|
2543
|
-
#include <defaultnormal_vertex>
|
|
2544
|
-
#ifndef FLAT_SHADED
|
|
2545
|
-
vNormal = normalize( transformedNormal );
|
|
2546
|
-
#endif
|
|
2547
|
-
#include <begin_vertex>
|
|
2548
|
-
#include <morphtarget_vertex>
|
|
2549
|
-
#include <skinning_vertex>
|
|
2550
|
-
#include <displacementmap_vertex>
|
|
2551
|
-
#include <project_vertex>
|
|
2552
|
-
#include <logdepthbuf_vertex>
|
|
2553
|
-
#include <clipping_planes_vertex>
|
|
2554
|
-
#include <fog_vertex>
|
|
2555
|
-
vViewPosition = - mvPosition.xyz;
|
|
2556
|
-
}`,Bm=`#define TOON
|
|
2557
|
-
uniform vec3 diffuse;
|
|
2558
|
-
uniform vec3 emissive;
|
|
2559
|
-
uniform vec3 specular;
|
|
2560
|
-
uniform float shininess;
|
|
2561
|
-
uniform float opacity;
|
|
2562
|
-
#include <common>
|
|
2563
|
-
#include <packing>
|
|
2564
|
-
#include <dithering_pars_fragment>
|
|
2565
|
-
#include <color_pars_fragment>
|
|
2566
|
-
#include <uv_pars_fragment>
|
|
2567
|
-
#include <uv2_pars_fragment>
|
|
2568
|
-
#include <map_pars_fragment>
|
|
2569
|
-
#include <alphamap_pars_fragment>
|
|
2570
|
-
#include <aomap_pars_fragment>
|
|
2571
|
-
#include <lightmap_pars_fragment>
|
|
2572
|
-
#include <emissivemap_pars_fragment>
|
|
2573
|
-
#include <gradientmap_pars_fragment>
|
|
2574
|
-
#include <fog_pars_fragment>
|
|
2575
|
-
#include <bsdfs>
|
|
2576
|
-
#include <lights_pars_begin>
|
|
2577
|
-
#include <lights_toon_pars_fragment>
|
|
2578
|
-
#include <shadowmap_pars_fragment>
|
|
2579
|
-
#include <bumpmap_pars_fragment>
|
|
2580
|
-
#include <normalmap_pars_fragment>
|
|
2581
|
-
#include <specularmap_pars_fragment>
|
|
2582
|
-
#include <logdepthbuf_pars_fragment>
|
|
2583
|
-
#include <clipping_planes_pars_fragment>
|
|
2584
|
-
void main() {
|
|
2585
|
-
#include <clipping_planes_fragment>
|
|
2586
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2587
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2588
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2589
|
-
#include <logdepthbuf_fragment>
|
|
2590
|
-
#include <map_fragment>
|
|
2591
|
-
#include <color_fragment>
|
|
2592
|
-
#include <alphamap_fragment>
|
|
2593
|
-
#include <alphatest_fragment>
|
|
2594
|
-
#include <specularmap_fragment>
|
|
2595
|
-
#include <normal_fragment_begin>
|
|
2596
|
-
#include <normal_fragment_maps>
|
|
2597
|
-
#include <emissivemap_fragment>
|
|
2598
|
-
#include <lights_toon_fragment>
|
|
2599
|
-
#include <lights_fragment_begin>
|
|
2600
|
-
#include <lights_fragment_maps>
|
|
2601
|
-
#include <lights_fragment_end>
|
|
2602
|
-
#include <aomap_fragment>
|
|
2603
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2604
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2605
|
-
#include <tonemapping_fragment>
|
|
2606
|
-
#include <encodings_fragment>
|
|
2607
|
-
#include <fog_fragment>
|
|
2608
|
-
#include <premultiplied_alpha_fragment>
|
|
2609
|
-
#include <dithering_fragment>
|
|
2610
|
-
}`,Um=`#define TOON
|
|
2611
|
-
varying vec3 vViewPosition;
|
|
2612
|
-
#ifndef FLAT_SHADED
|
|
2613
|
-
varying vec3 vNormal;
|
|
2614
|
-
#endif
|
|
2615
|
-
#include <common>
|
|
2616
|
-
#include <uv_pars_vertex>
|
|
2617
|
-
#include <uv2_pars_vertex>
|
|
2618
|
-
#include <displacementmap_pars_vertex>
|
|
2619
|
-
#include <color_pars_vertex>
|
|
2620
|
-
#include <fog_pars_vertex>
|
|
2621
|
-
#include <morphtarget_pars_vertex>
|
|
2622
|
-
#include <skinning_pars_vertex>
|
|
2623
|
-
#include <shadowmap_pars_vertex>
|
|
2624
|
-
#include <logdepthbuf_pars_vertex>
|
|
2625
|
-
#include <clipping_planes_pars_vertex>
|
|
2626
|
-
void main() {
|
|
2627
|
-
#include <uv_vertex>
|
|
2628
|
-
#include <uv2_vertex>
|
|
2629
|
-
#include <color_vertex>
|
|
2630
|
-
#include <beginnormal_vertex>
|
|
2631
|
-
#include <morphnormal_vertex>
|
|
2632
|
-
#include <skinbase_vertex>
|
|
2633
|
-
#include <skinnormal_vertex>
|
|
2634
|
-
#include <defaultnormal_vertex>
|
|
2635
|
-
#ifndef FLAT_SHADED
|
|
2636
|
-
vNormal = normalize( transformedNormal );
|
|
2637
|
-
#endif
|
|
2638
|
-
#include <begin_vertex>
|
|
2639
|
-
#include <morphtarget_vertex>
|
|
2640
|
-
#include <skinning_vertex>
|
|
2641
|
-
#include <displacementmap_vertex>
|
|
2642
|
-
#include <project_vertex>
|
|
2643
|
-
#include <logdepthbuf_vertex>
|
|
2644
|
-
#include <clipping_planes_vertex>
|
|
2645
|
-
vViewPosition = - mvPosition.xyz;
|
|
2646
|
-
#include <worldpos_vertex>
|
|
2647
|
-
#include <shadowmap_vertex>
|
|
2648
|
-
#include <fog_vertex>
|
|
2649
|
-
}`,zm=`#define PHONG
|
|
2650
|
-
uniform vec3 diffuse;
|
|
2651
|
-
uniform vec3 emissive;
|
|
2652
|
-
uniform vec3 specular;
|
|
2653
|
-
uniform float shininess;
|
|
2654
|
-
uniform float opacity;
|
|
2655
|
-
#include <common>
|
|
2656
|
-
#include <packing>
|
|
2657
|
-
#include <dithering_pars_fragment>
|
|
2658
|
-
#include <color_pars_fragment>
|
|
2659
|
-
#include <uv_pars_fragment>
|
|
2660
|
-
#include <uv2_pars_fragment>
|
|
2661
|
-
#include <map_pars_fragment>
|
|
2662
|
-
#include <alphamap_pars_fragment>
|
|
2663
|
-
#include <aomap_pars_fragment>
|
|
2664
|
-
#include <lightmap_pars_fragment>
|
|
2665
|
-
#include <emissivemap_pars_fragment>
|
|
2666
|
-
#include <envmap_common_pars_fragment>
|
|
2667
|
-
#include <envmap_pars_fragment>
|
|
2668
|
-
#include <cube_uv_reflection_fragment>
|
|
2669
|
-
#include <fog_pars_fragment>
|
|
2670
|
-
#include <bsdfs>
|
|
2671
|
-
#include <lights_pars_begin>
|
|
2672
|
-
#include <lights_phong_pars_fragment>
|
|
2673
|
-
#include <shadowmap_pars_fragment>
|
|
2674
|
-
#include <bumpmap_pars_fragment>
|
|
2675
|
-
#include <normalmap_pars_fragment>
|
|
2676
|
-
#include <specularmap_pars_fragment>
|
|
2677
|
-
#include <logdepthbuf_pars_fragment>
|
|
2678
|
-
#include <clipping_planes_pars_fragment>
|
|
2679
|
-
void main() {
|
|
2680
|
-
#include <clipping_planes_fragment>
|
|
2681
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2682
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2683
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2684
|
-
#include <logdepthbuf_fragment>
|
|
2685
|
-
#include <map_fragment>
|
|
2686
|
-
#include <color_fragment>
|
|
2687
|
-
#include <alphamap_fragment>
|
|
2688
|
-
#include <alphatest_fragment>
|
|
2689
|
-
#include <specularmap_fragment>
|
|
2690
|
-
#include <normal_fragment_begin>
|
|
2691
|
-
#include <normal_fragment_maps>
|
|
2692
|
-
#include <emissivemap_fragment>
|
|
2693
|
-
#include <lights_phong_fragment>
|
|
2694
|
-
#include <lights_fragment_begin>
|
|
2695
|
-
#include <lights_fragment_maps>
|
|
2696
|
-
#include <lights_fragment_end>
|
|
2697
|
-
#include <aomap_fragment>
|
|
2698
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2699
|
-
#include <envmap_fragment>
|
|
2700
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2701
|
-
#include <tonemapping_fragment>
|
|
2702
|
-
#include <encodings_fragment>
|
|
2703
|
-
#include <fog_fragment>
|
|
2704
|
-
#include <premultiplied_alpha_fragment>
|
|
2705
|
-
#include <dithering_fragment>
|
|
2706
|
-
}`,Gm=`#define PHONG
|
|
2707
|
-
varying vec3 vViewPosition;
|
|
2708
|
-
#ifndef FLAT_SHADED
|
|
2709
|
-
varying vec3 vNormal;
|
|
2710
|
-
#endif
|
|
2711
|
-
#include <common>
|
|
2712
|
-
#include <uv_pars_vertex>
|
|
2713
|
-
#include <uv2_pars_vertex>
|
|
2714
|
-
#include <displacementmap_pars_vertex>
|
|
2715
|
-
#include <envmap_pars_vertex>
|
|
2716
|
-
#include <color_pars_vertex>
|
|
2717
|
-
#include <fog_pars_vertex>
|
|
2718
|
-
#include <morphtarget_pars_vertex>
|
|
2719
|
-
#include <skinning_pars_vertex>
|
|
2720
|
-
#include <shadowmap_pars_vertex>
|
|
2721
|
-
#include <logdepthbuf_pars_vertex>
|
|
2722
|
-
#include <clipping_planes_pars_vertex>
|
|
2723
|
-
void main() {
|
|
2724
|
-
#include <uv_vertex>
|
|
2725
|
-
#include <uv2_vertex>
|
|
2726
|
-
#include <color_vertex>
|
|
2727
|
-
#include <beginnormal_vertex>
|
|
2728
|
-
#include <morphnormal_vertex>
|
|
2729
|
-
#include <skinbase_vertex>
|
|
2730
|
-
#include <skinnormal_vertex>
|
|
2731
|
-
#include <defaultnormal_vertex>
|
|
2732
|
-
#ifndef FLAT_SHADED
|
|
2733
|
-
vNormal = normalize( transformedNormal );
|
|
2734
|
-
#endif
|
|
2735
|
-
#include <begin_vertex>
|
|
2736
|
-
#include <morphtarget_vertex>
|
|
2737
|
-
#include <skinning_vertex>
|
|
2738
|
-
#include <displacementmap_vertex>
|
|
2739
|
-
#include <project_vertex>
|
|
2740
|
-
#include <logdepthbuf_vertex>
|
|
2741
|
-
#include <clipping_planes_vertex>
|
|
2742
|
-
vViewPosition = - mvPosition.xyz;
|
|
2743
|
-
#include <worldpos_vertex>
|
|
2744
|
-
#include <envmap_vertex>
|
|
2745
|
-
#include <shadowmap_vertex>
|
|
2746
|
-
#include <fog_vertex>
|
|
2747
|
-
}`,Hm=`#define STANDARD
|
|
2748
|
-
#ifdef PHYSICAL
|
|
2749
|
-
#define REFLECTIVITY
|
|
2750
|
-
#define CLEARCOAT
|
|
2751
|
-
#define TRANSPARENCY
|
|
2752
|
-
#endif
|
|
2753
|
-
uniform vec3 diffuse;
|
|
2754
|
-
uniform vec3 emissive;
|
|
2755
|
-
uniform float roughness;
|
|
2756
|
-
uniform float metalness;
|
|
2757
|
-
uniform float opacity;
|
|
2758
|
-
#ifdef TRANSPARENCY
|
|
2759
|
-
uniform float transparency;
|
|
2760
|
-
#endif
|
|
2761
|
-
#ifdef REFLECTIVITY
|
|
2762
|
-
uniform float reflectivity;
|
|
2763
|
-
#endif
|
|
2764
|
-
#ifdef CLEARCOAT
|
|
2765
|
-
uniform float clearcoat;
|
|
2766
|
-
uniform float clearcoatRoughness;
|
|
2767
|
-
#endif
|
|
2768
|
-
#ifdef USE_SHEEN
|
|
2769
|
-
uniform vec3 sheen;
|
|
2770
|
-
#endif
|
|
2771
|
-
varying vec3 vViewPosition;
|
|
2772
|
-
#ifndef FLAT_SHADED
|
|
2773
|
-
varying vec3 vNormal;
|
|
2774
|
-
#ifdef USE_TANGENT
|
|
2775
|
-
varying vec3 vTangent;
|
|
2776
|
-
varying vec3 vBitangent;
|
|
2777
|
-
#endif
|
|
2778
|
-
#endif
|
|
2779
|
-
#include <common>
|
|
2780
|
-
#include <packing>
|
|
2781
|
-
#include <dithering_pars_fragment>
|
|
2782
|
-
#include <color_pars_fragment>
|
|
2783
|
-
#include <uv_pars_fragment>
|
|
2784
|
-
#include <uv2_pars_fragment>
|
|
2785
|
-
#include <map_pars_fragment>
|
|
2786
|
-
#include <alphamap_pars_fragment>
|
|
2787
|
-
#include <aomap_pars_fragment>
|
|
2788
|
-
#include <lightmap_pars_fragment>
|
|
2789
|
-
#include <emissivemap_pars_fragment>
|
|
2790
|
-
#include <bsdfs>
|
|
2791
|
-
#include <cube_uv_reflection_fragment>
|
|
2792
|
-
#include <envmap_common_pars_fragment>
|
|
2793
|
-
#include <envmap_physical_pars_fragment>
|
|
2794
|
-
#include <fog_pars_fragment>
|
|
2795
|
-
#include <lights_pars_begin>
|
|
2796
|
-
#include <lights_physical_pars_fragment>
|
|
2797
|
-
#include <shadowmap_pars_fragment>
|
|
2798
|
-
#include <bumpmap_pars_fragment>
|
|
2799
|
-
#include <normalmap_pars_fragment>
|
|
2800
|
-
#include <clearcoat_pars_fragment>
|
|
2801
|
-
#include <roughnessmap_pars_fragment>
|
|
2802
|
-
#include <metalnessmap_pars_fragment>
|
|
2803
|
-
#include <logdepthbuf_pars_fragment>
|
|
2804
|
-
#include <clipping_planes_pars_fragment>
|
|
2805
|
-
void main() {
|
|
2806
|
-
#include <clipping_planes_fragment>
|
|
2807
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2808
|
-
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
2809
|
-
vec3 totalEmissiveRadiance = emissive;
|
|
2810
|
-
#include <logdepthbuf_fragment>
|
|
2811
|
-
#include <map_fragment>
|
|
2812
|
-
#include <color_fragment>
|
|
2813
|
-
#include <alphamap_fragment>
|
|
2814
|
-
#include <alphatest_fragment>
|
|
2815
|
-
#include <roughnessmap_fragment>
|
|
2816
|
-
#include <metalnessmap_fragment>
|
|
2817
|
-
#include <normal_fragment_begin>
|
|
2818
|
-
#include <normal_fragment_maps>
|
|
2819
|
-
#include <clearcoat_normal_fragment_begin>
|
|
2820
|
-
#include <clearcoat_normal_fragment_maps>
|
|
2821
|
-
#include <emissivemap_fragment>
|
|
2822
|
-
#include <lights_physical_fragment>
|
|
2823
|
-
#include <lights_fragment_begin>
|
|
2824
|
-
#include <lights_fragment_maps>
|
|
2825
|
-
#include <lights_fragment_end>
|
|
2826
|
-
#include <aomap_fragment>
|
|
2827
|
-
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
2828
|
-
#ifdef TRANSPARENCY
|
|
2829
|
-
diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );
|
|
2830
|
-
#endif
|
|
2831
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2832
|
-
#include <tonemapping_fragment>
|
|
2833
|
-
#include <encodings_fragment>
|
|
2834
|
-
#include <fog_fragment>
|
|
2835
|
-
#include <premultiplied_alpha_fragment>
|
|
2836
|
-
#include <dithering_fragment>
|
|
2837
|
-
}`,Vm=`#define STANDARD
|
|
2838
|
-
varying vec3 vViewPosition;
|
|
2839
|
-
#ifndef FLAT_SHADED
|
|
2840
|
-
varying vec3 vNormal;
|
|
2841
|
-
#ifdef USE_TANGENT
|
|
2842
|
-
varying vec3 vTangent;
|
|
2843
|
-
varying vec3 vBitangent;
|
|
2844
|
-
#endif
|
|
2845
|
-
#endif
|
|
2846
|
-
#include <common>
|
|
2847
|
-
#include <uv_pars_vertex>
|
|
2848
|
-
#include <uv2_pars_vertex>
|
|
2849
|
-
#include <displacementmap_pars_vertex>
|
|
2850
|
-
#include <color_pars_vertex>
|
|
2851
|
-
#include <fog_pars_vertex>
|
|
2852
|
-
#include <morphtarget_pars_vertex>
|
|
2853
|
-
#include <skinning_pars_vertex>
|
|
2854
|
-
#include <shadowmap_pars_vertex>
|
|
2855
|
-
#include <logdepthbuf_pars_vertex>
|
|
2856
|
-
#include <clipping_planes_pars_vertex>
|
|
2857
|
-
void main() {
|
|
2858
|
-
#include <uv_vertex>
|
|
2859
|
-
#include <uv2_vertex>
|
|
2860
|
-
#include <color_vertex>
|
|
2861
|
-
#include <beginnormal_vertex>
|
|
2862
|
-
#include <morphnormal_vertex>
|
|
2863
|
-
#include <skinbase_vertex>
|
|
2864
|
-
#include <skinnormal_vertex>
|
|
2865
|
-
#include <defaultnormal_vertex>
|
|
2866
|
-
#ifndef FLAT_SHADED
|
|
2867
|
-
vNormal = normalize( transformedNormal );
|
|
2868
|
-
#ifdef USE_TANGENT
|
|
2869
|
-
vTangent = normalize( transformedTangent );
|
|
2870
|
-
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
2871
|
-
#endif
|
|
2872
|
-
#endif
|
|
2873
|
-
#include <begin_vertex>
|
|
2874
|
-
#include <morphtarget_vertex>
|
|
2875
|
-
#include <skinning_vertex>
|
|
2876
|
-
#include <displacementmap_vertex>
|
|
2877
|
-
#include <project_vertex>
|
|
2878
|
-
#include <logdepthbuf_vertex>
|
|
2879
|
-
#include <clipping_planes_vertex>
|
|
2880
|
-
vViewPosition = - mvPosition.xyz;
|
|
2881
|
-
#include <worldpos_vertex>
|
|
2882
|
-
#include <shadowmap_vertex>
|
|
2883
|
-
#include <fog_vertex>
|
|
2884
|
-
}`,km=`#define NORMAL
|
|
2885
|
-
uniform float opacity;
|
|
2886
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2887
|
-
varying vec3 vViewPosition;
|
|
2888
|
-
#endif
|
|
2889
|
-
#ifndef FLAT_SHADED
|
|
2890
|
-
varying vec3 vNormal;
|
|
2891
|
-
#ifdef USE_TANGENT
|
|
2892
|
-
varying vec3 vTangent;
|
|
2893
|
-
varying vec3 vBitangent;
|
|
2894
|
-
#endif
|
|
2895
|
-
#endif
|
|
2896
|
-
#include <packing>
|
|
2897
|
-
#include <uv_pars_fragment>
|
|
2898
|
-
#include <bumpmap_pars_fragment>
|
|
2899
|
-
#include <normalmap_pars_fragment>
|
|
2900
|
-
#include <logdepthbuf_pars_fragment>
|
|
2901
|
-
#include <clipping_planes_pars_fragment>
|
|
2902
|
-
void main() {
|
|
2903
|
-
#include <clipping_planes_fragment>
|
|
2904
|
-
#include <logdepthbuf_fragment>
|
|
2905
|
-
#include <normal_fragment_begin>
|
|
2906
|
-
#include <normal_fragment_maps>
|
|
2907
|
-
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
|
2908
|
-
}`,Wm=`#define NORMAL
|
|
2909
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2910
|
-
varying vec3 vViewPosition;
|
|
2911
|
-
#endif
|
|
2912
|
-
#ifndef FLAT_SHADED
|
|
2913
|
-
varying vec3 vNormal;
|
|
2914
|
-
#ifdef USE_TANGENT
|
|
2915
|
-
varying vec3 vTangent;
|
|
2916
|
-
varying vec3 vBitangent;
|
|
2917
|
-
#endif
|
|
2918
|
-
#endif
|
|
2919
|
-
#include <common>
|
|
2920
|
-
#include <uv_pars_vertex>
|
|
2921
|
-
#include <displacementmap_pars_vertex>
|
|
2922
|
-
#include <morphtarget_pars_vertex>
|
|
2923
|
-
#include <skinning_pars_vertex>
|
|
2924
|
-
#include <logdepthbuf_pars_vertex>
|
|
2925
|
-
#include <clipping_planes_pars_vertex>
|
|
2926
|
-
void main() {
|
|
2927
|
-
#include <uv_vertex>
|
|
2928
|
-
#include <beginnormal_vertex>
|
|
2929
|
-
#include <morphnormal_vertex>
|
|
2930
|
-
#include <skinbase_vertex>
|
|
2931
|
-
#include <skinnormal_vertex>
|
|
2932
|
-
#include <defaultnormal_vertex>
|
|
2933
|
-
#ifndef FLAT_SHADED
|
|
2934
|
-
vNormal = normalize( transformedNormal );
|
|
2935
|
-
#ifdef USE_TANGENT
|
|
2936
|
-
vTangent = normalize( transformedTangent );
|
|
2937
|
-
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
2938
|
-
#endif
|
|
2939
|
-
#endif
|
|
2940
|
-
#include <begin_vertex>
|
|
2941
|
-
#include <morphtarget_vertex>
|
|
2942
|
-
#include <skinning_vertex>
|
|
2943
|
-
#include <displacementmap_vertex>
|
|
2944
|
-
#include <project_vertex>
|
|
2945
|
-
#include <logdepthbuf_vertex>
|
|
2946
|
-
#include <clipping_planes_vertex>
|
|
2947
|
-
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
|
2948
|
-
vViewPosition = - mvPosition.xyz;
|
|
2949
|
-
#endif
|
|
2950
|
-
}`,Xm=`uniform vec3 diffuse;
|
|
2951
|
-
uniform float opacity;
|
|
2952
|
-
#include <common>
|
|
2953
|
-
#include <color_pars_fragment>
|
|
2954
|
-
#include <map_particle_pars_fragment>
|
|
2955
|
-
#include <fog_pars_fragment>
|
|
2956
|
-
#include <logdepthbuf_pars_fragment>
|
|
2957
|
-
#include <clipping_planes_pars_fragment>
|
|
2958
|
-
void main() {
|
|
2959
|
-
#include <clipping_planes_fragment>
|
|
2960
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
2961
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2962
|
-
#include <logdepthbuf_fragment>
|
|
2963
|
-
#include <map_particle_fragment>
|
|
2964
|
-
#include <color_fragment>
|
|
2965
|
-
#include <alphatest_fragment>
|
|
2966
|
-
outgoingLight = diffuseColor.rgb;
|
|
2967
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
2968
|
-
#include <tonemapping_fragment>
|
|
2969
|
-
#include <encodings_fragment>
|
|
2970
|
-
#include <fog_fragment>
|
|
2971
|
-
#include <premultiplied_alpha_fragment>
|
|
2972
|
-
}`,jm=`uniform float size;
|
|
2973
|
-
uniform float scale;
|
|
2974
|
-
#include <common>
|
|
2975
|
-
#include <color_pars_vertex>
|
|
2976
|
-
#include <fog_pars_vertex>
|
|
2977
|
-
#include <morphtarget_pars_vertex>
|
|
2978
|
-
#include <logdepthbuf_pars_vertex>
|
|
2979
|
-
#include <clipping_planes_pars_vertex>
|
|
2980
|
-
void main() {
|
|
2981
|
-
#include <color_vertex>
|
|
2982
|
-
#include <begin_vertex>
|
|
2983
|
-
#include <morphtarget_vertex>
|
|
2984
|
-
#include <project_vertex>
|
|
2985
|
-
gl_PointSize = size;
|
|
2986
|
-
#ifdef USE_SIZEATTENUATION
|
|
2987
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
2988
|
-
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
2989
|
-
#endif
|
|
2990
|
-
#include <logdepthbuf_vertex>
|
|
2991
|
-
#include <clipping_planes_vertex>
|
|
2992
|
-
#include <worldpos_vertex>
|
|
2993
|
-
#include <fog_vertex>
|
|
2994
|
-
}`,qm=`uniform vec3 color;
|
|
2995
|
-
uniform float opacity;
|
|
2996
|
-
#include <common>
|
|
2997
|
-
#include <packing>
|
|
2998
|
-
#include <fog_pars_fragment>
|
|
2999
|
-
#include <bsdfs>
|
|
3000
|
-
#include <lights_pars_begin>
|
|
3001
|
-
#include <shadowmap_pars_fragment>
|
|
3002
|
-
#include <shadowmask_pars_fragment>
|
|
3003
|
-
void main() {
|
|
3004
|
-
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
3005
|
-
#include <tonemapping_fragment>
|
|
3006
|
-
#include <encodings_fragment>
|
|
3007
|
-
#include <fog_fragment>
|
|
3008
|
-
}`,Ym=`#include <fog_pars_vertex>
|
|
3009
|
-
#include <shadowmap_pars_vertex>
|
|
3010
|
-
void main() {
|
|
3011
|
-
#include <begin_vertex>
|
|
3012
|
-
#include <project_vertex>
|
|
3013
|
-
#include <worldpos_vertex>
|
|
3014
|
-
#include <shadowmap_vertex>
|
|
3015
|
-
#include <fog_vertex>
|
|
3016
|
-
}`,Zm=`uniform vec3 diffuse;
|
|
3017
|
-
uniform float opacity;
|
|
3018
|
-
#include <common>
|
|
3019
|
-
#include <uv_pars_fragment>
|
|
3020
|
-
#include <map_pars_fragment>
|
|
3021
|
-
#include <alphamap_pars_fragment>
|
|
3022
|
-
#include <fog_pars_fragment>
|
|
3023
|
-
#include <logdepthbuf_pars_fragment>
|
|
3024
|
-
#include <clipping_planes_pars_fragment>
|
|
3025
|
-
void main() {
|
|
3026
|
-
#include <clipping_planes_fragment>
|
|
3027
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
3028
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3029
|
-
#include <logdepthbuf_fragment>
|
|
3030
|
-
#include <map_fragment>
|
|
3031
|
-
#include <alphamap_fragment>
|
|
3032
|
-
#include <alphatest_fragment>
|
|
3033
|
-
outgoingLight = diffuseColor.rgb;
|
|
3034
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
3035
|
-
#include <tonemapping_fragment>
|
|
3036
|
-
#include <encodings_fragment>
|
|
3037
|
-
#include <fog_fragment>
|
|
3038
|
-
}`,Jm=`uniform float rotation;
|
|
3039
|
-
uniform vec2 center;
|
|
3040
|
-
#include <common>
|
|
3041
|
-
#include <uv_pars_vertex>
|
|
3042
|
-
#include <fog_pars_vertex>
|
|
3043
|
-
#include <logdepthbuf_pars_vertex>
|
|
3044
|
-
#include <clipping_planes_pars_vertex>
|
|
3045
|
-
void main() {
|
|
3046
|
-
#include <uv_vertex>
|
|
3047
|
-
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
3048
|
-
vec2 scale;
|
|
3049
|
-
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
3050
|
-
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
3051
|
-
#ifndef USE_SIZEATTENUATION
|
|
3052
|
-
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3053
|
-
if ( isPerspective ) scale *= - mvPosition.z;
|
|
3054
|
-
#endif
|
|
3055
|
-
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
3056
|
-
vec2 rotatedPosition;
|
|
3057
|
-
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
3058
|
-
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
3059
|
-
mvPosition.xy += rotatedPosition;
|
|
3060
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
3061
|
-
#include <logdepthbuf_vertex>
|
|
3062
|
-
#include <clipping_planes_vertex>
|
|
3063
|
-
#include <fog_vertex>
|
|
3064
|
-
}`,je={alphamap_fragment:Op,alphamap_pars_fragment:Dp,alphatest_fragment:Ip,aomap_fragment:Np,aomap_pars_fragment:Fp,begin_vertex:Bp,beginnormal_vertex:Up,bsdfs:zp,bumpmap_pars_fragment:Gp,clipping_planes_fragment:Hp,clipping_planes_pars_fragment:Vp,clipping_planes_pars_vertex:kp,clipping_planes_vertex:Wp,color_fragment:Xp,color_pars_fragment:jp,color_pars_vertex:qp,color_vertex:Yp,common:Zp,cube_uv_reflection_fragment:Jp,defaultnormal_vertex:Qp,displacementmap_pars_vertex:Kp,displacementmap_vertex:$p,emissivemap_fragment:ev,emissivemap_pars_fragment:tv,encodings_fragment:nv,encodings_pars_fragment:rv,envmap_fragment:iv,envmap_common_pars_fragment:av,envmap_pars_fragment:ov,envmap_pars_vertex:sv,envmap_physical_pars_fragment:yv,envmap_vertex:lv,fog_vertex:cv,fog_pars_vertex:uv,fog_fragment:hv,fog_pars_fragment:fv,gradientmap_pars_fragment:dv,lightmap_fragment:pv,lightmap_pars_fragment:vv,lights_lambert_vertex:mv,lights_pars_begin:gv,lights_toon_fragment:xv,lights_toon_pars_fragment:_v,lights_phong_fragment:bv,lights_phong_pars_fragment:wv,lights_physical_fragment:Mv,lights_physical_pars_fragment:Ev,lights_fragment_begin:Tv,lights_fragment_maps:Sv,lights_fragment_end:Av,logdepthbuf_fragment:Lv,logdepthbuf_pars_fragment:Pv,logdepthbuf_pars_vertex:Cv,logdepthbuf_vertex:Rv,map_fragment:Ov,map_pars_fragment:Dv,map_particle_fragment:Iv,map_particle_pars_fragment:Nv,metalnessmap_fragment:Fv,metalnessmap_pars_fragment:Bv,morphnormal_vertex:Uv,morphtarget_pars_vertex:zv,morphtarget_vertex:Gv,normal_fragment_begin:Hv,normal_fragment_maps:Vv,normalmap_pars_fragment:kv,clearcoat_normal_fragment_begin:Wv,clearcoat_normal_fragment_maps:Xv,clearcoat_pars_fragment:jv,packing:qv,premultiplied_alpha_fragment:Yv,project_vertex:Zv,dithering_fragment:Jv,dithering_pars_fragment:Qv,roughnessmap_fragment:Kv,roughnessmap_pars_fragment:$v,shadowmap_pars_fragment:em,shadowmap_pars_vertex:tm,shadowmap_vertex:nm,shadowmask_pars_fragment:rm,skinbase_vertex:im,skinning_pars_vertex:am,skinning_vertex:om,skinnormal_vertex:sm,specularmap_fragment:lm,specularmap_pars_fragment:cm,tonemapping_fragment:um,tonemapping_pars_fragment:hm,uv_pars_fragment:fm,uv_pars_vertex:dm,uv_vertex:pm,uv2_pars_fragment:vm,uv2_pars_vertex:mm,uv2_vertex:gm,worldpos_vertex:ym,background_frag:xm,background_vert:_m,cube_frag:bm,cube_vert:wm,depth_frag:Mm,depth_vert:Em,distanceRGBA_frag:Tm,distanceRGBA_vert:Sm,equirect_frag:Am,equirect_vert:Lm,linedashed_frag:Pm,linedashed_vert:Cm,meshbasic_frag:Rm,meshbasic_vert:Om,meshlambert_frag:Dm,meshlambert_vert:Im,meshmatcap_frag:Nm,meshmatcap_vert:Fm,meshtoon_frag:Bm,meshtoon_vert:Um,meshphong_frag:zm,meshphong_vert:Gm,meshphysical_frag:Hm,meshphysical_vert:Vm,normal_frag:km,normal_vert:Wm,points_frag:Xm,points_vert:jm,shadow_frag:qm,shadow_vert:Ym,sprite_frag:Zm,sprite_vert:Jm},Un={basic:{uniforms:Nt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:Nt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.fog,le.lights,{emissive:{value:new de(0)}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:Nt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new de(0)},specular:{value:new de(1118481)},shininess:{value:30}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:Nt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new de(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:Nt([le.common,le.specularmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new de(0)},specular:{value:new de(1118481)},shininess:{value:30}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:Nt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:Nt([le.points,le.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:Nt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:Nt([le.common,le.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:Nt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:je.normal_vert,fragmentShader:je.normal_frag},sprite:{uniforms:Nt([le.sprite,le.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new Ut},t2D:{value:null}},vertexShader:je.background_vert,fragmentShader:je.background_frag},cube:{uniforms:Nt([le.envmap,{opacity:{value:1}}]),vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distanceRGBA:{uniforms:Nt([le.common,le.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distanceRGBA_vert,fragmentShader:je.distanceRGBA_frag},shadow:{uniforms:Nt([le.lights,le.fog,{color:{value:new de(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};Un.physical={uniforms:Nt([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new X(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new de(0)},transparency:{value:0}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};function Qm(e,t,n,r){var i=new de(0),a=0,o,s,c=null,l=0,u=null;function h(d,m,g,y){var p=m.background,v=e.xr,_=v.getSession&&v.getSession();if(_&&_.environmentBlendMode==="additive"&&(p=null),p===null?f(i,a):p&&p.isColor&&(f(p,1),y=!0),(e.autoClear||y)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLCubeRenderTarget||p.mapping===ki)){s===void 0&&(s=new ut(new Ao(1,1,1),new Wt({type:"BackgroundCubeMaterial",uniforms:ri(Un.cube.uniforms),vertexShader:Un.cube.vertexShader,fragmentShader:Un.cube.fragmentShader,side:At,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(b,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(s));var x=p.isWebGLCubeRenderTarget?p.texture:p;s.material.uniforms.envMap.value=x,s.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,(c!==p||l!==x.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=p,l=x.version,u=e.toneMapping),d.unshift(s,s.geometry,s.material,0,0,null)}else p&&p.isTexture&&(o===void 0&&(o=new ut(new li(2,2),new Wt({type:"BackgroundMaterial",uniforms:ri(Un.background.uniforms),vertexShader:Un.background.vertexShader,fragmentShader:Un.background.fragmentShader,side:Gi,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=p,p.matrixAutoUpdate===!0&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),(c!==p||l!==p.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=p,l=p.version,u=e.toneMapping),d.unshift(o,o.geometry,o.material,0,0,null))}function f(d,m){t.buffers.color.setClear(d.r,d.g,d.b,m,r)}return{getClearColor:function(){return i},setClearColor:function(d,m){i.set(d),a=m!==void 0?m:1,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(d){a=d,f(i,a)},render:h}}function Km(e,t,n,r){var i=r.isWebGL2,a;function o(l){a=l}function s(l,u){e.drawArrays(a,l,u),n.update(u,a)}function c(l,u,h,f){if(f!==0){var d,m;if(i)d=e,m="drawArraysInstanced";else if(d=t.get("ANGLE_instanced_arrays"),m="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[m](a,u,h,f),n.update(h,a,f)}}this.setMode=o,this.render=s,this.renderInstances=c}function $m(e,t,n){var r;function i(){if(r!==void 0)return r;var T=t.get("EXT_texture_filter_anisotropic");return T!==null?r=e.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT):r=0,r}function a(T){if(T==="highp"){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o=typeof WebGL2RenderingContext!="undefined"&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&e instanceof WebGL2ComputeRenderingContext,s=n.precision!==void 0?n.precision:"highp",c=a(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),h=e.getParameter(35660),f=e.getParameter(3379),d=e.getParameter(34076),m=e.getParameter(34921),g=e.getParameter(36347),y=e.getParameter(36348),p=e.getParameter(36349),v=h>0,_=o||!!t.get("OES_texture_float"),x=v&&_,b=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:f,maxCubemapSize:d,maxAttributes:m,maxVertexUniforms:g,maxVaryings:y,maxFragmentUniforms:p,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:x,maxSamples:b}}function eg(){var e=this,t=null,n=0,r=!1,i=!1,a=new yn,o=new Ut,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h,f){var d=u.length!==0||h||n!==0||r;return r=h,t=l(u,f,0),n=u.length,d},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(u,h,f,d,m,g){if(!r||u===null||u.length===0||i&&!f)i?l(null):c();else{var y=i?0:n,p=y*4,v=m.clippingState||null;s.value=v,v=l(u,d,p,g);for(var _=0;_!==p;++_)v[_]=t[_];m.clippingState=v,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=y}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(u,h,f,d){var m=u!==null?u.length:0,g=null;if(m!==0){if(g=s.value,d!==!0||g===null){var y=f+m*4,p=h.matrixWorldInverse;o.getNormalMatrix(p),(g===null||g.length<y)&&(g=new Float32Array(y));for(var v=0,_=f;v!==m;++v,_+=4)a.copy(u[v]).applyMatrix4(p,o),a.normal.toArray(g,_),g[_+3]=a.constant}s.value=g,s.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function tg(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function ng(e,t,n){var r=new WeakMap,i=new WeakMap;function a(u){var h=u.target,f=r.get(h);f.index!==null&&t.remove(f.index);for(var d in f.attributes)t.remove(f.attributes[d]);h.removeEventListener("dispose",a),r.delete(h);var m=i.get(f);m&&(t.remove(m),i.delete(f)),n.memory.geometries--}function o(u,h){var f=r.get(h);return f||(h.addEventListener("dispose",a),h.isBufferGeometry?f=h:h.isGeometry&&(h._bufferGeometry===void 0&&(h._bufferGeometry=new ve().setFromObject(u)),f=h._bufferGeometry),r.set(h,f),n.memory.geometries++,f)}function s(u){var h=u.index,f=u.attributes;h!==null&&t.update(h,34963);for(var d in f)t.update(f[d],34962);var m=u.morphAttributes;for(var d in m)for(var g=m[d],y=0,p=g.length;y<p;y++)t.update(g[y],34962)}function c(u){var h=[],f=u.index,d=u.attributes.position,m=0;if(f!==null){var g=f.array;m=f.version;for(var y=0,p=g.length;y<p;y+=3){var v=g[y+0],_=g[y+1],x=g[y+2];h.push(v,_,_,x,x,v)}}else{var g=d.array;m=d.version;for(var y=0,p=g.length/3-1;y<p;y+=3){var v=y+0,_=y+1,x=y+2;h.push(v,_,_,x,x,v)}}var b=new(wu(h)>65535?ea:$i)(h,1);b.version=m,t.update(b,34963);var T=i.get(u);T&&t.remove(T),i.set(u,b)}function l(u){var h=i.get(u);if(h){var f=u.index;f!==null&&h.version<f.version&&c(u)}else c(u);return i.get(u)}return{get:o,update:s,getWireframeAttribute:l}}function rg(e,t,n,r){var i=r.isWebGL2,a;function o(f){a=f}var s,c;function l(f){s=f.type,c=f.bytesPerElement}function u(f,d){e.drawElements(a,d,s,f*c),n.update(d,a)}function h(f,d,m,g){if(g!==0){var y,p;if(i)y=e,p="drawElementsInstanced";else if(y=t.get("ANGLE_instanced_arrays"),p="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[p](a,m,s,d*c,g),n.update(m,a,g)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=h}function ig(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(a,o,s){switch(s=s||1,n.calls++,o){case 4:n.triangles+=s*(a/3);break;case 1:n.lines+=s*(a/2);break;case 3:n.lines+=s*(a-1);break;case 2:n.lines+=s*a;break;case 0:n.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function ag(e,t){return Math.abs(t[1])-Math.abs(e[1])}function og(e){var t={},n=new Float32Array(8);function r(i,a,o,s){var c=i.morphTargetInfluences,l=c===void 0?0:c.length,u=t[a.id];if(u===void 0){u=[];for(var h=0;h<l;h++)u[h]=[h,0];t[a.id]=u}for(var f=o.morphTargets&&a.morphAttributes.position,d=o.morphNormals&&a.morphAttributes.normal,h=0;h<l;h++){var m=u[h];m[1]!==0&&(f&&a.deleteAttribute("morphTarget"+h),d&&a.deleteAttribute("morphNormal"+h))}for(var h=0;h<l;h++){var m=u[h];m[0]=h,m[1]=c[h]}u.sort(ag);for(var g=0,h=0;h<8;h++){var m=u[h];if(m){var y=m[0],p=m[1];if(p){f&&a.setAttribute("morphTarget"+h,f[y]),d&&a.setAttribute("morphNormal"+h,d[y]),n[h]=p,g+=p;continue}}n[h]=0}var v=a.morphTargetsRelative?1:1-g;s.getUniforms().setValue(e,"morphTargetBaseInfluence",v),s.getUniforms().setValue(e,"morphTargetInfluences",n)}return{update:r}}function sg(e,t,n,r){var i=new WeakMap;function a(s){var c=r.render.frame,l=s.geometry,u=t.get(s,l);return i.get(u)!==c&&(l.isGeometry&&u.updateFromObject(s),t.update(u),i.set(u,c)),s.isInstancedMesh&&n.update(s.instanceMatrix,34962),u}function o(){i=new WeakMap}return{update:a,dispose:o}}function ar(e,t,n,r,i,a,o,s,c,l){e=e!==void 0?e:[],t=t!==void 0?t:zs,o=o!==void 0?o:xr,ot.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}ar.prototype=Object.create(ot.prototype),ar.prototype.constructor=ar,ar.prototype.isCubeTexture=!0,Object.defineProperty(ar.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});function oa(e,t,n,r){ot.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=_t,this.minFilter=_t,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}oa.prototype=Object.create(ot.prototype),oa.prototype.constructor=oa,oa.prototype.isDataTexture2DArray=!0;function sa(e,t,n,r){ot.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=_t,this.minFilter=_t,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}sa.prototype=Object.create(ot.prototype),sa.prototype.constructor=sa,sa.prototype.isDataTexture3D=!0;var Su=new ot,lg=new oa,cg=new sa,Au=new ar,Lu=[],Pu=[],Cu=new Float32Array(16),Ru=new Float32Array(9),Ou=new Float32Array(4);function ci(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=Lu[i];if(a===void 0&&(a=new Float32Array(i),Lu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function en(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Yt(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Du(e,t){var n=Pu[t];n===void 0&&(n=new Int32Array(t),Pu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function ug(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function hg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(en(n,t))return;e.uniform2fv(this.addr,t),Yt(n,t)}}function fg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(en(n,t))return;e.uniform3fv(this.addr,t),Yt(n,t)}}function dg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(en(n,t))return;e.uniform4fv(this.addr,t),Yt(n,t)}}function pg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(en(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Yt(n,t)}else{if(en(n,r))return;Ou.set(r),e.uniformMatrix2fv(this.addr,!1,Ou),Yt(n,r)}}function vg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(en(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Yt(n,t)}else{if(en(n,r))return;Ru.set(r),e.uniformMatrix3fv(this.addr,!1,Ru),Yt(n,r)}}function mg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(en(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Yt(n,t)}else{if(en(n,r))return;Cu.set(r),e.uniformMatrix4fv(this.addr,!1,Cu),Yt(n,r)}}function gg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||Su,i)}function yg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||lg,i)}function xg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||cg,i)}function _g(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||Au,i)}function bg(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function wg(e,t){var n=this.cache;en(n,t)||(e.uniform2iv(this.addr,t),Yt(n,t))}function Mg(e,t){var n=this.cache;en(n,t)||(e.uniform3iv(this.addr,t),Yt(n,t))}function Eg(e,t){var n=this.cache;en(n,t)||(e.uniform4iv(this.addr,t),Yt(n,t))}function Tg(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Sg(e){switch(e){case 5126:return ug;case 35664:return hg;case 35665:return fg;case 35666:return dg;case 35674:return pg;case 35675:return vg;case 35676:return mg;case 5124:case 35670:return bg;case 35667:case 35671:return wg;case 35668:case 35672:return Mg;case 35669:case 35673:return Eg;case 5125:return Tg;case 35678:case 36198:case 36298:case 36306:case 35682:return gg;case 35679:case 36299:case 36307:return xg;case 35680:case 36300:case 36308:case 36293:return _g;case 36289:case 36303:case 36311:case 36292:return yg}}function Ag(e,t){e.uniform1fv(this.addr,t)}function Lg(e,t){e.uniform1iv(this.addr,t)}function Pg(e,t){e.uniform2iv(this.addr,t)}function Cg(e,t){e.uniform3iv(this.addr,t)}function Rg(e,t){e.uniform4iv(this.addr,t)}function Og(e,t){var n=ci(t,this.size,2);e.uniform2fv(this.addr,n)}function Dg(e,t){var n=ci(t,this.size,3);e.uniform3fv(this.addr,n)}function Ig(e,t){var n=ci(t,this.size,4);e.uniform4fv(this.addr,n)}function Ng(e,t){var n=ci(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Fg(e,t){var n=ci(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Bg(e,t){var n=ci(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ug(e,t,n){var r=t.length,i=Du(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||Su,i[a])}function zg(e,t,n){var r=t.length,i=Du(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||Au,i[a])}function Gg(e){switch(e){case 5126:return Ag;case 35664:return Og;case 35665:return Dg;case 35666:return Ig;case 35674:return Ng;case 35675:return Fg;case 35676:return Bg;case 5124:case 35670:return Lg;case 35667:case 35671:return Pg;case 35668:case 35672:return Cg;case 35669:case 35673:return Rg;case 35678:case 36198:case 36298:case 36306:case 35682:return Ug;case 35680:case 36300:case 36308:case 36293:return zg}}function Hg(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=Sg(t.type)}function Iu(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=Gg(t.type)}Iu.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Yt(t,e)};function Nu(e){this.id=e,this.seq=[],this.map={}}Nu.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Ml=/([\w\d_]+)(\])?(\[|\.)?/g;function Fu(e,t){e.seq.push(t),e.map[t.id]=t}function Vg(e,t,n){var r=e.name,i=r.length;for(Ml.lastIndex=0;;){var a=Ml.exec(r),o=Ml.lastIndex,s=a[1],c=a[2]==="]",l=a[3];if(c&&(s=s|0),l===void 0||l==="["&&o+2===i){Fu(n,l===void 0?new Hg(s,e,t):new Iu(s,e,t));break}else{var u=n.map,h=u[s];h===void 0&&(h=new Nu(s),Fu(n,h)),n=h}}}function or(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r),a=e.getUniformLocation(t,i.name);Vg(i,a,this)}}or.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)},or.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},or.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}},or.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};function Bu(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var kg=0;function Wg(e){for(var t=e.split(`
|
|
3065
|
-
`),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join(`
|
|
3066
|
-
`)}function Uu(e){switch(e){case kt:return["Linear","( value )"];case uo:return["sRGB","( value )"];case Ys:return["RGBE","( value )"];case lu:return["RGBM","( value, 7.0 )"];case cu:return["RGBM","( value, 16.0 )"];case uu:return["RGBD","( value, 256.0 )"];case qs:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case lp:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function zu(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i==="")return"";var a=e.getShaderSource(t);return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+`
|
|
3067
|
-
`+i+Wg(a)}function la(e,t){var n=Uu(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Xg(e,t){var n=Uu(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function jg(e,t){var n;switch(t){case qc:n="Linear";break;case ld:n="Reinhard";break;case cd:n="Uncharted2";break;case ud:n="OptimizedCineon";break;case hd:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function qg(e){var t=[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return t.filter(ca).join(`
|
|
3068
|
-
`)}function Yg(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push("#define "+n+" "+r)}return t.join(`
|
|
3069
|
-
`)}function Zg(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name;n[o]=e.getAttribLocation(t,o)}return n}function ca(e){return e!==""}function Gu(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Hu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Jg=/^[ \t]*#include +<([\w\d./]+)>/gm;function El(e){return e.replace(Jg,Qg)}function Qg(e,t){var n=je[t];if(n===void 0)throw new Error("Can not resolve #include <"+t+">");return El(n)}var Kg=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,$g=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function Vu(e){return e.replace($g,ku).replace(Kg,ey)}function ey(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ku(e,t,n,r)}function ku(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Wu(e){var t="precision "+e.precision+` float;
|
|
3070
|
-
precision `+e.precision+" int;";return e.precision==="highp"?t+=`
|
|
3071
|
-
#define HIGH_PRECISION`:e.precision==="mediump"?t+=`
|
|
3072
|
-
#define MEDIUM_PRECISION`:e.precision==="lowp"&&(t+=`
|
|
3073
|
-
#define LOW_PRECISION`),t}function ty(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===Uc?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===Gf?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===zi&&(t="SHADOWMAP_TYPE_VSM"),t}function ny(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case zs:case Gs:t="ENVMAP_TYPE_CUBE";break;case ki:case Vs:t="ENVMAP_TYPE_CUBE_UV";break;case Yc:case Hs:t="ENVMAP_TYPE_EQUIREC";break;case Zc:t="ENVMAP_TYPE_SPHERE";break}return t}function ry(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case Gs:case Hs:t="ENVMAP_MODE_REFRACTION";break}return t}function iy(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case eo:t="ENVMAP_BLENDING_MULTIPLY";break;case od:t="ENVMAP_BLENDING_MIX";break;case sd:t="ENVMAP_BLENDING_ADD";break}return t}function ay(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=ty(n),c=ny(n),l=ry(n),u=iy(n),h=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?"":qg(n),d=Yg(i),m=r.createProgram(),g,y;if(n.isRawShaderMaterial?(g=[d].filter(ca).join(`
|
|
3074
|
-
`),g.length>0&&(g+=`
|
|
3075
|
-
`),y=[f,d].filter(ca).join(`
|
|
3076
|
-
`),y.length>0&&(y+=`
|
|
3077
|
-
`)):(g=[Wu(n),"#define SHADER_NAME "+n.shaderName,d,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+h,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+s:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," 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",`
|
|
3078
|
-
`].filter(ca).join(`
|
|
3079
|
-
`),y=[f,Wu(n),"#define SHADER_NAME "+n.shaderName,d,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+h,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+s:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Vi?"#define TONE_MAPPING":"",n.toneMapping!==Vi?je.tonemapping_pars_fragment:"",n.toneMapping!==Vi?jg("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?je.encodings_pars_fragment:"",n.mapEncoding?la("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?la("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?la("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?la("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?la("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?Xg("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
|
3080
|
-
`].filter(ca).join(`
|
|
3081
|
-
`)),a=El(a),a=Gu(a,n),a=Hu(a,n),o=El(o),o=Gu(o,n),o=Hu(o,n),a=Vu(a),o=Vu(o),n.isWebGL2&&!n.isRawShaderMaterial){var p=!1,v=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(p=!0,a=a.replace(v,""),o=o.replace(v,"")),g=[`#version 300 es
|
|
3082
|
-
`,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3083
|
-
`)+`
|
|
3084
|
-
`+g,y=[`#version 300 es
|
|
3085
|
-
`,"#define varying in",p?"":"out highp vec4 pc_fragColor;",p?"":"#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(`
|
|
3086
|
-
`)+`
|
|
3087
|
-
`+y}var _=g+a,x=y+o,b=Bu(r,35633,_),T=Bu(r,35632,x);if(r.attachShader(m,b),r.attachShader(m,T),n.index0AttributeName!==void 0?r.bindAttribLocation(m,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),N=r.getShaderInfoLog(b).trim(),O=r.getShaderInfoLog(T).trim(),J=!0,F=!0;if(r.getProgramParameter(m,35714)===!1){J=!1;var B=zu(r,b,"vertex"),V=zu(r,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",C,B,V)}else C!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):(N===""||O==="")&&(F=!1);F&&(this.diagnostics={runnable:J,programLog:C,vertexShader:{log:N,prefix:g},fragmentShader:{log:O,prefix:y}})}r.deleteShader(b),r.deleteShader(T);var Y;this.getUniforms=function(){return Y===void 0&&(Y=new or(r,m)),Y};var D;return this.getAttributes=function(){return D===void 0&&(D=Zg(r,m)),D},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=kg++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=T,this}function oy(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={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"},h=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function f(g,y){var p;if(y){var v=Un[y];p={name:g.type,uniforms:Lp.clone(v.uniforms),vertexShader:v.vertexShader,fragmentShader:v.fragmentShader}}else p={name:g.type,uniforms:g.uniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader};return p}function d(g){var y=g.skeleton,p=y.bones;if(o)return 1024;var v=c,_=Math.floor((v-20)/4),x=Math.min(_,p.length);return x<p.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+p.length+" bones. This GPU supports "+x+"."),0):x}function m(g){var y;return g?g.isTexture?y=g.encoding:g.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),y=g.texture.encoding):y=kt,y}this.getParameters=function(g,y,p,v,_,x,b){var T=v.fog,C=g.isMeshStandardMaterial?v.environment:null,N=g.envMap||C,O=u[g.type],J=b.isSkinnedMesh?d(b):0;g.precision!==null&&(s=n.getMaxPrecision(g.precision),s!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",s,"instead."));var F=f(g,O);g.onBeforeCompile(F,e);var B=e.getRenderTarget(),V={isWebGL2:i,shaderID:O,shaderName:F.name,uniforms:F.uniforms,vertexShader:F.vertexShader,fragmentShader:F.fragmentShader,defines:g.defines,isRawShaderMaterial:g.isRawShaderMaterial,isShaderMaterial:g.isShaderMaterial,precision:s,instancing:b.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:B!==null?m(B.texture):e.outputEncoding,map:!!g.map,mapEncoding:m(g.map),matcap:!!g.matcap,matcapEncoding:m(g.matcap),envMap:!!N,envMapMode:N&&N.mapping,envMapEncoding:m(N),envMapCubeUV:!!N&&(N.mapping===ki||N.mapping===Vs),lightMap:!!g.lightMap,lightMapEncoding:m(g.lightMap),aoMap:!!g.aoMap,emissiveMap:!!g.emissiveMap,emissiveMapEncoding:m(g.emissiveMap),bumpMap:!!g.bumpMap,normalMap:!!g.normalMap,objectSpaceNormalMap:g.normalMapType===hp,tangentSpaceNormalMap:g.normalMapType===Vr,clearcoatMap:!!g.clearcoatMap,clearcoatRoughnessMap:!!g.clearcoatRoughnessMap,clearcoatNormalMap:!!g.clearcoatNormalMap,displacementMap:!!g.displacementMap,roughnessMap:!!g.roughnessMap,metalnessMap:!!g.metalnessMap,specularMap:!!g.specularMap,alphaMap:!!g.alphaMap,gradientMap:!!g.gradientMap,sheen:!!g.sheen,combine:g.combine,vertexTangents:g.normalMap&&g.vertexTangents,vertexColors:g.vertexColors,vertexUvs:!!g.map||!!g.bumpMap||!!g.normalMap||!!g.specularMap||!!g.alphaMap||!!g.emissiveMap||!!g.roughnessMap||!!g.metalnessMap||!!g.clearcoatMap||!!g.clearcoatRoughnessMap||!!g.clearcoatNormalMap||!!g.displacementMap,uvsVertexOnly:!(g.map||g.bumpMap||g.normalMap||g.specularMap||g.alphaMap||g.emissiveMap||g.roughnessMap||g.metalnessMap||g.clearcoatNormalMap)&&!!g.displacementMap,fog:!!T,useFog:g.fog,fogExp2:T&&T.isFogExp2,flatShading:g.flatShading,sizeAttenuation:g.sizeAttenuation,logarithmicDepthBuffer:a,skinning:g.skinning&&J>0,maxBones:J,useVertexTexture:o,morphTargets:g.morphTargets,morphNormals:g.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numClippingPlanes:_,numClipIntersection:x,dithering:g.dithering,shadowMapEnabled:e.shadowMap.enabled&&p.length>0,shadowMapType:e.shadowMap.type,toneMapping:g.toneMapped?e.toneMapping:Vi,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:g.premultipliedAlpha,alphaTest:g.alphaTest,doubleSided:g.side===$a,flipSided:g.side===At,depthPacking:g.depthPacking!==void 0?g.depthPacking:!1,index0AttributeName:g.index0AttributeName,extensionDerivatives:g.extensions&&g.extensions.derivatives,extensionFragDepth:g.extensions&&g.extensions.fragDepth,extensionDrawBuffers:g.extensions&&g.extensions.drawBuffers,extensionShaderTextureLOD:g.extensions&&g.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get("EXT_frag_depth")!==null,rendererExtensionDrawBuffers:i||t.get("WEBGL_draw_buffers")!==null,rendererExtensionShaderTextureLod:i||t.get("EXT_shader_texture_lod")!==null,onBeforeCompile:g.onBeforeCompile};return V},this.getProgramCacheKey=function(g){var y=[];if(g.shaderID?y.push(g.shaderID):(y.push(g.fragmentShader),y.push(g.vertexShader)),g.defines!==void 0)for(var p in g.defines)y.push(p),y.push(g.defines[p]);if(g.isRawShaderMaterial===void 0){for(var v=0;v<h.length;v++)y.push(g[h[v]]);y.push(e.outputEncoding),y.push(e.gammaFactor)}return y.push(g.onBeforeCompile.toString()),y.join()},this.acquireProgram=function(g,y){for(var p,v=0,_=r.length;v<_;v++){var x=r[v];if(x.cacheKey===y){p=x,++p.usedTimes;break}}return p===void 0&&(p=new ay(e,y,g),r.push(p)),p},this.releaseProgram=function(g){if(--g.usedTimes===0){var y=r.indexOf(g);r[y]=r[r.length-1],r.pop(),g.destroy()}},this.programs=r}function sy(){var e=new WeakMap;function t(a){var o=e.get(a);return o===void 0&&(o={},e.set(a,o)),o}function n(a){e.delete(a)}function r(a,o,s){e.get(a)[o]=s}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function ly(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function cy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Xu(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(h,f,d,m,g,y){var p=e[t];return p===void 0?(p={id:h.id,object:h,geometry:f,material:d,program:d.program||i,groupOrder:m,renderOrder:h.renderOrder,z:g,group:y},e[t]=p):(p.id=h.id,p.object=h,p.geometry=f,p.material=d,p.program=d.program||i,p.groupOrder=m,p.renderOrder=h.renderOrder,p.z=g,p.group=y),t++,p}function s(h,f,d,m,g,y){var p=o(h,f,d,m,g,y);(d.transparent===!0?r:n).push(p)}function c(h,f,d,m,g,y){var p=o(h,f,d,m,g,y);(d.transparent===!0?r:n).unshift(p)}function l(h,f){n.length>1&&n.sort(h||ly),r.length>1&&r.sort(f||cy)}function u(){for(var h=t,f=e.length;h<f;h++){var d=e[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.program=null,d.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function uy(){var e=new WeakMap;function t(i){var a=i.target;a.removeEventListener("dispose",t),e.delete(a)}function n(i,a){var o=e.get(i),s;return o===void 0?(s=new Xu,e.set(i,new WeakMap),e.get(i).set(a,s),i.addEventListener("dispose",t)):(s=o.get(a),s===void 0&&(s=new Xu,o.set(a,s))),s}function r(){e=new WeakMap}return{get:n,dispose:r}}function hy(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new E,color:new de};break;case"SpotLight":n={position:new E,direction:new E,color:new de,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new E,color:new de,distance:0,decay:0};break;case"HemisphereLight":n={direction:new E,skyColor:new de,groundColor:new de};break;case"RectAreaLight":n={color:new de,position:new E,halfWidth:new E,halfHeight:new E};break}return e[t.id]=n,n}}}function fy(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case"DirectionalLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X};break;case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var dy=0;function py(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function vy(){for(var e=new hy,t=fy(),n={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:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new E);var i=new E,a=new We,o=new We;function s(c,l,u){for(var h=0,f=0,d=0,m=0;m<9;m++)n.probe[m].set(0,0,0);var g=0,y=0,p=0,v=0,_=0,x=0,b=0,T=0,C=u.matrixWorldInverse;c.sort(py);for(var m=0,N=c.length;m<N;m++){var O=c[m],J=O.color,F=O.intensity,B=O.distance,V=O.shadow&&O.shadow.map?O.shadow.map.texture:null;if(O.isAmbientLight)h+=J.r*F,f+=J.g*F,d+=J.b*F;else if(O.isLightProbe)for(var Y=0;Y<9;Y++)n.probe[Y].addScaledVector(O.sh.coefficients[Y],F);else if(O.isDirectionalLight){var D=e.get(O);if(D.color.copy(O.color).multiplyScalar(O.intensity),D.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(C),O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,n.directionalShadow[g]=k,n.directionalShadowMap[g]=V,n.directionalShadowMatrix[g]=O.shadow.matrix,x++}n.directional[g]=D,g++}else if(O.isSpotLight){var D=e.get(O);if(D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),D.color.copy(J).multiplyScalar(F),D.distance=B,D.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(C),D.coneCos=Math.cos(O.angle),D.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),D.decay=O.decay,O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,n.spotShadow[p]=k,n.spotShadowMap[p]=V,n.spotShadowMatrix[p]=O.shadow.matrix,T++}n.spot[p]=D,p++}else if(O.isRectAreaLight){var D=e.get(O);D.color.copy(J).multiplyScalar(F),D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),o.identity(),a.copy(O.matrixWorld),a.premultiply(C),o.extractRotation(a),D.halfWidth.set(O.width*.5,0,0),D.halfHeight.set(0,O.height*.5,0),D.halfWidth.applyMatrix4(o),D.halfHeight.applyMatrix4(o),n.rectArea[v]=D,v++}else if(O.isPointLight){var D=e.get(O);if(D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),D.color.copy(O.color).multiplyScalar(O.intensity),D.distance=O.distance,D.decay=O.decay,O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,k.shadowCameraNear=z.camera.near,k.shadowCameraFar=z.camera.far,n.pointShadow[y]=k,n.pointShadowMap[y]=V,n.pointShadowMatrix[y]=O.shadow.matrix,b++}n.point[y]=D,y++}else if(O.isHemisphereLight){var D=e.get(O);D.direction.setFromMatrixPosition(O.matrixWorld),D.direction.transformDirection(C),D.direction.normalize(),D.skyColor.copy(O.color).multiplyScalar(F),D.groundColor.copy(O.groundColor).multiplyScalar(F),n.hemi[_]=D,_++}}n.ambient[0]=h,n.ambient[1]=f,n.ambient[2]=d;var q=n.hash;(q.directionalLength!==g||q.pointLength!==y||q.spotLength!==p||q.rectAreaLength!==v||q.hemiLength!==_||q.numDirectionalShadows!==x||q.numPointShadows!==b||q.numSpotShadows!==T)&&(n.directional.length=g,n.spot.length=p,n.rectArea.length=v,n.point.length=y,n.hemi.length=_,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=b,n.spotShadowMatrix.length=T,q.directionalLength=g,q.pointLength=y,q.spotLength=p,q.rectAreaLength=v,q.hemiLength=_,q.numDirectionalShadows=x,q.numPointShadows=b,q.numSpotShadows=T,n.version=dy++)}return{setup:s,state:n}}function ju(){var e=new vy,t=[],n=[];function r(){t.length=0,n.length=0}function i(c){t.push(c)}function a(c){n.push(c)}function o(c){e.setup(t,n,c)}var s={lightsArray:t,shadowsArray:n,lights:e};return{init:r,state:s,setupLights:o,pushLight:i,pushShadow:a}}function my(){var e=new WeakMap;function t(i){var a=i.target;a.removeEventListener("dispose",t),e.delete(a)}function n(i,a){var o;return e.has(i)===!1?(o=new ju,e.set(i,new WeakMap),e.get(i).set(a,o),i.addEventListener("dispose",t)):e.get(i).has(a)===!1?(o=new ju,e.get(i).set(a,o)):o=e.get(i).get(a),o}function r(){e=new WeakMap}return{get:n,dispose:r}}function Er(e){Oe.call(this),this.type="MeshDepthMaterial",this.depthPacking=cp,this.skinning=!1,this.morphTargets=!1,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)}Er.prototype=Object.create(Oe.prototype),Er.prototype.constructor=Er,Er.prototype.isMeshDepthMaterial=!0,Er.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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};function Tr(e){Oe.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}Tr.prototype=Object.create(Oe.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isMeshDistanceMaterial=!0,Tr.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var gy=`uniform sampler2D shadow_pass;
|
|
3088
|
-
uniform vec2 resolution;
|
|
3089
|
-
uniform float radius;
|
|
3090
|
-
#include <packing>
|
|
3091
|
-
void main() {
|
|
3092
|
-
float mean = 0.0;
|
|
3093
|
-
float squared_mean = 0.0;
|
|
3094
|
-
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
|
|
3095
|
-
for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
|
|
3096
|
-
#ifdef HORIZONAL_PASS
|
|
3097
|
-
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
|
|
3098
|
-
mean += distribution.x;
|
|
3099
|
-
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
|
3100
|
-
#else
|
|
3101
|
-
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
|
|
3102
|
-
mean += depth;
|
|
3103
|
-
squared_mean += depth * depth;
|
|
3104
|
-
#endif
|
|
3105
|
-
}
|
|
3106
|
-
mean = mean * HALF_SAMPLE_RATE;
|
|
3107
|
-
squared_mean = squared_mean * HALF_SAMPLE_RATE;
|
|
3108
|
-
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3109
|
-
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3110
|
-
}`,yy=`void main() {
|
|
3111
|
-
gl_Position = vec4( position, 1.0 );
|
|
3112
|
-
}`;function qu(e,t,n){var r=new aa,i=new X,a=new X,o=new et,s=[],c=[],l={},u={0:At,1:Gi,2:$a},h=new Wt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new X},radius:{value:4}},vertexShader:yy,fragmentShader:gy}),f=h.clone();f.defines.HORIZONAL_PASS=1;var d=new ve;d.setAttribute("position",new De(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new ut(d,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Uc,this.render=function(b,T,C){if(g.enabled!==!1&&!(g.autoUpdate===!1&&g.needsUpdate===!1)&&b.length!==0){var N=e.getRenderTarget(),O=e.getActiveCubeFace(),J=e.getActiveMipmapLevel(),F=e.state;F.setBlending(Jn),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);for(var B=0,V=b.length;B<V;B++){var Y=b[B],D=Y.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",Y,"has no shadow.");continue}i.copy(D.mapSize);var z=D.getFrameExtents();if(i.multiply(z),a.copy(D.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/z.x),i.x=a.x*z.x,D.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/z.y),i.y=a.y*z.y,D.mapSize.y=a.y)),D.map===null&&!D.isPointLightShadow&&this.type===zi){var k={minFilter:It,magFilter:It,format:on};D.map=new $t(i.x,i.y,k),D.map.texture.name=Y.name+".shadowMap",D.mapPass=new $t(i.x,i.y,k),D.camera.updateProjectionMatrix()}if(D.map===null){var k={minFilter:_t,magFilter:_t,format:on};D.map=new $t(i.x,i.y,k),D.map.texture.name=Y.name+".shadowMap",D.camera.updateProjectionMatrix()}e.setRenderTarget(D.map),e.clear();for(var q=D.getViewportCount(),Z=0;Z<q;Z++){var ee=D.getViewport(Z);o.set(a.x*ee.x,a.y*ee.y,a.x*ee.z,a.y*ee.w),F.viewport(o),D.updateMatrices(Y,Z),r=D.getFrustum(),x(T,C,D.camera,Y,this.type)}!D.isPointLightShadow&&this.type===zi&&y(D,C)}g.needsUpdate=!1,e.setRenderTarget(N,O,J)}};function y(b,T){var C=t.update(m);h.uniforms.shadow_pass.value=b.map.texture,h.uniforms.resolution.value=b.mapSize,h.uniforms.radius.value=b.radius,e.setRenderTarget(b.mapPass),e.clear(),e.renderBufferDirect(T,null,C,h,m,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,e.setRenderTarget(b.map),e.clear(),e.renderBufferDirect(T,null,C,f,m,null)}function p(b,T,C){var N=b<<0|T<<1|C<<2,O=s[N];return O===void 0&&(O=new Er({depthPacking:up,morphTargets:b,skinning:T}),s[N]=O),O}function v(b,T,C){var N=b<<0|T<<1|C<<2,O=c[N];return O===void 0&&(O=new Tr({morphTargets:b,skinning:T}),c[N]=O),O}function _(b,T,C,N,O,J,F){var B=null,V=p,Y=b.customDepthMaterial;if(N.isPointLight===!0&&(V=v,Y=b.customDistanceMaterial),Y===void 0){var D=!1;C.morphTargets===!0&&(D=T.morphAttributes&&T.morphAttributes.position&&T.morphAttributes.position.length>0);var z=!1;b.isSkinnedMesh===!0&&(C.skinning===!0?z=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",b));var k=b.isInstancedMesh===!0;B=V(D,z,k)}else B=Y;if(e.localClippingEnabled&&C.clipShadows===!0&&C.clippingPlanes.length!==0){var q=B.uuid,Z=C.uuid,ee=l[q];ee===void 0&&(ee={},l[q]=ee);var te=ee[Z];te===void 0&&(te=B.clone(),ee[Z]=te),B=te}return B.visible=C.visible,B.wireframe=C.wireframe,F===zi?B.side=C.shadowSide!==null?C.shadowSide:C.side:B.side=C.shadowSide!==null?C.shadowSide:u[C.side],B.clipShadows=C.clipShadows,B.clippingPlanes=C.clippingPlanes,B.clipIntersection=C.clipIntersection,B.wireframeLinewidth=C.wireframeLinewidth,B.linewidth=C.linewidth,N.isPointLight===!0&&B.isMeshDistanceMaterial===!0&&(B.referencePosition.setFromMatrixPosition(N.matrixWorld),B.nearDistance=O,B.farDistance=J),B}function x(b,T,C,N,O){if(b.visible!==!1){var J=b.layers.test(T.layers);if(J&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&O===zi)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,b.matrixWorld);var F=t.update(b),B=b.material;if(Array.isArray(B))for(var V=F.groups,Y=0,D=V.length;Y<D;Y++){var z=V[Y],k=B[z.materialIndex];if(k&&k.visible){var q=_(b,F,k,N,C.near,C.far,O);e.renderBufferDirect(C,null,F,q,b,z)}}else if(B.visible){var q=_(b,F,B,N,C.near,C.far,O);e.renderBufferDirect(C,null,F,q,b,null)}}for(var Z=b.children,ee=0,te=Z.length;ee<te;ee++)x(Z[ee],T,C,N,O)}}}function xy(e,t,n){var r=n.isWebGL2;function i(){var I=!1,we=new et,Me=null,Ve=new et(0,0,0,0);return{setMask:function(Ee){Me!==Ee&&!I&&(e.colorMask(Ee,Ee,Ee,Ee),Me=Ee)},setLocked:function(Ee){I=Ee},setClear:function(Ee,Ze,it,pt,Ht){Ht===!0&&(Ee*=pt,Ze*=pt,it*=pt),we.set(Ee,Ze,it,pt),Ve.equals(we)===!1&&(e.clearColor(Ee,Ze,it,pt),Ve.copy(we))},reset:function(){I=!1,Me=null,Ve.set(-1,0,0,0)}}}function a(){var I=!1,we=null,Me=null,Ve=null;return{setTest:function(Ee){Ee?Te(2929):ue(2929)},setMask:function(Ee){we!==Ee&&!I&&(e.depthMask(Ee),we=Ee)},setFunc:function(Ee){if(Me!==Ee){if(Ee)switch(Ee){case $f:e.depthFunc(512);break;case ed:e.depthFunc(519);break;case td:e.depthFunc(513);break;case Bs:e.depthFunc(515);break;case nd:e.depthFunc(514);break;case rd:e.depthFunc(518);break;case id:e.depthFunc(516);break;case ad:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);Me=Ee}},setLocked:function(Ee){I=Ee},setClear:function(Ee){Ve!==Ee&&(e.clearDepth(Ee),Ve=Ee)},reset:function(){I=!1,we=null,Me=null,Ve=null}}}function o(){var I=!1,we=null,Me=null,Ve=null,Ee=null,Ze=null,it=null,pt=null,Ht=null;return{setTest:function(at){I||(at?Te(2960):ue(2960))},setMask:function(at){we!==at&&!I&&(e.stencilMask(at),we=at)},setFunc:function(at,Pt,Dt){(Me!==at||Ve!==Pt||Ee!==Dt)&&(e.stencilFunc(at,Pt,Dt),Me=at,Ve=Pt,Ee=Dt)},setOp:function(at,Pt,Dt){(Ze!==at||it!==Pt||pt!==Dt)&&(e.stencilOp(at,Pt,Dt),Ze=at,it=Pt,pt=Dt)},setLocked:function(at){I=at},setClear:function(at){Ht!==at&&(e.clearStencil(at),Ht=at)},reset:function(){I=!1,we=null,Me=null,Ve=null,Ee=null,Ze=null,it=null,pt=null,Ht=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),h=new Uint8Array(u),f=new Uint8Array(u),d=new Uint8Array(u),m={},g=null,y=null,p=null,v=null,_=null,x=null,b=null,T=null,C=null,N=!1,O=null,J=null,F=null,B=null,V=null,Y=e.getParameter(35661),D=!1,z=0,k=e.getParameter(7938);k.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL\ ([0-9])/.exec(k)[1]),D=z>=1):k.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(k)[1]),D=z>=2);var q=null,Z={},ee=new et,te=new et;function oe(I,we,Me){var Ve=new Uint8Array(4),Ee=e.createTexture();e.bindTexture(I,Ee),e.texParameteri(I,10241,9728),e.texParameteri(I,10240,9728);for(var Ze=0;Ze<Me;Ze++)e.texImage2D(we+Ze,0,6408,1,1,0,6408,5121,Ve);return Ee}var Pe={};Pe[3553]=oe(3553,3553,1),Pe[34067]=oe(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),Te(2929),c.setFunc(Bs),A(!1),L(Bc),Te(2884),nt(Jn);function be(){for(var I=0,we=h.length;I<we;I++)h[I]=0}function re(I){G(I,0)}function G(I,we){if(h[I]=1,f[I]===0&&(e.enableVertexAttribArray(I),f[I]=1),d[I]!==we){var Me=r?e:t.get("ANGLE_instanced_arrays");Me[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](I,we),d[I]=we}}function Be(){for(var I=0,we=f.length;I!==we;++I)f[I]!==h[I]&&(e.disableVertexAttribArray(I),f[I]=0)}function xe(I,we,Me,Ve,Ee,Ze){r===!0&&(Me===5124||Me===5125)?e.vertexAttribIPointer(I,we,Me,Ve,Ee,Ze):e.vertexAttribPointer(I,we,Me,Ve,Ee,Ze)}function Te(I){m[I]!==!0&&(e.enable(I),m[I]=!0)}function ue(I){m[I]!==!1&&(e.disable(I),m[I]=!1)}function $(I){return g!==I?(e.useProgram(I),g=I,!0):!1}var Ce={[Ur]:32774,[Vf]:32778,[kf]:32779};if(r)Ce[kc]=32775,Ce[Wc]=32776;else{var Ye=t.get("EXT_blend_minmax");Ye!==null&&(Ce[kc]=Ye.MIN_EXT,Ce[Wc]=Ye.MAX_EXT)}var Qe={[Wf]:0,[Xf]:1,[jf]:768,[Xc]:770,[Kf]:776,[Jf]:774,[Yf]:772,[qf]:769,[jc]:771,[Qf]:775,[Zf]:773};function nt(I,we,Me,Ve,Ee,Ze,it,pt){if(I===Jn){y&&(ue(3042),y=!1);return}if(y||(Te(3042),y=!0),I!==Hf){if(I!==p||pt!==N){if((v!==Ur||b!==Ur)&&(e.blendEquation(32774),v=Ur,b=Ur),pt)switch(I){case Hi:e.blendFuncSeparate(1,771,1,771);break;case Gc:e.blendFunc(1,1);break;case Hc:e.blendFuncSeparate(0,0,769,771);break;case Vc:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case Hi:e.blendFuncSeparate(770,771,1,771);break;case Gc:e.blendFunc(770,1);break;case Hc:e.blendFunc(0,769);break;case Vc:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}_=null,x=null,T=null,C=null,p=I,N=pt}return}Ee=Ee||we,Ze=Ze||Me,it=it||Ve,(we!==v||Ee!==b)&&(e.blendEquationSeparate(Ce[we],Ce[Ee]),v=we,b=Ee),(Me!==_||Ve!==x||Ze!==T||it!==C)&&(e.blendFuncSeparate(Qe[Me],Qe[Ve],Qe[Ze],Qe[it]),_=Me,x=Ve,T=Ze,C=it),p=I,N=null}function $e(I,we){I.side===$a?ue(2884):Te(2884);var Me=I.side===At;we&&(Me=!Me),A(Me),I.blending===Hi&&I.transparent===!1?nt(Jn):nt(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.premultipliedAlpha),c.setFunc(I.depthFunc),c.setTest(I.depthTest),c.setMask(I.depthWrite),s.setMask(I.colorWrite);var Ve=I.stencilWrite;l.setTest(Ve),Ve&&(l.setMask(I.stencilWriteMask),l.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),l.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),K(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits)}function A(I){O!==I&&(I?e.frontFace(2304):e.frontFace(2305),O=I)}function L(I){I!==Uf?(Te(2884),I!==J&&(I===Bc?e.cullFace(1029):I===zf?e.cullFace(1028):e.cullFace(1032))):ue(2884),J=I}function ne(I){I!==F&&(D&&e.lineWidth(I),F=I)}function K(I,we,Me){I?(Te(32823),(B!==we||V!==Me)&&(e.polygonOffset(we,Me),B=we,V=Me)):ue(32823)}function Fe(I){I?Te(3089):ue(3089)}function ye(I){I===void 0&&(I=33984+Y-1),q!==I&&(e.activeTexture(I),q=I)}function R(I,we){q===null&&ye();var Me=Z[q];Me===void 0&&(Me={type:void 0,texture:void 0},Z[q]=Me),(Me.type!==I||Me.texture!==we)&&(e.bindTexture(I,we||Pe[I]),Me.type=I,Me.texture=we)}function he(){var I=Z[q];I!==void 0&&I.type!==void 0&&(e.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function fe(){try{e.compressedTexImage2D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function me(){try{e.texImage2D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ie(){try{e.texImage3D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Se(I){ee.equals(I)===!1&&(e.scissor(I.x,I.y,I.z,I.w),ee.copy(I))}function pe(I){te.equals(I)===!1&&(e.viewport(I.x,I.y,I.z,I.w),te.copy(I))}function Re(){for(var I=0;I<f.length;I++)f[I]===1&&(e.disableVertexAttribArray(I),f[I]=0);m={},q=null,Z={},g=null,p=null,O=null,J=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:be,enableAttribute:re,enableAttributeAndDivisor:G,disableUnusedAttributes:Be,vertexAttribPointer:xe,enable:Te,disable:ue,useProgram:$,setBlending:nt,setMaterial:$e,setFlipSided:A,setCullFace:L,setLineWidth:ne,setPolygonOffset:K,setScissorTest:Fe,activeTexture:ye,bindTexture:R,unbindTexture:he,compressedTexImage2D:fe,texImage2D:me,texImage3D:ie,scissor:Se,viewport:pe,reset:Re}}function _y(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,f=new WeakMap,d,m=!1;try{m=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(A){}function g(A,L){return m?new OffscreenCanvas(A,L):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(A,L,ne,K){var Fe=1;if((A.width>K||A.height>K)&&(Fe=K/Math.max(A.width,A.height)),Fe<1||L===!0)if(typeof HTMLImageElement!="undefined"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&A instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&A instanceof ImageBitmap){var ye=L?ke.floorPowerOfTwo:Math.floor,R=ye(Fe*A.width),he=ye(Fe*A.height);d===void 0&&(d=g(R,he));var fe=ne?g(R,he):d;fe.width=R,fe.height=he;var me=fe.getContext("2d");return me.drawImage(A,0,0,R,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+R+"x"+he+")."),fe}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function p(A){return ke.isPowerOfTwo(A.width)&&ke.isPowerOfTwo(A.height)}function v(A){return s?!1:A.wrapS!==Vt||A.wrapT!==Vt||A.minFilter!==_t&&A.minFilter!==It}function _(A,L){return A.generateMipmaps&&L&&A.minFilter!==_t&&A.minFilter!==It}function x(A,L,ne,K){e.generateMipmap(A);var Fe=r.get(L);Fe.__maxMipLevel=Math.log(Math.max(ne,K))*Math.LOG2E}function b(A,L,ne){if(s===!1)return L;if(A!==null){if(e[A]!==void 0)return e[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}var K=L;return L===6403&&(ne===5126&&(K=33326),ne===5131&&(K=33325),ne===5121&&(K=33321)),L===6407&&(ne===5126&&(K=34837),ne===5131&&(K=34843),ne===5121&&(K=32849)),L===6408&&(ne===5126&&(K=34836),ne===5131&&(K=34842),ne===5121&&(K=32856)),(K===33325||K===33326||K===34842||K===34836)&&t.get("EXT_color_buffer_float"),K}function T(A){return A===_t||A===ks||A===Ws?9728:9729}function C(A){var L=A.target;L.removeEventListener("dispose",C),O(L),L.isVideoTexture&&f.delete(L),o.memory.textures--}function N(A){var L=A.target;L.removeEventListener("dispose",N),J(L),o.memory.textures--}function O(A){var L=r.get(A);L.__webglInit!==void 0&&(e.deleteTexture(L.__webglTexture),r.remove(A))}function J(A){var L=r.get(A),ne=r.get(A.texture);if(A){if(ne.__webglTexture!==void 0&&e.deleteTexture(ne.__webglTexture),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(var K=0;K<6;K++)e.deleteFramebuffer(L.__webglFramebuffer[K]),L.__webglDepthbuffer&&e.deleteRenderbuffer(L.__webglDepthbuffer[K]);else e.deleteFramebuffer(L.__webglFramebuffer),L.__webglDepthbuffer&&e.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&e.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer&&e.deleteRenderbuffer(L.__webglColorRenderbuffer),L.__webglDepthRenderbuffer&&e.deleteRenderbuffer(L.__webglDepthRenderbuffer);r.remove(A.texture),r.remove(A)}}var F=0;function B(){F=0}function V(){var A=F;return A>=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),F+=1,A}function Y(A,L){var ne=r.get(A);if(A.isVideoTexture&&Ce(A),A.version>0&&ne.__version!==A.version){var K=A.image;if(K===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(K.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(ne,A,L);return}}n.activeTexture(33984+L),n.bindTexture(3553,ne.__webglTexture)}function D(A,L){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){Pe(ne,A,L);return}n.activeTexture(33984+L),n.bindTexture(35866,ne.__webglTexture)}function z(A,L){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){Pe(ne,A,L);return}n.activeTexture(33984+L),n.bindTexture(32879,ne.__webglTexture)}function k(A,L){if(A.image.length===6){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){oe(ne,A),n.activeTexture(33984+L),n.bindTexture(34067,ne.__webglTexture),e.pixelStorei(37440,A.flipY);for(var K=A&&(A.isCompressedTexture||A.image[0].isCompressedTexture),Fe=A.image[0]&&A.image[0].isDataTexture,ye=[],R=0;R<6;R++)!K&&!Fe?ye[R]=y(A.image[R],!1,!0,l):ye[R]=Fe?A.image[R].image:A.image[R];var he=ye[0],fe=p(he)||s,me=a.convert(A.format),ie=a.convert(A.type),Se=b(A.internalFormat,me,ie);te(34067,A,fe);var pe;if(K){for(var R=0;R<6;R++){pe=ye[R].mipmaps;for(var Re=0;Re<pe.length;Re++){var I=pe[Re];A.format!==on&&A.format!==xr?me!==null?n.compressedTexImage2D(34069+R,Re,Se,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+R,Re,Se,I.width,I.height,0,me,ie,I.data)}}ne.__maxMipLevel=pe.length-1}else{pe=A.mipmaps;for(var R=0;R<6;R++)if(Fe){n.texImage2D(34069+R,0,Se,ye[R].width,ye[R].height,0,me,ie,ye[R].data);for(var Re=0;Re<pe.length;Re++){var I=pe[Re],we=I.image[R].image;n.texImage2D(34069+R,Re+1,Se,we.width,we.height,0,me,ie,we.data)}}else{n.texImage2D(34069+R,0,Se,me,ie,ye[R]);for(var Re=0;Re<pe.length;Re++){var I=pe[Re];n.texImage2D(34069+R,Re+1,Se,me,ie,I.image[R])}}ne.__maxMipLevel=pe.length}_(A,fe)&&x(34067,A,he.width,he.height),ne.__version=A.version,A.onUpdate&&A.onUpdate(A)}else n.activeTexture(33984+L),n.bindTexture(34067,ne.__webglTexture)}}function q(A,L){n.activeTexture(33984+L),n.bindTexture(34067,r.get(A).__webglTexture)}var Z={[to]:10497,[Vt]:33071,[no]:33648},ee={[_t]:9728,[ks]:9984,[Ws]:9986,[It]:9729,[Jc]:9985,[ro]:9987};function te(A,L,ne){ne?(e.texParameteri(A,10242,Z[L.wrapS]),e.texParameteri(A,10243,Z[L.wrapT]),(A===32879||A===35866)&&e.texParameteri(A,32882,Z[L.wrapR]),e.texParameteri(A,10240,ee[L.magFilter]),e.texParameteri(A,10241,ee[L.minFilter])):(e.texParameteri(A,10242,33071),e.texParameteri(A,10243,33071),(A===32879||A===35866)&&e.texParameteri(A,32882,33071),(L.wrapS!==Vt||L.wrapT!==Vt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(A,10240,T(L.magFilter)),e.texParameteri(A,10241,T(L.minFilter)),L.minFilter!==_t&&L.minFilter!==It&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var K=t.get("EXT_texture_filter_anisotropic");if(K){if(L.type===Qn&&t.get("OES_texture_float_linear")===null||L.type===oo&&(s||t.get("OES_texture_half_float_linear"))===null)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(e.texParameterf(A,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,i.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function oe(A,L){A.__webglInit===void 0&&(A.__webglInit=!0,L.addEventListener("dispose",C),A.__webglTexture=e.createTexture(),o.memory.textures++)}function Pe(A,L,ne){var K=3553;L.isDataTexture2DArray&&(K=35866),L.isDataTexture3D&&(K=32879),oe(A,L),n.activeTexture(33984+ne),n.bindTexture(K,A.__webglTexture),e.pixelStorei(37440,L.flipY),e.pixelStorei(37441,L.premultiplyAlpha),e.pixelStorei(3317,L.unpackAlignment);var Fe=v(L)&&p(L.image)===!1,ye=y(L.image,Fe,!1,u),R=p(ye)||s,he=a.convert(L.format),fe=a.convert(L.type),me=b(L.internalFormat,he,fe);te(K,L,R);var ie,Se=L.mipmaps;if(L.isDepthTexture)me=6402,s?L.type===Qn?me=36012:L.type===ao?me=33190:L.type===Xi?me=35056:me=33189:L.type===Qn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===zr&&me===6402&&L.type!==io&&L.type!==ao&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=io,fe=a.convert(L.type)),L.format===ji&&me===6402&&(me=34041,L.type!==Xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=Xi,fe=a.convert(L.type))),n.texImage2D(3553,0,me,ye.width,ye.height,0,he,fe,null);else if(L.isDataTexture)if(Se.length>0&&R){for(var pe=0,Re=Se.length;pe<Re;pe++)ie=Se[pe],n.texImage2D(3553,pe,me,ie.width,ie.height,0,he,fe,ie.data);L.generateMipmaps=!1,A.__maxMipLevel=Se.length-1}else n.texImage2D(3553,0,me,ye.width,ye.height,0,he,fe,ye.data),A.__maxMipLevel=0;else if(L.isCompressedTexture){for(var pe=0,Re=Se.length;pe<Re;pe++)ie=Se[pe],L.format!==on&&L.format!==xr?he!==null?n.compressedTexImage2D(3553,pe,me,ie.width,ie.height,0,ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,pe,me,ie.width,ie.height,0,he,fe,ie.data);A.__maxMipLevel=Se.length-1}else if(L.isDataTexture2DArray)n.texImage3D(35866,0,me,ye.width,ye.height,ye.depth,0,he,fe,ye.data),A.__maxMipLevel=0;else if(L.isDataTexture3D)n.texImage3D(32879,0,me,ye.width,ye.height,ye.depth,0,he,fe,ye.data),A.__maxMipLevel=0;else if(Se.length>0&&R){for(var pe=0,Re=Se.length;pe<Re;pe++)ie=Se[pe],n.texImage2D(3553,pe,me,he,fe,ie);L.generateMipmaps=!1,A.__maxMipLevel=Se.length-1}else n.texImage2D(3553,0,me,he,fe,ye),A.__maxMipLevel=0;_(L,R)&&x(K,L,ye.width,ye.height),A.__version=L.version,L.onUpdate&&L.onUpdate(L)}function be(A,L,ne,K){var Fe=a.convert(L.texture.format),ye=a.convert(L.texture.type),R=b(L.texture.internalFormat,Fe,ye);n.texImage2D(K,0,R,L.width,L.height,0,Fe,ye,null),e.bindFramebuffer(36160,A),e.framebufferTexture2D(36160,ne,K,r.get(L.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function re(A,L,ne){if(e.bindRenderbuffer(36161,A),L.depthBuffer&&!L.stencilBuffer){var K=33189;if(ne){var Fe=L.depthTexture;Fe&&Fe.isDepthTexture&&(Fe.type===Qn?K=36012:Fe.type===ao&&(K=33190));var ye=$(L);e.renderbufferStorageMultisample(36161,ye,K,L.width,L.height)}else e.renderbufferStorage(36161,K,L.width,L.height);e.framebufferRenderbuffer(36160,36096,36161,A)}else if(L.depthBuffer&&L.stencilBuffer){if(ne){var ye=$(L);e.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height)}else e.renderbufferStorage(36161,34041,L.width,L.height);e.framebufferRenderbuffer(36160,33306,36161,A)}else{var R=a.convert(L.texture.format),he=a.convert(L.texture.type),K=b(L.texture.internalFormat,R,he);if(ne){var ye=$(L);e.renderbufferStorageMultisample(36161,ye,K,L.width,L.height)}else e.renderbufferStorage(36161,K,L.width,L.height)}e.bindRenderbuffer(36161,null)}function G(A,L){var ne=L&&L.isWebGLCubeRenderTarget;if(ne)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,A),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),Y(L.depthTexture,0);var K=r.get(L.depthTexture).__webglTexture;if(L.depthTexture.format===zr)e.framebufferTexture2D(36160,36096,3553,K,0);else if(L.depthTexture.format===ji)e.framebufferTexture2D(36160,33306,3553,K,0);else throw new Error("Unknown depthTexture format")}function Be(A){var L=r.get(A),ne=A.isWebGLCubeRenderTarget===!0;if(A.depthTexture){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");G(L.__webglFramebuffer,A)}else if(ne){L.__webglDepthbuffer=[];for(var K=0;K<6;K++)e.bindFramebuffer(36160,L.__webglFramebuffer[K]),L.__webglDepthbuffer[K]=e.createRenderbuffer(),re(L.__webglDepthbuffer[K],A,!1)}else e.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=e.createRenderbuffer(),re(L.__webglDepthbuffer,A,!1);e.bindFramebuffer(36160,null)}function xe(A){var L=r.get(A),ne=r.get(A.texture);A.addEventListener("dispose",N),ne.__webglTexture=e.createTexture(),o.memory.textures++;var K=A.isWebGLCubeRenderTarget===!0,Fe=A.isWebGLMultisampleRenderTarget===!0,ye=p(A)||s;if(s&&A.texture.format===xr&&(A.texture.type===Qn||A.texture.type===oo)&&(A.texture.format=on,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),K){L.__webglFramebuffer=[];for(var R=0;R<6;R++)L.__webglFramebuffer[R]=e.createFramebuffer()}else if(L.__webglFramebuffer=e.createFramebuffer(),Fe)if(s){L.__webglMultisampledFramebuffer=e.createFramebuffer(),L.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,L.__webglColorRenderbuffer);var he=a.convert(A.texture.format),fe=a.convert(A.texture.type),me=b(A.texture.internalFormat,he,fe),ie=$(A);e.renderbufferStorageMultisample(36161,ie,me,A.width,A.height),e.bindFramebuffer(36160,L.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,L.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),A.depthBuffer&&(L.__webglDepthRenderbuffer=e.createRenderbuffer(),re(L.__webglDepthRenderbuffer,A,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(K){n.bindTexture(34067,ne.__webglTexture),te(34067,A.texture,ye);for(var R=0;R<6;R++)be(L.__webglFramebuffer[R],A,36064,34069+R);_(A.texture,ye)&&x(34067,A.texture,A.width,A.height),n.bindTexture(34067,null)}else n.bindTexture(3553,ne.__webglTexture),te(3553,A.texture,ye),be(L.__webglFramebuffer,A,36064,3553),_(A.texture,ye)&&x(3553,A.texture,A.width,A.height),n.bindTexture(3553,null);A.depthBuffer&&Be(A)}function Te(A){var L=A.texture,ne=p(A)||s;if(_(L,ne)){var K=A.isWebGLCubeRenderTarget?34067:3553,Fe=r.get(L).__webglTexture;n.bindTexture(K,Fe),x(K,L,A.width,A.height),n.bindTexture(K,null)}}function ue(A){if(A.isWebGLMultisampleRenderTarget)if(s){var L=r.get(A);e.bindFramebuffer(36008,L.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,L.__webglFramebuffer);var ne=A.width,K=A.height,Fe=16384;A.depthBuffer&&(Fe|=256),A.stencilBuffer&&(Fe|=1024),e.blitFramebuffer(0,0,ne,K,0,0,ne,K,Fe,9728),e.bindFramebuffer(36160,L.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function $(A){return s&&A.isWebGLMultisampleRenderTarget?Math.min(h,A.samples):0}function Ce(A){var L=o.render.frame;f.get(A)!==L&&(f.set(A,L),A.update())}var Ye=!1,Qe=!1;function nt(A,L){A&&A.isWebGLRenderTarget&&(Ye===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ye=!0),A=A.texture),Y(A,L)}function $e(A,L){A&&A.isWebGLCubeRenderTarget&&(Qe===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Qe=!0),A=A.texture),A&&A.isCubeTexture||Array.isArray(A.image)&&A.image.length===6?k(A,L):q(A,L)}this.allocateTextureUnit=V,this.resetTextureUnits=B,this.setTexture2D=Y,this.setTexture2DArray=D,this.setTexture3D=z,this.setTextureCube=k,this.setTextureCubeDynamic=q,this.setupRenderTarget=xe,this.updateRenderTargetMipmap=Te,this.updateMultisampleRenderTarget=ue,this.safeSetTexture2D=nt,this.safeSetTextureCube=$e}function by(e,t,n){var r=n.isWebGL2;function i(a){var o;if(a===Wi)return 5121;if(a===vd)return 32819;if(a===md)return 32820;if(a===gd)return 33635;if(a===fd)return 5120;if(a===dd)return 5122;if(a===io)return 5123;if(a===pd)return 5124;if(a===ao)return 5125;if(a===Qn)return 5126;if(a===oo)return r?5131:(o=t.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===yd)return 6406;if(a===xr)return 6407;if(a===on)return 6408;if(a===xd)return 6409;if(a===_d)return 6410;if(a===zr)return 6402;if(a===ji)return 34041;if(a===wd)return 6403;if(a===Md)return 36244;if(a===Ed)return 33319;if(a===Td)return 33320;if(a===Sd)return 36248;if(a===Ad)return 36249;if(a===Qc||a===Kc||a===$c||a===eu)if(o=t.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===Qc)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===Kc)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===$c)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===eu)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===tu||a===nu||a===ru||a===iu)if(o=t.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===tu)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===nu)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===ru)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===iu)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===Ld)return o=t.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((a===au||a===ou)&&(o=t.get("WEBGL_compressed_texture_etc"),o!==null)){if(a===au)return o.COMPRESSED_RGB8_ETC2;if(a===ou)return o.COMPRESSED_RGBA8_ETC2_EAC}if(a===Pd||a===Cd||a===Rd||a===Od||a===Dd||a===Id||a===Nd||a===Fd||a===Bd||a===Ud||a===zd||a===Gd||a===Hd||a===Vd||a===Wd||a===Xd||a===jd||a===qd||a===Yd||a===Zd||a===Jd||a===Qd||a===Kd||a===$d||a===ep||a===tp||a===np||a===rp)return o=t.get("WEBGL_compressed_texture_astc"),o!==null?a:null;if(a===kd)return o=t.get("EXT_texture_compression_bptc"),o!==null?a:null;if(a===Xi)return r?34042:(o=t.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}function Tl(e){Et.call(this),this.cameras=e||[]}Tl.prototype=Object.assign(Object.create(Et.prototype),{constructor:Tl,isArrayCamera:!0});function ua(){ae.call(this),this.type="Group"}ua.prototype=Object.assign(Object.create(ae.prototype),{constructor:ua,isGroup:!0});function Co(){this._targetRay=null,this._grip=null}Object.assign(Co.prototype,{constructor:Co,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new ua,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new ua,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}});function Yu(e,t){var n=this,r=null,i=1,a=null,o="local-floor",s=null,c=[],l=new Map,u=new Et;u.layers.enable(1),u.viewport=new et;var h=new Et;h.layers.enable(2),h.viewport=new et;var f=[u,h],d=new Tl;d.layers.enable(1),d.layers.enable(2);var m=null,g=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(F){var B=c[F];return B===void 0&&(B=new Co,c[F]=B),B.getTargetRaySpace()},this.getControllerGrip=function(F){var B=c[F];return B===void 0&&(B=new Co,c[F]=B),B.getGripSpace()};function y(F){var B=l.get(F.inputSource);B&&B.dispatchEvent({type:F.type})}function p(){l.forEach(function(F,B){F.disconnect(B)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),J.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(F){a=F,J.setContext(r),J.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}this.setFramebufferScaleFactor=function(F){i=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){o=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(F){if(r=F,r!==null){r.addEventListener("select",y),r.addEventListener("selectstart",y),r.addEventListener("selectend",y),r.addEventListener("squeeze",y),r.addEventListener("squeezestart",y),r.addEventListener("squeezeend",y),r.addEventListener("end",p);var B=t.getContextAttributes();B.xrCompatible!==!0&&t.makeXRCompatible();var V={antialias:B.antialias,alpha:B.alpha,depth:B.depth,stencil:B.stencil,framebufferScaleFactor:i},Y=new XRWebGLLayer(r,t,V);r.updateRenderState({baseLayer:Y}),r.requestReferenceSpace(o).then(v),r.addEventListener("inputsourceschange",_)}};function _(F){for(var B=r.inputSources,V=0;V<c.length;V++)l.set(B[V],c[V]);for(var V=0;V<F.removed.length;V++){var Y=F.removed[V],D=l.get(Y);D&&(D.dispatchEvent({type:"disconnected",data:Y}),l.delete(Y))}for(var V=0;V<F.added.length;V++){var Y=F.added[V],D=l.get(Y);D&&D.dispatchEvent({type:"connected",data:Y})}}var x=new E,b=new E;function T(F,B,V){x.setFromMatrixPosition(B.matrixWorld),b.setFromMatrixPosition(V.matrixWorld);var Y=x.distanceTo(b),D=B.projectionMatrix.elements,z=V.projectionMatrix.elements,k=D[14]/(D[10]-1),q=D[14]/(D[10]+1),Z=(D[9]+1)/D[5],ee=(D[9]-1)/D[5],te=(D[8]-1)/D[0],oe=(z[8]+1)/z[0],Pe=k*te,be=k*oe,re=Y/(-te+oe),G=re*-te;B.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(G),F.translateZ(re),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.getInverse(F.matrixWorld);var Be=k+re,xe=q+re,Te=Pe-G,ue=be+(Y-G),$=Z*q/xe*Be,Ce=ee*q/xe*Be;F.projectionMatrix.makePerspective(Te,ue,$,Ce,Be,xe)}function C(F,B){B===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(B.matrixWorld,F.matrix),F.matrixWorldInverse.getInverse(F.matrixWorld)}this.getCamera=function(F){d.near=h.near=u.near=F.near,d.far=h.far=u.far=F.far,(m!==d.near||g!==d.far)&&(r.updateRenderState({depthNear:d.near,depthFar:d.far}),m=d.near,g=d.far);var B=F.parent,V=d.cameras;C(d,B);for(var Y=0;Y<V.length;Y++)C(V[Y],B);F.matrixWorld.copy(d.matrixWorld);for(var D=F.children,Y=0,z=D.length;Y<z;Y++)D[Y].updateMatrixWorld(!0);return V.length===2?T(d,u,h):d.projectionMatrix.copy(u.projectionMatrix),d};var N=null;function O(F,B){if(s=B.getViewerPose(a),s!==null){var V=s.views,Y=r.renderState.baseLayer;e.setFramebuffer(Y.framebuffer);var D=!1;V.length!==d.cameras.length&&(d.cameras.length=0,D=!0);for(var z=0;z<V.length;z++){var k=V[z],q=Y.getViewport(k),Z=f[z];Z.matrix.fromArray(k.transform.matrix),Z.projectionMatrix.fromArray(k.projectionMatrix),Z.viewport.set(q.x,q.y,q.width,q.height),z===0&&d.matrix.copy(Z.matrix),D===!0&&d.cameras.push(Z)}}for(var ee=r.inputSources,z=0;z<c.length;z++){var te=c[z],oe=ee[z];te.update(oe,B,a)}N&&N(F,B)}var J=new Tu;J.setAnimationLoop(O),this.setAnimationLoop=function(F){N=F},this.dispose=function(){}}Object.assign(Yu.prototype,sn.prototype);function wy(e){function t(p,v){p.fogColor.value.copy(v.color),v.isFog?(p.fogNear.value=v.near,p.fogFar.value=v.far):v.isFogExp2&&(p.fogDensity.value=v.density)}function n(p,v,_,x,b){v.isMeshBasicMaterial?r(p,v):v.isMeshLambertMaterial?(r(p,v),c(p,v)):v.isMeshToonMaterial?(r(p,v),u(p,v)):v.isMeshPhongMaterial?(r(p,v),l(p,v)):v.isMeshStandardMaterial?(r(p,v,_),v.isMeshPhysicalMaterial?f(p,v,_):h(p,v,_)):v.isMeshMatcapMaterial?(r(p,v),d(p,v)):v.isMeshDepthMaterial?(r(p,v),m(p,v)):v.isMeshDistanceMaterial?(r(p,v),g(p,v)):v.isMeshNormalMaterial?(r(p,v),y(p,v)):v.isLineBasicMaterial?(i(p,v),v.isLineDashedMaterial&&a(p,v)):v.isPointsMaterial?o(p,v,x,b):v.isSpriteMaterial?s(p,v):v.isShadowMaterial?(p.color.value.copy(v.color),p.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function r(p,v,_){p.opacity.value=v.opacity,v.color&&p.diffuse.value.copy(v.color),v.emissive&&p.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap),v.specularMap&&(p.specularMap.value=v.specularMap);var x=v.envMap||_;x&&(p.envMap.value=x,p.flipEnvMap.value=x.isCubeTexture?-1:1,p.reflectivity.value=v.reflectivity,p.refractionRatio.value=v.refractionRatio,p.maxMipLevel.value=e.get(x).__maxMipLevel),v.lightMap&&(p.lightMap.value=v.lightMap,p.lightMapIntensity.value=v.lightMapIntensity),v.aoMap&&(p.aoMap.value=v.aoMap,p.aoMapIntensity.value=v.aoMapIntensity);var b;v.map?b=v.map:v.specularMap?b=v.specularMap:v.displacementMap?b=v.displacementMap:v.normalMap?b=v.normalMap:v.bumpMap?b=v.bumpMap:v.roughnessMap?b=v.roughnessMap:v.metalnessMap?b=v.metalnessMap:v.alphaMap?b=v.alphaMap:v.emissiveMap&&(b=v.emissiveMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix));var T;v.aoMap?T=v.aoMap:v.lightMap&&(T=v.lightMap),T!==void 0&&(T.isWebGLRenderTarget&&(T=T.texture),T.matrixAutoUpdate===!0&&T.updateMatrix(),p.uv2Transform.value.copy(T.matrix))}function i(p,v){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity}function a(p,v){p.dashSize.value=v.dashSize,p.totalSize.value=v.dashSize+v.gapSize,p.scale.value=v.scale}function o(p,v,_,x){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity,p.size.value=v.size*_,p.scale.value=x*.5,v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap);var b;v.map?b=v.map:v.alphaMap&&(b=v.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix))}function s(p,v){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity,p.rotation.value=v.rotation,v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap);var _;v.map?_=v.map:v.alphaMap&&(_=v.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),p.uvTransform.value.copy(_.matrix))}function c(p,v){v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap)}function l(p,v){p.specular.value.copy(v.specular),p.shininess.value=Math.max(v.shininess,1e-4),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===At&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===At&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function u(p,v){p.specular.value.copy(v.specular),p.shininess.value=Math.max(v.shininess,1e-4),v.gradientMap&&(p.gradientMap.value=v.gradientMap),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===At&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===At&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function h(p,v,_){p.roughness.value=v.roughness,p.metalness.value=v.metalness,v.roughnessMap&&(p.roughnessMap.value=v.roughnessMap),v.metalnessMap&&(p.metalnessMap.value=v.metalnessMap),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===At&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===At&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias),(v.envMap||_)&&(p.envMapIntensity.value=v.envMapIntensity)}function f(p,v,_){h(p,v,_),p.reflectivity.value=v.reflectivity,p.clearcoat.value=v.clearcoat,p.clearcoatRoughness.value=v.clearcoatRoughness,v.sheen&&p.sheen.value.copy(v.sheen),v.clearcoatMap&&(p.clearcoatMap.value=v.clearcoatMap),v.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap),v.clearcoatNormalMap&&(p.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),p.clearcoatNormalMap.value=v.clearcoatNormalMap,v.side===At&&p.clearcoatNormalScale.value.negate()),p.transparency.value=v.transparency}function d(p,v){v.matcap&&(p.matcap.value=v.matcap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===At&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===At&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function m(p,v){v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function g(p,v){v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias),p.referencePosition.value.copy(v.referencePosition),p.nearDistance.value=v.nearDistance,p.farDistance.value=v.farDistance}function y(p,v){v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===At&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===At&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Zu(e){e=e||{};var t=e.canvas!==void 0?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=e.context!==void 0?e.context:null,r=e.alpha!==void 0?e.alpha:!1,i=e.depth!==void 0?e.depth:!0,a=e.stencil!==void 0?e.stencil:!0,o=e.antialias!==void 0?e.antialias:!1,s=e.premultipliedAlpha!==void 0?e.premultipliedAlpha:!0,c=e.preserveDrawingBuffer!==void 0?e.preserveDrawingBuffer:!1,l=e.powerPreference!==void 0?e.powerPreference:"default",u=e.failIfMajorPerformanceCaveat!==void 0?e.failIfMajorPerformanceCaveat:!1,h=null,f=null;this.domElement=t,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.gammaFactor=2,this.outputEncoding=kt,this.physicallyCorrectLights=!1,this.toneMapping=Vi,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d=this,m=!1,g=null,y=0,p=0,v=null,_=null,x=-1,b={geometry:null,program:null,wireframe:!1},T=null,C=null,N=new et,O=new et,J=null,F=t.width,B=t.height,V=1,Y=null,D=null,z=new et(0,0,F,B),k=new et(0,0,F,B),q=!1,Z=new aa,ee=new eg,te=!1,oe=!1,Pe=new We,be=new E;function re(){return v===null?V:1}var G;try{var Be={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",Re,!1),G=n||t.getContext("webgl",Be)||t.getContext("experimental-webgl",Be),G===null)throw t.getContext("webgl")!==null?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");G.getShaderPrecisionFormat===void 0&&(G.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}var xe,Te,ue,$,Ce,Ye,Qe,nt,$e,A,L,ne,K,Fe,ye,R,he,fe;function me(){xe=new tg(G),Te=new $m(G,xe,e),Te.isWebGL2===!1&&(xe.get("WEBGL_depth_texture"),xe.get("OES_texture_float"),xe.get("OES_texture_half_float"),xe.get("OES_texture_half_float_linear"),xe.get("OES_standard_derivatives"),xe.get("OES_element_index_uint"),xe.get("ANGLE_instanced_arrays")),xe.get("OES_texture_float_linear"),fe=new by(G,xe,Te),ue=new xy(G,xe,Te),ue.scissor(O.copy(k).multiplyScalar(V).floor()),ue.viewport(N.copy(z).multiplyScalar(V).floor()),$=new ig,Ce=new sy,Ye=new _y(G,xe,ue,Ce,Te,fe,$),Qe=new Rp(G,Te),nt=new ng(G,Qe,$),$e=new sg(G,nt,Qe,$),ye=new og(G),A=new oy(d,xe,Te),L=new wy(Ce),ne=new uy,K=new my,Fe=new Qm(d,ue,$e,s),R=new Km(G,xe,$,Te),he=new rg(G,xe,$,Te),$.programs=A.programs,d.capabilities=Te,d.extensions=xe,d.properties=Ce,d.renderLists=ne,d.state=ue,d.info=$}me();var ie=new Yu(d,G);this.xr=ie;var Se=new qu(d,$e,Te.maxTextureSize);this.shadowMap=Se,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){var S=xe.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){var S=xe.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(S){S!==void 0&&(V=S,this.setSize(F,B,!1))},this.getSize=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),S=new X),S.set(F,B)},this.setSize=function(S,W,H){if(ie.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=S,B=W,t.width=Math.floor(S*V),t.height=Math.floor(W*V),H!==!1&&(t.style.width=S+"px",t.style.height=W+"px"),this.setViewport(0,0,S,W)},this.getDrawingBufferSize=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),S=new X),S.set(F*V,B*V).floor()},this.setDrawingBufferSize=function(S,W,H){F=S,B=W,V=H,t.width=Math.floor(S*H),t.height=Math.floor(W*H),this.setViewport(0,0,S,W)},this.getCurrentViewport=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),S=new et),S.copy(N)},this.getViewport=function(S){return S.copy(z)},this.setViewport=function(S,W,H,j){S.isVector4?z.set(S.x,S.y,S.z,S.w):z.set(S,W,H,j),ue.viewport(N.copy(z).multiplyScalar(V).floor())},this.getScissor=function(S){return S.copy(k)},this.setScissor=function(S,W,H,j){S.isVector4?k.set(S.x,S.y,S.z,S.w):k.set(S,W,H,j),ue.scissor(O.copy(k).multiplyScalar(V).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(S){ue.setScissorTest(q=S)},this.setOpaqueSort=function(S){Y=S},this.setTransparentSort=function(S){D=S},this.getClearColor=function(){return Fe.getClearColor()},this.setClearColor=function(){Fe.setClearColor.apply(Fe,arguments)},this.getClearAlpha=function(){return Fe.getClearAlpha()},this.setClearAlpha=function(){Fe.setClearAlpha.apply(Fe,arguments)},this.clear=function(S,W,H){var j=0;(S===void 0||S)&&(j|=16384),(W===void 0||W)&&(j|=256),(H===void 0||H)&&(j|=1024),G.clear(j)},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(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Re,!1),ne.dispose(),K.dispose(),Ce.dispose(),$e.dispose(),ie.dispose(),Ht.stop()};function pe(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1,me()}function I(S){var W=S.target;W.removeEventListener("dispose",I),we(W)}function we(S){Me(S),Ce.remove(S)}function Me(S){var W=Ce.get(S).program;S.program=void 0,W!==void 0&&A.releaseProgram(W)}function Ve(S,W){S.render(function(H){d.renderBufferImmediate(H,W)})}this.renderBufferImmediate=function(S,W){ue.initAttributes();var H=Ce.get(S);S.hasPositions&&!H.position&&(H.position=G.createBuffer()),S.hasNormals&&!H.normal&&(H.normal=G.createBuffer()),S.hasUvs&&!H.uv&&(H.uv=G.createBuffer()),S.hasColors&&!H.color&&(H.color=G.createBuffer());var j=W.getAttributes();S.hasPositions&&(G.bindBuffer(34962,H.position),G.bufferData(34962,S.positionArray,35048),ue.enableAttribute(j.position),G.vertexAttribPointer(j.position,3,5126,!1,0,0)),S.hasNormals&&(G.bindBuffer(34962,H.normal),G.bufferData(34962,S.normalArray,35048),ue.enableAttribute(j.normal),G.vertexAttribPointer(j.normal,3,5126,!1,0,0)),S.hasUvs&&(G.bindBuffer(34962,H.uv),G.bufferData(34962,S.uvArray,35048),ue.enableAttribute(j.uv),G.vertexAttribPointer(j.uv,2,5126,!1,0,0)),S.hasColors&&(G.bindBuffer(34962,H.color),G.bufferData(34962,S.colorArray,35048),ue.enableAttribute(j.color),G.vertexAttribPointer(j.color,3,5126,!1,0,0)),ue.disableUnusedAttributes(),G.drawArrays(4,0,S.count),S.count=0};var Ee=new Ji;this.renderBufferDirect=function(S,W,H,j,se,Ge){W===null&&(W=Ee);var Ie=se.isMesh&&se.matrixWorld.determinant()<0,Ae=Ii(S,W,j,se);ue.setMaterial(j,Ie);var Ue=!1;(b.geometry!==H.id||b.program!==Ae.id||b.wireframe!==(j.wireframe===!0))&&(b.geometry=H.id,b.program=Ae.id,b.wireframe=j.wireframe===!0,Ue=!0),(j.morphTargets||j.morphNormals)&&(ye.update(se,H,j,Ae),Ue=!0),se.isInstancedMesh===!0&&(Ue=!0);var He=H.index,ct=H.attributes.position;if(He===null){if(ct===void 0||ct.count===0)return}else if(He.count===0)return;var Ke=1;j.wireframe===!0&&(He=nt.getWireframeAttribute(H),Ke=2);var Je,ze=R;He!==null&&(Je=Qe.get(He),ze=he,ze.setIndex(Je)),Ue&&(Ze(se,H,j,Ae),He!==null&&G.bindBuffer(34963,Je.buffer));var qe=He!==null?He.count:ct.count,yt=H.drawRange.start*Ke,Tt=H.drawRange.count*Ke,xt=Ge!==null?Ge.start*Ke:0,vn=Ge!==null?Ge.count*Ke:1/0,st=Math.max(yt,xt),Xn=Math.min(qe,yt+Tt,xt+vn)-1,mr=Math.max(0,Xn-st+1);if(mr!==0){if(se.isMesh)j.wireframe===!0?(ue.setLineWidth(j.wireframeLinewidth*re()),ze.setMode(1)):ze.setMode(4);else if(se.isLine){var ja=j.linewidth;ja===void 0&&(ja=1),ue.setLineWidth(ja*re()),se.isLineSegments?ze.setMode(1):se.isLineLoop?ze.setMode(2):ze.setMode(3)}else se.isPoints?ze.setMode(0):se.isSprite&&ze.setMode(4);if(se.isInstancedMesh)ze.renderInstances(H,st,mr,se.count);else if(H.isInstancedBufferGeometry){var Fi=Math.min(H.instanceCount,H._maxInstanceCount);ze.renderInstances(H,st,mr,Fi)}else ze.render(st,mr)}};function Ze(S,W,H,j){if(!(Te.isWebGL2===!1&&(S.isInstancedMesh||W.isInstancedBufferGeometry)&&xe.get("ANGLE_instanced_arrays")===null)){ue.initAttributes();var se=W.attributes,Ge=j.getAttributes(),Ie=H.defaultAttributeValues;for(var Ae in Ge){var Ue=Ge[Ae];if(Ue>=0){var He=se[Ae];if(He!==void 0){var ct=He.normalized,Ke=He.itemSize,Je=Qe.get(He);if(Je===void 0)continue;var ze=Je.buffer,qe=Je.type,yt=Je.bytesPerElement;if(He.isInterleavedBufferAttribute){var Tt=He.data,xt=Tt.stride,vn=He.offset;Tt&&Tt.isInstancedInterleavedBuffer?(ue.enableAttributeAndDivisor(Ue,Tt.meshPerAttribute),W._maxInstanceCount===void 0&&(W._maxInstanceCount=Tt.meshPerAttribute*Tt.count)):ue.enableAttribute(Ue),G.bindBuffer(34962,ze),ue.vertexAttribPointer(Ue,Ke,qe,ct,xt*yt,vn*yt)}else He.isInstancedBufferAttribute?(ue.enableAttributeAndDivisor(Ue,He.meshPerAttribute),W._maxInstanceCount===void 0&&(W._maxInstanceCount=He.meshPerAttribute*He.count)):ue.enableAttribute(Ue),G.bindBuffer(34962,ze),ue.vertexAttribPointer(Ue,Ke,qe,ct,0,0)}else if(Ae==="instanceMatrix"){var Je=Qe.get(S.instanceMatrix);if(Je===void 0)continue;var ze=Je.buffer,qe=Je.type;ue.enableAttributeAndDivisor(Ue+0,1),ue.enableAttributeAndDivisor(Ue+1,1),ue.enableAttributeAndDivisor(Ue+2,1),ue.enableAttributeAndDivisor(Ue+3,1),G.bindBuffer(34962,ze),G.vertexAttribPointer(Ue+0,4,qe,!1,64,0),G.vertexAttribPointer(Ue+1,4,qe,!1,64,16),G.vertexAttribPointer(Ue+2,4,qe,!1,64,32),G.vertexAttribPointer(Ue+3,4,qe,!1,64,48)}else if(Ie!==void 0){var st=Ie[Ae];if(st!==void 0)switch(st.length){case 2:G.vertexAttrib2fv(Ue,st);break;case 3:G.vertexAttrib3fv(Ue,st);break;case 4:G.vertexAttrib4fv(Ue,st);break;default:G.vertexAttrib1fv(Ue,st)}}}}ue.disableUnusedAttributes()}}this.compile=function(S,W){f=K.get(S,W),f.init(),S.traverse(function(j){j.isLight&&(f.pushLight(j),j.castShadow&&f.pushShadow(j))}),f.setupLights(W);const H={};S.traverse(function(j){let se=j.material;if(se)if(Array.isArray(se))for(let Ge=0;Ge<se.length;Ge++){let Ie=se[Ge];Ie.uuid in H||(Kt(Ie,S,j),H[Ie.uuid]=!0)}else se.uuid in H||(Kt(se,S,j),H[se.uuid]=!0)})};var it=null;function pt(S){ie.isPresenting||it&&it(S)}var Ht=new Tu;Ht.setAnimationLoop(pt),typeof window!="undefined"&&Ht.setContext(window),this.setAnimationLoop=function(S){it=S,ie.setAnimationLoop(S),Ht.start()},this.render=function(S,W){var H,j;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),H=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),j=arguments[3]),!(W&&W.isCamera)){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!m){b.geometry=null,b.program=null,b.wireframe=!1,x=-1,T=null,S.autoUpdate===!0&&S.updateMatrixWorld(),W.parent===null&&W.updateMatrixWorld(),ie.enabled&&ie.isPresenting&&(W=ie.getCamera(W)),S.onBeforeRender(d,S,W,H||v),f=K.get(S,W),f.init(),Pe.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Z.setFromProjectionMatrix(Pe),oe=this.localClippingEnabled,te=ee.init(this.clippingPlanes,oe,W),h=ne.get(S,W),h.init(),at(S,W,0,d.sortObjects),h.finish(),d.sortObjects===!0&&h.sort(Y,D),te&&ee.beginShadows();var se=f.state.shadowsArray;Se.render(se,S,W),f.setupLights(W),te&&ee.endShadows(),this.info.autoReset&&this.info.reset(),H!==void 0&&this.setRenderTarget(H),Fe.render(h,S,W,j);var Ge=h.opaque,Ie=h.transparent;if(S.overrideMaterial){var Ae=S.overrideMaterial;Ge.length&&Pt(Ge,S,W,Ae),Ie.length&&Pt(Ie,S,W,Ae)}else Ge.length&&Pt(Ge,S,W),Ie.length&&Pt(Ie,S,W);S.onAfterRender(d,S,W),v!==null&&(Ye.updateRenderTargetMipmap(v),Ye.updateMultisampleRenderTarget(v)),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1),h=null,f=null}};function at(S,W,H,j){if(S.visible!==!1){var se=S.layers.test(W.layers);if(se){if(S.isGroup)H=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(W);else if(S.isLight)f.pushLight(S),S.castShadow&&f.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Z.intersectsSprite(S)){j&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe);var Ge=$e.update(S),Ie=S.material;Ie.visible&&h.push(S,Ge,Ie,H,be.z,null)}}else if(S.isImmediateRenderObject)j&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe),h.push(S,null,S.material,H,be.z,null);else if((S.isMesh||S.isLine||S.isPoints)&&(S.isSkinnedMesh&&S.skeleton.frame!==$.render.frame&&(S.skeleton.update(),S.skeleton.frame=$.render.frame),!S.frustumCulled||Z.intersectsObject(S))){j&&be.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe);var Ge=$e.update(S),Ie=S.material;if(Array.isArray(Ie))for(var Ae=Ge.groups,Ue=0,He=Ae.length;Ue<He;Ue++){var ct=Ae[Ue],Ke=Ie[ct.materialIndex];Ke&&Ke.visible&&h.push(S,Ge,Ke,H,be.z,ct)}else Ie.visible&&h.push(S,Ge,Ie,H,be.z,null)}}for(var Je=S.children,Ue=0,He=Je.length;Ue<He;Ue++)at(Je[Ue],W,H,j)}}function Pt(S,W,H,j){for(var se=0,Ge=S.length;se<Ge;se++){var Ie=S[se],Ae=Ie.object,Ue=Ie.geometry,He=j===void 0?Ie.material:j,ct=Ie.group;if(H.isArrayCamera){C=H;for(var Ke=H.cameras,Je=0,ze=Ke.length;Je<ze;Je++){var qe=Ke[Je];Ae.layers.test(qe.layers)&&(ue.viewport(N.copy(qe.viewport)),f.setupLights(qe),Dt(Ae,W,qe,Ue,He,ct))}}else C=null,Dt(Ae,W,H,Ue,He,ct)}}function Dt(S,W,H,j,se,Ge){if(S.onBeforeRender(d,W,H,j,se,Ge),f=K.get(W,C||H),S.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),S.isImmediateRenderObject){var Ie=Ii(H,W,se,S);ue.setMaterial(se),b.geometry=null,b.program=null,b.wireframe=!1,Ve(S,Ie)}else d.renderBufferDirect(H,W,j,se,S,Ge);S.onAfterRender(d,W,H,j,se,Ge),f=K.get(W,C||H)}function Kt(S,W,H){var j=Ce.get(S),se=f.state.lights,Ge=f.state.shadowsArray,Ie=se.state.version,Ae=A.getParameters(S,se.state,Ge,W,ee.numPlanes,ee.numIntersection,H),Ue=A.getProgramCacheKey(Ae),He=j.program,ct=!0;if(He===void 0)S.addEventListener("dispose",I);else if(He.cacheKey!==Ue)Me(S);else if(j.lightsStateVersion!==Ie)j.lightsStateVersion=Ie,ct=!1;else{if(Ae.shaderID!==void 0)return;ct=!1}ct&&(He=A.acquireProgram(Ae,Ue),j.program=He,j.uniforms=Ae.uniforms,j.outputEncoding=Ae.outputEncoding,S.program=He);var Ke=He.getAttributes();if(S.morphTargets){S.numSupportedMorphTargets=0;for(var Je=0;Je<d.maxMorphTargets;Je++)Ke["morphTarget"+Je]>=0&&S.numSupportedMorphTargets++}if(S.morphNormals){S.numSupportedMorphNormals=0;for(var Je=0;Je<d.maxMorphNormals;Je++)Ke["morphNormal"+Je]>=0&&S.numSupportedMorphNormals++}var ze=j.uniforms;(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(j.numClippingPlanes=ee.numPlanes,j.numIntersection=ee.numIntersection,ze.clippingPlanes=ee.uniform),j.environment=S.isMeshStandardMaterial?W.environment:null,j.fog=W.fog,j.needsLights=Br(S),j.lightsStateVersion=Ie,j.needsLights&&(ze.ambientLightColor.value=se.state.ambient,ze.lightProbe.value=se.state.probe,ze.directionalLights.value=se.state.directional,ze.directionalLightShadows.value=se.state.directionalShadow,ze.spotLights.value=se.state.spot,ze.spotLightShadows.value=se.state.spotShadow,ze.rectAreaLights.value=se.state.rectArea,ze.pointLights.value=se.state.point,ze.pointLightShadows.value=se.state.pointShadow,ze.hemisphereLights.value=se.state.hemi,ze.directionalShadowMap.value=se.state.directionalShadowMap,ze.directionalShadowMatrix.value=se.state.directionalShadowMatrix,ze.spotShadowMap.value=se.state.spotShadowMap,ze.spotShadowMatrix.value=se.state.spotShadowMatrix,ze.pointShadowMap.value=se.state.pointShadowMap,ze.pointShadowMatrix.value=se.state.pointShadowMatrix);var qe=j.program.getUniforms(),yt=or.seqWithValue(qe.seq,ze);j.uniformsList=yt}function Ii(S,W,H,j){Ye.resetTextureUnits();var se=W.fog,Ge=H.isMeshStandardMaterial?W.environment:null,Ie=v===null?d.outputEncoding:v.texture.encoding,Ae=Ce.get(H),Ue=f.state.lights;if(te&&(oe||S!==T)){var He=S===T&&H.id===x;ee.setState(H.clippingPlanes,H.clipIntersection,H.clipShadows,S,Ae,He)}H.version===Ae.__version?(Ae.program===void 0||H.fog&&Ae.fog!==se||Ae.environment!==Ge||Ae.needsLights&&Ae.lightsStateVersion!==Ue.state.version||Ae.numClippingPlanes!==void 0&&(Ae.numClippingPlanes!==ee.numPlanes||Ae.numIntersection!==ee.numIntersection)||Ae.outputEncoding!==Ie)&&Kt(H,W,j):(Kt(H,W,j),Ae.__version=H.version);var ct=!1,Ke=!1,Je=!1,ze=Ae.program,qe=ze.getUniforms(),yt=Ae.uniforms;if(ue.useProgram(ze.program)&&(ct=!0,Ke=!0,Je=!0),H.id!==x&&(x=H.id,Ke=!0),ct||T!==S){if(qe.setValue(G,"projectionMatrix",S.projectionMatrix),Te.logarithmicDepthBuffer&&qe.setValue(G,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),T!==S&&(T=S,Ke=!0,Je=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){var Tt=qe.map.cameraPosition;Tt!==void 0&&Tt.setValue(G,be.setFromMatrixPosition(S.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&qe.setValue(G,"isOrthographic",S.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.skinning)&&qe.setValue(G,"viewMatrix",S.matrixWorldInverse)}if(H.skinning){qe.setOptional(G,j,"bindMatrix"),qe.setOptional(G,j,"bindMatrixInverse");var xt=j.skeleton;if(xt){var vn=xt.bones;if(Te.floatVertexTextures){if(xt.boneTexture===void 0){var st=Math.sqrt(vn.length*4);st=ke.ceilPowerOfTwo(st),st=Math.max(st,4);var Xn=new Float32Array(st*st*4);Xn.set(xt.boneMatrices);var mr=new oi(Xn,st,st,on,Qn);xt.boneMatrices=Xn,xt.boneTexture=mr,xt.boneTextureSize=st}qe.setValue(G,"boneTexture",xt.boneTexture,Ye),qe.setValue(G,"boneTextureSize",xt.boneTextureSize)}else qe.setOptional(G,xt,"boneMatrices")}}return(Ke||Ae.receiveShadow!==j.receiveShadow)&&(Ae.receiveShadow=j.receiveShadow,qe.setValue(G,"receiveShadow",j.receiveShadow)),Ke&&(qe.setValue(G,"toneMappingExposure",d.toneMappingExposure),qe.setValue(G,"toneMappingWhitePoint",d.toneMappingWhitePoint),Ae.needsLights&&Ni(yt,Je),se&&H.fog&&L.refreshFogUniforms(yt,se),L.refreshMaterialUniforms(yt,H,Ge,V,B),yt.ltc_1!==void 0&&(yt.ltc_1.value=le.LTC_1),yt.ltc_2!==void 0&&(yt.ltc_2.value=le.LTC_2),or.upload(G,Ae.uniformsList,yt,Ye)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(or.upload(G,Ae.uniformsList,yt,Ye),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&qe.setValue(G,"center",j.center),qe.setValue(G,"modelViewMatrix",j.modelViewMatrix),qe.setValue(G,"normalMatrix",j.normalMatrix),qe.setValue(G,"modelMatrix",j.matrixWorld),ze}function Ni(S,W){S.ambientLightColor.needsUpdate=W,S.lightProbe.needsUpdate=W,S.directionalLights.needsUpdate=W,S.directionalLightShadows.needsUpdate=W,S.pointLights.needsUpdate=W,S.pointLightShadows.needsUpdate=W,S.spotLights.needsUpdate=W,S.spotLightShadows.needsUpdate=W,S.rectAreaLights.needsUpdate=W,S.hemisphereLights.needsUpdate=W}function Br(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.setFramebuffer=function(S){g!==S&&v===null&&G.bindFramebuffer(36160,S),g=S},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return v},this.setRenderTarget=function(S,W,H){v=S,y=W,p=H,S&&Ce.get(S).__webglFramebuffer===void 0&&Ye.setupRenderTarget(S);var j=g,se=!1;if(S){var Ge=Ce.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(j=Ge[W||0],se=!0):S.isWebGLMultisampleRenderTarget?j=Ce.get(S).__webglMultisampledFramebuffer:j=Ge,N.copy(S.viewport),O.copy(S.scissor),J=S.scissorTest}else N.copy(z).multiplyScalar(V).floor(),O.copy(k).multiplyScalar(V).floor(),J=q;if(_!==j&&(G.bindFramebuffer(36160,j),_=j),ue.viewport(N),ue.scissor(O),ue.setScissorTest(J),se){var Ie=Ce.get(S.texture);G.framebufferTexture2D(36160,36064,34069+(W||0),Ie.__webglTexture,H||0)}},this.readRenderTargetPixels=function(S,W,H,j,se,Ge,Ie){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ae=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Ie!==void 0&&(Ae=Ae[Ie]),Ae){var Ue=!1;Ae!==_&&(G.bindFramebuffer(36160,Ae),Ue=!0);try{var He=S.texture,ct=He.format,Ke=He.type;if(ct!==on&&fe.convert(ct)!==G.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Ke!==Wi&&fe.convert(Ke)!==G.getParameter(35738)&&!(Ke===Qn&&(Te.isWebGL2||xe.get("OES_texture_float")||xe.get("WEBGL_color_buffer_float")))&&!(Ke===oo&&(Te.isWebGL2?xe.get("EXT_color_buffer_float"):xe.get("EXT_color_buffer_half_float")))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G.checkFramebufferStatus(36160)===36053?W>=0&&W<=S.width-j&&H>=0&&H<=S.height-se&&G.readPixels(W,H,j,se,fe.convert(ct),fe.convert(Ke),Ge):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Ue&&G.bindFramebuffer(36160,_)}}},this.copyFramebufferToTexture=function(S,W,H){H===void 0&&(H=0);var j=Math.pow(2,-H),se=Math.floor(W.image.width*j),Ge=Math.floor(W.image.height*j),Ie=fe.convert(W.format);Ye.setTexture2D(W,0),G.copyTexImage2D(3553,H,Ie,S.x,S.y,se,Ge,0),ue.unbindTexture()},this.copyTextureToTexture=function(S,W,H,j){j===void 0&&(j=0);var se=W.image.width,Ge=W.image.height,Ie=fe.convert(H.format),Ae=fe.convert(H.type);Ye.setTexture2D(H,0),W.isDataTexture?G.texSubImage2D(3553,j,S.x,S.y,se,Ge,Ie,Ae,W.image.data):W.isCompressedTexture?G.compressedTexSubImage2D(3553,j,S.x,S.y,W.mipmaps[0].width,W.mipmaps[0].height,Ie,W.mipmaps[0].data):G.texSubImage2D(3553,j,S.x,S.y,Ie,Ae,W.image),j===0&&H.generateMipmaps&&G.generateMipmap(3553),ue.unbindTexture()},this.initTexture=function(S){Ye.setTexture2D(S,0),ue.unbindTexture()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Sl(e,t){this.name="",this.color=new de(e),this.density=t!==void 0?t:25e-5}Object.assign(Sl.prototype,{isFogExp2:!0,clone:function(){return new Sl(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});function Al(e,t,n){this.name="",this.color=new de(e),this.near=t!==void 0?t:1,this.far=n!==void 0?n:1e3}Object.assign(Al.prototype,{isFog:!0,clone:function(){return new Al(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});function sr(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ho,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(sr.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(sr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Sr=new E;function Ro(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}Object.defineProperties(Ro.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ro.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Sr.x=this.getX(t),Sr.y=this.getY(t),Sr.z=this.getZ(t),Sr.applyMatrix4(e),this.setXYZ(t,Sr.x,Sr.y,Sr.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(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:function(e,t,n,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]=r,this},setXYZW:function(e,t,n,r,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]=r,this.data.array[e+3]=i,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new De(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}});function Ar(e){Oe.call(this),this.type="SpriteMaterial",this.color=new de(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Ar.prototype=Object.create(Oe.prototype),Ar.prototype.constructor=Ar,Ar.prototype.isSpriteMaterial=!0,Ar.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var ui,ha=new E,hi=new E,fi=new E,di=new X,fa=new X,Ju=new We,Oo=new E,da=new E,Do=new E,Qu=new X,Ll=new X,Ku=new X;function Pl(e){if(ae.call(this),this.type="Sprite",ui===void 0){ui=new ve;var 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 sr(t,5);ui.setIndex([0,1,2,0,2,3]),ui.setAttribute("position",new Ro(n,3,0,!1)),ui.setAttribute("uv",new Ro(n,2,3,!1))}this.geometry=ui,this.material=e!==void 0?e:new Ar,this.center=new X(.5,.5)}Pl.prototype=Object.assign(Object.create(ae.prototype),{constructor:Pl,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),hi.setFromMatrixScale(this.matrixWorld),Ju.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),fi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&hi.multiplyScalar(-fi.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;Io(Oo.set(-.5,-.5,0),fi,a,hi,r,i),Io(da.set(.5,-.5,0),fi,a,hi,r,i),Io(Do.set(.5,.5,0),fi,a,hi,r,i),Qu.set(0,0),Ll.set(1,0),Ku.set(1,1);var o=e.ray.intersectTriangle(Oo,da,Do,!1,ha);if(!(o===null&&(Io(da.set(-.5,.5,0),fi,a,hi,r,i),Ll.set(0,1),o=e.ray.intersectTriangle(Oo,Do,da,!1,ha),o===null))){var s=e.ray.origin.distanceTo(ha);s<e.near||s>e.far||t.push({distance:s,point:ha.clone(),uv:Ot.getUV(ha,Oo,da,Do,Qu,Ll,Ku,new X),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return ae.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}});function Io(e,t,n,r,i,a){di.subVectors(e,n).addScalar(.5).multiply(r),i!==void 0?(fa.x=a*di.x-i*di.y,fa.y=i*di.x+a*di.y):fa.copy(di),e.copy(t),e.x+=fa.x,e.y+=fa.y,e.applyMatrix4(Ju)}var No=new E,$u=new E;function Fo(){ae.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Fo.prototype=Object.assign(Object.create(ae.prototype),{constructor:Fo,isLOD:!0,copy:function(e){ae.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){var n=this.levels;if(n.length>0){No.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(No);this.getObjectForDistance(r).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){No.setFromMatrixPosition(e.matrixWorld),$u.setFromMatrixPosition(this.matrixWorld);var n=No.distanceTo($u)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}});function Cl(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ut.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new We,this.bindMatrixInverse=new We}Cl.prototype=Object.assign(Object.create(ut.prototype),{constructor:Cl,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new et,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){ut.prototype.updateMatrixWorld.call(this,e),this.bindMode==="attached"?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode==="detached"?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new E,t=new et,n=new et,r=new E,i=new We;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var h=t.getComponent(l);i.multiplyMatrices(s.bones[h].matrixWorld,s.boneInverses[h]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()});var eh=new We,My=new We;function Rl(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new We)}}Object.assign(Rl.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new We;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:My;eh.multiplyMatrices(o,t[i]),eh.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Rl(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}});function th(){ae.call(this),this.type="Bone"}th.prototype=Object.assign(Object.create(ae.prototype),{constructor:th,isBone:!0});var nh=new We,rh=new We,Bo=[],pa=new ut;function Ol(e,t,n){ut.call(this,e,t),this.instanceMatrix=new De(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}Ol.prototype=Object.assign(Object.create(ut.prototype),{constructor:Ol,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(pa.geometry=this.geometry,pa.material=this.material,pa.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,nh),rh.multiplyMatrices(n,nh),pa.matrixWorld=rh,pa.raycast(e,Bo);for(var a=0,o=Bo.length;a<o;a++){var s=Bo[a];s.instanceId=i,s.object=this,t.push(s)}Bo.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}});function mt(e){Oe.call(this),this.type="LineBasicMaterial",this.color=new de(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}mt.prototype=Object.create(Oe.prototype),mt.prototype.constructor=mt,mt.prototype.isLineBasicMaterial=!0,mt.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var ih=new E,ah=new E,oh=new We,Uo=new Jr,zo=new Dn;function tn(e,t,n){n===1&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),ae.call(this),this.type="Line",this.geometry=e!==void 0?e:new ve,this.material=t!==void 0?t:new mt,this.updateMorphTargets()}tn.prototype=Object.assign(Object.create(ae.prototype),{constructor:tn,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)ih.fromBufferAttribute(t,r-1),ah.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ih.distanceTo(ah);e.setAttribute("lineDistance",new ce(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),zo.copy(n.boundingSphere),zo.applyMatrix4(r),zo.radius+=i,e.ray.intersectsSphere(zo)!==!1){oh.getInverse(r),Uo.copy(e.ray).applyMatrix4(oh);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new E,c=new E,l=new E,u=new E,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,d=n.attributes,m=d.position.array;if(f!==null)for(var g=f.array,y=0,p=g.length-1;y<p;y+=h){var v=g[y],_=g[y+1];s.fromArray(m,v*3),c.fromArray(m,_*3);var x=Uo.distanceSqToSegment(s,c,u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,p=m.length/3-1;y<p;y+=h){s.fromArray(m,3*y),c.fromArray(m,3*y+3);var x=Uo.distanceSqToSegment(s,c,u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var T=n.vertices,C=T.length,y=0;y<C-1;y+=h){var x=Uo.distanceSqToSegment(T[y],T[y+1],u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Go=new E,Ho=new E;function Mt(e,t){tn.call(this,e,t),this.type="LineSegments"}Mt.prototype=Object.assign(Object.create(tn.prototype),{constructor:Mt,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Go.fromBufferAttribute(t,r),Ho.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Go.distanceTo(Ho);e.setAttribute("lineDistance",new ce(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)Go.copy(a[r]),Ho.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Go.distanceTo(Ho);return this}});function Dl(e,t){tn.call(this,e,t),this.type="LineLoop"}Dl.prototype=Object.assign(Object.create(tn.prototype),{constructor:Dl,isLineLoop:!0});function Lr(e){Oe.call(this),this.type="PointsMaterial",this.color=new de(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Lr.prototype=Object.create(Oe.prototype),Lr.prototype.constructor=Lr,Lr.prototype.isPointsMaterial=!0,Lr.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var sh=new We,Il=new Jr,Vo=new Dn,ko=new E;function Nl(e,t){ae.call(this),this.type="Points",this.geometry=e!==void 0?e:new ve,this.material=t!==void 0?t:new Lr,this.updateMorphTargets()}Nl.prototype=Object.assign(Object.create(ae.prototype),{constructor:Nl,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),Vo.copy(n.boundingSphere),Vo.applyMatrix4(r),Vo.radius+=i,e.ray.intersectsSphere(Vo)!==!1){sh.getInverse(r),Il.copy(e.ray).applyMatrix4(sh);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes,l=c.position.array;if(s!==null)for(var u=s.array,h=0,f=u.length;h<f;h++){var d=u[h];ko.fromArray(l,d*3),Fl(ko,d,o,r,e,t,this)}else for(var h=0,m=l.length/3;h<m;h++)ko.fromArray(l,h*3),Fl(ko,h,o,r,e,t,this)}else for(var g=n.vertices,h=0,m=g.length;h<m;h++)Fl(g[h],h,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function Fl(e,t,n,r,i,a,o){var s=Il.distanceSqToPoint(e);if(s<n){var c=new E;Il.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function lh(e,t,n,r,i,a,o,s,c){ot.call(this,e,t,n,r,i,a,o,s,c),this.format=o!==void 0?o:xr,this.minFilter=a!==void 0?a:It,this.magFilter=i!==void 0?i:It,this.generateMipmaps=!1}lh.prototype=Object.assign(Object.create(ot.prototype),{constructor:lh,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});function va(e,t,n,r,i,a,o,s,c,l,u,h){ot.call(this,null,a,o,s,c,l,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}va.prototype=Object.create(ot.prototype),va.prototype.constructor=va,va.prototype.isCompressedTexture=!0;function Wo(e,t,n,r,i,a,o,s,c){ot.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}Wo.prototype=Object.create(ot.prototype),Wo.prototype.constructor=Wo,Wo.prototype.isCanvasTexture=!0;function Xo(e,t,n,r,i,a,o,s,c,l){if(l=l!==void 0?l:zr,l!==zr&&l!==ji)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&l===zr&&(n=io),n===void 0&&l===ji&&(n=Xi),ot.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o!==void 0?o:_t,this.minFilter=s!==void 0?s:_t,this.flipY=!1,this.generateMipmaps=!1}Xo.prototype=Object.create(ot.prototype),Xo.prototype.constructor=Xo,Xo.prototype.isDepthTexture=!0;function jo(e){ve.call(this),this.type="WireframeGeometry";var t=[],n,r,i,a,o,s=[0,0],c={},l,u,h,f,d=["a","b","c"],m;if(e&&e.isGeometry){var g=e.faces;for(n=0,i=g.length;n<i;n++){var y=g[n];for(r=0;r<3;r++)u=y[d[r]],h=y[d[(r+1)%3]],s[0]=Math.min(u,h),s[1]=Math.max(u,h),f=s[0]+","+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var p,v,_,x,b,T,C,N;if(m=new E,e.index!==null){for(p=e.attributes.position,v=e.index,_=e.groups,_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]),a=0,o=_.length;a<o;++a)for(x=_[a],b=x.start,T=x.count,n=b,i=b+T;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),h=v.getX(n+(r+1)%3),s[0]=Math.min(u,h),s[1]=Math.max(u,h),f=s[0]+","+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(p,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(p,l.index2),t.push(m.x,m.y,m.z)}else for(p=e.attributes.position,n=0,i=p.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(p,C),t.push(m.x,m.y,m.z),N=3*n+(r+1)%3,m.fromBufferAttribute(p,N),t.push(m.x,m.y,m.z)}this.setAttribute("position",new ce(t,3))}jo.prototype=Object.create(ve.prototype),jo.prototype.constructor=jo;function qo(e,t,n){Ne.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new ma(e,t,n)),this.mergeVertices()}qo.prototype=Object.create(Ne.prototype),qo.prototype.constructor=qo;function ma(e,t,n){ve.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new E,l=new E,u=new E,h=new E,f=new E,d,m;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var g=t+1;for(d=0;d<=n;d++){var y=d/n;for(m=0;m<=t;m++){var p=m/t;e(p,y,l),i.push(l.x,l.y,l.z),p-s>=0?(e(p-s,y,u),h.subVectors(l,u)):(e(p+s,y,u),h.subVectors(u,l)),y-s>=0?(e(p,y-s,u),f.subVectors(l,u)):(e(p,y+s,u),f.subVectors(u,l)),c.crossVectors(h,f).normalize(),a.push(c.x,c.y,c.z),o.push(p,y)}}for(d=0;d<n;d++)for(m=0;m<t;m++){var v=d*g+m,_=d*g+m+1,x=(d+1)*g+m+1,b=(d+1)*g+m;r.push(v,_,b),r.push(_,x,b)}this.setIndex(r),this.setAttribute("position",new ce(i,3)),this.setAttribute("normal",new ce(a,3)),this.setAttribute("uv",new ce(o,2))}ma.prototype=Object.create(ve.prototype),ma.prototype.constructor=ma;function Yo(e,t,n,r){Ne.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Zt(e,t,n,r)),this.mergeVertices()}Yo.prototype=Object.create(Ne.prototype),Yo.prototype.constructor=Yo;function Zt(e,t,n,r){ve.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute("position",new ce(i,3)),this.setAttribute("normal",new ce(i.slice(),3)),this.setAttribute("uv",new ce(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(p){for(var v=new E,_=new E,x=new E,b=0;b<t.length;b+=3)f(t[b+0],v),f(t[b+1],_),f(t[b+2],x),s(v,_,x,p)}function s(p,v,_,x){var b=Math.pow(2,x),T=[],C,N;for(C=0;C<=b;C++){T[C]=[];var O=p.clone().lerp(_,C/b),J=v.clone().lerp(_,C/b),F=b-C;for(N=0;N<=F;N++)N===0&&C===b?T[C][N]=O:T[C][N]=O.clone().lerp(J,N/F)}for(C=0;C<b;C++)for(N=0;N<2*(b-C)-1;N++){var B=Math.floor(N/2);N%2===0?(h(T[C][B+1]),h(T[C+1][B]),h(T[C][B])):(h(T[C][B+1]),h(T[C+1][B+1]),h(T[C+1][B]))}}function c(p){for(var v=new E,_=0;_<i.length;_+=3)v.x=i[_+0],v.y=i[_+1],v.z=i[_+2],v.normalize().multiplyScalar(p),i[_+0]=v.x,i[_+1]=v.y,i[_+2]=v.z}function l(){for(var p=new E,v=0;v<i.length;v+=3){p.x=i[v+0],p.y=i[v+1],p.z=i[v+2];var _=g(p)/2/Math.PI+.5,x=y(p)/Math.PI+.5;a.push(_,1-x)}d(),u()}function u(){for(var p=0;p<a.length;p+=6){var v=a[p+0],_=a[p+2],x=a[p+4],b=Math.max(v,_,x),T=Math.min(v,_,x);b>.9&&T<.1&&(v<.2&&(a[p+0]+=1),_<.2&&(a[p+2]+=1),x<.2&&(a[p+4]+=1))}}function h(p){i.push(p.x,p.y,p.z)}function f(p,v){var _=p*3;v.x=e[_+0],v.y=e[_+1],v.z=e[_+2]}function d(){for(var p=new E,v=new E,_=new E,x=new E,b=new X,T=new X,C=new X,N=0,O=0;N<i.length;N+=9,O+=6){p.set(i[N+0],i[N+1],i[N+2]),v.set(i[N+3],i[N+4],i[N+5]),_.set(i[N+6],i[N+7],i[N+8]),b.set(a[O+0],a[O+1]),T.set(a[O+2],a[O+3]),C.set(a[O+4],a[O+5]),x.copy(p).add(v).add(_).divideScalar(3);var J=g(x);m(b,O+0,p,J),m(T,O+2,v,J),m(C,O+4,_,J)}}function m(p,v,_,x){x<0&&p.x===1&&(a[v]=p.x-1),_.x===0&&_.z===0&&(a[v]=x/2/Math.PI+.5)}function g(p){return Math.atan2(p.z,-p.x)}function y(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}Zt.prototype=Object.create(ve.prototype),Zt.prototype.constructor=Zt;function Zo(e,t){Ne.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ga(e,t)),this.mergeVertices()}Zo.prototype=Object.create(Ne.prototype),Zo.prototype.constructor=Zo;function ga(e,t){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];Zt.call(this,n,r,e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}ga.prototype=Object.create(Zt.prototype),ga.prototype.constructor=ga;function Jo(e,t){Ne.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new pi(e,t)),this.mergeVertices()}Jo.prototype=Object.create(Ne.prototype),Jo.prototype.constructor=Jo;function pi(e,t){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Zt.call(this,n,r,e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}pi.prototype=Object.create(Zt.prototype),pi.prototype.constructor=pi;function Qo(e,t){Ne.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ya(e,t)),this.mergeVertices()}Qo.prototype=Object.create(Ne.prototype),Qo.prototype.constructor=Qo;function ya(e,t){var n=(1+Math.sqrt(5))/2,r=[-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],i=[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];Zt.call(this,r,i,e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}ya.prototype=Object.create(Zt.prototype),ya.prototype.constructor=ya;function Ko(e,t){Ne.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new xa(e,t)),this.mergeVertices()}Ko.prototype=Object.create(Ne.prototype),Ko.prototype.constructor=Ko;function xa(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,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,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],a=[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];Zt.call(this,i,a,e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}xa.prototype=Object.create(Zt.prototype),xa.prototype.constructor=xa;function $o(e,t,n,r,i,a){Ne.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new vi(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}$o.prototype=Object.create(Ne.prototype),$o.prototype.constructor=$o;function vi(e,t,n,r,i){ve.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new E,s=new E,c=new X,l=new E,u,h,f=[],d=[],m=[],g=[];y(),this.setIndex(g),this.setAttribute("position",new ce(f,3)),this.setAttribute("normal",new ce(d,3)),this.setAttribute("uv",new ce(m,2));function y(){for(u=0;u<t;u++)p(u);p(i===!1?t:0),_(),v()}function p(x){l=e.getPointAt(x/t,l);var b=a.normals[x],T=a.binormals[x];for(h=0;h<=r;h++){var C=h/r*Math.PI*2,N=Math.sin(C),O=-Math.cos(C);s.x=O*b.x+N*T.x,s.y=O*b.y+N*T.y,s.z=O*b.z+N*T.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(h=1;h<=t;h++)for(u=1;u<=r;u++){var x=(r+1)*(h-1)+(u-1),b=(r+1)*h+(u-1),T=(r+1)*h+u,C=(r+1)*(h-1)+u;g.push(x,b,C),g.push(b,T,C)}}function _(){for(u=0;u<=t;u++)for(h=0;h<=r;h++)c.x=u/t,c.y=h/r,m.push(c.x,c.y)}}vi.prototype=Object.create(ve.prototype),vi.prototype.constructor=vi,vi.prototype.toJSON=function(){var e=ve.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e};function es(e,t,n,r,i,a,o){Ne.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new _a(e,t,n,r,i,a)),this.mergeVertices()}es.prototype=Object.create(Ne.prototype),es.prototype.constructor=es;function _a(e,t,n,r,i,a){ve.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,h,f=new E,d=new E,m=new E,g=new E,y=new E,p=new E,v=new E;for(u=0;u<=n;++u){var _=u/n*i*Math.PI*2;for(F(_,i,a,e,m),F(_+.01,i,a,e,g),p.subVectors(g,m),v.addVectors(g,m),y.crossVectors(p,v),v.crossVectors(y,p),y.normalize(),v.normalize(),h=0;h<=r;++h){var x=h/r*Math.PI*2,b=-t*Math.cos(x),T=t*Math.sin(x);f.x=m.x+(b*v.x+T*y.x),f.y=m.y+(b*v.y+T*y.y),f.z=m.z+(b*v.z+T*y.z),s.push(f.x,f.y,f.z),d.subVectors(f,m).normalize(),c.push(d.x,d.y,d.z),l.push(u/n),l.push(h/r)}}for(h=1;h<=n;h++)for(u=1;u<=r;u++){var C=(r+1)*(h-1)+(u-1),N=(r+1)*h+(u-1),O=(r+1)*h+u,J=(r+1)*(h-1)+u;o.push(C,N,J),o.push(N,O,J)}this.setIndex(o),this.setAttribute("position",new ce(s,3)),this.setAttribute("normal",new ce(c,3)),this.setAttribute("uv",new ce(l,2));function F(B,V,Y,D,z){var k=Math.cos(B),q=Math.sin(B),Z=Y/V*B,ee=Math.cos(Z);z.x=D*(2+ee)*.5*k,z.y=D*(2+ee)*q*.5,z.z=D*Math.sin(Z)*.5}}_a.prototype=Object.create(ve.prototype),_a.prototype.constructor=_a;function ts(e,t,n,r,i){Ne.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new ba(e,t,n,r,i)),this.mergeVertices()}ts.prototype=Object.create(Ne.prototype),ts.prototype.constructor=ts;function ba(e,t,n,r,i){ve.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new E,u=new E,h=new E,f,d;for(f=0;f<=n;f++)for(d=0;d<=r;d++){var m=d/r*i,g=f/n*Math.PI*2;u.x=(e+t*Math.cos(g))*Math.cos(m),u.y=(e+t*Math.cos(g))*Math.sin(m),u.z=t*Math.sin(g),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),h.subVectors(u,l).normalize(),s.push(h.x,h.y,h.z),c.push(d/r),c.push(f/n)}for(f=1;f<=n;f++)for(d=1;d<=r;d++){var y=(r+1)*f+d-1,p=(r+1)*(f-1)+d-1,v=(r+1)*(f-1)+d,_=(r+1)*f+d;a.push(y,p,_),a.push(p,v,_)}this.setIndex(a),this.setAttribute("position",new ce(o,3)),this.setAttribute("normal",new ce(s,3)),this.setAttribute("uv",new ce(c,2))}ba.prototype=Object.create(ve.prototype),ba.prototype.constructor=ba;var Ey={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=ch(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,h,f,d;if(r&&(a=Py(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)h=e[m],f=e[m+1],h<s&&(s=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);d=Math.max(l-s,u-c),d=d!==0?1/d:0}return wa(a,o,n,s,c,d),o}};function ch(e,t,n,r,i){var a,o;if(i===Gy(e,t,n,r)>0)for(a=t;a<n;a+=r)o=fh(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=fh(a,e[a],e[a+1],o);return o&&ns(o,o.next)&&(Ea(o),o=o.next),o}function lr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(ns(n,n.next)||ht(n.prev,n,n.next)===0)){if(Ea(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function wa(e,t,n,r,i,a,o){if(e){!o&&a&&Iy(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?Sy(e,r,i,a):Ty(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),Ea(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=Ay(lr(e),t,n),wa(e,t,n,r,i,a,2)):o===2&&Ly(e,t,n,r,i,a):wa(lr(e),t,n,r,i,a,1);break}}}}function Ty(e){var t=e.prev,n=e,r=e.next;if(ht(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(mi(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&ht(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Sy(e,t,n,r){var i=e.prev,a=e,o=e.next;if(ht(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Bl(s,c,t,n,r),f=Bl(l,u,t,n,r),d=e.prevZ,m=e.nextZ;d&&d.z>=h&&m&&m.z<=f;){if(d!==e.prev&&d!==e.next&&mi(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ht(d.prev,d,d.next)>=0||(d=d.prevZ,m!==e.prev&&m!==e.next&&mi(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&ht(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&mi(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ht(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&mi(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&ht(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Ay(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!ns(i,a)&&uh(i,r,r.next,a)&&Ma(i,a)&&Ma(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Ea(r),Ea(r.next),r=e=a),r=r.next}while(r!==e);return lr(r)}function Ly(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&By(o,s)){var c=hh(o,s);o=lr(o,o.next),c=lr(c,c.next),wa(o,t,n,r,i,a),wa(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function Py(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=ch(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(Fy(l));for(i.sort(Cy),a=0;a<i.length;a++)Ry(i[a],n),n=lr(n,n.next);return n}function Cy(e,t){return e.x-t.x}function Ry(e,t){if(t=Oy(e,t),t){var n=hh(t,e);lr(t,t.next),lr(n,n.next)}}function Oy(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,h=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&mi(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Ma(n,e)&&(f<h||f===h&&(n.x>o.x||n.x===o.x&&Dy(o,n)))&&(o=n,h=f)),n=n.next;while(n!==c);return o}function Dy(e,t){return ht(e.prev,e,t.prev)<0&&ht(t.next,e,e.next)<0}function Iy(e,t,n,r){var i=e;do i.z===null&&(i.z=Bl(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Ny(i)}function Ny(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,!!r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Bl(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Fy(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function mi(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function By(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Uy(e,t)&&(Ma(e,t)&&Ma(t,e)&&zy(e,t)&&(ht(e.prev,e,t.prev)||ht(e,t.prev,t))||ns(e,t)&&ht(e.prev,e,e.next)>0&&ht(t.prev,t,t.next)>0)}function ht(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ns(e,t){return e.x===t.x&&e.y===t.y}function uh(e,t,n,r){var i=is(ht(e,t,n)),a=is(ht(e,t,r)),o=is(ht(n,r,e)),s=is(ht(n,r,t));return!!(i!==a&&o!==s||i===0&&rs(e,n,t)||a===0&&rs(e,r,t)||o===0&&rs(n,e,r)||s===0&&rs(n,t,r))}function rs(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function is(e){return e>0?1:e<0?-1:0}function Uy(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&uh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ma(e,t){return ht(e.prev,e,e.next)<0?ht(e,t,e.next)>=0&&ht(e,e.prev,t)>=0:ht(e,t,e.prev)<0||ht(e,e.next,t)<0}function zy(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function hh(e,t){var n=new Ul(e.i,e.x,e.y),r=new Ul(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function fh(e,t,n,r){var i=new Ul(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ea(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ul(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gy(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var cr={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return cr.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];dh(e),ph(n,e);var a=e.length;t.forEach(dh);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,ph(n,t[o]);for(var s=Ey.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function dh(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ph(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function gi(e,t){Ne.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new zn(e,t)),this.mergeVertices()}gi.prototype=Object.create(Ne.prototype),gi.prototype.constructor=gi,gi.prototype.toJSON=function(){var e=Ne.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return vh(t,n,e)};function zn(e,t){ve.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute("position",new ce(r,3)),this.setAttribute("uv",new ce(i,2)),this.computeVertexNormals();function c(l){var u=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:100,m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:6,y=t.bevelSize!==void 0?t.bevelSize:g-2,p=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3,_=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:Hy;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),d=t.amount);var b,T=!1,C,N,O,J;_&&(b=_.getSpacedPoints(f),T=!0,m=!1,C=_.computeFrenetFrames(f,!1),N=new E,O=new E,J=new E),m||(v=0,g=0,y=0,p=0);var F,B,V,Y=l.extractPoints(h),D=Y.shape,z=Y.holes,k=!cr.isClockWise(D);if(k)for(D=D.reverse(),B=0,V=z.length;B<V;B++)F=z[B],cr.isClockWise(F)&&(z[B]=F.reverse());var q=cr.triangulateShape(D,z),Z=D;for(B=0,V=z.length;B<V;B++)F=z[B],D=D.concat(F);function ee(ie,Se,pe){return Se||console.error("THREE.ExtrudeGeometry: vec does not exist"),Se.clone().multiplyScalar(pe).add(ie)}var te,oe,Pe,be,re,G=D.length,Be,xe=q.length;function Te(ie,Se,pe){var Re,I,we,Me=ie.x-Se.x,Ve=ie.y-Se.y,Ee=pe.x-ie.x,Ze=pe.y-ie.y,it=Me*Me+Ve*Ve,pt=Me*Ze-Ve*Ee;if(Math.abs(pt)>Number.EPSILON){var Ht=Math.sqrt(it),at=Math.sqrt(Ee*Ee+Ze*Ze),Pt=Se.x-Ve/Ht,Dt=Se.y+Me/Ht,Kt=pe.x-Ze/at,Ii=pe.y+Ee/at,Ni=((Kt-Pt)*Ze-(Ii-Dt)*Ee)/(Me*Ze-Ve*Ee);Re=Pt+Me*Ni-ie.x,I=Dt+Ve*Ni-ie.y;var Br=Re*Re+I*I;if(Br<=2)return new X(Re,I);we=Math.sqrt(Br/2)}else{var S=!1;Me>Number.EPSILON?Ee>Number.EPSILON&&(S=!0):Me<-Number.EPSILON?Ee<-Number.EPSILON&&(S=!0):Math.sign(Ve)===Math.sign(Ze)&&(S=!0),S?(Re=-Ve,I=Me,we=Math.sqrt(it)):(Re=Me,I=Ve,we=Math.sqrt(it/2))}return new X(Re/we,I/we)}for(var ue=[],$=0,Ce=Z.length,Ye=Ce-1,Qe=$+1;$<Ce;$++,Ye++,Qe++)Ye===Ce&&(Ye=0),Qe===Ce&&(Qe=0),ue[$]=Te(Z[$],Z[Ye],Z[Qe]);var nt=[],$e,A=ue.concat();for(B=0,V=z.length;B<V;B++){for(F=z[B],$e=[],$=0,Ce=F.length,Ye=Ce-1,Qe=$+1;$<Ce;$++,Ye++,Qe++)Ye===Ce&&(Ye=0),Qe===Ce&&(Qe=0),$e[$]=Te(F[$],F[Ye],F[Qe]);nt.push($e),A=A.concat($e)}for(te=0;te<v;te++){for(Pe=te/v,be=g*Math.cos(Pe*Math.PI/2),oe=y*Math.sin(Pe*Math.PI/2)+p,$=0,Ce=Z.length;$<Ce;$++)re=ee(Z[$],ue[$],oe),ye(re.x,re.y,-be);for(B=0,V=z.length;B<V;B++)for(F=z[B],$e=nt[B],$=0,Ce=F.length;$<Ce;$++)re=ee(F[$],$e[$],oe),ye(re.x,re.y,-be)}for(oe=y+p,$=0;$<G;$++)re=m?ee(D[$],A[$],oe):D[$],T?(O.copy(C.normals[0]).multiplyScalar(re.x),N.copy(C.binormals[0]).multiplyScalar(re.y),J.copy(b[0]).add(O).add(N),ye(J.x,J.y,J.z)):ye(re.x,re.y,0);var L;for(L=1;L<=f;L++)for($=0;$<G;$++)re=m?ee(D[$],A[$],oe):D[$],T?(O.copy(C.normals[L]).multiplyScalar(re.x),N.copy(C.binormals[L]).multiplyScalar(re.y),J.copy(b[L]).add(O).add(N),ye(J.x,J.y,J.z)):ye(re.x,re.y,d/f*L);for(te=v-1;te>=0;te--){for(Pe=te/v,be=g*Math.cos(Pe*Math.PI/2),oe=y*Math.sin(Pe*Math.PI/2)+p,$=0,Ce=Z.length;$<Ce;$++)re=ee(Z[$],ue[$],oe),ye(re.x,re.y,d+be);for(B=0,V=z.length;B<V;B++)for(F=z[B],$e=nt[B],$=0,Ce=F.length;$<Ce;$++)re=ee(F[$],$e[$],oe),T?ye(re.x,re.y+b[f-1].y,b[f-1].x+be):ye(re.x,re.y,d+be)}ne(),K();function ne(){var ie=r.length/3;if(m){var Se=0,pe=G*Se;for($=0;$<xe;$++)Be=q[$],R(Be[2]+pe,Be[1]+pe,Be[0]+pe);for(Se=f+v*2,pe=G*Se,$=0;$<xe;$++)Be=q[$],R(Be[0]+pe,Be[1]+pe,Be[2]+pe)}else{for($=0;$<xe;$++)Be=q[$],R(Be[2],Be[1],Be[0]);for($=0;$<xe;$++)Be=q[$],R(Be[0]+G*f,Be[1]+G*f,Be[2]+G*f)}n.addGroup(ie,r.length/3-ie,0)}function K(){var ie=r.length/3,Se=0;for(Fe(Z,Se),Se+=Z.length,B=0,V=z.length;B<V;B++)F=z[B],Fe(F,Se),Se+=F.length;n.addGroup(ie,r.length/3-ie,1)}function Fe(ie,Se){var pe,Re;for($=ie.length;--$>=0;){pe=$,Re=$-1,Re<0&&(Re=ie.length-1);var I=0,we=f+v*2;for(I=0;I<we;I++){var Me=G*I,Ve=G*(I+1),Ee=Se+pe+Me,Ze=Se+Re+Me,it=Se+Re+Ve,pt=Se+pe+Ve;he(Ee,Ze,it,pt)}}}function ye(ie,Se,pe){u.push(ie),u.push(Se),u.push(pe)}function R(ie,Se,pe){fe(ie),fe(Se),fe(pe);var Re=r.length/3,I=x.generateTopUV(n,r,Re-3,Re-2,Re-1);me(I[0]),me(I[1]),me(I[2])}function he(ie,Se,pe,Re){fe(ie),fe(Se),fe(Re),fe(Se),fe(pe),fe(Re);var I=r.length/3,we=x.generateSideWallUV(n,r,I-6,I-3,I-2,I-1);me(we[0]),me(we[1]),me(we[3]),me(we[1]),me(we[2]),me(we[3])}function fe(ie){r.push(u[ie*3+0]),r.push(u[ie*3+1]),r.push(u[ie*3+2])}function me(ie){i.push(ie.x),i.push(ie.y)}}}zn.prototype=Object.create(ve.prototype),zn.prototype.constructor=zn,zn.prototype.toJSON=function(){var e=ve.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return vh(t,n,e)};var Hy={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new X(a,o),new X(s,c),new X(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],h=t[r*3+2],f=t[i*3],d=t[i*3+1],m=t[i*3+2],g=t[a*3],y=t[a*3+1],p=t[a*3+2];return Math.abs(s-u)<.01?[new X(o,1-c),new X(l,1-h),new X(f,1-m),new X(g,1-p)]:[new X(s,1-c),new X(u,1-h),new X(d,1-m),new X(y,1-p)]}};function vh(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function as(e,t){Ne.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Ta(e,t)),this.mergeVertices()}as.prototype=Object.create(Ne.prototype),as.prototype.constructor=as;function Ta(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Ne;var r=n.generateShapes(e,t.size);t.depth=t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),zn.call(this,r,t),this.type="TextBufferGeometry"}Ta.prototype=Object.create(zn.prototype),Ta.prototype.constructor=Ta;function os(e,t,n,r,i,a,o){Ne.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new yi(e,t,n,r,i,a,o)),this.mergeVertices()}os.prototype=Object.create(Ne.prototype),os.prototype.constructor=os;function yi(e,t,n,r,i,a,o){ve.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r!==void 0?r:0,i=i!==void 0?i:Math.PI*2,a=a!==void 0?a:0,o=o!==void 0?o:Math.PI;var s=Math.min(a+o,Math.PI),c,l,u=0,h=[],f=new E,d=new E,m=[],g=[],y=[],p=[];for(l=0;l<=n;l++){var v=[],_=l/n,x=0;for(l==0&&a==0?x=.5/t:l==n&&s==Math.PI&&(x=-.5/t),c=0;c<=t;c++){var b=c/t;f.x=-e*Math.cos(r+b*i)*Math.sin(a+_*o),f.y=e*Math.cos(a+_*o),f.z=e*Math.sin(r+b*i)*Math.sin(a+_*o),g.push(f.x,f.y,f.z),d.copy(f).normalize(),y.push(d.x,d.y,d.z),p.push(b+x,1-_),v.push(u++)}h.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var T=h[l][c+1],C=h[l][c],N=h[l+1][c],O=h[l+1][c+1];(l!==0||a>0)&&m.push(T,C,O),(l!==n-1||s<Math.PI)&&m.push(C,N,O)}this.setIndex(m),this.setAttribute("position",new ce(g,3)),this.setAttribute("normal",new ce(y,3)),this.setAttribute("uv",new ce(p,2))}yi.prototype=Object.create(ve.prototype),yi.prototype.constructor=yi;function ss(e,t,n,r,i,a){Ne.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Sa(e,t,n,r,i,a)),this.mergeVertices()}ss.prototype=Object.create(Ne.prototype),ss.prototype.constructor=ss;function Sa(e,t,n,r,i,a){ve.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i!==void 0?i:0,a=a!==void 0?a:Math.PI*2,n=n!==void 0?Math.max(3,n):8,r=r!==void 0?Math.max(1,r):1;var o=[],s=[],c=[],l=[],u,h=e,f=(t-e)/r,d=new E,m=new X,g,y;for(g=0;g<=r;g++){for(y=0;y<=n;y++)u=i+y/n*a,d.x=h*Math.cos(u),d.y=h*Math.sin(u),s.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,l.push(m.x,m.y);h+=f}for(g=0;g<r;g++){var p=g*(n+1);for(y=0;y<n;y++){u=y+p;var v=u,_=u+n+1,x=u+n+2,b=u+1;o.push(v,_,b),o.push(_,x,b)}}this.setIndex(o),this.setAttribute("position",new ce(s,3)),this.setAttribute("normal",new ce(c,3)),this.setAttribute("uv",new ce(l,2))}Sa.prototype=Object.create(ve.prototype),Sa.prototype.constructor=Sa;function ls(e,t,n,r){Ne.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new Aa(e,t,n,r)),this.mergeVertices()}ls.prototype=Object.create(Ne.prototype),ls.prototype.constructor=ls;function Aa(e,t,n,r){ve.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=ke.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new E,u=new X,h,f;for(h=0;h<=t;h++){var d=n+h*c*r,m=Math.sin(d),g=Math.cos(d);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*g,a.push(l.x,l.y,l.z),u.x=h/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(h=0;h<t;h++)for(f=0;f<e.length-1;f++){s=f+h*e.length;var y=s,p=s+e.length,v=s+e.length+1,_=s+1;i.push(y,p,_),i.push(p,v,_)}if(this.setIndex(i),this.setAttribute("position",new ce(a,3)),this.setAttribute("uv",new ce(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,b=new E,T=new E,C=new E;for(s=t*e.length*3,h=0,f=0;h<e.length;h++,f+=3)b.x=x[f+0],b.y=x[f+1],b.z=x[f+2],T.x=x[s+f+0],T.y=x[s+f+1],T.z=x[s+f+2],C.addVectors(b,T).normalize(),x[f+0]=x[s+f+0]=C.x,x[f+1]=x[s+f+1]=C.y,x[f+2]=x[s+f+2]=C.z}}Aa.prototype=Object.create(ve.prototype),Aa.prototype.constructor=Aa;function xi(e,t){Ne.call(this),this.type="ShapeGeometry",typeof t=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new _i(e,t)),this.mergeVertices()}xi.prototype=Object.create(Ne.prototype),xi.prototype.constructor=xi,xi.prototype.toJSON=function(){var e=Ne.prototype.toJSON.call(this),t=this.parameters.shapes;return mh(t,e)};function _i(e,t){ve.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute("position",new ce(r,3)),this.setAttribute("normal",new ce(i,3)),this.setAttribute("uv",new ce(a,2));function l(u){var h,f,d,m=r.length/3,g=u.extractPoints(t),y=g.shape,p=g.holes;for(cr.isClockWise(y)===!1&&(y=y.reverse()),h=0,f=p.length;h<f;h++)d=p[h],cr.isClockWise(d)===!0&&(p[h]=d.reverse());var v=cr.triangulateShape(y,p);for(h=0,f=p.length;h<f;h++)d=p[h],y=y.concat(d);for(h=0,f=y.length;h<f;h++){var _=y[h];r.push(_.x,_.y,0),i.push(0,0,1),a.push(_.x,_.y)}for(h=0,f=v.length;h<f;h++){var x=v[h],b=x[0]+m,T=x[1]+m,C=x[2]+m;n.push(b,T,C),s+=3}}}_i.prototype=Object.create(ve.prototype),_i.prototype.constructor=_i,_i.prototype.toJSON=function(){var e=ve.prototype.toJSON.call(this),t=this.parameters.shapes;return mh(t,e)};function mh(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function cs(e,t){ve.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=t!==void 0?t:1;var n=[],r=Math.cos(ke.DEG2RAD*t),i=[0,0],a={},o,s,c,l=["a","b","c"],u;e.isBufferGeometry?(u=new Ne,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var h=u.vertices,f=u.faces,d=0,m=f.length;d<m;d++)for(var g=f[d],y=0;y<3;y++)o=g[l[y]],s=g[l[(y+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+","+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:d,face2:void 0}:a[c].face2=d;for(c in a){var p=a[c];if(p.face2===void 0||f[p.face1].normal.dot(f[p.face2].normal)<=r){var v=h[p.index1];n.push(v.x,v.y,v.z),v=h[p.index2],n.push(v.x,v.y,v.z)}}this.setAttribute("position",new ce(n,3))}cs.prototype=Object.create(ve.prototype),cs.prototype.constructor=cs;function bi(e,t,n,r,i,a,o,s){Ne.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new ur(e,t,n,r,i,a,o,s)),this.mergeVertices()}bi.prototype=Object.create(Ne.prototype),bi.prototype.constructor=bi;function ur(e,t,n,r,i,a,o,s){ve.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e!==void 0?e:1,t=t!==void 0?t:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,s=s!==void 0?s:Math.PI*2;var l=[],u=[],h=[],f=[],d=0,m=[],g=n/2,y=0;p(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new ce(u,3)),this.setAttribute("normal",new ce(h,3)),this.setAttribute("uv",new ce(f,2));function p(){var _,x,b=new E,T=new E,C=0,N=(t-e)/n;for(x=0;x<=i;x++){var O=[],J=x/i,F=J*(t-e)+e;for(_=0;_<=r;_++){var B=_/r,V=B*s+o,Y=Math.sin(V),D=Math.cos(V);T.x=F*Y,T.y=-J*n+g,T.z=F*D,u.push(T.x,T.y,T.z),b.set(Y,N,D).normalize(),h.push(b.x,b.y,b.z),f.push(B,1-J),O.push(d++)}m.push(O)}for(_=0;_<r;_++)for(x=0;x<i;x++){var z=m[x][_],k=m[x+1][_],q=m[x+1][_+1],Z=m[x][_+1];l.push(z,k,Z),l.push(k,q,Z),C+=6}c.addGroup(y,C,0),y+=C}function v(_){var x,b,T,C=new X,N=new E,O=0,J=_===!0?e:t,F=_===!0?1:-1;for(b=d,x=1;x<=r;x++)u.push(0,g*F,0),h.push(0,F,0),f.push(.5,.5),d++;for(T=d,x=0;x<=r;x++){var B=x/r,V=B*s+o,Y=Math.cos(V),D=Math.sin(V);N.x=J*D,N.y=g*F,N.z=J*Y,u.push(N.x,N.y,N.z),h.push(0,F,0),C.x=Y*.5+.5,C.y=D*.5*F+.5,f.push(C.x,C.y),d++}for(x=0;x<r;x++){var z=b+x,k=T+x;_===!0?l.push(k,k+1,z):l.push(k+1,k,z),O+=3}c.addGroup(y,O,_===!0?1:2),y+=O}}ur.prototype=Object.create(ve.prototype),ur.prototype.constructor=ur;function us(e,t,n,r,i,a,o){bi.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}us.prototype=Object.create(bi.prototype),us.prototype.constructor=us;function hs(e,t,n,r,i,a,o){ur.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}hs.prototype=Object.create(ur.prototype),hs.prototype.constructor=hs;function fs(e,t,n,r){Ne.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new La(e,t,n,r)),this.mergeVertices()}fs.prototype=Object.create(Ne.prototype),fs.prototype.constructor=fs;function La(e,t,n,r){ve.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t!==void 0?Math.max(3,t):8,n=n!==void 0?n:0,r=r!==void 0?r:Math.PI*2;var i=[],a=[],o=[],s=[],c,l,u=new E,h=new X;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),h.x=(a[c]/e+1)/2,h.y=(a[c+1]/e+1)/2,s.push(h.x,h.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute("position",new ce(a,3)),this.setAttribute("normal",new ce(o,3)),this.setAttribute("uv",new ce(s,2))}La.prototype=Object.create(ve.prototype),La.prototype.constructor=La;var zt=Object.freeze({__proto__:null,WireframeGeometry:jo,ParametricGeometry:qo,ParametricBufferGeometry:ma,TetrahedronGeometry:Zo,TetrahedronBufferGeometry:ga,OctahedronGeometry:Jo,OctahedronBufferGeometry:pi,IcosahedronGeometry:Qo,IcosahedronBufferGeometry:ya,DodecahedronGeometry:Ko,DodecahedronBufferGeometry:xa,PolyhedronGeometry:Yo,PolyhedronBufferGeometry:Zt,TubeGeometry:$o,TubeBufferGeometry:vi,TorusKnotGeometry:es,TorusKnotBufferGeometry:_a,TorusGeometry:ts,TorusBufferGeometry:ba,TextGeometry:as,TextBufferGeometry:Ta,SphereGeometry:os,SphereBufferGeometry:yi,RingGeometry:ss,RingBufferGeometry:Sa,PlaneGeometry:Po,PlaneBufferGeometry:li,LatheGeometry:ls,LatheBufferGeometry:Aa,ShapeGeometry:xi,ShapeBufferGeometry:_i,ExtrudeGeometry:gi,ExtrudeBufferGeometry:zn,EdgesGeometry:cs,ConeGeometry:us,ConeBufferGeometry:hs,CylinderGeometry:bi,CylinderBufferGeometry:ur,CircleGeometry:fs,CircleBufferGeometry:La,BoxGeometry:Ap,BoxBufferGeometry:Ao});function wi(e){Oe.call(this),this.type="ShadowMaterial",this.color=new de(0),this.transparent=!0,this.setValues(e)}wi.prototype=Object.create(Oe.prototype),wi.prototype.constructor=wi,wi.prototype.isShadowMaterial=!0,wi.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this};function hr(e){Wt.call(this,e),this.type="RawShaderMaterial"}hr.prototype=Object.create(Wt.prototype),hr.prototype.constructor=hr,hr.prototype.isRawShaderMaterial=!0;function Gn(e){Oe.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new de(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 de(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vr,this.normalScale=new X(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}Gn.prototype=Object.create(Oe.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isMeshStandardMaterial=!0,Gn.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this};function Mi(e){Gn.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new X(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}Mi.prototype=Object.create(Gn.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshPhysicalMaterial=!0,Mi.prototype.copy=function(e){return Gn.prototype.copy.call(this,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.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new de).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this};function Pr(e){Oe.call(this),this.type="MeshPhongMaterial",this.color=new de(16777215),this.specular=new de(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new de(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vr,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Pr.prototype=Object.create(Oe.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshPhongMaterial=!0,Pr.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ei(e){Oe.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new de(16777215),this.specular=new de(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new de(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vr,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Ei.prototype=Object.create(Oe.prototype),Ei.prototype.constructor=Ei,Ei.prototype.isMeshToonMaterial=!0,Ei.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ti(e){Oe.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vr,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Ti.prototype=Object.create(Oe.prototype),Ti.prototype.constructor=Ti,Ti.prototype.isMeshNormalMaterial=!0,Ti.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Si(e){Oe.call(this),this.type="MeshLambertMaterial",this.color=new de(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new de(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=eo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Si.prototype=Object.create(Oe.prototype),Si.prototype.constructor=Si,Si.prototype.isMeshLambertMaterial=!0,Si.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ai(e){Oe.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new de(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vr,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Ai.prototype=Object.create(Oe.prototype),Ai.prototype.constructor=Ai,Ai.prototype.isMeshMatcapMaterial=!0,Ai.prototype.copy=function(e){return Oe.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Li(e){mt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Li.prototype=Object.create(mt.prototype),Li.prototype.constructor=Li,Li.prototype.isLineDashedMaterial=!0,Li.prototype.copy=function(e){return mt.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Vy=Object.freeze({__proto__:null,ShadowMaterial:wi,SpriteMaterial:Ar,RawShaderMaterial:hr,ShaderMaterial:Wt,PointsMaterial:Lr,MeshPhysicalMaterial:Mi,MeshStandardMaterial:Gn,MeshPhongMaterial:Pr,MeshToonMaterial:Ei,MeshNormalMaterial:Ti,MeshLambertMaterial:Si,MeshDepthMaterial:Er,MeshDistanceMaterial:Tr,MeshBasicMaterial:hn,MeshMatcapMaterial:Ai,LineDashedMaterial:Li,LineBasicMaterial:mt,Material:Oe}),ft={arraySlice:function(e,t,n){return ft.isTypedArray(e)?new e.constructor(e.subarray(t,n!==void 0?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(a,o){return e[a]-e[o]}for(var n=e.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],f=0;f<c.times.length;++f){var d=c.times[f]*i;if(!(d<n||d>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)h.push(c.values[f*l+m])}}u.length!==0&&(c.times=ft.convertArray(u,c.times.constructor),c.values=ft.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;for(var g=1/0,s=0;s<a.tracks.length;++s)g>a.tracks[s].times[0]&&(g=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*g);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c==="bool"||c==="string")){var l=e.tracks.find(function(x){return x.name===s.name&&x.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),h=s.times.length-1,f;if(a<=s.times[0])f=ft.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[h]){var d=h*u;f=ft.arraySlice(s.values,d)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}if(c==="quaternion"){var g=new bt(f[0],f[1],f[2],f[3]).normalize().conjugate();g.toArray(f)}for(var y=l.times.length,p=0;p<y;++p){var v=p*u;if(c==="quaternion")bt.multiplyQuaternionsFlat(l.values,v,f,0,l.values,v);else for(var _=0;_<u;++_)l.values[v+_]-=f[_]}}}}return e.blendMode=su,e}};function nn(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}Object.assign(nn.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}a=t.length;break n}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}a=n,n=0;break n}break e}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(nn.prototype,{beforeStart_:nn.prototype.copySampleValue_,afterEnd_:nn.prototype.copySampleValue_});function zl(e,t,n,r){nn.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}zl.prototype=Object.assign(Object.create(nn.prototype),{constructor:zl,DefaultSettings_:{endingStart:Gr,endingEnd:Gr},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Hr:i=e,o=2*t-n;break;case co:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Hr:a=e,s=2*n-t;break;case co:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,f=this._weightNext,d=(n-t)/(r-t),m=d*d,g=m*d,y=-h*g+2*h*m-h*d,p=(1+h)*g+(-1.5-2*h)*m+(-.5+h)*d+1,v=(-1-f)*g+(1.5+f)*m+.5*d,_=f*g-f*m,x=0;x!==o;++x)i[x]=y*a[l+x]+p*a[c+x]+v*a[s+x]+_*a[u+x];return i}});function ds(e,t,n,r){nn.call(this,e,t,n,r)}ds.prototype=Object.assign(Object.create(nn.prototype),{constructor:ds,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}});function Gl(e,t,n,r){nn.call(this,e,t,n,r)}Gl.prototype=Object.assign(Object.create(nn.prototype),{constructor:Gl,interpolate_:function(e){return this.copySampleValue_(e-1)}});function Ft(e,t,n,r){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=ft.convertArray(t,this.TimeBufferType),this.values=ft.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}Object.assign(Ft,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:ft.convertArray(e.times,Array),values:ft.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}}),Object.assign(Ft.prototype,{constructor:Ft,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:lo,InterpolantFactoryMethodDiscrete:function(e){return new Gl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new ds(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new zl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case so:t=this.InterpolantFactoryMethodDiscrete;break;case lo:t=this.InterpolantFactoryMethodLinear;break;case Xs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var 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:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return so;case this.InterpolantFactoryMethodLinear:return lo;case this.InterpolantFactoryMethodSmooth:return Xs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=ft.arraySlice(n,i,a),this.values=ft.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(r!==void 0&&ft.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e},optimize:function(){for(var e=ft.arraySlice(this.times),t=ft.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Xs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==c[0]))if(r)s=!0;else for(var u=o*n,h=u-n,f=u+n,d=0;d!==n;++d){var m=t[u+d];if(m!==t[h+d]||m!==t[f+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var g=o*n,y=i*n,d=0;d!==n;++d)t[y+d]=t[g+d]}++i}}if(a>0){e[i]=e[a];for(var g=a*n,y=i*n,d=0;d!==n;++d)t[y+d]=t[g+d];++i}return i!==e.length?(this.times=ft.arraySlice(e,0,i),this.values=ft.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=ft.arraySlice(this.times,0),t=ft.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}});function Hl(e,t,n){Ft.call(this,e,t,n)}Hl.prototype=Object.assign(Object.create(Ft.prototype),{constructor:Hl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:so,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function Vl(e,t,n,r){Ft.call(this,e,t,n,r)}Vl.prototype=Object.assign(Object.create(Ft.prototype),{constructor:Vl,ValueTypeName:"color"});function Pa(e,t,n,r){Ft.call(this,e,t,n,r)}Pa.prototype=Object.assign(Object.create(Ft.prototype),{constructor:Pa,ValueTypeName:"number"});function kl(e,t,n,r){nn.call(this,e,t,n,r)}kl.prototype=Object.assign(Object.create(nn.prototype),{constructor:kl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)bt.slerpFlat(i,0,a,s-o,a,s,c);return i}});function ps(e,t,n,r){Ft.call(this,e,t,n,r)}ps.prototype=Object.assign(Object.create(Ft.prototype),{constructor:ps,ValueTypeName:"quaternion",DefaultInterpolation:lo,InterpolantFactoryMethodLinear:function(e){return new kl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0});function Wl(e,t,n,r){Ft.call(this,e,t,n,r)}Wl.prototype=Object.assign(Object.create(Ft.prototype),{constructor:Wl,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:so,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function Ca(e,t,n,r){Ft.call(this,e,t,n,r)}Ca.prototype=Object.assign(Object.create(Ft.prototype),{constructor:Ca,ValueTypeName:"vector"});function fn(e,t,n,r){this.name=e,this.tracks=n,this.duration=t!==void 0?t:-1,this.blendMode=r!==void 0?r:js,this.uuid=ke.generateUUID(),this.duration<0&&this.resetDuration()}function ky(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Pa;case"vector":case"vector2":case"vector3":case"vector4":return Ca;case"color":return Vl;case"quaternion":return ps;case"bool":case"boolean":return Hl;case"string":return Wl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Wy(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=ky(e.type);if(e.times===void 0){var n=[],r=[];ft.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(fn,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Wy(n[i]).scale(r));return new fn(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ft.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=ft.getKeyframeOrder(s);s=ft.sortedArray(s,1,l),c=ft.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Pa(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new fn(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var h=[];for(var l in r)h.push(fn.CreateFromMorphTargetSequence(l,r[l],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(x,b,T,C,N){if(T.length!==0){var O=[],J=[];ft.flattenJSON(T,O,J,C),O.length!==0&&N.push(new x(b,O,J))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var h={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var d=0;d<u[f].morphTargets.length;d++)h[u[f].morphTargets[d]]=-1;for(var m in h){for(var g=[],y=[],d=0;d!==u[f].morphTargets.length;++d){var p=u[f];g.push(p.time),y.push(p.morphTarget===m?1:0)}r.push(new Pa(".morphTargetInfluence["+m+"]",g,y))}a=h.length*(o||1)}else{var v=".bones["+t[l].name+"]";n(Ca,v+".position",u,"pos",r),n(ps,v+".quaternion",u,"rot",r),n(Ca,v+".scale",u,"scl",r)}}if(r.length===0)return null;var _=new fn(i,a,r,s);return _}}),Object.assign(fn.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new fn(this.name,this.duration,e,this.blendMode)}});var Pi={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function gh(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(l){o++,i===!1&&r.onStart!==void 0&&r.onStart(l,a,o),i=!0},this.itemEnd=function(l){a++,r.onProgress!==void 0&&r.onProgress(l,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(l){r.onError!==void 0&&r.onError(l)},this.resolveURL=function(l){return s?s(l):l},this.setURLModifier=function(l){return s=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){var u=c.indexOf(l);return u!==-1&&c.splice(u,2),this},this.getHandler=function(l){for(var u=0,h=c.length;u<h;u+=2){var f=c[u],d=c[u+1];if(f.global&&(f.lastIndex=0),f.test(l))return d}return null}}var Xy=new gh;function tt(e){this.manager=e!==void 0?e:Xy,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(tt.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var dn={};function bn(e){tt.call(this,e)}bn.prototype=Object.assign(Object.create(tt.prototype),{constructor:bn,load:function(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Pi.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(dn[e]!==void 0){dn[e].push({onLoad:t,onProgress:n,onError:r});return}var o=/^data:(.*?)(;base64)?,(.*)$/,s=e.match(o);if(s){var c=s[1],l=!!s[2],u=s[3];u=decodeURIComponent(u),l&&(u=atob(u));try{var h,f=(this.responseType||"").toLowerCase();switch(f){case"arraybuffer":case"blob":for(var d=new Uint8Array(u.length),m=0;m<u.length;m++)d[m]=u.charCodeAt(m);f==="blob"?h=new Blob([d.buffer],{type:c}):h=d.buffer;break;case"document":var g=new DOMParser;h=g.parseFromString(u,c);break;case"json":h=JSON.parse(u);break;default:h=u;break}setTimeout(function(){t&&t(h),i.manager.itemEnd(e)},0)}catch(v){setTimeout(function(){r&&r(v),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{dn[e]=[],dn[e].push({onLoad:t,onProgress:n,onError:r});var y=new XMLHttpRequest;y.open("GET",e,!0),y.addEventListener("load",function(v){var _=this.response,x=dn[e];if(delete dn[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Pi.add(e,_);for(var b=0,T=x.length;b<T;b++){var C=x[b];C.onLoad&&C.onLoad(_)}i.manager.itemEnd(e)}else{for(var b=0,T=x.length;b<T;b++){var C=x[b];C.onError&&C.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),y.addEventListener("progress",function(v){for(var _=dn[e],x=0,b=_.length;x<b;x++){var T=_[x];T.onProgress&&T.onProgress(v)}},!1),y.addEventListener("error",function(v){var _=dn[e];delete dn[e];for(var x=0,b=_.length;x<b;x++){var T=_[x];T.onError&&T.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),y.addEventListener("abort",function(v){var _=dn[e];delete dn[e];for(var x=0,b=_.length;x<b;x++){var T=_[x];T.onError&&T.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(y.responseType=this.responseType),this.withCredentials!==void 0&&(y.withCredentials=this.withCredentials),y.overrideMimeType&&y.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(var p in this.requestHeader)y.setRequestHeader(p,this.requestHeader[p]);y.send(null)}return i.manager.itemStart(e),y},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}});function yh(e){tt.call(this,e)}yh.prototype=Object.assign(Object.create(tt.prototype),{constructor:yh,load:function(e,t,n,r){var i=this,a=new bn(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=fn.parse(e[n]);t.push(r)}return t}});function xh(e){tt.call(this,e)}xh.prototype=Object.assign(Object.create(tt.prototype),{constructor:xh,load:function(e,t,n,r){var i=this,a=[],o=new va;o.image=a;var s=new bn(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer");function c(f){s.load(e[f],function(d){var m=i.parse(d,!0);a[f]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},l+=1,l===6&&(m.mipmapCount===1&&(o.minFilter=It),o.format=m.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)c(u);else s.load(e,function(f){var d=i.parse(f,!0);if(d.isCubemap)for(var m=d.mipmaps.length/d.mipmapCount,g=0;g<m;g++){a[g]={mipmaps:[]};for(var y=0;y<d.mipmapCount;y++)a[g].mipmaps.push(d.mipmaps[g*d.mipmapCount+y]),a[g].format=d.format,a[g].width=d.width,a[g].height=d.height}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=It),o.format=d.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}});function _h(e){tt.call(this,e)}_h.prototype=Object.assign(Object.create(tt.prototype),{constructor:_h,load:function(e,t,n,r){var i=this,a=new oi,o=new bn(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(s){var c=i.parse(s);c&&(c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Vt,a.wrapT=c.wrapT!==void 0?c.wrapT:Vt,a.magFilter=c.magFilter!==void 0?c.magFilter:It,a.minFilter=c.minFilter!==void 0?c.minFilter:It,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=ro),c.mipmapCount===1&&(a.minFilter=It),a.needsUpdate=!0,t&&t(a,c))},n,r),a}});function Ra(e){tt.call(this,e)}Ra.prototype=Object.assign(Object.create(tt.prototype),{constructor:Ra,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Pi.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Pi.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(l){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(l),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}});function Xl(e){tt.call(this,e)}Xl.prototype=Object.assign(Object.create(tt.prototype),{constructor:Xl,load:function(e,t,n,r){var i=new ar,a=new Ra(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(l){a.load(e[l],function(u){i.images[l]=u,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}});function jl(e){tt.call(this,e)}jl.prototype=Object.assign(Object.create(tt.prototype),{constructor:jl,load:function(e,t,n,r){var i=new ot,a=new Ra(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){i.image=o;var s=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;i.format=s?xr:on,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}});function Le(){this.type="Curve",this.arcLengthDivisions=200}Object.assign(Le.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n=this.getLengths(),r=0,i=n.length,a;t?a=t:a=e*n[i-1];for(var o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1],h=u-l,f=(a-l)/h,d=(r+f)/(i-1);return d},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new X:new E);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new E,r=[],i=[],a=[],o=new E,s=new We,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new E),r[c].normalize();i[0]=new E,a[0]=new E;var h=Number.MAX_VALUE,f=Math.abs(r[0].x),d=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=h&&(h=f,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),m<=h&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(ke.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(ke.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}});function rn(e,t,n,r,i,a,o,s){Le.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}rn.prototype=Object.create(Le.prototype),rn.prototype.constructor=rn,rn.prototype.isEllipseCurve=!0,rn.prototype.getPoint=function(e,t){for(var n=t||new X,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(a?i=0:i=r),this.aClockwise===!0&&!a&&(i===r?i=-r:i=i-r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,f=c-this.aY;s=h*l-f*u+this.aX,c=h*u+f*l+this.aY}return n.set(s,c)},rn.prototype.copy=function(e){return Le.prototype.copy.call(this,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},rn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);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},rn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,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};function Oa(e,t,n,r,i,a){rn.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}Oa.prototype=Object.create(rn.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isArcCurve=!0;function ql(){var e=0,t=0,n=0,r=0;function i(a,o,s,c){e=a,t=s,n=-3*a+3*o-2*s-c,r=2*a-2*o+s+c}return{initCatmullRom:function(a,o,s,c,l){i(o,s,l*(s-a),l*(c-o))},initNonuniformCatmullRom:function(a,o,s,c,l,u,h){var f=(o-a)/l-(s-a)/(l+u)+(s-o)/u,d=(s-o)/u-(c-o)/(u+h)+(c-s)/h;f*=u,d*=u,i(o,s,f,d)},calc:function(a){var o=a*a,s=o*a;return e+t*a+n*o+r*s}}}var vs=new E,Yl=new ql,Zl=new ql,Jl=new ql;function Jt(e,t,n,r){Le.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}Jt.prototype=Object.create(Le.prototype),Jt.prototype.constructor=Jt,Jt.prototype.isCatmullRomCurve3=!0,Jt.prototype.getPoint=function(e,t){var n=t||new E,r=this.points,i=r.length,a=(i-(this.closed?0:1))*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,h;if(this.closed||o>0?c=r[(o-1)%i]:(vs.subVectors(r[0],r[1]).add(r[0]),c=vs),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?h=r[(o+2)%i]:(vs.subVectors(r[i-1],r[i-2]).add(r[i-1]),h=vs),this.curveType==="centripetal"||this.curveType==="chordal"){var f=this.curveType==="chordal"?.5:.25,d=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),g=Math.pow(u.distanceToSquared(h),f);m<1e-4&&(m=1),d<1e-4&&(d=m),g<1e-4&&(g=m),Yl.initNonuniformCatmullRom(c.x,l.x,u.x,h.x,d,m,g),Zl.initNonuniformCatmullRom(c.y,l.y,u.y,h.y,d,m,g),Jl.initNonuniformCatmullRom(c.z,l.z,u.z,h.z,d,m,g)}else this.curveType==="catmullrom"&&(Yl.initCatmullRom(c.x,l.x,u.x,h.x,this.tension),Zl.initCatmullRom(c.y,l.y,u.y,h.y,this.tension),Jl.initCatmullRom(c.z,l.z,u.z,h.z,this.tension));return n.set(Yl.calc(s),Zl.calc(s),Jl.calc(s)),n},Jt.prototype.copy=function(e){Le.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Jt.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Jt.prototype.fromJSON=function(e){Le.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new E().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this};function bh(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function jy(e,t){var n=1-e;return n*n*t}function qy(e,t){return 2*(1-e)*e*t}function Yy(e,t){return e*e*t}function Da(e,t,n,r){return jy(e,t)+qy(e,n)+Yy(e,r)}function Zy(e,t){var n=1-e;return n*n*n*t}function Jy(e,t){var n=1-e;return 3*n*n*e*t}function Qy(e,t){return 3*(1-e)*e*e*t}function Ky(e,t){return e*e*e*t}function Ia(e,t,n,r,i){return Zy(e,t)+Jy(e,n)+Qy(e,r)+Ky(e,i)}function wn(e,t,n,r){Le.call(this),this.type="CubicBezierCurve",this.v0=e||new X,this.v1=t||new X,this.v2=n||new X,this.v3=r||new X}wn.prototype=Object.create(Le.prototype),wn.prototype.constructor=wn,wn.prototype.isCubicBezierCurve=!0,wn.prototype.getPoint=function(e,t){var n=t||new X,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ia(e,r.x,i.x,a.x,o.x),Ia(e,r.y,i.y,a.y,o.y)),n},wn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},wn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},wn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Hn(e,t,n,r){Le.call(this),this.type="CubicBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E,this.v3=r||new E}Hn.prototype=Object.create(Le.prototype),Hn.prototype.constructor=Hn,Hn.prototype.isCubicBezierCurve3=!0,Hn.prototype.getPoint=function(e,t){var n=t||new E,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ia(e,r.x,i.x,a.x,o.x),Ia(e,r.y,i.y,a.y,o.y),Ia(e,r.z,i.z,a.z,o.z)),n},Hn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Hn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Hn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Qt(e,t){Le.call(this),this.type="LineCurve",this.v1=e||new X,this.v2=t||new X}Qt.prototype=Object.create(Le.prototype),Qt.prototype.constructor=Qt,Qt.prototype.isLineCurve=!0,Qt.prototype.getPoint=function(e,t){var n=t||new X;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Qt.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Qt.prototype.getTangent=function(e,t){var n=t||new X,n=n.copy(this.v2).sub(this.v1).normalize();return n},Qt.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Qt.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Qt.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function Mn(e,t){Le.call(this),this.type="LineCurve3",this.v1=e||new E,this.v2=t||new E}Mn.prototype=Object.create(Le.prototype),Mn.prototype.constructor=Mn,Mn.prototype.isLineCurve3=!0,Mn.prototype.getPoint=function(e,t){var n=t||new E;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Mn.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Mn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Mn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Mn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function En(e,t,n){Le.call(this),this.type="QuadraticBezierCurve",this.v0=e||new X,this.v1=t||new X,this.v2=n||new X}En.prototype=Object.create(Le.prototype),En.prototype.constructor=En,En.prototype.isQuadraticBezierCurve=!0,En.prototype.getPoint=function(e,t){var n=t||new X,r=this.v0,i=this.v1,a=this.v2;return n.set(Da(e,r.x,i.x,a.x),Da(e,r.y,i.y,a.y)),n},En.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},En.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},En.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function Vn(e,t,n){Le.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E}Vn.prototype=Object.create(Le.prototype),Vn.prototype.constructor=Vn,Vn.prototype.isQuadraticBezierCurve3=!0,Vn.prototype.getPoint=function(e,t){var n=t||new E,r=this.v0,i=this.v1,a=this.v2;return n.set(Da(e,r.x,i.x,a.x),Da(e,r.y,i.y,a.y),Da(e,r.z,i.z,a.z)),n},Vn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Vn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Vn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function Tn(e){Le.call(this),this.type="SplineCurve",this.points=e||[]}Tn.prototype=Object.create(Le.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isSplineCurve=!0,Tn.prototype.getPoint=function(e,t){var n=t||new X,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(bh(o,s.x,c.x,l.x,u.x),bh(o,s.y,c.y,l.y,u.y)),n},Tn.prototype.copy=function(e){Le.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},Tn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},Tn.prototype.fromJSON=function(e){Le.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new X().fromArray(r))}return this};var Ql=Object.freeze({__proto__:null,ArcCurve:Oa,CatmullRomCurve3:Jt,CubicBezierCurve:wn,CubicBezierCurve3:Hn,EllipseCurve:rn,LineCurve:Qt,LineCurve3:Mn,QuadraticBezierCurve:En,QuadraticBezierCurve3:Vn,SplineCurve:Tn});function fr(){Le.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}fr.prototype=Object.assign(Object.create(Le.prototype),{constructor:fr,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Qt(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Le.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Le.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Le.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new Ql[r.type]().fromJSON(r))}return this}});function Sn(e){fr.call(this),this.type="Path",this.currentPoint=new X,e&&this.setFromPoints(e)}Sn.prototype=Object.assign(Object.create(fr.prototype),{constructor:Sn,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new Qt(this.currentPoint.clone(),new X(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new En(this.currentPoint.clone(),new X(e,t),new X(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new wn(this.currentPoint.clone(),new X(e,t),new X(n,r),new X(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e),n=new Tn(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new rn(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return fr.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=fr.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return fr.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}});function Cr(e){Sn.call(this,e),this.uuid=ke.generateUUID(),this.type="Shape",this.holes=[]}Cr.prototype=Object.assign(Object.create(Sn.prototype),{constructor:Cr,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Sn.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=Sn.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){Sn.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new Sn().fromJSON(r))}return this}});function lt(e,t){ae.call(this),this.type="Light",this.color=new de(e),this.intensity=t!==void 0?t:1,this.receiveShadow=void 0}lt.prototype=Object.assign(Object.create(ae.prototype),{constructor:lt,isLight:!0,copy:function(e){return ae.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=ae.prototype.toJSON.call(this,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}});function Kl(e,t,n){lt.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ae.DefaultUp),this.updateMatrix(),this.groundColor=new de(t)}Kl.prototype=Object.assign(Object.create(lt.prototype),{constructor:Kl,isHemisphereLight:!0,copy:function(e){return lt.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}});function kn(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new X(512,512),this.map=null,this.mapPass=null,this.matrix=new We,this._frustum=new aa,this._frameExtents=new X(1,1),this._viewportCount=1,this._viewports=[new et(0,0,1,1)]}Object.assign(kn.prototype,{_projScreenMatrix:new We,_lightPositionWorld:new E,_lookTarget:new E,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),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:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),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}});function $l(){kn.call(this,new Et(50,1,.5,500))}$l.prototype=Object.assign(Object.create(kn.prototype),{constructor:$l,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=ke.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),kn.prototype.updateMatrices.call(this,e)}});function ec(e,t,n,r,i,a){lt.call(this,e,t),this.type="SpotLight",this.position.copy(ae.DefaultUp),this.updateMatrix(),this.target=new ae,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=n!==void 0?n:0,this.angle=r!==void 0?r:Math.PI/3,this.penumbra=i!==void 0?i:0,this.decay=a!==void 0?a:1,this.shadow=new $l}ec.prototype=Object.assign(Object.create(lt.prototype),{constructor:ec,isSpotLight:!0,copy:function(e){return lt.prototype.copy.call(this,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}});function tc(){kn.call(this,new Et(90,1,.5,500)),this._frameExtents=new X(4,2),this._viewportCount=6,this._viewports=[new et(2,1,1,1),new et(0,1,1,1),new et(3,1,1,1),new et(1,1,1,1),new et(3,0,1,1),new et(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}tc.prototype=Object.assign(Object.create(kn.prototype),{constructor:tc,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}});function nc(e,t,n,r){lt.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(i){this.intensity=i/(4*Math.PI)}}),this.distance=n!==void 0?n:0,this.decay=r!==void 0?r:1,this.shadow=new tc}nc.prototype=Object.assign(Object.create(lt.prototype),{constructor:nc,isPointLight:!0,copy:function(e){return lt.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}});function Na(e,t,n,r,i,a){Bn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e!==void 0?e:-1,this.right=t!==void 0?t:1,this.top=n!==void 0?n:1,this.bottom=r!==void 0?r:-1,this.near=i!==void 0?i:.1,this.far=a!==void 0?a:2e3,this.updateProjectionMatrix()}Na.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Na,isOrthographicCamera:!0,copy:function(e,t){return Bn.prototype.copy.call(this,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:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ae.prototype.toJSON.call(this,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}});function rc(){kn.call(this,new Na(-5,5,5,-5,.5,500))}rc.prototype=Object.assign(Object.create(kn.prototype),{constructor:rc,isDirectionalLightShadow:!0,updateMatrices:function(e){kn.prototype.updateMatrices.call(this,e)}});function ic(e,t){lt.call(this,e,t),this.type="DirectionalLight",this.position.copy(ae.DefaultUp),this.updateMatrix(),this.target=new ae,this.shadow=new rc}ic.prototype=Object.assign(Object.create(lt.prototype),{constructor:ic,isDirectionalLight:!0,copy:function(e){return lt.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}});function ac(e,t){lt.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}ac.prototype=Object.assign(Object.create(lt.prototype),{constructor:ac,isAmbientLight:!0});function oc(e,t,n,r){lt.call(this,e,t),this.type="RectAreaLight",this.width=n!==void 0?n:10,this.height=r!==void 0?r:10}oc.prototype=Object.assign(Object.create(lt.prototype),{constructor:oc,isRectAreaLight:!0,copy:function(e){return lt.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=lt.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});function sc(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new E)}Object.assign(sc.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*r)),t.addScaledVector(a[5],1.092548*(r*i)),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],1.092548*(n*i)),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}}),Object.assign(sc,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}});function pn(e,t){lt.call(this,void 0,t),this.type="LightProbe",this.sh=e!==void 0?e:new sc}pn.prototype=Object.assign(Object.create(lt.prototype),{constructor:pn,isLightProbe:!0,copy:function(e){return lt.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=lt.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}});function lc(e){tt.call(this,e),this.textures={}}lc.prototype=Object.assign(Object.create(tt.prototype),{constructor:lc,load:function(e,t,n,r){var i=this,a=new bn(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(c){return t[c]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",c),t[c]}var r=new Vy[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new de().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=new de().setHex(a.value);break;case"v2":r.uniforms[i].value=new X().fromArray(a.value);break;case"v3":r.uniforms[i].value=new E().fromArray(a.value);break;case"v4":r.uniforms[i].value=new et().fromArray(a.value);break;case"m3":r.uniforms[i].value=new Ut().fromArray(a.value);case"m4":r.uniforms[i].value=new We().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new X().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new X().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}});var wh={decodeText:function(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(i){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}};function ms(){ve.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}ms.prototype=Object.assign(Object.create(ve.prototype),{constructor:ms,isInstancedBufferGeometry:!0,copy:function(e){return ve.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=ve.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}});function cc(e,t,n,r){typeof n=="number"&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),De.call(this,e,t,n),this.meshPerAttribute=r||1}cc.prototype=Object.assign(Object.create(De.prototype),{constructor:cc,isInstancedBufferAttribute:!0,copy:function(e){return De.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=De.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}});function uc(e){tt.call(this,e)}uc.prototype=Object.assign(Object.create(tt.prototype),{constructor:uc,load:function(e,t,n,r){var i=this,a=new bn(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new ms:new ve,n=e.data.index;if(n!==void 0){var r=new hc[n.type](n.array);t.setIndex(new De(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new hc[o.type](o.array),s=o.isInstancedBufferAttribute?cc:De,c=new s(r,o.itemSize,o.normalized);o.name!==void 0&&(c.name=o.name),t.setAttribute(a,c)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var u=l[a],h=[],f=0,d=u.length;f<d;f++){var o=u[f],r=new hc[o.type](o.array),c=new De(r,o.itemSize,o.normalized);o.name!==void 0&&(c.name=o.name),h.push(c)}t.morphAttributes[a]=h}var m=e.data.morphTargetsRelative;m&&(t.morphTargetsRelative=!0);var g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(var f=0,y=g.length;f!==y;++f){var p=g[f];t.addGroup(p.start,p.count,p.materialIndex)}var v=e.data.boundingSphere;if(v!==void 0){var _=new E;v.center!==void 0&&_.fromArray(v.center),t.boundingSphere=new Dn(_,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var hc={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray!="undefined"?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function fc(e){tt.call(this,e)}fc.prototype=Object.assign(Object.create(tt.prototype),{constructor:fc,load:function(e,t,n,r){var i=this,a=this.path===""?wh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new bn(i.manager);o.setPath(this.path),o.load(e,function(s){var c=null;try{c=JSON.parse(s)}catch(u){r!==void 0&&r(u),console.error("THREE:ObjectLoader: Can't parse "+e+".",u.message);return}var l=c.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}i.parse(c,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new Cr().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new uc,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new zt[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new zt[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new zt[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new zt[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new zt[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new zt[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new zt[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new zt[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new zt[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new zt[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new zt[s.type](new Ql[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new zt[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new zt[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],c=0,l=s.shapes.length;c<l;c++){var u=t[s.shapes[c]];h.push(u)}o=new zt[s.type](h,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(var h=[],c=0,l=s.shapes.length;c<l;c++){var u=t[s.shapes[c]];h.push(u)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new Ql[f.type]().fromJSON(f)),o=new zt[s.type](h,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new lc;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type==="MultiMaterial"){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=fn.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(g){return n.manager.itemStart(g),o.load(g,function(){n.manager.itemEnd(g)},void 0,function(){n.manager.itemError(g),n.manager.itemEnd(g)})}if(e!==void 0&&e.length>0){var a=new gh(t),o=new Ra(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;s<c;s++){var l=e[s],u=l.url;if(Array.isArray(u)){r[l.uuid]=[];for(var h=0,f=u.length;h<f;h++){var d=u[h],m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[l.uuid].push(i(m))}}else{var m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;r[l.uuid]=i(m)}}}return r},parseTextures:function(e,t){function n(c,l){return typeof c=="number"?c:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",c),l[c])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s;Array.isArray(t[o.image])?s=new ar(t[o.image]):s=new ot(t[o.image]),s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,$y)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Mh),s.wrapT=n(o.wrap[1],Mh)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,Eh)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,Eh)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(y){return t[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",y),t[y]}function a(y){if(y!==void 0){if(Array.isArray(y)){for(var p=[],v=0,_=y.length;v<_;v++){var x=y[v];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),p.push(n[x])}return p}return n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),n[y]}}switch(e.type){case"Scene":r=new Ji,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new de(e.background)),e.fog!==void 0&&(e.fog.type==="Fog"?r.fog=new Al(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(r.fog=new Sl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new Et(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new Na(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new ac(e.color,e.intensity);break;case"DirectionalLight":r=new ic(e.color,e.intensity);break;case"PointLight":r=new nc(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new oc(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new ec(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new Kl(e.color,e.groundColor,e.intensity);break;case"LightProbe":r=new pn().fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=i(e.geometry),s=a(e.material);r=new ut(o,s);break;case"InstancedMesh":var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Ol(o,s,c),r.instanceMatrix=new De(new Float32Array(l.array),16);break;case"LOD":r=new Fo;break;case"Line":r=new tn(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Dl(i(e.geometry),a(e.material));break;case"LineSegments":r=new Mt(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new Nl(i(e.geometry),a(e.material));break;case"Sprite":r=new Pl(a(e.material));break;case"Group":r=new ua;break;default:r=new ae}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix!==void 0?(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,h=0;h<u.length;h++)r.add(this.parseObject(u[h],t,n));if(e.type==="LOD"){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,d=0;d<f.length;d++){var m=f[d],g=r.getObjectByProperty("uuid",m.object);g!==void 0&&r.addLevel(g,m.distance)}}return r}});var $y={UVMapping:Us,CubeReflectionMapping:zs,CubeRefractionMapping:Gs,EquirectangularReflectionMapping:Yc,EquirectangularRefractionMapping:Hs,SphericalReflectionMapping:Zc,CubeUVReflectionMapping:ki,CubeUVRefractionMapping:Vs},Mh={RepeatWrapping:to,ClampToEdgeWrapping:Vt,MirroredRepeatWrapping:no},Eh={NearestFilter:_t,NearestMipmapNearestFilter:ks,NearestMipmapLinearFilter:Ws,LinearFilter:It,LinearMipmapNearestFilter:Jc,LinearMipmapLinearFilter:ro};function Th(e){typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),tt.call(this,e),this.options=void 0}Th.prototype=Object.assign(Object.create(tt.prototype),{constructor:Th,setOptions:function(t){return this.options=t,this},load:function(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Pi.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(o){return o.blob()}).then(function(o){return i.options===void 0?createImageBitmap(o):createImageBitmap(o,i.options)}).then(function(o){Pi.add(e,o),t&&t(o),i.manager.itemEnd(e)}).catch(function(o){r&&r(o),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}});function Sh(){this.type="ShapePath",this.color=new de,this.subPaths=[],this.currentPath=null}Object.assign(Sh.prototype,{moveTo:function(e,t){return this.currentPath=new Sn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(D){for(var z=[],k=0,q=D.length;k<q;k++){var Z=D[k],ee=new Cr;ee.curves=Z.curves,z.push(ee)}return z}function r(D,z){for(var k=z.length,q=!1,Z=k-1,ee=0;ee<k;Z=ee++){var te=z[Z],oe=z[ee],Pe=oe.x-te.x,be=oe.y-te.y;if(Math.abs(be)>Number.EPSILON){if(be<0&&(te=z[ee],Pe=-Pe,oe=z[Z],be=-be),D.y<te.y||D.y>oe.y)continue;if(D.y===te.y){if(D.x===te.x)return!0}else{var re=be*(D.x-te.x)-Pe*(D.y-te.y);if(re===0)return!0;if(re<0)continue;q=!q}}else{if(D.y!==te.y)continue;if(oe.x<=D.x&&D.x<=te.x||te.x<=D.x&&D.x<=oe.x)return!0}}return q}var i=cr.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new Cr,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h=[],f=[],d=[],m=0,g;f[m]=void 0,d[m]=[];for(var y=0,p=a.length;y<p;y++)s=a[y],g=s.getPoints(),o=i(g),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new Cr,p:g},f[m].s.curves=s.curves,u&&m++,d[m]=[]):d[m].push({h:s,p:g[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,_=[],x=0,b=f.length;x<b;x++)h[x]=[];for(var x=0,b=f.length;x<b;x++)for(var T=d[x],C=0;C<T.length;C++){for(var N=T[C],O=!0,J=0;J<f.length;J++)r(N.p,f[J].p)&&(x!==J&&_.push({froms:x,tos:J,hole:C}),O?(O=!1,h[J].push(N)):v=!0);O&&h[x].push(N)}_.length>0&&(v||(d=h))}for(var F,y=0,B=f.length;y<B;y++){c=f[y].s,l.push(c),F=d[y];for(var V=0,Y=F.length;V<Y;V++)c.holes.push(F[V].h)}return l}});function Ah(e){this.type="Font",this.data=e}Object.assign(Ah.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=e0(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}});function e0(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`
|
|
3113
|
-
`)s=0,c-=a;else{var h=t0(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}function t0(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(!a){console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".");return}var o=new Sh,s,c,l,u,h,f,d,m;if(a.o)for(var g=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),y=0,p=g.length;y<p;){var v=g[y++];switch(v){case"m":s=g[y++]*t+n,c=g[y++]*t+r,o.moveTo(s,c);break;case"l":s=g[y++]*t+n,c=g[y++]*t+r,o.lineTo(s,c);break;case"q":l=g[y++]*t+n,u=g[y++]*t+r,h=g[y++]*t+n,f=g[y++]*t+r,o.quadraticCurveTo(h,f,l,u);break;case"b":l=g[y++]*t+n,u=g[y++]*t+r,h=g[y++]*t+n,f=g[y++]*t+r,d=g[y++]*t+n,m=g[y++]*t+r,o.bezierCurveTo(h,f,d,m,l,u);break}}return{offsetX:a.ha*t,path:o}}function Lh(e){tt.call(this,e)}Lh.prototype=Object.assign(Object.create(tt.prototype),{constructor:Lh,load:function(e,t,n,r){var i=this,a=new bn(this.manager);a.setPath(this.path),a.load(e,function(o){var s;try{s=JSON.parse(o)}catch(l){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),s=JSON.parse(o.substring(65,o.length-2))}var c=i.parse(s);t&&t(c)},n,r)},parse:function(e){return new Ah(e)}});var gs,Ph={getContext:function(){return gs===void 0&&(gs=new(window.AudioContext||window.webkitAudioContext)),gs},setContext:function(e){gs=e}};function dc(e){tt.call(this,e)}dc.prototype=Object.assign(Object.create(tt.prototype),{constructor:dc,load:function(e,t,n,r){var i=this,a=new bn(i.manager);a.setResponseType("arraybuffer"),a.setPath(i.path),a.load(e,function(o){try{var s=o.slice(0),c=Ph.getContext();c.decodeAudioData(s,function(l){t(l)})}catch(l){r?r(l):console.error(l),i.manager.itemError(e)}},n,r)}});function Ch(e,t,n){pn.call(this,void 0,n);var r=new de().set(e),i=new de().set(t),a=new E(r.r,r.g,r.b),o=new E(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}Ch.prototype=Object.assign(Object.create(pn.prototype),{constructor:Ch,isHemisphereLightProbe:!0,copy:function(e){return pn.prototype.copy.call(this,e),this},toJSON:function(e){var t=pn.prototype.toJSON.call(this,e);return t}});function Rh(e,t){pn.call(this,void 0,t);var n=new de().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Rh.prototype=Object.assign(Object.create(pn.prototype),{constructor:Rh,isAmbientLightProbe:!0,copy:function(e){return pn.prototype.copy.call(this,e),this},toJSON:function(e){var t=pn.prototype.toJSON.call(this,e);return t}});var Oh=new We,Dh=new We;function n0(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Et,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Et,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}}Object.assign(n0.prototype,{update:function(e){var t=this._cache,n=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;if(n){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;var r=e.projectionMatrix.clone(),i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(ke.DEG2RAD*t.fov*.5)/t.zoom,s,c;Dh.elements[12]=-i,Oh.elements[12]=i,s=-o*t.aspect+a,c=o*t.aspect+a,r.elements[0]=2*t.near/(c-s),r.elements[8]=(c+s)/(c-s),this.cameraL.projectionMatrix.copy(r),s=-o*t.aspect-a,c=o*t.aspect-a,r.elements[0]=2*t.near/(c-s),r.elements[8]=(c+s)/(c-s),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Dh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Oh)}});function Ih(e){this.autoStart=e!==void 0?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Ih.prototype,{start:function(){this.startTime=(typeof performance=="undefined"?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance=="undefined"?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Rr=new E,Nh=new bt,r0=new E,Or=new E;function Fh(){ae.call(this),this.type="AudioListener",this.context=Ph.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ih}Fh.prototype=Object.assign(Object.create(ae.prototype),{constructor:Fh,getInput:function(){return this.gain},removeFilter:function(){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:function(){return this.filter},setFilter:function(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:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){ae.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rr,Nh,r0),Or.set(0,0,-1).applyQuaternion(Nh),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Rr.x,r),t.positionY.linearRampToValueAtTime(Rr.y,r),t.positionZ.linearRampToValueAtTime(Rr.z,r),t.forwardX.linearRampToValueAtTime(Or.x,r),t.forwardY.linearRampToValueAtTime(Or.y,r),t.forwardZ.linearRampToValueAtTime(Or.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Rr.x,Rr.y,Rr.z),t.setOrientation(Or.x,Or.y,Or.z,n.x,n.y,n.z)}});function Fa(e){ae.call(this),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.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Fa.prototype=Object.assign(Object.create(ae.prototype),{constructor:Fa,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),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;var 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:function(){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:function(){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:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var 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},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var 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},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(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:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(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:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(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:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Dr=new E,Bh=new bt,i0=new E,Ir=new E;function Uh(e){Fa.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}Uh.prototype=Object.assign(Object.create(Fa.prototype),{constructor:Uh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(ae.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Dr,Bh,i0),Ir.set(0,0,1).applyQuaternion(Bh);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Dr.x,n),t.positionY.linearRampToValueAtTime(Dr.y,n),t.positionZ.linearRampToValueAtTime(Dr.z,n),t.orientationX.linearRampToValueAtTime(Ir.x,n),t.orientationY.linearRampToValueAtTime(Ir.y,n),t.orientationZ.linearRampToValueAtTime(Ir.z,n)}else t.setPosition(Dr.x,Dr.y,Dr.z),t.setOrientation(Ir.x,Ir.y,Ir.z)}}});function zh(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t!==void 0?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}Object.assign(zh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}});function Gh(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(Gh.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){bt.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;bt.multiplyQuaternionsFlat(e,a,e,t,e,n),bt.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}});var pc="\\[\\]\\.:\\/",a0=new RegExp("["+pc+"]","g"),vc="[^"+pc+"]",o0="[^"+pc.replace("\\.","")+"]",s0=/((?:WC+[\/:])*)/.source.replace("WC",vc),l0=/(WCOD+)?/.source.replace("WCOD",o0),c0=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",vc),u0=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",vc),h0=new RegExp("^"+s0+l0+c0+u0+"$"),f0=["material","materials","bones"];function Hh(e,t,n){var r=n||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}Object.assign(Hh.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}});function Gt(e,t,n){this.path=t,this.parsedPath=n||Gt.parseTrackName(t),this.node=Gt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}Object.assign(Gt,{Composite:Hh,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Gt.Composite(e,t,n):new Gt(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(a0,"")},parseTrackName:function(e){var t=h0.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);f0.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(a){for(var o=0;o<a.length;o++){var s=a[o];if(s.name===t||s.uuid===t)return s;var c=r(s.children);if(c)return c}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(Gt.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,n){t[n]=this.node[this.propertyName]},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)t[n++]=r[i]},function(t,n){t[n]=this.resolvedProperty[this.propertyIndex]},function(t,n){this.resolvedProperty.toArray(t,n)}],SetterByBindingTypeAndVersioning:[[function(t,n){this.targetObject[this.propertyName]=t[n]},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++]},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++];this.targetObject.needsUpdate=!0},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty[this.propertyIndex]=t[n]},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty.fromArray(t,n)},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,n){this.bind(),this.getValue(t,n)},setValue:function(t,n){this.bind(),this.setValue(t,n)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Gt.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){var a=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(var o=0;o<e.length;o++)if(e[o].name===a){a=o;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(a!==void 0){if(e[a]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);var u=this.BindingType.Direct;if(i!==void 0){if(r==="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[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Gt.prototype,{_getValue_unbound:Gt.prototype.getValue,_setValue_unbound:Gt.prototype.setValue});function d0(){this.uuid=ke.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}Object.assign(d0.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],f=h.uuid,d=r[f];if(d===void 0){d=t++,r[f]=d,e.push(h);for(var m=0,g=s;m!==g;++m)o[m].push(new Gt(h,i[m],a[m]))}else if(d<n){c=e[d];var y=--n,p=e[y];r[p.uuid]=d,e[d]=p,r[f]=y,e[y]=h;for(var m=0,g=s;m!==g;++m){var v=o[m],_=v[y],x=v[d];v[d]=_,x===void 0&&(x=new Gt(h,i[m],a[m])),v[y]=x}}else e[d]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var f=0,d=i;f!==d;++f){var m=r[f],g=m[u],y=m[l];m[l]=g,m[u]=y}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(u!==void 0)if(delete r[l],u<n){var h=--n,f=e[h],d=--t,m=e[d];r[f.uuid]=u,e[u]=f,r[m.uuid]=h,e[h]=m,e.pop();for(var g=0,y=a;g!==y;++g){var p=i[g],v=p[h],_=p[d];p[u]=v,p[h]=_,p.pop()}}else{var d=--t,m=e[d];r[m.uuid]=u,e[u]=m,e.pop();for(var g=0,y=a;g!==y;++g){var p=i[g];p[u]=p[d],p.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=l,f=s.length;h!==f;++h){var d=s[h];u[h]=new Gt(d,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}});function Vh(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=new Array(a),s={endingStart:Gr,endingEnd:Gr},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ap,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}Object.assign(Vh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case su:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case js:default:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===op;if(e===0)return i===-1?t:a&&(i&1)===1?n-t:t;if(r===ip){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)===1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Hr,r.endingEnd=Hr):(e?r.endingStart=this.zeroSlopeAtStart?Hr:Gr:r.endingStart=co,t?r.endingEnd=this.zeroSlopeAtEnd?Hr:Gr:r.endingEnd=co)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}});function kh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}kh.prototype=Object.assign(Object.create(sn.prototype),{constructor:kh,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],f=h.name,d=l[f];if(d!==void 0)a[u]=d;else{if(d=a[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;d=new Gh(Gt.create(n,f,m),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,f),a[u]=d}o[u].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,h=(e._localRoot||this._root).uuid;delete u[h],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new ds(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e=="string"?fn.findByName(r,e):e,o=a!==null?a.uuid:e,s=this._actionsByClip[o],c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=js),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new Vh(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e=="string"?fn.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,n=t-1;n>=0;--n)e[n].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){var s=t[o];s._update(r,e,i,a)}for(var c=this._bindings,l=this._nActiveBindings,o=0;o!==l;++o)c[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,a=i[t];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(s!==void 0)for(var c in s){var l=s[c];l.restoreOriginalState(),this._removeInactiveBinding(l)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}});function mc(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}mc.prototype.clone=function(){return new mc(this.value.clone===void 0?this.value:this.value.clone())};function Wh(e,t,n){sr.call(this,e,t),this.meshPerAttribute=n||1}Wh.prototype=Object.assign(Object.create(sr.prototype),{constructor:Wh,isInstancedInterleavedBuffer:!0,copy:function(e){return sr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}});function Xh(e,t,n,r){this.ray=new Jr(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new Qs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function jh(e,t){return e.distance-t.distance}function gc(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)gc(i[a],t,n,!0)}Object.assign(Xh.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(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.")},intersectObject:function(e,t,n){var r=n||[];return gc(e,this,r,t),r.sort(jh),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)gc(e[i],this,r,t);return r.sort(jh),r}});function yc(e,t,n){return this.radius=e!==void 0?e:1,this.phi=t!==void 0?t:0,this.theta=n!==void 0?n:0,this}Object.assign(yc.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(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(ke.clamp(t/this.radius,-1,1))),this}});function p0(e,t,n){return this.radius=e!==void 0?e:1,this.theta=t!==void 0?t:0,this.y=n!==void 0?n:0,this}Object.assign(p0.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var qh=new X;function Yh(e,t){this.min=e!==void 0?e:new X(1/0,1/0),this.max=t!==void 0?t:new X(-1/0,-1/0)}Object.assign(Yh.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new X),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new X),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(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:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new X),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:function(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:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new X),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=qh.copy(e).clamp(this.min,this.max);return t.sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Zh=new E,ys=new E;function Jh(e,t){this.start=e!==void 0?e:new E,this.end=t!==void 0?t:new E}Object.assign(Jh.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new E),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn("THREE.Line3: .delta() target is now required"),e=new E),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn("THREE.Line3: .at() target is now required"),t=new E),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Zh.subVectors(e,this.start),ys.subVectors(this.end,this.start);var n=ys.dot(ys),r=ys.dot(Zh),i=r/n;return t&&(i=ke.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new E),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}});function xs(e){ae.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}xs.prototype=Object.create(ae.prototype),xs.prototype.constructor=xs,xs.prototype.isImmediateRenderObject=!0;var Qh=new E;function Ba(e,t){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new ve,r=[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],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute("position",new ce(r,3));var l=new mt({fog:!1,toneMapped:!1});this.cone=new Mt(n,l),this.add(this.cone),this.update()}Ba.prototype=Object.create(ae.prototype),Ba.prototype.constructor=Ba,Ba.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Ba.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var dr=new E,_s=new We,xc=new We;function Kh(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,Kh(e.children[n]));return t}function Ci(e){for(var t=Kh(e),n=new ve,r=[],i=[],a=new de(0,0,1),o=new de(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new ce(r,3)),n.setAttribute("color",new ce(i,3));var l=new mt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Mt.call(this,n,l),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}Ci.prototype=Object.create(Mt.prototype),Ci.prototype.constructor=Ci,Ci.prototype.isSkeletonHelper=!0,Ci.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");xc.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(_s.multiplyMatrices(xc,o.matrixWorld),dr.setFromMatrixPosition(_s),r.setXYZ(a,dr.x,dr.y,dr.z),_s.multiplyMatrices(xc,o.parent.matrixWorld),dr.setFromMatrixPosition(_s),r.setXYZ(a+1,dr.x,dr.y,dr.z),a+=2)}n.getAttribute("position").needsUpdate=!0,ae.prototype.updateMatrixWorld.call(this,e)};function Ua(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new yi(t,4,2),i=new hn({wireframe:!0,fog:!1,toneMapped:!1});ut.call(this,r,i),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Ua.prototype=Object.create(ut.prototype),Ua.prototype.constructor=Ua,Ua.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Ua.prototype.update=function(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var v0=new E,$h=new de,ef=new de;function za(e,t,n){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new pi(t);r.rotateY(Math.PI*.5),this.material=new hn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute("position"),a=new Float32Array(i.count*3);r.setAttribute("color",new De(a,3)),this.add(new ut(r,this.material)),this.update()}za.prototype=Object.create(ae.prototype),za.prototype.constructor=za,za.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},za.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");$h.copy(this.light.color),ef.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?$h:ef;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(v0.setFromMatrixPosition(this.light.matrixWorld).negate())};function _c(e,t,n,r){e=e||10,t=t||10,n=new de(n!==void 0?n:4473924),r=new de(r!==void 0?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var d=new ve;d.setAttribute("position",new ce(s,3)),d.setAttribute("color",new ce(c,3));var m=new mt({vertexColors:!0,toneMapped:!1});Mt.call(this,d,m),this.type="GridHelper"}_c.prototype=Object.assign(Object.create(Mt.prototype),{constructor:_c,copy:function(e){return Mt.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}});function bc(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new de(i!==void 0?i:4473924),a=new de(a!==void 0?a:8947848);var o=[],s=[],c,l,u,h,f,d,m;for(h=0;h<=t;h++)u=h/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=h&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(h=0;h<=n;h++)for(m=h&1?i:a,d=e-e/n*h,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*d,l=Math.cos(u)*d,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*d,l=Math.cos(u)*d,o.push(c,0,l),s.push(m.r,m.g,m.b);var g=new ve;g.setAttribute("position",new ce(o,3)),g.setAttribute("color",new ce(s,3));var y=new mt({vertexColors:!0,toneMapped:!1});Mt.call(this,g,y),this.type="PolarGridHelper"}bc.prototype=Object.create(Mt.prototype),bc.prototype.constructor=bc;var tf=new E,bs=new E,nf=new E;function Ga(e,t,n){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new ve;r.setAttribute("position",new ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new mt({fog:!1,toneMapped:!1});this.lightPlane=new tn(r,i),this.add(this.lightPlane),r=new ve,r.setAttribute("position",new ce([0,0,0,0,0,1],3)),this.targetLine=new tn(r,i),this.add(this.targetLine),this.update()}Ga.prototype=Object.create(ae.prototype),Ga.prototype.constructor=Ga,Ga.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Ga.prototype.update=function(){tf.setFromMatrixPosition(this.light.matrixWorld),bs.setFromMatrixPosition(this.light.target.matrixWorld),nf.subVectors(bs,tf),this.lightPlane.lookAt(bs),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(bs),this.targetLine.scale.z=nf.length()};var ws=new E,dt=new Bn;function Ms(e){var t=new ve,n=new mt({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new de(16755200),s=new de(16711680),c=new de(43775),l=new de(16777215),u=new de(3355443);h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u);function h(d,m,g){f(d,g),f(m,g)}function f(d,m){r.push(0,0,0),i.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(r.length/3-1)}t.setAttribute("position",new ce(r,3)),t.setAttribute("color",new ce(i,3)),Mt.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}Ms.prototype=Object.create(Mt.prototype),Ms.prototype.constructor=Ms,Ms.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;dt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),gt("c",t,e,dt,0,0,-1),gt("t",t,e,dt,0,0,1),gt("n1",t,e,dt,-n,-r,-1),gt("n2",t,e,dt,n,-r,-1),gt("n3",t,e,dt,-n,r,-1),gt("n4",t,e,dt,n,r,-1),gt("f1",t,e,dt,-n,-r,1),gt("f2",t,e,dt,n,-r,1),gt("f3",t,e,dt,-n,r,1),gt("f4",t,e,dt,n,r,1),gt("u1",t,e,dt,n*.7,r*1.1,-1),gt("u2",t,e,dt,-n*.7,r*1.1,-1),gt("u3",t,e,dt,0,r*2,-1),gt("cf1",t,e,dt,-n,0,1),gt("cf2",t,e,dt,n,0,1),gt("cf3",t,e,dt,0,-r,1),gt("cf4",t,e,dt,0,r,1),gt("cn1",t,e,dt,-n,0,-1),gt("cn2",t,e,dt,n,0,-1),gt("cn3",t,e,dt,0,-r,-1),gt("cn4",t,e,dt,0,r,-1),e.getAttribute("position").needsUpdate=!0};function gt(e,t,n,r,i,a,o){ws.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],ws.x,ws.y,ws.z)}var Es=new gn;function Nr(e,t){this.object=e,t===void 0&&(t=16776960);var 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]),r=new Float32Array(8*3),i=new ve;i.setIndex(new De(n,1)),i.setAttribute("position",new De(r,3)),Mt.call(this,i,new mt({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}Nr.prototype=Object.create(Mt.prototype),Nr.prototype.constructor=Nr,Nr.prototype.update=function(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Es.setFromObject(this.object),!Es.isEmpty()){var t=Es.min,n=Es.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Nr.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Nr.prototype.copy=function(e){return Mt.prototype.copy.call(this,e),this.object=e.object,this},Nr.prototype.clone=function(){return new this.constructor().copy(this)};function Ts(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var 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]),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],i=new ve;i.setIndex(new De(n,1)),i.setAttribute("position",new ce(r,3)),Mt.call(this,i,new mt({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}Ts.prototype=Object.create(Mt.prototype),Ts.prototype.constructor=Ts,Ts.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),ae.prototype.updateMatrixWorld.call(this,e))};function Ss(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n!==void 0?n:16776960,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,0,0,1,0,0,0],a=new ve;a.setAttribute("position",new ce(i,3)),a.computeBoundingSphere(),tn.call(this,a,new mt({color:r,toneMapped:!1})),this.type="PlaneHelper";var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new ve;s.setAttribute("position",new ce(o,3)),s.computeBoundingSphere(),this.add(new ut(s,new hn({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}Ss.prototype=Object.create(tn.prototype),Ss.prototype.constructor=Ss,Ss.prototype.updateMatrixWorld=function(e){var 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?At:Gi,this.lookAt(this.plane.normal),ae.prototype.updateMatrixWorld.call(this,e)};var rf=new E,As,wc;function pr(e,t,n,r,i,a){ae.call(this),this.type="ArrowHelper",e===void 0&&(e=new E(0,0,1)),t===void 0&&(t=new E(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),As===void 0&&(As=new ve,As.setAttribute("position",new ce([0,0,0,0,1,0],3)),wc=new ur(0,.5,1,5,1),wc.translate(0,-.5,0)),this.position.copy(t),this.line=new tn(As,new mt({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ut(wc,new hn({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}pr.prototype=Object.create(ae.prototype),pr.prototype.constructor=pr,pr.prototype.setDirection=function(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{rf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(rf,t)}},pr.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),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()},pr.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},pr.prototype.copy=function(e){return ae.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},pr.prototype.clone=function(){return new this.constructor().copy(this)};function Mc(e){e=e||1;var 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],r=new ve;r.setAttribute("position",new ce(t,3)),r.setAttribute("color",new ce(n,3));var i=new mt({vertexColors:!0,toneMapped:!1});Mt.call(this,r,i),this.type="AxesHelper"}Mc.prototype=Object.create(Mt.prototype),Mc.prototype.constructor=Mc;var Ri=4,vr=8,An=Math.pow(2,vr),af=[.125,.215,.35,.446,.526,.582],of=vr-Ri+1+af.length,Oi=20,Ln={[kt]:0,[uo]:1,[Ys]:2,[lu]:3,[cu]:4,[uu]:5,[qs]:6},Ec=new Na,{_lodPlanes:Ha,_sizeLods:sf,_sigmas:Ls}=g0(),Tc=null,Fr=(1+Math.sqrt(5))/2,Di=1/Fr,lf=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,Fr,Di),new E(0,Fr,-Di),new E(Di,0,Fr),new E(-Di,0,Fr),new E(Fr,Di,0),new E(-Fr,Di,0)];function cf(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=y0(Oi),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}cf.prototype={constructor:cf,fromScene:function(e,t=0,n=.1,r=100){Tc=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=_t,e.minFilter=_t,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){Tc=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=ff(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=hf(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<Ha.length;e++)Ha[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Tc),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:_t,minFilter:_t,generateMipmaps:!1,type:Wi,format:bd,encoding:m0(e)?e.encoding:Ys,depthBuffer:!1,stencilBuffer:!1},n=uf(t);return n.depthBuffer=!e,this._pingPongRenderTarget=uf(t),n},_compileMaterial:function(e){var t=new ut(Ha[0],e);this._renderer.compile(t,Ec)},_sceneToCubeUV:function(e,t,n,r){var i=90,a=1,o=new Et(i,a,t,n),s=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],l=this._renderer,u=l.outputEncoding,h=l.toneMapping,f=l.toneMappingExposure,d=l.getClearColor(),m=l.getClearAlpha();l.toneMapping=qc,l.toneMappingExposure=1,l.outputEncoding=kt;var g=e.background;if(g&&g.isColor){g.convertSRGBToLinear();var y=Math.max(g.r,g.g,g.b),p=Math.min(Math.max(Math.ceil(Math.log2(y)),-128),127);g=g.multiplyScalar(Math.pow(2,-p));var v=(p+128)/255;l.setClearColor(g,v),e.background=null}for(var _=0;_<6;_++){var x=_%3;x==0?(o.up.set(0,s[_],0),o.lookAt(c[_],0,0)):x==1?(o.up.set(0,0,s[_]),o.lookAt(0,c[_],0)):(o.up.set(0,s[_],0),o.lookAt(0,0,c[_])),Sc(r,x*An,_>2?An:0,An,An),l.setRenderTarget(r),l.render(e,o)}l.toneMapping=h,l.toneMappingExposure=f,l.outputEncoding=u,l.setClearColor(d,m)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=ff()):this._equirectShader==null&&(this._equirectShader=hf());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new ut(Ha[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=Ln[e.encoding],a.outputEncoding.value=Ln[t.texture.encoding],Sc(t,0,0,3*An,2*An),n.setRenderTarget(t),n.render(i,Ec)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<of;r++){var i=Math.sqrt(Ls[r]*Ls[r]-Ls[r-1]*Ls[r-1]),a=lf[(r-1)%lf.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");var l=3,u=new ut(Ha[r],c),h=c.uniforms,f=sf[n]-1,d=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*Oi-1),m=i/d,g=isFinite(i)?1+Math.floor(l*m):Oi;g>Oi&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Oi}`);for(var y=[],p=0,v=0;v<Oi;++v){var b=v/m,_=Math.exp(-b*b/2);y.push(_),v==0?p+=_:v<g&&(p+=2*_)}for(var v=0;v<y.length;v++)y[v]=y[v]/p;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=y,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o),h.dTheta.value=d,h.mipInt.value=vr-n,h.inputEncoding.value=Ln[e.texture.encoding],h.outputEncoding.value=Ln[e.texture.encoding];var x=sf[r],b=3*Math.max(0,An-2*x),T=(r===0?0:2*An)+2*x*(r>vr-Ri?r-vr+Ri:0);Sc(t,b,T,3*x,2*x),s.setRenderTarget(t),s.render(u,Ec)}};function m0(e){return e===void 0||e.type!==Wi?!1:e.encoding===kt||e.encoding===uo||e.encoding===qs}function g0(){for(var e=[],t=[],n=[],r=vr,i=0;i<of;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>vr-Ri?o=af[i-vr+Ri-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,f=6,d=3,m=2,g=1,y=new Float32Array(d*f*h),p=new Float32Array(m*f*h),v=new Float32Array(g*f*h),_=0;_<h;_++){var x=_%3*2/3-1,b=_>2?0:-1,T=[x,b,0,x+2/3,b,0,x+2/3,b+1,0,x,b,0,x+2/3,b+1,0,x,b+1,0];y.set(T,d*f*_),p.set(u,m*f*_);var C=[_,_,_,_,_,_];v.set(C,g*f*_)}var N=new ve;N.setAttribute("position",new De(y,d)),N.setAttribute("uv",new De(p,m)),N.setAttribute("faceIndex",new De(v,g)),e.push(N),r>Ri&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function uf(e){var t=new $t(3*An,3*An,e);return t.texture.mapping=ki,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Sc(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function y0(e){var t=new Float32Array(e),n=new E(0,1,0),r=new hr({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Ln[kt]},outputEncoding:{value:Ln[kt]}},vertexShader:Ac(),fragmentShader:`
|
|
3114
|
-
precision mediump float;
|
|
3115
|
-
precision mediump int;
|
|
3116
|
-
varying vec3 vOutputDirection;
|
|
3117
|
-
uniform sampler2D envMap;
|
|
3118
|
-
uniform int samples;
|
|
3119
|
-
uniform float weights[n];
|
|
3120
|
-
uniform bool latitudinal;
|
|
3121
|
-
uniform float dTheta;
|
|
3122
|
-
uniform float mipInt;
|
|
3123
|
-
uniform vec3 poleAxis;
|
|
3124
|
-
|
|
3125
|
-
${Lc()}
|
|
3126
|
-
|
|
3127
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
3128
|
-
#include <cube_uv_reflection_fragment>
|
|
3129
|
-
|
|
3130
|
-
vec3 getSample(float theta, vec3 axis) {
|
|
3131
|
-
float cosTheta = cos(theta);
|
|
3132
|
-
// Rodrigues' axis-angle rotation
|
|
3133
|
-
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
3134
|
-
+ cross(axis, vOutputDirection) * sin(theta)
|
|
3135
|
-
+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);
|
|
3136
|
-
return bilinearCubeUV(envMap, sampleDirection, mipInt);
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
void main() {
|
|
3140
|
-
vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);
|
|
3141
|
-
if (all(equal(axis, vec3(0.0))))
|
|
3142
|
-
axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);
|
|
3143
|
-
axis = normalize(axis);
|
|
3144
|
-
gl_FragColor = vec4(0.0);
|
|
3145
|
-
gl_FragColor.rgb += weights[0] * getSample(0.0, axis);
|
|
3146
|
-
for (int i = 1; i < n; i++) {
|
|
3147
|
-
if (i >= samples)
|
|
3148
|
-
break;
|
|
3149
|
-
float theta = dTheta * float(i);
|
|
3150
|
-
gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);
|
|
3151
|
-
gl_FragColor.rgb += weights[i] * getSample(theta, axis);
|
|
3152
|
-
}
|
|
3153
|
-
gl_FragColor = linearToOutputTexel(gl_FragColor);
|
|
3154
|
-
}
|
|
3155
|
-
`,blending:Jn,depthTest:!1,depthWrite:!1});return r.type="SphericalGaussianBlur",r}function hf(){var e=new X(1,1),t=new hr({uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Ln[kt]},outputEncoding:{value:Ln[kt]}},vertexShader:Ac(),fragmentShader:`
|
|
3156
|
-
precision mediump float;
|
|
3157
|
-
precision mediump int;
|
|
3158
|
-
varying vec3 vOutputDirection;
|
|
3159
|
-
uniform sampler2D envMap;
|
|
3160
|
-
uniform vec2 texelSize;
|
|
3161
|
-
|
|
3162
|
-
${Lc()}
|
|
3163
|
-
|
|
3164
|
-
#include <common>
|
|
3165
|
-
|
|
3166
|
-
void main() {
|
|
3167
|
-
gl_FragColor = vec4(0.0);
|
|
3168
|
-
vec3 outputDirection = normalize(vOutputDirection);
|
|
3169
|
-
vec2 uv = equirectUv( outputDirection );
|
|
3170
|
-
vec2 f = fract(uv / texelSize - 0.5);
|
|
3171
|
-
uv -= f * texelSize;
|
|
3172
|
-
vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
3173
|
-
uv.x += texelSize.x;
|
|
3174
|
-
vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
3175
|
-
uv.y += texelSize.y;
|
|
3176
|
-
vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
3177
|
-
uv.x -= texelSize.x;
|
|
3178
|
-
vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
|
|
3179
|
-
vec3 tm = mix(tl, tr, f.x);
|
|
3180
|
-
vec3 bm = mix(bl, br, f.x);
|
|
3181
|
-
gl_FragColor.rgb = mix(tm, bm, f.y);
|
|
3182
|
-
gl_FragColor = linearToOutputTexel(gl_FragColor);
|
|
3183
|
-
}
|
|
3184
|
-
`,blending:Jn,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function ff(){var e=new hr({uniforms:{envMap:{value:null},inputEncoding:{value:Ln[kt]},outputEncoding:{value:Ln[kt]}},vertexShader:Ac(),fragmentShader:`
|
|
3185
|
-
precision mediump float;
|
|
3186
|
-
precision mediump int;
|
|
3187
|
-
varying vec3 vOutputDirection;
|
|
3188
|
-
uniform samplerCube envMap;
|
|
3189
|
-
|
|
3190
|
-
${Lc()}
|
|
3191
|
-
|
|
3192
|
-
void main() {
|
|
3193
|
-
gl_FragColor = vec4(0.0);
|
|
3194
|
-
gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;
|
|
3195
|
-
gl_FragColor = linearToOutputTexel(gl_FragColor);
|
|
3196
|
-
}
|
|
3197
|
-
`,blending:Jn,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Ac(){return`
|
|
3198
|
-
precision mediump float;
|
|
3199
|
-
precision mediump int;
|
|
3200
|
-
attribute vec3 position;
|
|
3201
|
-
attribute vec2 uv;
|
|
3202
|
-
attribute float faceIndex;
|
|
3203
|
-
varying vec3 vOutputDirection;
|
|
3204
|
-
|
|
3205
|
-
// RH coordinate system; PMREM face-indexing convention
|
|
3206
|
-
vec3 getDirection(vec2 uv, float face) {
|
|
3207
|
-
uv = 2.0 * uv - 1.0;
|
|
3208
|
-
vec3 direction = vec3(uv, 1.0);
|
|
3209
|
-
if (face == 0.0) {
|
|
3210
|
-
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
3211
|
-
} else if (face == 1.0) {
|
|
3212
|
-
direction = direction.xzy;
|
|
3213
|
-
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
3214
|
-
} else if (face == 2.0) {
|
|
3215
|
-
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
3216
|
-
} else if (face == 3.0) {
|
|
3217
|
-
direction = direction.zyx;
|
|
3218
|
-
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
3219
|
-
} else if (face == 4.0) {
|
|
3220
|
-
direction = direction.xzy;
|
|
3221
|
-
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
3222
|
-
} else if (face == 5.0) {
|
|
3223
|
-
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
3224
|
-
}
|
|
3225
|
-
return direction;
|
|
3226
|
-
}
|
|
3227
|
-
|
|
3228
|
-
void main() {
|
|
3229
|
-
vOutputDirection = getDirection(uv, faceIndex);
|
|
3230
|
-
gl_Position = vec4( position, 1.0 );
|
|
3231
|
-
}
|
|
3232
|
-
`}function Lc(){return`
|
|
3233
|
-
uniform int inputEncoding;
|
|
3234
|
-
uniform int outputEncoding;
|
|
3235
|
-
|
|
3236
|
-
#include <encodings_pars_fragment>
|
|
3237
|
-
|
|
3238
|
-
vec4 inputTexelToLinear(vec4 value){
|
|
3239
|
-
if(inputEncoding == 0){
|
|
3240
|
-
return value;
|
|
3241
|
-
}else if(inputEncoding == 1){
|
|
3242
|
-
return sRGBToLinear(value);
|
|
3243
|
-
}else if(inputEncoding == 2){
|
|
3244
|
-
return RGBEToLinear(value);
|
|
3245
|
-
}else if(inputEncoding == 3){
|
|
3246
|
-
return RGBMToLinear(value, 7.0);
|
|
3247
|
-
}else if(inputEncoding == 4){
|
|
3248
|
-
return RGBMToLinear(value, 16.0);
|
|
3249
|
-
}else if(inputEncoding == 5){
|
|
3250
|
-
return RGBDToLinear(value, 256.0);
|
|
3251
|
-
}else{
|
|
3252
|
-
return GammaToLinear(value, 2.2);
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
vec4 linearToOutputTexel(vec4 value){
|
|
3257
|
-
if(outputEncoding == 0){
|
|
3258
|
-
return value;
|
|
3259
|
-
}else if(outputEncoding == 1){
|
|
3260
|
-
return LinearTosRGB(value);
|
|
3261
|
-
}else if(outputEncoding == 2){
|
|
3262
|
-
return LinearToRGBE(value);
|
|
3263
|
-
}else if(outputEncoding == 3){
|
|
3264
|
-
return LinearToRGBM(value, 7.0);
|
|
3265
|
-
}else if(outputEncoding == 4){
|
|
3266
|
-
return LinearToRGBM(value, 16.0);
|
|
3267
|
-
}else if(outputEncoding == 5){
|
|
3268
|
-
return LinearToRGBD(value, 256.0);
|
|
3269
|
-
}else{
|
|
3270
|
-
return LinearToGamma(value, 2.2);
|
|
3271
|
-
}
|
|
3272
|
-
}
|
|
3273
|
-
|
|
3274
|
-
vec4 envMapTexelToLinear(vec4 color) {
|
|
3275
|
-
return inputTexelToLinear(color);
|
|
3276
|
-
}
|
|
3277
|
-
`}Le.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Le.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(fr.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Ne,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new E(i.x,i.y,i.z||0))}return t}}),Object.assign(Sn.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Object.create(Jt.prototype),Object.create(Jt.prototype);function df(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Jt.call(this,e),this.type="catmullrom"}df.prototype=Object.create(Jt.prototype),Object.assign(df.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),_c.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Ci.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(tt.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),wh.extractUrlBase(e)}}),tt.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.")}},Object.assign(fc.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Yh.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(gn.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Dn.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),aa.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Jh.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(ke,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),ke.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),ke.ceilPowerOfTwo(e)}}),Object.assign(Ut.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(We.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new E().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)}}),yn.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},bt.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Jr.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Ot.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Ot,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ot.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ot.getNormal(e,t,n,r)}}),Object.assign(Cr.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gi(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new xi(this,e)}}),Object.assign(X.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(E.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(et.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ne.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(ae.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ae.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},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.")}}}),Object.assign(ut.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(ut.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),sp},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.")}}}),Object.defineProperties(Fo.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Rl.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Cl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Le.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Et.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(lt.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(De.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===qi},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(qi)}}}),Object.assign(De.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?qi:ho),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(ve.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new De(arguments[1],arguments[2]))):e==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ve.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}}}),Object.defineProperties(ms.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(Xh.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(sr.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===qi},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(sr.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?qi:ho),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(zn.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(mc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Oe.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 de}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===zc}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Pr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Wt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Zu.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Zu.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},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(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=e===!0?uo:kt}}}),Object.defineProperties(qu.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.")}}}),Object.defineProperties($t.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Fa.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this,n=new dc;return n.load(e,function(r){t.setBuffer(r)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),zh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ra.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},_r.crossOrigin=void 0,_r.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new jl;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},_r.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Xl;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},_r.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},_r.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Bf}}));var Va=function(e,t){t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new E,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:Yn.ROTATE,MIDDLE:Yn.DOLLY,RIGHT:Yn.PAN},this.touches={ONE:Zn.ROTATE,TWO:Zn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=function(){var R=new E,he=new bt().setFromUnitVectors(e.up,new E(0,1,0)),fe=he.clone().inverse(),me=new E,ie=new bt;return function(){var pe=n.object.position;return R.copy(pe).sub(n.target),R.applyQuaternion(he),l.setFromVector3(R),n.autoRotate&&s===o.NONE&&O(C()),n.enableDamping?(l.theta+=u.theta*n.dampingFactor,l.phi+=u.phi*n.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi),l.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=h,l.radius=Math.max(n.minDistance,Math.min(n.maxDistance,l.radius)),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),R.setFromSpherical(l),R.applyQuaternion(fe),pe.copy(n.target).add(R),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),f.set(0,0,0)),h=1,d||me.distanceToSquared(n.object.position)>c||8*(1-ie.dot(n.object.quaternion))>c?(n.dispatchEvent(r),me.copy(n.object.position),ie.copy(n.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ye,!1),n.domElement.removeEventListener("mousedown",Qe,!1),n.domElement.removeEventListener("wheel",A,!1),n.domElement.removeEventListener("touchstart",ne,!1),n.domElement.removeEventListener("touchend",Fe,!1),n.domElement.removeEventListener("touchmove",K,!1),document.removeEventListener("mousemove",nt,!1),document.removeEventListener("mouseup",$e,!1),n.domElement.removeEventListener("keydown",L,!1)};var n=this,r={type:"change"},i={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,l=new yc,u=new yc,h=1,f=new E,d=!1,m=new X,g=new X,y=new X,p=new X,v=new X,_=new X,x=new X,b=new X,T=new X;function C(){return 2*Math.PI/60/60*n.autoRotateSpeed}function N(){return Math.pow(.95,n.zoomSpeed)}function O(R){u.theta-=R}function J(R){u.phi-=R}var F=function(){var R=new E;return function(fe,me){R.setFromMatrixColumn(me,0),R.multiplyScalar(-fe),f.add(R)}}(),B=function(){var R=new E;return function(fe,me){n.screenSpacePanning===!0?R.setFromMatrixColumn(me,1):(R.setFromMatrixColumn(me,0),R.crossVectors(n.object.up,R)),R.multiplyScalar(fe),f.add(R)}}(),V=function(){var R=new E;return function(fe,me){var ie=n.domElement;if(n.object.isPerspectiveCamera){var Se=n.object.position;R.copy(Se).sub(n.target);var pe=R.length();pe*=Math.tan(n.object.fov/2*Math.PI/180),F(2*fe*pe/ie.clientHeight,n.object.matrix),B(2*me*pe/ie.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(F(fe*(n.object.right-n.object.left)/n.object.zoom/ie.clientWidth,n.object.matrix),B(me*(n.object.top-n.object.bottom)/n.object.zoom/ie.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Y(R){n.object.isPerspectiveCamera?h/=R:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*R)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(R){n.object.isPerspectiveCamera?h*=R:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/R)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(R){m.set(R.clientX,R.clientY)}function k(R){x.set(R.clientX,R.clientY)}function q(R){p.set(R.clientX,R.clientY)}function Z(R){g.set(R.clientX,R.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);var he=n.domElement;O(2*Math.PI*y.x/he.clientHeight),J(2*Math.PI*y.y/he.clientHeight),m.copy(g),n.update()}function ee(R){b.set(R.clientX,R.clientY),T.subVectors(b,x),T.y>0?Y(N()):T.y<0&&D(N()),x.copy(b),n.update()}function te(R){v.set(R.clientX,R.clientY),_.subVectors(v,p).multiplyScalar(n.panSpeed),V(_.x,_.y),p.copy(v),n.update()}function oe(R){R.deltaY<0?D(N()):R.deltaY>0&&Y(N()),n.update()}function Pe(R){var he=!1;switch(R.keyCode){case n.keys.UP:V(0,n.keyPanSpeed),he=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),he=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),he=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),he=!0;break}he&&(R.preventDefault(),n.update())}function be(R){if(R.touches.length==1)m.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);m.set(he,fe)}}function re(R){if(R.touches.length==1)p.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);p.set(he,fe)}}function G(R){var he=R.touches[0].pageX-R.touches[1].pageX,fe=R.touches[0].pageY-R.touches[1].pageY,me=Math.sqrt(he*he+fe*fe);x.set(0,me)}function Be(R){n.enableZoom&&G(R),n.enablePan&&re(R)}function xe(R){n.enableZoom&&G(R),n.enableRotate&&be(R)}function Te(R){if(R.touches.length==1)g.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);g.set(he,fe)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);var me=n.domElement;O(2*Math.PI*y.x/me.clientHeight),J(2*Math.PI*y.y/me.clientHeight),m.copy(g)}function ue(R){if(R.touches.length==1)v.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);v.set(he,fe)}_.subVectors(v,p).multiplyScalar(n.panSpeed),V(_.x,_.y),p.copy(v)}function $(R){var he=R.touches[0].pageX-R.touches[1].pageX,fe=R.touches[0].pageY-R.touches[1].pageY,me=Math.sqrt(he*he+fe*fe);b.set(0,me),T.set(0,Math.pow(b.y/x.y,n.zoomSpeed)),Y(T.y),x.copy(b)}function Ce(R){n.enableZoom&&$(R),n.enablePan&&ue(R)}function Ye(R){n.enableZoom&&$(R),n.enableRotate&&Te(R)}function Qe(R){if(n.enabled!==!1){R.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus();var he;switch(R.button){case 0:he=n.mouseButtons.LEFT;break;case 1:he=n.mouseButtons.MIDDLE;break;case 2:he=n.mouseButtons.RIGHT;break;default:he=-1}switch(he){case Yn.DOLLY:if(n.enableZoom===!1)return;k(R),s=o.DOLLY;break;case Yn.ROTATE:if(R.ctrlKey||R.metaKey||R.shiftKey){if(n.enablePan===!1)return;q(R),s=o.PAN}else{if(n.enableRotate===!1)return;z(R),s=o.ROTATE}break;case Yn.PAN:if(R.ctrlKey||R.metaKey||R.shiftKey){if(n.enableRotate===!1)return;z(R),s=o.ROTATE}else{if(n.enablePan===!1)return;q(R),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&(document.addEventListener("mousemove",nt,!1),document.addEventListener("mouseup",$e,!1),n.dispatchEvent(i))}}function nt(R){if(n.enabled!==!1)switch(R.preventDefault(),s){case o.ROTATE:if(n.enableRotate===!1)return;Z(R);break;case o.DOLLY:if(n.enableZoom===!1)return;ee(R);break;case o.PAN:if(n.enablePan===!1)return;te(R);break}}function $e(R){n.enabled!==!1&&(document.removeEventListener("mousemove",nt,!1),document.removeEventListener("mouseup",$e,!1),n.dispatchEvent(a),s=o.NONE)}function A(R){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(R.preventDefault(),R.stopPropagation(),n.dispatchEvent(i),oe(R),n.dispatchEvent(a))}function L(R){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||Pe(R)}function ne(R){if(n.enabled!==!1){switch(R.preventDefault(),R.touches.length){case 1:switch(n.touches.ONE){case Zn.ROTATE:if(n.enableRotate===!1)return;be(R),s=o.TOUCH_ROTATE;break;case Zn.PAN:if(n.enablePan===!1)return;re(R),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case Zn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Be(R),s=o.TOUCH_DOLLY_PAN;break;case Zn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(R),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}}function K(R){if(n.enabled!==!1)switch(R.preventDefault(),R.stopPropagation(),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;Te(R),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;ue(R),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ce(R),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ye(R),n.update();break;default:s=o.NONE}}function Fe(R){n.enabled!==!1&&(n.dispatchEvent(a),s=o.NONE)}function ye(R){n.enabled!==!1&&R.preventDefault()}n.domElement.addEventListener("contextmenu",ye,!1),n.domElement.addEventListener("mousedown",Qe,!1),n.domElement.addEventListener("wheel",A,!1),n.domElement.addEventListener("touchstart",ne,!1),n.domElement.addEventListener("touchend",Fe,!1),n.domElement.addEventListener("touchmove",K,!1),n.domElement.addEventListener("keydown",L,!1),n.domElement.tabIndex===-1&&(n.domElement.tabIndex=0),this.update()};Va.prototype=Object.create(sn.prototype),Va.prototype.constructor=Va;var Pc=function(e,t){Va.call(this,e,t),this.mouseButtons.LEFT=Yn.PAN,this.mouseButtons.RIGHT=Yn.ROTATE,this.touches.ONE=Zn.PAN,this.touches.TWO=Zn.DOLLY_ROTATE};Pc.prototype=Object.create(sn.prototype),Pc.prototype.constructor=Pc;var Wn=function(e){ae.call(this),this.element=e,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})};Wn.prototype=Object.create(ae.prototype),Wn.prototype.constructor=Wn;var Ps=function(e){Wn.call(this,e)};Ps.prototype=Object.create(Wn.prototype),Ps.prototype.constructor=Ps;var x0=function(){var e=this,t,n,r,i,a=new We,o={camera:{fov:0,style:""},objects:new WeakMap},s=document.createElement("div");s.style.overflow="hidden",this.domElement=s;var c=document.createElement("div");c.style.WebkitTransformStyle="preserve-3d",c.style.transformStyle="preserve-3d",c.style.pointerEvents="none",s.appendChild(c);var l=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:n}},this.setSize=function(p,v){t=p,n=v,r=t/2,i=n/2,s.style.width=p+"px",s.style.height=v+"px",c.style.width=p+"px",c.style.height=v+"px"};function u(p){return Math.abs(p)<1e-10?0:p}function h(p){var v=p.elements;return"matrix3d("+u(v[0])+","+u(-v[1])+","+u(v[2])+","+u(v[3])+","+u(v[4])+","+u(-v[5])+","+u(v[6])+","+u(v[7])+","+u(v[8])+","+u(-v[9])+","+u(v[10])+","+u(v[11])+","+u(v[12])+","+u(-v[13])+","+u(v[14])+","+u(v[15])+")"}function f(p,v){var _=p.elements,x="matrix3d("+u(_[0])+","+u(_[1])+","+u(_[2])+","+u(_[3])+","+u(-_[4])+","+u(-_[5])+","+u(-_[6])+","+u(-_[7])+","+u(_[8])+","+u(_[9])+","+u(_[10])+","+u(_[11])+","+u(_[12])+","+u(_[13])+","+u(_[14])+","+u(_[15])+")";return l?"translate(-50%,-50%)translate("+r+"px,"+i+"px)"+v+x:"translate(-50%,-50%)"+x}function d(p,v,_,x){if(p instanceof Wn){p.onBeforeRender(e,v,_);var b;p instanceof Ps?(a.copy(_.matrixWorldInverse),a.transpose(),a.copyPosition(p.matrixWorld),a.scale(p.scale),a.elements[3]=0,a.elements[7]=0,a.elements[11]=0,a.elements[15]=1,b=f(a,x)):b=f(p.matrixWorld,x);var T=p.element,C=o.objects.get(p);if(C===void 0||C.style!==b){T.style.WebkitTransform=b,T.style.transform=b;var N={style:b};l&&(N.distanceToCameraSquared=m(_,p)),o.objects.set(p,N)}T.style.display=p.visible?"":"none",T.parentNode!==c&&c.appendChild(T),p.onAfterRender(e,v,_)}for(var O=0,J=p.children.length;O<J;O++)d(p.children[O],v,_,x)}var m=function(){var p=new E,v=new E;return function(_,x){return p.setFromMatrixPosition(_.matrixWorld),v.setFromMatrixPosition(x.matrixWorld),p.distanceToSquared(v)}}();function g(p){var v=[];return p.traverse(function(_){_ instanceof Wn&&v.push(_)}),v}function y(p){for(var v=g(p).sort(function(T,C){var N=o.objects.get(T).distanceToCameraSquared,O=o.objects.get(C).distanceToCameraSquared;return N-O}),_=v.length,x=0,b=v.length;x<b;x++)v[x].element.style.zIndex=_-x}this.render=function(p,v){var _=v.projectionMatrix.elements[5]*i;if(o.camera.fov!==_&&(v.isPerspectiveCamera?(s.style.WebkitPerspective=_+"px",s.style.perspective=_+"px"):(s.style.WebkitPerspective="",s.style.perspective=""),o.camera.fov=_),p.autoUpdate===!0&&p.updateMatrixWorld(),v.parent===null&&v.updateMatrixWorld(),v.isOrthographicCamera)var x=-(v.right+v.left)/2,b=(v.top+v.bottom)/2;var T=v.isOrthographicCamera?"scale("+_+")translate("+u(x)+"px,"+u(b)+"px)"+h(v.matrixWorldInverse):"translateZ("+_+"px)"+h(v.matrixWorldInverse),C=T+"translate("+r+"px,"+i+"px)";o.camera.style!==C&&!l&&(c.style.WebkitTransform=C,c.style.transform=C,o.camera.style=C),d(p,p,v,T),l&&y(p)}};function pf(e,t,n){var r=t.getBoundingClientRect(),i=r.top,a=r.left,o=r.width,s=r.height;return new _e.Vector2((e.x-a)/o*2-1,-(e.y-i)/s*2+1)}var vf=function(e){Ya(t,e);function t(n,r,i,a,o){var s=e.call(this)||this;s.type="RoundedBoxGeometry",o=isNaN(o)?1:Math.max(1,Math.floor(o)),n=isNaN(n)?1:n,r=isNaN(r)?1:r,i=isNaN(i)?1:i,a=isNaN(a)?.15:a,a=Math.min(a,Math.min(n,Math.min(r,Math.min(i)))/2);var c=n/2-a,l=r/2-a,u=i/2-a;s.parameters={width:n,height:r,depth:i,radius:a,radiusSegments:o};var h=o+1,f=h*o+1<<3,d=new _e.BufferAttribute(new Float32Array(f*3),3),m=new _e.BufferAttribute(new Float32Array(f*3),3),g=[],y=[];new _e.Vector3;var p=new _e.Vector3,v=[],_=[],x=[],b=h*o,T=h*o+1;C(),O(),N(),J(),B(),F();function C(){for(var D=[new _e.Vector3(1,1,1),new _e.Vector3(1,1,-1),new _e.Vector3(-1,1,-1),new _e.Vector3(-1,1,1),new _e.Vector3(1,-1,1),new _e.Vector3(1,-1,-1),new _e.Vector3(-1,-1,-1),new _e.Vector3(-1,-1,1)],z=0;z<8;z++)g.push([]),y.push([]);for(var k=Math.PI/2,q=new _e.Vector3(c,l,u),Z=0;Z<=o;Z++){var ee=Z/o,te=ee*k,oe=Math.cos(te),Pe=Math.sin(te);if(Z==o){p.set(0,1,0);var be=p.clone().multiplyScalar(a).add(q);g[0].push(be),v.push(be);var re=p.clone();y[0].push(re),_.push(re);continue}for(var G=0;G<=o;G++){var Be=G/o,xe=Be*k;p.x=oe*Math.cos(xe),p.y=Pe,p.z=oe*Math.sin(xe);var be=p.clone().multiplyScalar(a).add(q);g[0].push(be),v.push(be);var re=p.clone().normalize();y[0].push(re),_.push(re)}}for(var Te=1;Te<8;Te++)for(var z=0;z<g[0].length;z++){var be=g[0][z].clone().multiply(D[Te]);g[Te].push(be),v.push(be);var re=y[0][z].clone().multiply(D[Te]);y[Te].push(re),_.push(re)}}function N(){for(var D=[!0,!1,!0,!1,!1,!0,!1,!0],z=h*(o-1),k=0;k<8;k++){for(var q=T*k,Z=0;Z<o-1;Z++)for(var ee=Z*h,te=(Z+1)*h,oe=0;oe<o;oe++){var Pe=oe+1,be=q+ee+oe,re=q+ee+Pe,G=q+te+oe,Be=q+te+Pe;D[k]?(x.push(be),x.push(G),x.push(re),x.push(re),x.push(G),x.push(Be)):(x.push(be),x.push(re),x.push(G),x.push(re),x.push(Be),x.push(G))}for(var oe=0;oe<o;oe++){var be=q+z+oe,re=q+z+oe+1,G=q+b;D[k]?(x.push(be),x.push(G),x.push(re)):(x.push(be),x.push(re),x.push(G))}}}function O(){var D=b,z=b+T,k=b+T*2,q=b+T*3;x.push(D),x.push(z),x.push(k),x.push(D),x.push(k),x.push(q),D=b+T*4,z=b+T*5,k=b+T*6,q=b+T*7,x.push(D),x.push(k),x.push(z),x.push(D),x.push(q),x.push(k),D=0,z=T,k=T*4,q=T*5,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q),D=T*2,z=T*3,k=T*6,q=T*7,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q),D=o,z=o+T*3,k=o+T*4,q=o+T*7,x.push(D),x.push(z),x.push(k),x.push(z),x.push(q),x.push(k),D=o+T,z=o+T*2,k=o+T*5,q=o+T*6,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q)}function J(){for(var D=0;D<4;D++)for(var z=D*T,k=4*T+z,q=(D&1)===1,Z=0;Z<o;Z++){var ee=Z+1,te=z+Z,oe=z+ee,Pe=k+Z,be=k+ee;q?(x.push(te),x.push(Pe),x.push(oe),x.push(oe),x.push(Pe),x.push(be)):(x.push(te),x.push(oe),x.push(Pe),x.push(oe),x.push(be),x.push(Pe))}}function F(){for(var D=[0,2,4,6],z=[1,3,5,7],k=0;k<4;k++)for(var q=T*D[k],Z=T*z[k],ee=1>=k,te=0;te<o;te++){var oe=te*h,Pe=(te+1)*h,be=q+oe,re=q+Pe,G=Z+oe,Be=Z+Pe;ee?(x.push(be),x.push(G),x.push(re),x.push(re),x.push(G),x.push(Be)):(x.push(be),x.push(re),x.push(G),x.push(re),x.push(Be),x.push(G))}}function B(){for(var D=o-1,z=[0,1,4,5],k=[3,2,7,6],q=[0,1,1,0],Z=0;Z<4;Z++)for(var ee=z[Z]*T,te=k[Z]*T,oe=0;oe<=D;oe++){var Pe=ee+o+oe*h,be=ee+(oe!=D?o+(oe+1)*h:T-1),re=te+o+oe*h,G=te+(oe!=D?o+(oe+1)*h:T-1);q[Z]?(x.push(Pe),x.push(re),x.push(be),x.push(be),x.push(re),x.push(G)):(x.push(Pe),x.push(be),x.push(re),x.push(be),x.push(G),x.push(re))}}for(var V=0,Y=0;Y<v.length;Y++)d.setXYZ(V,v[Y].x,v[Y].y,v[Y].z),m.setXYZ(V,_[Y].x,_[Y].y,_[Y].z),V++;return s.setIndex(new _e.BufferAttribute(new Uint16Array(x),1)),s.setAttribute("position",d),s.setAttribute("normal",m),s}return t}(_e.BufferGeometry);function ka(e,t){return typeof e!="number"||typeof t!="number"?!1:Math.abs(e-t)<.001}function Wa(e,t,n,r){r===void 0&&(r=function(a){return a});var i=r(n);return e*(1-i)+t*i}var Lt=Number((Math.PI/2).toFixed(5));function _0(e,t,n){var r=new _e.Shape;return r.moveTo(n,0),r.lineTo(e-n,0),r.absarc(e-n,n,n,-Lt,0,!1),r.lineTo(e,t-n),r.absarc(e-n,t-n,n,0,Lt,!1),r.lineTo(n,t),r.absarc(n,t-n,n,Lt,Math.PI,!1),r.lineTo(0,n),r.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),r}var Xa=function(e){var t=document.createElement("div");t.innerText=e;var n=new Wn(t);return n.name=e,n.scale.set(.3,.3,.3),t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n},Cs=function(e){var t=new _e.PlaneGeometry(5,5),n=new _e.MeshBasicMaterial({transparent:!0,opacity:0}),r=new _e.Mesh(t,n),i=document.createElement("div");i.innerText=e;var a=new Wn(i);return a.name=e,a.scale.set(.3,.3,.3),i.style.color="#ffffff",i.style.opacity="0.5",i.style.pointerEvents="none",i.style.backfaceVisibility="hidden",r.rotateX(-Lt),r.add(a),r},b0=function(e){Ya(t,e);function t(n,r){var i=e.call(this,n)||this;i.camera=new yr.Camera(90),i.scene=new _e.Scene,i.renderer=new _e.WebGLRenderer({antialias:!0,alpha:!0}),i.css3drenderer=new x0,i.ambientLight=new _e.AmbientLight(16777215,.7),i.wrapper=document.createElement("div"),i.arrows=document.createElement("div"),i.arrowLeft=document.createElement("div"),i.arrowRight=document.createElement("div"),i.arrowFront=document.createElement("div"),i.arrowBack=document.createElement("div"),i.arrowTop=document.createElement("div"),i.arrowBottom=document.createElement("div"),i.spherical=null,i.dragging=!1,i.style=document.createElement("style"),i.directionalLight=new _e.DirectionalLight(16777215,.2),i.box=new _e.Mesh(new vf(8,8,8,.5,20),new _e.MeshPhongMaterial({color:16777215})),i.faces=new _e.Group,i.orient=function(s){var c=s.longitude,l=s.latitude;i.dragging=!1,i.spherical=null,i.controls.enableDamping=!1,i.five.setState(Object.assign({latitude:l},c!==void 0?{longitude:c+i.config.fixedLongitude}:{})),i.five.ready().then(function(){i.controls.enableDamping=!0,i.setState({arrowsVisible:!0})})},i.onRenderFrame=function(){var s,c,l,u,h;if(i.renderer.render(i.scene,i.camera),i.css3drenderer.render(i.scene,i.camera),i.directionalLight.position.copy(i.camera.position),(s=i.controls)===null||s===void 0||s.update(),i.dragging){i.camera.computePose(),i.updateByCamera();var f=i.camera.pose,d=f.longitude,m=f.latitude;i.five.setState({longitude:d,latitude:m},!0),i.updateArrows({longitude:d,latitude:m})}else if(i.spherical&&(!ka(i.spherical.pi,(c=i.controls)===null||c===void 0?void 0:c.getPolarAngle())||!ka(i.spherical.theta,(l=i.controls)===null||l===void 0?void 0:l.getAzimuthalAngle()))){i.spherical={pi:(u=i.controls)===null||u===void 0?void 0:u.getPolarAngle(),theta:(h=i.controls)===null||h===void 0?void 0:h.getAzimuthalAngle()},i.camera.computePose(),i.updateByCamera();var g=i.camera.pose,d=g.longitude,m=g.latitude;i.five.setState({longitude:d,latitude:m},!0),i.updateArrows({longitude:d,latitude:m})}else i.spherical=null},i.onTapGesture=function(s){var c=s.pointers[0].clientX,l=s.pointers[0].clientY,u=pf({x:c,y:l},i.wrapper),h=new _e.Raycaster;h.setFromCamera(u,i.camera);var f=h.intersectObjects(i.faces.children,!1)[0];if(f){var d=f.object.userData,m=d.longitude,g=d.latitude;i.orient({longitude:m,latitude:g})}},i.onFiveWantsGesture=function(){if(i.spherical)return!1},i.onFiveModeChange=function(s){i.controls&&(i.controls.maxPolarAngle=s==="Topview"?0:Lt)},i.onCameraUpdate=function(s){var c=s.state;if(!i.dragging&&!i.spherical){var l=c.longitude,u=c.latitude;i.camera.pose.longitude===l&&i.camera.pose.latitude===u||(i.camera.setFromPose({longitude:l,latitude:u,distance:20,offset:new _e.Vector3(0,0,0)}),i.updateByCamera(),i.updateArrows({longitude:l,latitude:u}))}},i.onPanStart=function(s){i.dragging=!0,i.spherical={}},i.onMouseMove=function(s){if(!i.dragging){var c=pf({x:s.clientX,y:s.clientY},i.wrapper),l=new _e.Raycaster;l.setFromCamera(c,i.camera);var u=l.intersectObjects(i.faces.children,!1)[0];i.faces.children.forEach(function(h){h.material.opacity=0,h.children[0].element.style.color=""}),u&&(u.object.material.opacity=.3,u.object.children[0].element.style.color="#336dff")}},i.onPanEnd=function(s){i.dragging=!1,i.spherical={pi:i.controls.getPolarAngle(),theta:i.controls.getAzimuthalAngle()}},i.dispose=function(){i.disable()},i.five=n;var a={enabled:!1,visible:!0,arrowsVisible:!1};i.state=Object.assign(a,r==null?void 0:r.initialState);var o=Bt({fixedLongitude:0,orthoView:!0},r==null?void 0:r.config);return i._config=o,i.state.enabled&&i._enable({userAction:!1}),i.mc=new Fs.Manager(i.wrapper),i.mc.add(new Fs.Tap({interval:410})),i.mc.add(new Fs.Pan({threshold:10,pointers:0})),i.camera.setFromPose({distance:20,offset:new _e.Vector3(0,0,0),longitude:n.camera.pose.latitude,latitude:n.camera.pose.latitude}),i.cylinder=new _e.Mesh(new _e.CylinderGeometry(13.2,14,.01,50,1,!0),new _e.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
354
|
+
* Licensed under the MIT license */var Ze=function(c,o,n,a){var t=["","webkit","Moz","MS","ms","o"],l=o.createElement?o.createElement("div"):a,h="function",u=Math.round,m=Math.abs,p=Date.now;function y(e,r,i){return setTimeout(z(e,i),r)}function T(e,r,i){return Array.isArray(e)?(M(e,i[r],i),!0):!1}function M(e,r,i){var s;if(e)if(e.forEach)e.forEach(r,i);else if(e.length!==a)for(s=0;s<e.length;)r.call(i,e[s],s,e),s++;else for(s in e)e.hasOwnProperty(s)&&r.call(i,e[s],s,e)}function N(e,r,i){var s="DEPRECATED METHOD: "+r+`
|
|
355
|
+
`+i+` AT
|
|
356
|
+
`;return function(){var v=new Error("get-stack-trace"),d=v&&v.stack?v.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=c.console&&(c.console.warn||c.console.log);return b&&b.call(c.console,s,d),e.apply(this,arguments)}}var C;typeof Object.assign!="function"?C=function(r){if(r===a||r===null)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(r),s=1;s<arguments.length;s++){var v=arguments[s];if(v!==a&&v!==null)for(var d in v)v.hasOwnProperty(d)&&(i[d]=v[d])}return i}:C=Object.assign;var F=N(function(r,i,s){for(var v=Object.keys(i),d=0;d<v.length;)(!s||s&&r[v[d]]===a)&&(r[v[d]]=i[v[d]]),d++;return r},"extend","Use `assign`."),H=N(function(r,i){return F(r,i,!0)},"merge","Use `assign`.");function O(e,r,i){var s=r.prototype,v;v=e.prototype=Object.create(s),v.constructor=e,v._super=s,i&&C(v,i)}function z(e,r){return function(){return e.apply(r,arguments)}}function Z(e,r){return typeof e==h?e.apply(r&&r[0]||a,r):e}function f(e,r){return e===a?r:e}function V(e,r,i){M(pe(r),function(s){e.addEventListener(s,i,!1)})}function P(e,r,i){M(pe(r),function(s){e.removeEventListener(s,i,!1)})}function Fe(e,r){for(;e;){if(e==r)return!0;e=e.parentNode}return!1}function ae(e,r){return e.indexOf(r)>-1}function pe(e){return e.trim().split(/\s+/g)}function le(e,r,i){if(e.indexOf&&!i)return e.indexOf(r);for(var s=0;s<e.length;){if(i&&e[s][i]==r||!i&&e[s]===r)return s;s++}return-1}function de(e){return Array.prototype.slice.call(e,0)}function De(e,r,i){for(var s=[],v=[],d=0;d<e.length;){var b=e[d][r];le(v,b)<0&&s.push(e[d]),v[d]=b,d++}return s=s.sort(function(J,B){return J[r]>B[r]}),s}function ce(e,r){for(var i,s,v=r[0].toUpperCase()+r.slice(1),d=0;d<t.length;){if(i=t[d],s=i?i+v:r,s in e)return s;d++}return a}var te=1;function A(){return te++}function E(e){var r=e.ownerDocument||e;return r.defaultView||r.parentWindow||c}var w=/mobile|tablet|ip(ad|hone|od)|android/i,I="ontouchstart"in c,D=ce(c,"PointerEvent")!==a,K=I&&w.test(navigator.userAgent),R="touch",x="pen",Y="mouse",k="kinect",S=25,_=1,q=2,U=4,L=8,Ue=1,be=2,Ee=4,Pe=8,_e=16,re=be|Ee,fe=Pe|_e,ut=re|fe,ht=["x","y"],Re=["clientX","clientY"];function Q(e,r){var i=this;this.manager=e,this.callback=r,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(s){Z(e.options.enable,[e])&&i.handler(s)},this.init()}Q.prototype={handler:function(){},init:function(){this.evEl&&V(this.element,this.evEl,this.domHandler),this.evTarget&&V(this.target,this.evTarget,this.domHandler),this.evWin&&V(E(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(E(this.element),this.evWin,this.domHandler)}};function $t(e){var r,i=e.options.inputClass;return i?r=i:D?r=Je:K?r=Ve:I?r=Qe:r=Le,new r(e,er)}function er(e,r,i){var s=i.pointers.length,v=i.changedPointers.length,d=r&_&&s-v===0,b=r&(U|L)&&s-v===0;i.isFirst=!!d,i.isFinal=!!b,d&&(e.session={}),i.eventType=r,tr(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function tr(e,r){var i=e.session,s=r.pointers,v=s.length;i.firstInput||(i.firstInput=ft(r)),v>1&&!i.firstMultiple?i.firstMultiple=ft(r):v===1&&(i.firstMultiple=!1);var d=i.firstInput,b=i.firstMultiple,j=b?b.center:d.center,J=r.center=vt(s);r.timeStamp=p(),r.deltaTime=r.timeStamp-d.timeStamp,r.angle=Ke(j,J),r.distance=Be(j,J),rr(i,r),r.offsetDirection=dt(r.deltaX,r.deltaY);var B=pt(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=B.x,r.overallVelocityY=B.y,r.overallVelocity=m(B.x)>m(B.y)?B.x:B.y,r.scale=b?ar(b.pointers,s):1,r.rotation=b?ir(b.pointers,s):0,r.maxPointers=i.prevInput?r.pointers.length>i.prevInput.maxPointers?r.pointers.length:i.prevInput.maxPointers:r.pointers.length,nr(i,r);var ie=e.element;Fe(r.srcEvent.target,ie)&&(ie=r.srcEvent.target),r.target=ie}function rr(e,r){var i=r.center,s=e.offsetDelta||{},v=e.prevDelta||{},d=e.prevInput||{};(r.eventType===_||d.eventType===U)&&(v=e.prevDelta={x:d.deltaX||0,y:d.deltaY||0},s=e.offsetDelta={x:i.x,y:i.y}),r.deltaX=v.x+(i.x-s.x),r.deltaY=v.y+(i.y-s.y)}function nr(e,r){var i=e.lastInterval||r,s=r.timeStamp-i.timeStamp,v,d,b,j;if(r.eventType!=L&&(s>S||i.velocity===a)){var J=r.deltaX-i.deltaX,B=r.deltaY-i.deltaY,ie=pt(s,J,B);d=ie.x,b=ie.y,v=m(ie.x)>m(ie.y)?ie.x:ie.y,j=dt(J,B),e.lastInterval=r}else v=i.velocity,d=i.velocityX,b=i.velocityY,j=i.direction;r.velocity=v,r.velocityX=d,r.velocityY=b,r.direction=j}function ft(e){for(var r=[],i=0;i<e.pointers.length;)r[i]={clientX:u(e.pointers[i].clientX),clientY:u(e.pointers[i].clientY)},i++;return{timeStamp:p(),pointers:r,center:vt(r),deltaX:e.deltaX,deltaY:e.deltaY}}function vt(e){var r=e.length;if(r===1)return{x:u(e[0].clientX),y:u(e[0].clientY)};for(var i=0,s=0,v=0;v<r;)i+=e[v].clientX,s+=e[v].clientY,v++;return{x:u(i/r),y:u(s/r)}}function pt(e,r,i){return{x:r/e||0,y:i/e||0}}function dt(e,r){return e===r?Ue:m(e)>=m(r)?e<0?be:Ee:r<0?Pe:_e}function Be(e,r,i){i||(i=ht);var s=r[i[0]]-e[i[0]],v=r[i[1]]-e[i[1]];return Math.sqrt(s*s+v*v)}function Ke(e,r,i){i||(i=ht);var s=r[i[0]]-e[i[0]],v=r[i[1]]-e[i[1]];return Math.atan2(v,s)*180/Math.PI}function ir(e,r){return Ke(r[1],r[0],Re)+Ke(e[1],e[0],Re)}function ar(e,r){return Be(r[0],r[1],Re)/Be(e[0],e[1],Re)}var or={mousedown:_,mousemove:q,mouseup:U},sr="mousedown",lr="mousemove mouseup";function Le(){this.evEl=sr,this.evWin=lr,this.pressed=!1,Q.apply(this,arguments)}O(Le,Q,{handler:function(r){var i=or[r.type];i&_&&(r.button===0||r.button===2)&&(this.pressed=!0),i&q&&r.which!==1&&(i=U),this.pressed&&(i&U&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:Y,srcEvent:r}))}});var mt={pointerdown:_,pointermove:q,pointerup:U,pointercancel:L,pointerout:L},cr={2:R,3:x,4:Y,5:k},gt="pointerdown",yt="pointermove pointerup pointercancel";c.MSPointerEvent&&!c.PointerEvent&&(gt="MSPointerDown",yt="MSPointerMove MSPointerUp MSPointerCancel");function Je(){this.evEl=gt,this.evWin=yt,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}O(Je,Q,{handler:function(r){var i=this.store,s=!1,v=!1,d=r.type.toLowerCase().replace("ms",""),b=mt[d],j=cr[r.pointerType]||r.pointerType,J=j==R,B=le(i,r.pointerId,"pointerId");b&_&&(r.button===0||r.button===2||J)?B<0&&(i.push(r),B=i.length-1):b&(U|L)?s=!0:!J&&r.buttons===0&&(s=!0,v=!0,b=mt.pointerup),!(B<0)&&(v||(i[B]=r),this.callback(this.manager,b,{pointers:i,changedPointers:[r],pointerType:j,srcEvent:i[B]}),s&&i.splice(B,1))}});var ur={touchstart:_,touchmove:q,touchend:U,touchcancel:L},hr="touchstart",fr="touchstart touchmove touchend touchcancel";function Tt(){this.evTarget=hr,this.evWin=fr,this.started=!1,Q.apply(this,arguments)}O(Tt,Q,{handler:function(r){var i=ur[r.type];if(i===_&&(this.started=!0),!!this.started){var s=vr.call(this,r,i);i&(U|L)&&s[0].length-s[1].length===0&&(this.started=!1),this.callback(this.manager,i,{pointers:s[0],changedPointers:s[1],pointerType:R,srcEvent:r})}}});function vr(e,r){var i=de(e.touches),s=de(e.changedTouches);return r&(U|L)&&(i=De(i.concat(s),"identifier")),[i,s]}var pr={touchstart:_,touchmove:q,touchend:U,touchcancel:L},dr="touchstart touchmove touchend touchcancel";function Ve(){this.evTarget=dr,this.targetIds={},Q.apply(this,arguments)}O(Ve,Q,{handler:function(r){var i=pr[r.type],s=mr.call(this,r,i);s&&this.callback(this.manager,i,{pointers:s[0],changedPointers:s[1],pointerType:R,srcEvent:r})}});function mr(e,r){var i=de(e.touches),s=this.targetIds;if(r&(_|q)&&i.length===1)return s[i[0].identifier]=!0,[i,i];var v,d,b=de(e.changedTouches),j=[],J=this.target;if(d=i.filter(function(B){return Fe(B.target,J)}),r===_)for(v=0;v<d.length;)s[d[v].identifier]=!0,v++;for(v=0;v<b.length;)s[b[v].identifier]&&j.push(b[v]),r&(U|L)&&delete s[b[v].identifier],v++;if(j.length)return[De(d.concat(j),"identifier"),j]}var gr=2500,wt=25;function Qe(){Q.apply(this,arguments);var e=z(this.handler,this);this.touch=new Ve(this.manager,e),this.mouse=new Le(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}O(Qe,Q,{handler:function(r,i,s){var v=s.pointerType==R,d=s.pointerType==Y;if(!(d&&s.sourceCapabilities&&s.sourceCapabilities.firesTouchEvents)){if(v)yr.call(this,i,s);else if(d&&Tr.call(this,s))return;this.callback(r,i,s)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function yr(e,r){e&_?(this.primaryTouch=r.changedPointers[0].identifier,bt.call(this,r)):e&(U|L)&&bt.call(this,r)}function bt(e){var r=e.changedPointers[0];if(r.identifier===this.primaryTouch){var i={x:r.clientX,y:r.clientY};this.lastTouches.push(i);var s=this.lastTouches,v=function(){var d=s.indexOf(i);d>-1&&s.splice(d,1)};setTimeout(v,gr)}}function Tr(e){for(var r=e.srcEvent.clientX,i=e.srcEvent.clientY,s=0;s<this.lastTouches.length;s++){var v=this.lastTouches[s],d=Math.abs(r-v.x),b=Math.abs(i-v.y);if(d<=wt&&b<=wt)return!0}return!1}var Et=l?ce(l.style,"touchAction"):a,Pt=Et!==a,_t="compute",Mt="auto",$e="manipulation",ve="none",Me="pan-x",Ce="pan-y",Ge=br();function et(e,r){this.manager=e,this.set(r)}et.prototype={set:function(e){e==_t&&(e=this.compute()),Pt&&this.manager.element.style&&Ge[e]&&(this.manager.element.style[Et]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return M(this.manager.recognizers,function(r){Z(r.options.enable,[r])&&(e=e.concat(r.getTouchAction()))}),wr(e.join(" "))},preventDefaults:function(e){var r=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented){r.preventDefault();return}var s=this.actions,v=ae(s,ve)&&!Ge[ve],d=ae(s,Ce)&&!Ge[Ce],b=ae(s,Me)&&!Ge[Me];if(v){var j=e.pointers.length===1,J=e.distance<2,B=e.deltaTime<250;if(j&&J&&B)return}if(!(b&&d)&&(v||d&&i&re||b&&i&fe))return this.preventSrc(r)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function wr(e){if(ae(e,ve))return ve;var r=ae(e,Me),i=ae(e,Ce);return r&&i?ve:r||i?r?Me:Ce:ae(e,$e)?$e:Mt}function br(){if(!Pt)return!1;var e={},r=c.CSS&&c.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){e[i]=r?c.CSS.supports("touch-action",i):!0}),e}var He=1,$=2,me=4,ue=8,oe=ue,Ae=16,ne=32;function se(e){this.options=C({},this.defaults,e||{}),this.id=A(),this.manager=null,this.options.enable=f(this.options.enable,!0),this.state=He,this.simultaneous={},this.requireFail=[]}se.prototype={defaults:{},set:function(e){return C(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(T(e,"recognizeWith",this))return this;var r=this.simultaneous;return e=Ye(e,this),r[e.id]||(r[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return T(e,"dropRecognizeWith",this)?this:(e=Ye(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(T(e,"requireFailure",this))return this;var r=this.requireFail;return e=Ye(e,this),le(r,e)===-1&&(r.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(T(e,"dropRequireFailure",this))return this;e=Ye(e,this);var r=le(this.requireFail,e);return r>-1&&this.requireFail.splice(r,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var r=this,i=this.state;function s(v){r.manager.emit(v,e)}i<ue&&s(r.options.event+Ct(i)),s(r.options.event),e.additionalEvent&&s(e.additionalEvent),i>=ue&&s(r.options.event+Ct(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=ne},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(ne|He)))return!1;e++}return!0},recognize:function(e){var r=C({},e);if(!Z(this.options.enable,[this,r])){this.reset(),this.state=ne;return}this.state&(oe|Ae|ne)&&(this.state=He),this.state=this.process(r),this.state&($|me|ue|Ae)&&this.tryEmit(r)},process:function(e){},getTouchAction:function(){},reset:function(){}};function Ct(e){return e&Ae?"cancel":e&ue?"end":e&me?"move":e&$?"start":""}function At(e){return e==_e?"down":e==Pe?"up":e==be?"left":e==Ee?"right":""}function Ye(e,r){var i=r.manager;return i?i.get(e):e}function ee(){se.apply(this,arguments)}O(ee,se,{defaults:{pointers:1},attrTest:function(e){var r=this.options.pointers;return r===0||e.pointers.length===r},process:function(e){var r=this.state,i=e.eventType,s=r&($|me),v=this.attrTest(e);return s&&(i&L||!v)?r|Ae:s||v?i&U?r|ue:r&$?r|me:$:ne}});function je(){ee.apply(this,arguments),this.pX=null,this.pY=null}O(je,ee,{defaults:{event:"pan",threshold:10,pointers:1,direction:ut},getTouchAction:function(){var e=this.options.direction,r=[];return e&re&&r.push(Ce),e&fe&&r.push(Me),r},directionTest:function(e){var r=this.options,i=!0,s=e.distance,v=e.direction,d=e.deltaX,b=e.deltaY;return v&r.direction||(r.direction&re?(v=d===0?Ue:d<0?be:Ee,i=d!=this.pX,s=Math.abs(e.deltaX)):(v=b===0?Ue:b<0?Pe:_e,i=b!=this.pY,s=Math.abs(e.deltaY))),e.direction=v,i&&s>r.threshold&&v&r.direction},attrTest:function(e){return ee.prototype.attrTest.call(this,e)&&(this.state&$||!(this.state&$)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var r=At(e.direction);r&&(e.additionalEvent=this.options.event+r),this._super.emit.call(this,e)}});function tt(){ee.apply(this,arguments)}O(tt,ee,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ve]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&$)},emit:function(e){if(e.scale!==1){var r=e.scale<1?"in":"out";e.additionalEvent=this.options.event+r}this._super.emit.call(this,e)}});function rt(){se.apply(this,arguments),this._timer=null,this._input=null}O(rt,se,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Mt]},process:function(e){var r=this.options,i=e.pointers.length===r.pointers,s=e.distance<r.threshold,v=e.deltaTime>r.time;if(this._input=e,!s||!i||e.eventType&(U|L)&&!v)this.reset();else if(e.eventType&_)this.reset(),this._timer=y(function(){this.state=oe,this.tryEmit()},r.time,this);else if(e.eventType&U)return oe;return ne},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===oe&&(e&&e.eventType&U?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}});function nt(){ee.apply(this,arguments)}O(nt,ee,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ve]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&$)}});function it(){ee.apply(this,arguments)}O(it,ee,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:re|fe,pointers:1},getTouchAction:function(){return je.prototype.getTouchAction.call(this)},attrTest:function(e){var r=this.options.direction,i;return r&(re|fe)?i=e.overallVelocity:r&re?i=e.overallVelocityX:r&fe&&(i=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&m(i)>this.options.velocity&&e.eventType&U},emit:function(e){var r=At(e.offsetDirection);r&&this.manager.emit(this.options.event+r,e),this.manager.emit(this.options.event,e)}});function Xe(){se.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}O(Xe,se,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[$e]},process:function(e){var r=this.options,i=e.pointers.length===r.pointers,s=e.distance<r.threshold,v=e.deltaTime<r.time;if(this.reset(),e.eventType&_&&this.count===0)return this.failTimeout();if(s&&v&&i){if(e.eventType!=U)return this.failTimeout();var d=this.pTime?e.timeStamp-this.pTime<r.interval:!0,b=!this.pCenter||Be(this.pCenter,e.center)<r.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,!b||!d?this.count=1:this.count+=1,this._input=e;var j=this.count%r.taps;if(j===0)return this.hasRequireFailures()?(this._timer=y(function(){this.state=oe,this.tryEmit()},r.interval,this),$):oe}return ne},failTimeout:function(){return this._timer=y(function(){this.state=ne},this.options.interval,this),ne},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==oe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function ge(e,r){return r=r||{},r.recognizers=f(r.recognizers,ge.defaults.preset),new at(e,r)}ge.VERSION="2.0.7",ge.defaults={domEvents:!1,touchAction:_t,enable:!0,inputTarget:null,inputClass:null,preset:[[nt,{enable:!1}],[tt,{enable:!1},["rotate"]],[it,{direction:re}],[je,{direction:re},["swipe"]],[Xe],[Xe,{event:"doubletap",taps:2},["tap"]],[rt]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Er=1,It=2;function at(e,r){this.options=C({},ge.defaults,r||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=$t(this),this.touchAction=new et(this,this.options.touchAction),xt(this,!0),M(this.options.recognizers,function(i){var s=this.add(new i[0](i[1]));i[2]&&s.recognizeWith(i[2]),i[3]&&s.requireFailure(i[3])},this)}at.prototype={set:function(e){return C(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?It:Er},recognize:function(e){var r=this.session;if(!r.stopped){this.touchAction.preventDefaults(e);var i,s=this.recognizers,v=r.curRecognizer;(!v||v&&v.state&oe)&&(v=r.curRecognizer=null);for(var d=0;d<s.length;)i=s[d],r.stopped!==It&&(!v||i==v||i.canRecognizeWith(v))?i.recognize(e):i.reset(),!v&&i.state&($|me|ue)&&(v=r.curRecognizer=i),d++}},get:function(e){if(e instanceof se)return e;for(var r=this.recognizers,i=0;i<r.length;i++)if(r[i].options.event==e)return r[i];return null},add:function(e){if(T(e,"add",this))return this;var r=this.get(e.options.event);return r&&this.remove(r),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(T(e,"remove",this))return this;if(e=this.get(e),e){var r=this.recognizers,i=le(r,e);i!==-1&&(r.splice(i,1),this.touchAction.update())}return this},on:function(e,r){if(e!==a&&r!==a){var i=this.handlers;return M(pe(e),function(s){i[s]=i[s]||[],i[s].push(r)}),this}},off:function(e,r){if(e!==a){var i=this.handlers;return M(pe(e),function(s){r?i[s]&&i[s].splice(le(i[s],r),1):delete i[s]}),this}},emit:function(e,r){this.options.domEvents&&Pr(e,r);var i=this.handlers[e]&&this.handlers[e].slice();if(!(!i||!i.length)){r.type=e,r.preventDefault=function(){r.srcEvent.preventDefault()};for(var s=0;s<i.length;)i[s](r),s++}},destroy:function(){this.element&&xt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function xt(e,r){var i=e.element;if(i.style){var s;M(e.options.cssProps,function(v,d){s=ce(i.style,d),r?(e.oldCssProps[s]=i.style[s],i.style[s]=v):i.style[s]=e.oldCssProps[s]||""}),r||(e.oldCssProps={})}}function Pr(e,r){var i=o.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=r,r.target.dispatchEvent(i)}return C(ge,{INPUT_START:_,INPUT_MOVE:q,INPUT_END:U,INPUT_CANCEL:L,STATE_POSSIBLE:He,STATE_BEGAN:$,STATE_CHANGED:me,STATE_ENDED:ue,STATE_RECOGNIZED:oe,STATE_CANCELLED:Ae,STATE_FAILED:ne,DIRECTION_NONE:Ue,DIRECTION_LEFT:be,DIRECTION_RIGHT:Ee,DIRECTION_UP:Pe,DIRECTION_DOWN:_e,DIRECTION_HORIZONTAL:re,DIRECTION_VERTICAL:fe,DIRECTION_ALL:ut,Manager:at,Input:Q,TouchAction:et,TouchInput:Ve,MouseInput:Le,PointerEventInput:Je,TouchMouseInput:Qe,SingleTouchInput:Tt,Recognizer:se,AttrRecognizer:ee,Tap:Xe,Pan:je,Swipe:it,Pinch:tt,Rotate:nt,Press:rt,on:V,off:P,each:M,merge:H,extend:F,assign:C,inherit:O,bindFn:z,prefixed:ce}),ge}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function lt(c,o,n){var a=o.getBoundingClientRect(),t=a.top,l=a.left,h=a.width,u=a.height;return new g.Vector2((c.x-l)/h*2-1,-(c.y-t)/u*2+1)}var ct=function(c){Ie(o,c);function o(n,a,t,l,h){var u=c.call(this)||this;u.type="RoundedBoxGeometry",h=isNaN(h)?1:Math.max(1,Math.floor(h)),n=isNaN(n)?1:n,a=isNaN(a)?1:a,t=isNaN(t)?1:t,l=isNaN(l)?.15:l,l=Math.min(l,Math.min(n,Math.min(a,Math.min(t)))/2);var m=n/2-l,p=a/2-l,y=t/2-l;u.parameters={width:n,height:a,depth:t,radius:l,radiusSegments:h};var T=h+1,M=T*h+1<<3,N=new g.BufferAttribute(new Float32Array(M*3),3),C=new g.BufferAttribute(new Float32Array(M*3),3),F=[],H=[];new g.Vector3;var O=new g.Vector3,z=[],Z=[],f=[],V=T*h,P=T*h+1;Fe(),pe(),ae(),le(),De(),de();function Fe(){for(var A=[new g.Vector3(1,1,1),new g.Vector3(1,1,-1),new g.Vector3(-1,1,-1),new g.Vector3(-1,1,1),new g.Vector3(1,-1,1),new g.Vector3(1,-1,-1),new g.Vector3(-1,-1,-1),new g.Vector3(-1,-1,1)],E=0;E<8;E++)F.push([]),H.push([]);for(var w=Math.PI/2,I=new g.Vector3(m,p,y),D=0;D<=h;D++){var K=D/h,R=K*w,x=Math.cos(R),Y=Math.sin(R);if(D==h){O.set(0,1,0);var k=O.clone().multiplyScalar(l).add(I);F[0].push(k),z.push(k);var S=O.clone();H[0].push(S),Z.push(S);continue}for(var _=0;_<=h;_++){var q=_/h,U=q*w;O.x=x*Math.cos(U),O.y=Y,O.z=x*Math.sin(U);var k=O.clone().multiplyScalar(l).add(I);F[0].push(k),z.push(k);var S=O.clone().normalize();H[0].push(S),Z.push(S)}}for(var L=1;L<8;L++)for(var E=0;E<F[0].length;E++){var k=F[0][E].clone().multiply(A[L]);F[L].push(k),z.push(k);var S=H[0][E].clone().multiply(A[L]);H[L].push(S),Z.push(S)}}function ae(){for(var A=[!0,!1,!0,!1,!1,!0,!1,!0],E=T*(h-1),w=0;w<8;w++){for(var I=P*w,D=0;D<h-1;D++)for(var K=D*T,R=(D+1)*T,x=0;x<h;x++){var Y=x+1,k=I+K+x,S=I+K+Y,_=I+R+x,q=I+R+Y;A[w]?(f.push(k),f.push(_),f.push(S),f.push(S),f.push(_),f.push(q)):(f.push(k),f.push(S),f.push(_),f.push(S),f.push(q),f.push(_))}for(var x=0;x<h;x++){var k=I+E+x,S=I+E+x+1,_=I+V;A[w]?(f.push(k),f.push(_),f.push(S)):(f.push(k),f.push(S),f.push(_))}}}function pe(){var A=V,E=V+P,w=V+P*2,I=V+P*3;f.push(A),f.push(E),f.push(w),f.push(A),f.push(w),f.push(I),A=V+P*4,E=V+P*5,w=V+P*6,I=V+P*7,f.push(A),f.push(w),f.push(E),f.push(A),f.push(I),f.push(w),A=0,E=P,w=P*4,I=P*5,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(I),A=P*2,E=P*3,w=P*6,I=P*7,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(I),A=h,E=h+P*3,w=h+P*4,I=h+P*7,f.push(A),f.push(E),f.push(w),f.push(E),f.push(I),f.push(w),A=h+P,E=h+P*2,w=h+P*5,I=h+P*6,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(I)}function le(){for(var A=0;A<4;A++)for(var E=A*P,w=4*P+E,I=(A&1)===1,D=0;D<h;D++){var K=D+1,R=E+D,x=E+K,Y=w+D,k=w+K;I?(f.push(R),f.push(Y),f.push(x),f.push(x),f.push(Y),f.push(k)):(f.push(R),f.push(x),f.push(Y),f.push(x),f.push(k),f.push(Y))}}function de(){for(var A=[0,2,4,6],E=[1,3,5,7],w=0;w<4;w++)for(var I=P*A[w],D=P*E[w],K=1>=w,R=0;R<h;R++){var x=R*T,Y=(R+1)*T,k=I+x,S=I+Y,_=D+x,q=D+Y;K?(f.push(k),f.push(_),f.push(S),f.push(S),f.push(_),f.push(q)):(f.push(k),f.push(S),f.push(_),f.push(S),f.push(q),f.push(_))}}function De(){for(var A=h-1,E=[0,1,4,5],w=[3,2,7,6],I=[0,1,1,0],D=0;D<4;D++)for(var K=E[D]*P,R=w[D]*P,x=0;x<=A;x++){var Y=K+h+x*T,k=K+(x!=A?h+(x+1)*T:P-1),S=R+h+x*T,_=R+(x!=A?h+(x+1)*T:P-1);I[D]?(f.push(Y),f.push(S),f.push(k),f.push(k),f.push(S),f.push(_)):(f.push(Y),f.push(k),f.push(S),f.push(k),f.push(_),f.push(S))}}for(var ce=0,te=0;te<z.length;te++)N.setXYZ(ce,z[te].x,z[te].y,z[te].z),C.setXYZ(ce,Z[te].x,Z[te].y,Z[te].z),ce++;return u.setIndex(new g.BufferAttribute(new Uint16Array(f),1)),u.setAttribute("position",N),u.setAttribute("normal",C),u}return o}(g.BufferGeometry);function ye(c,o){return typeof c!="number"||typeof o!="number"?!1:Math.abs(c-o)<.001}function Te(c,o,n,a){a===void 0&&(a=function(l){return l});var t=a(n);return c*(1-t)+o*t}var X=Number((Math.PI/2).toFixed(5));function qt(c,o,n){var a=new g.Shape;return a.moveTo(n,0),a.lineTo(c-n,0),a.absarc(c-n,n,n,-X,0,!1),a.lineTo(c,o-n),a.absarc(c-n,o-n,n,0,X,!1),a.lineTo(n,o),a.absarc(n,o-n,n,X,Math.PI,!1),a.lineTo(0,n),a.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),a}var we=function(c){var o=document.createElement("div");o.innerText=c;var n=new ze.CSS3DObject(o);return n.name=c,n.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",n},ke=function(c){var o=new g.PlaneGeometry(5,5),n=new g.MeshBasicMaterial({transparent:!0,opacity:0}),a=new g.Mesh(o,n),t=document.createElement("div");t.innerText=c;var l=new ze.CSS3DObject(t);return l.name=c,l.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",a.rotateX(-X),a.add(l),a},Zt=function(c){Ie(o,c);function o(n,a){var t=c.call(this,n)||this;t.camera=new he.Camera(90),t.scene=new g.Scene,t.renderer=new g.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new ze.CSS3DRenderer,t.ambientLight=new g.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new g.DirectionalLight(16777215,.2),t.box=new g.Mesh(new ct(8,8,8,.5,20),new g.MeshPhongMaterial({color:16777215})),t.faces=new g.Group,t.orient=function(u){var m=u.longitude,p=u.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:p},m!==void 0?{longitude:m+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var u,m,p,y,T;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(u=t.controls)===null||u===void 0||u.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var M=t.camera.pose,N=M.longitude,C=M.latitude;t.five.setState({longitude:N,latitude:C},!0),t.updateArrows({longitude:N,latitude:C})}else if(t.spherical&&(!ye(t.spherical.pi,(m=t.controls)===null||m===void 0?void 0:m.getPolarAngle())||!ye(t.spherical.theta,(p=t.controls)===null||p===void 0?void 0:p.getAzimuthalAngle()))){t.spherical={pi:(y=t.controls)===null||y===void 0?void 0:y.getPolarAngle(),theta:(T=t.controls)===null||T===void 0?void 0:T.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var F=t.camera.pose,N=F.longitude,C=F.latitude;t.five.setState({longitude:N,latitude:C},!0),t.updateArrows({longitude:N,latitude:C})}else t.spherical=null},t.onTapGesture=function(u){var m=u.pointers[0].clientX,p=u.pointers[0].clientY,y=lt({x:m,y:p},t.wrapper),T=new g.Raycaster;T.setFromCamera(y,t.camera);var M=T.intersectObjects(t.faces.children,!1)[0];if(M){var N=M.object.userData,C=N.longitude,F=N.latitude;t.orient({longitude:C,latitude:F})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(u){t.controls&&(t.controls.maxPolarAngle=u==="Topview"?0:X)},t.onCameraUpdate=function(u){var m=u.state;if(!t.dragging&&!t.spherical){var p=m.longitude,y=m.latitude;t.camera.pose.longitude===p&&t.camera.pose.latitude===y||(t.camera.setFromPose({longitude:p,latitude:y,distance:20,offset:new g.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:p,latitude:y}))}},t.onPanStart=function(u){t.dragging=!0,t.spherical={}},t.onMouseMove=function(u){if(!t.dragging){var m=lt({x:u.clientX,y:u.clientY},t.wrapper),p=new g.Raycaster;p.setFromCamera(m,t.camera);var y=p.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(T){T.material.opacity=0,T.children[0].element.style.color=""}),y&&(y.object.material.opacity=.3,y.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(u){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=n;var l={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(l,a==null?void 0:a.initialState);var h=W({fixedLongitude:0,orthoView:!0},a==null?void 0:a.config);return t._config=h,t.state.enabled&&t._enable({userAction:!1}),t.mc=new Ze.Manager(t.wrapper),t.mc.add(new Ze.Tap({interval:410})),t.mc.add(new Ze.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new g.Vector3(0,0,0),longitude:n.camera.pose.latitude,latitude:n.camera.pose.latitude}),t.cylinder=new g.Mesh(new g.CylinderGeometry(13.2,14,.01,50,1,!0),new g.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
|
|
3278
357
|
varying vec3 pos;
|
|
3279
358
|
varying mat4 vViewMatrix;
|
|
3280
359
|
void main() {
|
|
@@ -3304,7 +383,7 @@ vec4 envMapTexelToLinear(vec4 color) {
|
|
|
3304
383
|
vec4 color = mix(color1, color2, z);
|
|
3305
384
|
gl_FragColor = color;
|
|
3306
385
|
}
|
|
3307
|
-
`,transparent:!0})),
|
|
386
|
+
`,transparent:!0})),t.init(),t}return Object.defineProperty(o.prototype,"config",{get:function(){return W({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(n,a){var t=this.state;this.state=W(W({},this.state),n),typeof n.arrowsVisible=="boolean"&&this.handleArrowsVisible(n.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:a})},o.prototype.appendTo=function(n){if(n){n.appendChild(this.wrapper);var a=this.wrapper.getBoundingClientRect(),t=a.width,l=a.height;this.renderer.setSize(t,l),this.css3drenderer.setSize(t,l)}},o.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var n=this.cylinder;n.position.y=-3;var a=ke("西");a.position.set(-19,0,0),n.add(a);var t=ke("东");t.position.set(19,0,0),n.add(t);var l=ke("北");l.position.set(0,0,-19),n.add(l);var h=ke("南");h.position.set(0,0,19),n.add(h),this.updateByCamera(),this.scene.add(n,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},o.prototype.initDom=function(){this.style.innerHTML=`
|
|
3308
387
|
.OrientationPlugin .OrientationArrows {
|
|
3309
388
|
position: absolute;
|
|
3310
389
|
top: 0;
|
|
@@ -3404,7 +483,7 @@ vec4 envMapTexelToLinear(vec4 color) {
|
|
|
3404
483
|
border-color: transparent transparent var(--color) transparent;
|
|
3405
484
|
transform: translate(0, -15px);
|
|
3406
485
|
}
|
|
3407
|
-
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},
|
|
486
|
+
`,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},o.prototype.bindEvents=function(){var n=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return n.orient({longitude:0,latitude:X})},this.arrowLeft.onclick=function(){return n.orient({longitude:-X,latitude:0})},this.arrowRight.onclick=function(){return n.orient({longitude:X,latitude:0})},this.arrowFront.onclick=function(){return n.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return n.orient({longitude:Math.PI,latitude:0})}},o.prototype.unbindEvents=function(){this.five.off("renderFrame",this.onRenderFrame),this.five.off("camera.update",this.onCameraUpdate),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("modeChange",this.onFiveModeChange),this.mc.off("tap",this.onTapGesture),this.mc.off("panstart",this.onPanStart),this.mc.off("panend",this.onPanEnd),this.wrapper.removeEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null},o.prototype.updateByCamera=function(){var n=Te(.2,1,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),a=Te(11,13,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),t=Te(12,15,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),l=Te(13,19,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),h=Te(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(u){return u*u});this.cylinder.geometry=new g.CylinderGeometry(a,t,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=a,this.cylinder.material.uniforms.radiusBottom.value=t,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(function(u){u.position.normalize().multiplyScalar(l),u.scale.set(n,n,n);var m=u.children[0];m&&(m.element.style.opacity=h.toString())})},o.prototype.updateArrows=function(n){n.longitude;var a=n.latitude,t=X-a<.02;this.setState({arrowsVisible:t})},o.prototype.handleArrowsVisible=function(n){var a=this;if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=n?.4:1,this.cylinder.material.needsUpdate=!0,n){var t=this.five.getCurrentState(),l=t.longitude,h=t.latitude;if(X-h<.03)this.five.state.mode==="Topview"||this.five.state.mode==="Mapview"?(this.faces.getObjectByName("上").element.className="active",this.arrows.innerHTML="",this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform="rotate(".concat((l-this.config.fixedLongitude)/Math.PI*180,"deg)")):(this.arrows.innerHTML="",this.faces.getObjectByName("上").element.className="");else{switch(this.arrows.innerHTML="",this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(function(){a.five.controller.cameraType="orthographic",a.five.ready().then(function(){return a.five.controller.cameraMotion.ended=!1})}),!0){case ye(0,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("前").element.className="active";break;case ye(X,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("右").element.className="active";break;case ye(Math.PI,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("后").element.className="active";break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("左").element.className="active";break}this.arrows.style.transform=""}this.arrows.style.display="block"}else this.config.orthoView&&(this.five.controller.cameraType="auto",this.five.ready().then(function(){return a.five.controller.cameraMotion.ended=!1})),this.arrows.style.display="none",this.faces.children.forEach(function(u){u.children[0].element.className=""})},o.prototype.setState=function(n,a){a===void 0&&(a={});var t=this.state,l=a.userAction!==void 0?a.userAction:!0;if(this.updateState(n,l),n.enabled!==void 0&&t.enabled!==n.enabled){var h={userAction:l};n.enabled?this._enable(h):this._disable(h)}},o.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},o.prototype.initFaces=function(){var n=qt(7,7,.5),a=new g.ShapeGeometry(n);a.translate(-3.5,-3.5,0);var t=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));t.userData={longitude:0,latitude:0},t.position.z=4.1,t.add(we("前"));var l=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(Math.PI),l.position.z=-4.1,l.add(we("后")),l.userData={longitude:Math.PI,latitude:0};var h=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));h.rotateY(X),h.position.x=4.1,h.add(we("右")),h.userData={longitude:X,latitude:0};var u=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));u.rotateY(-X),u.position.x=-4.1,u.add(we("左")),u.userData={longitude:-X,latitude:0};var m=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));m.rotateX(-X),m.position.y=4.1,m.add(we("上")),m.userData={longitude:0,latitude:X},this.faces.add(t,l,u,h,m)},o.prototype.initControls=function(){var n=this.controls=new Nt.OrbitControls(this.camera,this.renderer.domElement);n.enableZoom=!1,n.enableDamping=!0,n.enablePan=!1,n.maxPolarAngle=X,n.dampingFactor=.15,n.rotateSpeed=.25},o.prototype.load=function(n){return xe(this,void 0,void 0,function(){return Oe(this,function(a){return[2]})})},o.prototype._enable=function(n){var a=this.five.getCurrentState(),t=a.longitude,l=a.latitude;this.camera.setFromPose({longitude:t,latitude:l,distance:20,offset:new g.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()},o.prototype._disable=function(n){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},o.prototype.enable=function(n){var a;if(!this.state.enabled){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!0},t),this._enable({userAction:t}),document.head.appendChild(this.style)}},o.prototype.disable=function(n){var a;if(this.state.enabled!==!1){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!1},t),this._disable({userAction:t}),document.head.removeChild(this.style)}},o}(G.BasePlugin.Controller),Kt=function(c,o){return new Zt(c,o)},Jt=function(c){Ie(o,c);function o(n,a){var t=c.call(this,n)||this;return t.data={},t.pluginName="BackgroundPlugin",t._onFiveCameraUpdate=function(l){var h=(Math.PI/2-Math.max(l.latitude,0))/(Math.PI/2),u=Math.max(.2-h,0)*10;t.gradientBg&&(t.gradientBg.style.transform="translateY(-".concat((1-h)*50,"%)")),t.groundBg&&(t.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(u*100,"%, transparent ").concat(u*120,"%)"))},t._addEventListener=function(){t.five.on("cameraUpdate",t._onFiveCameraUpdate)},t._removeEventListener=function(){t.five.off("cameraUpdate",t._onFiveCameraUpdate)},t.load=function(){return xe(t,void 0,void 0,function(){return Oe(this,function(l){return[2]})})},t.setState=function(l,h){},t.enable=function(){var l,h=(l=t.five.getElement())===null||l===void 0?void 0:l.parentNode;if(!h){t.five.ready().then(function(){return t.enable()});return}t.state.enabled||(t._onFiveCameraUpdate(t.five.getPose(),!1),t.gradientBg&&h.appendChild(t.gradientBg),t.groundBg&&h.appendChild(t.groundBg),t.style&&document.head.appendChild(t.style),t._addEventListener(),t.hooks.emit("enable",{userAction:!0}),t.state.enabled=!0)},t.disable=function(l){var h,u,m,p;t.state.enabled&&((u=(h=t.gradientBg)===null||h===void 0?void 0:h.parentNode)===null||u===void 0||u.removeChild(t.gradientBg),(p=(m=t.groundBg)===null||m===void 0?void 0:m.parentNode)===null||p===void 0||p.removeChild(t.groundBg),t.style&&document.head.removeChild(t.style),t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1)},t.dispose=function(){t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1},t.state={enabled:!1},typeof document=="undefined"||(t.gradientBg=document.createElement("div"),t.groundBg=document.createElement("div"),t.style=document.createElement("style"),t.gradientBg.className="BackgroundPluginBg",t.groundBg.className="BackgroundPluginGroundBg",t.style.innerHTML=`
|
|
3408
487
|
.BackgroundPluginBg {
|
|
3409
488
|
position: absolute;
|
|
3410
489
|
top: 0;
|
|
@@ -3425,4 +504,4 @@ vec4 envMapTexelToLinear(vec4 color) {
|
|
|
3425
504
|
z-index: -1;
|
|
3426
505
|
pointerEvents: none;
|
|
3427
506
|
}
|
|
3428
|
-
`,
|
|
507
|
+
`,t.enable()),t}return o}(St.BasePlugin.Controller),Qt=function(c,o){return new Jt(c,o)};G.BackgroundPlugin=Qt,G.ItemMaskPlugin=Wt,G.OrientationPlugin=Kt,G.RoundedBoxGeometry=ct,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})});
|