!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(1));var r=i.Vector2,o=i.PerspectiveCamera,a=i.Vector3,s=i.OrthographicCamera,c=i.Scene,h=i.SphereGeometry,u=i.Mesh,l=i.MeshBasicMaterial,d=i.Raycaster,p=i.ImageUtils,f=i.WebGLRenderer,m=i.Texture,g=i.SpriteMaterial,v=i.Sprite,y=i.TextureLoader,x=i.Math;console.log(222,THREE),function(t,e){var n,i,b,_,w,M,E,T,S=75,A=1e3,L=!1,R=0,P=0,C=0,I=0,U=0,N=0,O=new r,D=[],F=[],B=[],z={container:"panoramaConianer",url:"resources/img/panorama/pano-7.jpg",lables:[],widthSegments:60,heightSegments:40,pRadius:1e3,minFocalLength:1,maxFocalLength:100,showlable:"show"};function G(t){this.render(t)}function H(t,e,n){for(var i in e)!e.hasOwnProperty(i)||t.hasOwnProperty(i)&&!n||(t[i]=e[i]);return t}function V(t){if(t==e||null==t||""==t||void 0===t)return!0}function k(t){t.preventDefault(),L=!0,U=t.clientX,N=t.clientY,C=R,I=P}function j(t){L&&(R=.1*(U-t.clientX)+C,P=.1*(t.clientY-N)+I)}function W(){L=!1}function X(t){O.x=t.clientX/window.innerWidth*2-1,O.y=-t.clientY/window.innerHeight*2+1,M.setFromCamera(O,_),M.intersectObjects(D).forEach(function(t){alert("Intersection: "+t.object.name)})}function q(t,e,i){t=t||window.event;var r=n.getFocalLength();return(t.wheelDelta?t.wheelDelta<0:t.detail>0)?r>e&&(r-=.05*r,n.setFocalLength(r)):r-1&&r.x<1&&r.y>-1&&r.y<1&&r.z>-1&&r.z<1?(F[t].sprite.scale.set(32,32,32),F[t].sprite.position.set(i.x,i.y,1)):(F[t].sprite.scale.set(1,1,1),F[t].sprite.position.set(0,0,0))}if(void 0!==B)for(var t=0;t-1&&r.x<1&&r.y>-1&&r.y<1&&r.z>-1&&r.z<1){var o=B[t].context.measureText(B[t].name),a=3.5*o.width;B[t].sprite.scale.set(400,150,1),B[t].sprite.position.set(i.x+a,i.y-40,1)}else B[t].sprite.scale.set(1,1,1),B[t].sprite.position.set(0,0,0)}}(),b.clear(),b.render(i,n),b.clearDepth(),b.render(w,_)}function K(t,e){e=Math.max(-85,Math.min(85,e));var n=x.degToRad(90-e),i=x.degToRad(t),r={x:A*Math.sin(n)*Math.cos(i),y:A*Math.cos(n),z:A*Math.sin(n)*Math.sin(i)};return new a(r.x,r.y,r.z)}function $(t,e){var n=t.clone();n.project(e);var i={x:Math.round((n.x+1)*window.innerWidth/2-window.innerWidth/2),y:Math.round(window.innerHeight/2-(1-n.y)*window.innerHeight/2),z:0};return new a(i.x,i.y,i.z)}G.prototype={constructor:this,def:{},render:function(e){var r,m,g,v,y,x,T=this;this.def=H(z,e,!0),document.getElementById(this.def.container).innerHTML="",B=[],r=this.def.container,E=document.getElementById(r),(n=new o(S,window.innerWidth/window.innerHeight,1,1100)).target=new a(0,0,0),(_=new s(-window.innerWidth/2,window.innerWidth/2,window.innerHeight/2,-window.innerHeight/2,1,10)).position.z=10,i=new c,w=new c,M=new d,m=this.def.pRadius,g=this.def.widthSegments,v=this.def.heightSegments,y=this.def.url,(x=new u(new h(m,g,v),new l({map:p.loadTexture(y)}))).scale.x=-1,i.add(x),(b=new f).setSize(window.innerWidth,window.innerHeight),b.autoClear=!1,E.appendChild(b.domElement),function(t,e){if("show"==e)for(var n=0;n.5?180*(a-.5):180*(.5-a)*-1,{lon:(o>.5?360*-(1-o):360*o).toFixed(2),lat:s=s.toFixed(2)}}function dt(t,e,n,i){var r=et.getContext("2d");r.font="bold 20px 楷体",r.fillStyle=i,r.fillText(n,t,e)}function pt(t,e){var n=et.getContext("2d");n.fillStyle="#0000ff",n.beginPath(),n.arc(t,e,5,0,2*Math.PI,!0),n.closePath(),n.stroke(),n.fill(),n.fillStyle="#ff0000",n.beginPath(),n.arc(t,e,2,0,2*Math.PI,!0),n.closePath(),n.fill()}function ft(t,e){var n=T.style.height.split("px")[0],i=T.style.width.split("px")[0];return{x:t>0?1*t/180*.5*i:.5*(1+t/180)*i+.5*i,y:e>0?(1-e/90)*n*.5:-1*e/90*.5*n+.5*n}}function mt(t,e,n){var i=ut(t),r=T.offsetLeft,o=T.offsetTop,a=i.x-r,s=i.y-o;pt(a,s),dt(a,s,n,e);var c=lt(t),h={lon:c.lon,lat:c.lat,text:n};return at.push(h),h}function gt(t){for(var e,n=!1,i=0;ir&&c.ya?(nt.style.display="block",nt.style.left=c.x+"px",nt.style.top=c.y+"px",e=lt(t),n="经度:"+e.lon+"
纬度:"+e.lat,nt.innerHTML=n):nt.style.display="none"}),function(t,e){for(var n in t){var i=t[n],r=ft(i.lon,i.lat);pt(r.x,r.y),dt(r.x,r.y,i.text,e)}}(t.def.lables,t.def.lableColor);var c=t;2==st&&(t.def.addLable&&nt.addEventListener("dblclick",function(t){var e=prompt("标记名称");V(e)||mt(t,c.def.lableColor,e)}),t.def.getLable&&(document.oncontextmenu=function(t){t.preventDefault()},nt.addEventListener("mousedown",function(t){if(2==t.button){var e=gt(t);V(e.lon)||alert("经度"+e.lon+",纬度"+e.lat+",名称"+e.text)}})),t.def.deleteLbale&&nt.addEventListener("mousedown",function(e){if(1==e.button){var n=gt(e);if(!V(n.lon))confirm("您确认要删除该标记吗?")&&(vt(at,n),t.clean(),t.init())}}))},100),st++},getAllLables:function(){return at},addLable:function(t,e){mt(t,this.def.lableColor,e)},getLable:function(t){return gt(t)},listen:function(t,e){nt.addEventListener(t,function(t){e(t)})},delete:function(t){V(t.lon)||vt(at,t)},clean:function(){document.getElementById(this.def.container).innerHTML=""}},t.tpanorama=G,t.tpanoramaSetting=ht,t.tpanoramaSetContainer=T}(window)},function(t,e,n){"use strict";function i(){}n.r(e),n.d(e,"WebGLRenderTargetCube",function(){return ze}),n.d(e,"WebGLRenderTarget",function(){return Be}),n.d(e,"WebGLRenderer",function(){return Ar}),n.d(e,"ShaderLib",function(){return Dn}),n.d(e,"UniformsLib",function(){return Un}),n.d(e,"UniformsUtils",function(){return Nn}),n.d(e,"ShaderChunk",function(){return On}),n.d(e,"FogExp2",function(){return Lr}),n.d(e,"Fog",function(){return Rr}),n.d(e,"Scene",function(){return Pr}),n.d(e,"LensFlare",function(){return Cr}),n.d(e,"Sprite",function(){return Ur}),n.d(e,"LOD",function(){return Nr}),n.d(e,"SkinnedMesh",function(){return Fr}),n.d(e,"Skeleton",function(){return Or}),n.d(e,"Bone",function(){return Dr}),n.d(e,"Mesh",function(){return Gi}),n.d(e,"LineSegments",function(){return Gr}),n.d(e,"LineLoop",function(){return Hr}),n.d(e,"Line",function(){return zr}),n.d(e,"Points",function(){return kr}),n.d(e,"Group",function(){return jr}),n.d(e,"VideoTexture",function(){return Wr}),n.d(e,"DataTexture",function(){return ke}),n.d(e,"CompressedTexture",function(){return Xr}),n.d(e,"CubeTexture",function(){return je}),n.d(e,"CanvasTexture",function(){return qr}),n.d(e,"DepthTexture",function(){return Yr}),n.d(e,"Texture",function(){return De}),n.d(e,"CompressedTextureLoader",function(){return Jo}),n.d(e,"DataTextureLoader",function(){return Qo}),n.d(e,"CubeTextureLoader",function(){return $o}),n.d(e,"TextureLoader",function(){return ta}),n.d(e,"ObjectLoader",function(){return Da}),n.d(e,"MaterialLoader",function(){return Aa}),n.d(e,"BufferGeometryLoader",function(){return La}),n.d(e,"DefaultLoadingManager",function(){return Yo}),n.d(e,"LoadingManager",function(){return qo}),n.d(e,"JSONLoader",function(){return Oa}),n.d(e,"ImageLoader",function(){return Ko}),n.d(e,"FontLoader",function(){return ns}),n.d(e,"FileLoader",function(){return Zo}),n.d(e,"Loader",function(){return Na}),n.d(e,"Cache",function(){return Xo}),n.d(e,"AudioLoader",function(){return ws}),n.d(e,"SpotLightShadow",function(){return ra}),n.d(e,"SpotLight",function(){return oa}),n.d(e,"PointLight",function(){return aa}),n.d(e,"RectAreaLight",function(){return ua}),n.d(e,"HemisphereLight",function(){return na}),n.d(e,"DirectionalLightShadow",function(){return sa}),n.d(e,"DirectionalLight",function(){return ca}),n.d(e,"AmbientLight",function(){return ha}),n.d(e,"LightShadow",function(){return ia}),n.d(e,"Light",function(){return ea}),n.d(e,"StereoCamera",function(){return Ms}),n.d(e,"PerspectiveCamera",function(){return Xi}),n.d(e,"OrthographicCamera",function(){return qi}),n.d(e,"CubeCamera",function(){return Es}),n.d(e,"ArrayCamera",function(){return Ts}),n.d(e,"Camera",function(){return Wi}),n.d(e,"AudioListener",function(){return Ss}),n.d(e,"PositionalAudio",function(){return Ls}),n.d(e,"AudioContext",function(){return _s}),n.d(e,"AudioAnalyser",function(){return Rs}),n.d(e,"Audio",function(){return As}),n.d(e,"VectorKeyframeTrack",function(){return ya}),n.d(e,"StringKeyframeTrack",function(){return wa}),n.d(e,"QuaternionKeyframeTrack",function(){return ba}),n.d(e,"NumberKeyframeTrack",function(){return _a}),n.d(e,"ColorKeyframeTrack",function(){return Ea}),n.d(e,"BooleanKeyframeTrack",function(){return Ma}),n.d(e,"PropertyMixer",function(){return Ps}),n.d(e,"PropertyBinding",function(){return Is}),n.d(e,"KeyframeTrack",function(){return Ta}),n.d(e,"AnimationUtils",function(){return da}),n.d(e,"AnimationObjectGroup",function(){return Us}),n.d(e,"AnimationMixer",function(){return Os}),n.d(e,"AnimationClip",function(){return Sa}),n.d(e,"Uniform",function(){return Ds}),n.d(e,"InstancedBufferGeometry",function(){return Fs}),n.d(e,"BufferGeometry",function(){return zi}),n.d(e,"GeometryIdCount",function(){return Fi}),n.d(e,"Geometry",function(){return Bi}),n.d(e,"InterleavedBufferAttribute",function(){return Bs}),n.d(e,"InstancedInterleavedBuffer",function(){return Gs}),n.d(e,"InterleavedBuffer",function(){return zs}),n.d(e,"InstancedBufferAttribute",function(){return Hs}),n.d(e,"Face3",function(){return _i}),n.d(e,"Object3D",function(){return yi}),n.d(e,"Raycaster",function(){return Vs}),n.d(e,"Layers",function(){return hi}),n.d(e,"EventDispatcher",function(){return i}),n.d(e,"Clock",function(){return Ws}),n.d(e,"QuaternionLinearInterpolant",function(){return xa}),n.d(e,"LinearInterpolant",function(){return ma}),n.d(e,"DiscreteInterpolant",function(){return ga}),n.d(e,"CubicInterpolant",function(){return fa}),n.d(e,"Interpolant",function(){return pa}),n.d(e,"Triangle",function(){return bi}),n.d(e,"Math",function(){return Ae}),n.d(e,"Spherical",function(){return Xs}),n.d(e,"Cylindrical",function(){return qs}),n.d(e,"Plane",function(){return ri}),n.d(e,"Frustum",function(){return oi}),n.d(e,"Sphere",function(){return ni}),n.d(e,"Ray",function(){return si}),n.d(e,"Matrix4",function(){return Ve}),n.d(e,"Matrix3",function(){return ii}),n.d(e,"Box3",function(){return ei}),n.d(e,"Box2",function(){return Fn}),n.d(e,"Line3",function(){return xi}),n.d(e,"Euler",function(){return ci}),n.d(e,"Vector4",function(){return Fe}),n.d(e,"Vector3",function(){return He}),n.d(e,"Vector2",function(){return Le}),n.d(e,"Quaternion",function(){return Ge}),n.d(e,"Color",function(){return In}),n.d(e,"MorphBlendMesh",function(){return Ys}),n.d(e,"ImmediateRenderObject",function(){return Zs}),n.d(e,"VertexNormalsHelper",function(){return Js}),n.d(e,"SpotLightHelper",function(){return Qs}),n.d(e,"SkeletonHelper",function(){return Ks}),n.d(e,"PointLightHelper",function(){return $s}),n.d(e,"RectAreaLightHelper",function(){return tc}),n.d(e,"HemisphereLightHelper",function(){return ec}),n.d(e,"GridHelper",function(){return nc}),n.d(e,"PolarGridHelper",function(){return ic}),n.d(e,"FaceNormalsHelper",function(){return rc}),n.d(e,"DirectionalLightHelper",function(){return oc}),n.d(e,"CameraHelper",function(){return ac}),n.d(e,"BoxHelper",function(){return sc}),n.d(e,"ArrowHelper",function(){return cc}),n.d(e,"AxisHelper",function(){return hc}),n.d(e,"CatmullRomCurve3",function(){return mc}),n.d(e,"CubicBezierCurve3",function(){return gc}),n.d(e,"QuadraticBezierCurve3",function(){return vc}),n.d(e,"LineCurve3",function(){return yc}),n.d(e,"ArcCurve",function(){return xc}),n.d(e,"EllipseCurve",function(){return Xa}),n.d(e,"SplineCurve",function(){return qa}),n.d(e,"CubicBezierCurve",function(){return Ya}),n.d(e,"QuadraticBezierCurve",function(){return Za}),n.d(e,"LineCurve",function(){return ja}),n.d(e,"Shape",function(){return $a}),n.d(e,"Path",function(){return Ka}),n.d(e,"ShapePath",function(){return ts}),n.d(e,"Font",function(){return es}),n.d(e,"CurvePath",function(){return Wa}),n.d(e,"Curve",function(){return ka}),n.d(e,"ShapeUtils",function(){return mo}),n.d(e,"SceneUtils",function(){return bc}),n.d(e,"WireframeGeometry",function(){return Zr}),n.d(e,"ParametricGeometry",function(){return Jr}),n.d(e,"ParametricBufferGeometry",function(){return Qr}),n.d(e,"TetrahedronGeometry",function(){return to}),n.d(e,"TetrahedronBufferGeometry",function(){return eo}),n.d(e,"OctahedronGeometry",function(){return no}),n.d(e,"OctahedronBufferGeometry",function(){return io}),n.d(e,"IcosahedronGeometry",function(){return ro}),n.d(e,"IcosahedronBufferGeometry",function(){return oo}),n.d(e,"DodecahedronGeometry",function(){return ao}),n.d(e,"DodecahedronBufferGeometry",function(){return so}),n.d(e,"PolyhedronGeometry",function(){return Kr}),n.d(e,"PolyhedronBufferGeometry",function(){return $r}),n.d(e,"TubeGeometry",function(){return co}),n.d(e,"TubeBufferGeometry",function(){return ho}),n.d(e,"TorusKnotGeometry",function(){return uo}),n.d(e,"TorusKnotBufferGeometry",function(){return lo}),n.d(e,"TorusGeometry",function(){return po}),n.d(e,"TorusBufferGeometry",function(){return fo}),n.d(e,"TextGeometry",function(){return yo}),n.d(e,"TextBufferGeometry",function(){return xo}),n.d(e,"SphereGeometry",function(){return bo}),n.d(e,"SphereBufferGeometry",function(){return _o}),n.d(e,"RingGeometry",function(){return wo}),n.d(e,"RingBufferGeometry",function(){return Mo}),n.d(e,"PlaneGeometry",function(){return ki}),n.d(e,"PlaneBufferGeometry",function(){return ji}),n.d(e,"LatheGeometry",function(){return Eo}),n.d(e,"LatheBufferGeometry",function(){return To}),n.d(e,"ShapeGeometry",function(){return So}),n.d(e,"ShapeBufferGeometry",function(){return Ao}),n.d(e,"ExtrudeGeometry",function(){return go}),n.d(e,"ExtrudeBufferGeometry",function(){return vo}),n.d(e,"EdgesGeometry",function(){return Lo}),n.d(e,"ConeGeometry",function(){return Co}),n.d(e,"ConeBufferGeometry",function(){return Io}),n.d(e,"CylinderGeometry",function(){return Ro}),n.d(e,"CylinderBufferGeometry",function(){return Po}),n.d(e,"CircleGeometry",function(){return Uo}),n.d(e,"CircleBufferGeometry",function(){return No}),n.d(e,"BoxGeometry",function(){return Hi}),n.d(e,"BoxBufferGeometry",function(){return Vi}),n.d(e,"ShadowMaterial",function(){return Do}),n.d(e,"SpriteMaterial",function(){return Ir}),n.d(e,"RawShaderMaterial",function(){return Fo}),n.d(e,"ShaderMaterial",function(){return $n}),n.d(e,"PointsMaterial",function(){return Vr}),n.d(e,"MeshPhysicalMaterial",function(){return zo}),n.d(e,"MeshStandardMaterial",function(){return Bo}),n.d(e,"MeshPhongMaterial",function(){return Go}),n.d(e,"MeshToonMaterial",function(){return Ho}),n.d(e,"MeshNormalMaterial",function(){return Vo}),n.d(e,"MeshLambertMaterial",function(){return ko}),n.d(e,"MeshDepthMaterial",function(){return ti}),n.d(e,"MeshBasicMaterial",function(){return wi}),n.d(e,"LineDashedMaterial",function(){return jo}),n.d(e,"LineBasicMaterial",function(){return Br}),n.d(e,"Material",function(){return Kn}),n.d(e,"Float64BufferAttribute",function(){return Ii}),n.d(e,"Float32BufferAttribute",function(){return Ci}),n.d(e,"Uint32BufferAttribute",function(){return Pi}),n.d(e,"Int32BufferAttribute",function(){return Ri}),n.d(e,"Uint16BufferAttribute",function(){return Li}),n.d(e,"Int16BufferAttribute",function(){return Ai}),n.d(e,"Uint8ClampedBufferAttribute",function(){return Si}),n.d(e,"Uint8BufferAttribute",function(){return Ti}),n.d(e,"Int8BufferAttribute",function(){return Ei}),n.d(e,"BufferAttribute",function(){return Mi}),n.d(e,"REVISION",function(){return u}),n.d(e,"MOUSE",function(){return l}),n.d(e,"CullFaceNone",function(){return d}),n.d(e,"CullFaceBack",function(){return p}),n.d(e,"CullFaceFront",function(){return f}),n.d(e,"CullFaceFrontBack",function(){return m}),n.d(e,"FrontFaceDirectionCW",function(){return g}),n.d(e,"FrontFaceDirectionCCW",function(){return v}),n.d(e,"BasicShadowMap",function(){return y}),n.d(e,"PCFShadowMap",function(){return x}),n.d(e,"PCFSoftShadowMap",function(){return b}),n.d(e,"FrontSide",function(){return _}),n.d(e,"BackSide",function(){return w}),n.d(e,"DoubleSide",function(){return M}),n.d(e,"FlatShading",function(){return E}),n.d(e,"SmoothShading",function(){return T}),n.d(e,"NoColors",function(){return S}),n.d(e,"FaceColors",function(){return A}),n.d(e,"VertexColors",function(){return L}),n.d(e,"NoBlending",function(){return R}),n.d(e,"NormalBlending",function(){return P}),n.d(e,"AdditiveBlending",function(){return C}),n.d(e,"SubtractiveBlending",function(){return I}),n.d(e,"MultiplyBlending",function(){return U}),n.d(e,"CustomBlending",function(){return N}),n.d(e,"AddEquation",function(){return O}),n.d(e,"SubtractEquation",function(){return D}),n.d(e,"ReverseSubtractEquation",function(){return F}),n.d(e,"MinEquation",function(){return B}),n.d(e,"MaxEquation",function(){return z}),n.d(e,"ZeroFactor",function(){return G}),n.d(e,"OneFactor",function(){return H}),n.d(e,"SrcColorFactor",function(){return V}),n.d(e,"OneMinusSrcColorFactor",function(){return k}),n.d(e,"SrcAlphaFactor",function(){return j}),n.d(e,"OneMinusSrcAlphaFactor",function(){return W}),n.d(e,"DstAlphaFactor",function(){return X}),n.d(e,"OneMinusDstAlphaFactor",function(){return q}),n.d(e,"DstColorFactor",function(){return Y}),n.d(e,"OneMinusDstColorFactor",function(){return Z}),n.d(e,"SrcAlphaSaturateFactor",function(){return J}),n.d(e,"NeverDepth",function(){return Q}),n.d(e,"AlwaysDepth",function(){return K}),n.d(e,"LessDepth",function(){return $}),n.d(e,"LessEqualDepth",function(){return tt}),n.d(e,"EqualDepth",function(){return et}),n.d(e,"GreaterEqualDepth",function(){return nt}),n.d(e,"GreaterDepth",function(){return it}),n.d(e,"NotEqualDepth",function(){return rt}),n.d(e,"MultiplyOperation",function(){return ot}),n.d(e,"MixOperation",function(){return at}),n.d(e,"AddOperation",function(){return st}),n.d(e,"NoToneMapping",function(){return ct}),n.d(e,"LinearToneMapping",function(){return ht}),n.d(e,"ReinhardToneMapping",function(){return ut}),n.d(e,"Uncharted2ToneMapping",function(){return lt}),n.d(e,"CineonToneMapping",function(){return dt}),n.d(e,"UVMapping",function(){return pt}),n.d(e,"CubeReflectionMapping",function(){return ft}),n.d(e,"CubeRefractionMapping",function(){return mt}),n.d(e,"EquirectangularReflectionMapping",function(){return gt}),n.d(e,"EquirectangularRefractionMapping",function(){return vt}),n.d(e,"SphericalReflectionMapping",function(){return yt}),n.d(e,"CubeUVReflectionMapping",function(){return xt}),n.d(e,"CubeUVRefractionMapping",function(){return bt}),n.d(e,"RepeatWrapping",function(){return _t}),n.d(e,"ClampToEdgeWrapping",function(){return wt}),n.d(e,"MirroredRepeatWrapping",function(){return Mt}),n.d(e,"NearestFilter",function(){return Et}),n.d(e,"NearestMipMapNearestFilter",function(){return Tt}),n.d(e,"NearestMipMapLinearFilter",function(){return St}),n.d(e,"LinearFilter",function(){return At}),n.d(e,"LinearMipMapNearestFilter",function(){return Lt}),n.d(e,"LinearMipMapLinearFilter",function(){return Rt}),n.d(e,"UnsignedByteType",function(){return Pt}),n.d(e,"ByteType",function(){return Ct}),n.d(e,"ShortType",function(){return It}),n.d(e,"UnsignedShortType",function(){return Ut}),n.d(e,"IntType",function(){return Nt}),n.d(e,"UnsignedIntType",function(){return Ot}),n.d(e,"FloatType",function(){return Dt}),n.d(e,"HalfFloatType",function(){return Ft}),n.d(e,"UnsignedShort4444Type",function(){return Bt}),n.d(e,"UnsignedShort5551Type",function(){return zt}),n.d(e,"UnsignedShort565Type",function(){return Gt}),n.d(e,"UnsignedInt248Type",function(){return Ht}),n.d(e,"AlphaFormat",function(){return Vt}),n.d(e,"RGBFormat",function(){return kt}),n.d(e,"RGBAFormat",function(){return jt}),n.d(e,"LuminanceFormat",function(){return Wt}),n.d(e,"LuminanceAlphaFormat",function(){return Xt}),n.d(e,"RGBEFormat",function(){return qt}),n.d(e,"DepthFormat",function(){return Yt}),n.d(e,"DepthStencilFormat",function(){return Zt}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return Jt}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return Qt}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return Kt}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return $t}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return te}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return ee}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return ne}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return ie}),n.d(e,"RGB_ETC1_Format",function(){return re}),n.d(e,"LoopOnce",function(){return oe}),n.d(e,"LoopRepeat",function(){return ae}),n.d(e,"LoopPingPong",function(){return se}),n.d(e,"InterpolateDiscrete",function(){return ce}),n.d(e,"InterpolateLinear",function(){return he}),n.d(e,"InterpolateSmooth",function(){return ue}),n.d(e,"ZeroCurvatureEnding",function(){return le}),n.d(e,"ZeroSlopeEnding",function(){return de}),n.d(e,"WrapAroundEnding",function(){return pe}),n.d(e,"TrianglesDrawMode",function(){return fe}),n.d(e,"TriangleStripDrawMode",function(){return me}),n.d(e,"TriangleFanDrawMode",function(){return ge}),n.d(e,"LinearEncoding",function(){return ve}),n.d(e,"sRGBEncoding",function(){return ye}),n.d(e,"GammaEncoding",function(){return xe}),n.d(e,"RGBEEncoding",function(){return be}),n.d(e,"LogLuvEncoding",function(){return _e}),n.d(e,"RGBM7Encoding",function(){return we}),n.d(e,"RGBM16Encoding",function(){return Me}),n.d(e,"RGBDEncoding",function(){return Ee}),n.d(e,"BasicDepthPacking",function(){return Te}),n.d(e,"RGBADepthPacking",function(){return Se}),n.d(e,"CubeGeometry",function(){return Hi}),n.d(e,"Face4",function(){return _c}),n.d(e,"LineStrip",function(){return wc}),n.d(e,"LinePieces",function(){return Mc}),n.d(e,"MeshFaceMaterial",function(){return Ec}),n.d(e,"MultiMaterial",function(){return Tc}),n.d(e,"PointCloud",function(){return Sc}),n.d(e,"Particle",function(){return Ac}),n.d(e,"ParticleSystem",function(){return Lc}),n.d(e,"PointCloudMaterial",function(){return Rc}),n.d(e,"ParticleBasicMaterial",function(){return Pc}),n.d(e,"ParticleSystemMaterial",function(){return Cc}),n.d(e,"Vertex",function(){return Ic}),n.d(e,"DynamicBufferAttribute",function(){return Uc}),n.d(e,"Int8Attribute",function(){return Nc}),n.d(e,"Uint8Attribute",function(){return Oc}),n.d(e,"Uint8ClampedAttribute",function(){return Dc}),n.d(e,"Int16Attribute",function(){return Fc}),n.d(e,"Uint16Attribute",function(){return Bc}),n.d(e,"Int32Attribute",function(){return zc}),n.d(e,"Uint32Attribute",function(){return Gc}),n.d(e,"Float32Attribute",function(){return Hc}),n.d(e,"Float64Attribute",function(){return Vc}),n.d(e,"ClosedSplineCurve3",function(){return kc}),n.d(e,"SplineCurve3",function(){return jc}),n.d(e,"Spline",function(){return Wc}),n.d(e,"BoundingBoxHelper",function(){return Xc}),n.d(e,"EdgesHelper",function(){return qc}),n.d(e,"WireframeHelper",function(){return Yc}),n.d(e,"XHRLoader",function(){return Zc}),n.d(e,"BinaryTextureLoader",function(){return Jc}),n.d(e,"GeometryUtils",function(){return Qc}),n.d(e,"ImageUtils",function(){return Kc}),n.d(e,"Projector",function(){return $c}),n.d(e,"CanvasRenderer",function(){return th}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n>=4,a[t]=o[19===t?3&r|8:r]);return a.join("")}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ae.DEG2RAD},radToDeg:function(t){return t*Ae.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};function Le(t,e){this.x=t||0,this.y=e||0}Object.defineProperties(Le.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Le.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(c=new Le,h=new Le,function(t,e){return c.set(t,t),h.set(e,e),this.clamp(c,h)}),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/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(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}});var Re,Pe,Ce,Ie,Ue,Ne,Oe=0;function De(t,e,n,i,r,o,a,s,c,h){Object.defineProperty(this,"id",{value:Oe++}),this.uuid=Ae.generateUUID(),this.name="",this.image=void 0!==t?t:De.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:De.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:wt,this.wrapT=void 0!==i?i:wt,this.magFilter=void 0!==r?r:At,this.minFilter=void 0!==o?o:Rt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:jt,this.type=void 0!==s?s:Pt,this.offset=new Le(0,0),this.repeat=new Le(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:ve,this.version=0,this.onUpdate=null}function Fe(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function Be(t,e,n){this.uuid=Ae.generateUUID(),this.width=t,this.height=e,this.scissor=new Fe(0,0,t,e),this.scissorTest=!1,this.viewport=new Fe(0,0,t,e),void 0===(n=n||{}).minFilter&&(n.minFilter=At),this.texture=new De(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function ze(t,e,n){Be.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function Ge(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function He(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function Ve(){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.")}function ke(t,e,n,i,r,o,a,s,c,h,u,l){De.call(this,null,o,a,s,c,h,i,r,u,l),this.image={data:t,width:e,height:n},this.magFilter=void 0!==c?c:Et,this.minFilter=void 0!==h?h:Et,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function je(t,e,n,i,r,o,a,s,c,h){t=void 0!==t?t:[],e=void 0!==e?e:ft,De.call(this,t,e,n,i,r,o,a,s,c,h),this.flipY=!1}De.DEFAULT_IMAGE=void 0,De.DEFAULT_MAPPING=pt,Object.defineProperty(De.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(De.prototype,i.prototype,{constructor:De,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={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],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Ae.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:((e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===pt){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case _t:t.x=t.x-Math.floor(t.x);break;case wt:t.x=t.x<0?0:1;break;case Mt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case _t:t.y=t.y-Math.floor(t.y);break;case wt:t.y=t.y<0?0:1;break;case Mt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(Fe.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o=t.elements,a=o[0],s=o[4],c=o[8],h=o[1],u=o[5],l=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-h)<.01&&Math.abs(c-d)<.01&&Math.abs(l-p)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+d)<.1&&Math.abs(l+p)<.1&&Math.abs(a+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(u+1)/2,v=(f+1)/2,y=(s+h)/4,x=(c+d)/4,b=(l+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=b/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=b/r),this.set(n,i,r,e),this}var _=Math.sqrt((p-l)*(p-l)+(c-d)*(c-d)+(h-s)*(h-s));return Math.abs(_)<.001&&(_=1),this.x=(p-l)/_,this.y=(c-d)/_,this.z=(h-s)/_,this.w=Math.acos((a+u+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new Fe,e=new Fe;return function(n,i){return t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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)},lengthManhattan: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())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(Be.prototype,i.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ze.prototype=Object.create(Be.prototype),ze.prototype.constructor=ze,ze.prototype.isWebGLRenderTargetCube=!0,Object.assign(Ge,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3],l=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(u!==f||s!==l||c!==d||h!==p){var m=1-a,g=s*l+c*d+h*p+u*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var _=a*v;if(s=s*m+l*_,c=c*m+d*_,h=h*m+p*_,u=u*m+f*_,m===1-a){var w=1/Math.sqrt(s*s+c*c+h*h+u*u);s*=w,c*=w,h*=w,u*=w}}t[e]=s,t[e+1]=c,t[e+2]=h,t[e+3]=u}}),Object.defineProperties(Ge.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Ge.prototype,{set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),h=a(i/2),u=a(r/2),l=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u-l*d*p):"YXZ"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u+l*d*p):"ZXY"===o?(this._x=l*h*u-c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u-l*d*p):"ZYX"===o?(this._x=l*h*u-c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u+l*d*p):"YZX"===o?(this._x=l*h*u+c*d*p,this._y=c*d*u+l*h*p,this._z=c*h*p-l*d*u,this._w=c*h*u-l*d*p):"XZY"===o&&(this._x=l*h*u-c*d*p,this._y=c*d*u-l*h*p,this._z=c*h*p+l*d*u,this._w=c*h*u+l*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],h=n[2],u=n[6],l=n[10],d=i+s+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-c)*e,this._y=(o-h)*e,this._z=(a-r)*e):i>s&&i>l?(e=2*Math.sqrt(1+i-s-l),this._w=(u-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+h)/e):s>l?(e=2*Math.sqrt(1+s-i-l),this._w=(o-h)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+l-i-s),this._w=(a-r)/e,this._x=(o+h)/e,this._y=(c+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new He;return function(n,i){return void 0===e&&(e=new He),(t=n.dot(i)+1)<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,h=e._w;return this._x=n*h+o*a+i*c-r*s,this._y=i*h+o*s+r*a-n*c,this._z=r*h+o*c+n*s-i*a,this._w=o*h-n*a-i*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-e)*c)/s,u=Math.sin(e*c)/s;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(He.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(Ce=new Ge,function(t){return!1===(t&&t.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ce.setFromEuler(t))}),applyAxisAngle:function(){var t=new Ge;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14];var o=r[3]*e+r[7]*n+r[11]*i+r[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,h=s*n+a*e-r*i,u=s*i+r*n-o*e,l=-r*e-o*n-a*i;return this.x=c*s+l*-r+h*-a-u*-o,this.y=h*s+l*-o+u*-r-c*-a,this.z=u*s+l*-a+c*-o-h*-r,this},project:(Pe=new Ve,function(t){return Pe.multiplyMatrices(t.projectionMatrix,Pe.getInverse(t.matrixWorld)),this.applyMatrix4(Pe)}),unproject:function(){var t=new Ve;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new He,e=new He;return function(n,i){return t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/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(t){return this.x*t.x+this.y*t.y+this.z*t.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(Re=new He,function(t){return Re.copy(this).projectOnVector(t),this.sub(Re)}),reflect:function(){var t=new He;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ae.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ve.prototype,{isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,h,u,l,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=h,g[10]=u,g[14]=l,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 Ve).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new He;return function(e){var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),h=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var l=o*h,d=o*u,p=a*h,f=a*u;e[0]=s*h,e[4]=-s*u,e[8]=c,e[1]=d+p*c,e[5]=l-f*c,e[9]=-a*s,e[2]=f-l*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*u,e[5]=o*h,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){m=s*h,g=s*u,v=c*h,y=c*u;e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*h,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){l=o*h,d=o*u,p=a*h,f=a*u;e[0]=s*h,e[4]=p*c-d,e[8]=l*c+f,e[1]=s*u,e[5]=f*c+l,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var x=o*s,b=o*c,_=a*s,w=a*c;e[0]=s*h,e[4]=w-x*u,e[8]=_*u+b,e[1]=u,e[5]=o*h,e[9]=-a*h,e[2]=-c*h,e[6]=b*u+_,e[10]=x-w*u}else if("XZY"===t.order){x=o*s,b=o*c,_=a*s,w=a*c;e[0]=s*h,e[4]=-u,e[8]=c*h,e[1]=x*u+w,e[5]=o*h,e[9]=b*u-_,e[2]=_*u-b,e[6]=a*h,e[10]=w*u+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,i=t._y,r=t._z,o=t._w,a=n+n,s=i+i,c=r+r,h=n*a,u=n*s,l=n*c,d=i*s,p=i*c,f=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+f),e[4]=u-v,e[8]=l+g,e[1]=u+v,e[5]=1-(h+f),e[9]=p-m,e[2]=l-g,e[6]=p+m,e[10]=1-(h+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(Ie=new He,Ue=new He,Ne=new He,function(t,e,n){var i=this.elements;return Ne.subVectors(t,e),0===Ne.lengthSq()&&(Ne.z=1),Ne.normalize(),Ie.crossVectors(n,Ne),0===Ie.lengthSq()&&(Ne.z+=1e-4,Ie.crossVectors(n,Ne)),Ie.normalize(),Ue.crossVectors(Ne,Ie),i[0]=Ie.x,i[4]=Ue.x,i[8]=Ne.x,i[1]=Ie.y,i[5]=Ue.y,i[9]=Ne.y,i[2]=Ie.z,i[6]=Ue.z,i[10]=Ne.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],h=n[1],u=n[5],l=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],I=i[14],U=i[3],N=i[7],O=i[11],D=i[15];return r[0]=o*_+a*T+s*R+c*U,r[4]=o*w+a*S+s*P+c*N,r[8]=o*M+a*A+s*C+c*O,r[12]=o*E+a*L+s*I+c*D,r[1]=h*_+u*T+l*R+d*U,r[5]=h*w+u*S+l*P+d*N,r[9]=h*M+u*A+l*C+d*O,r[13]=h*E+u*L+l*I+d*D,r[2]=p*_+f*T+m*R+g*U,r[6]=p*w+f*S+m*P+g*N,r[10]=p*M+f*A+m*C+g*O,r[14]=p*E+f*L+m*I+g*D,r[3]=v*_+y*T+x*R+b*U,r[7]=v*w+y*S+x*P+b*N,r[11]=v*M+y*A+x*C+b*O,r[15]=v*E+y*L+x*I+b*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new He;return function(e){for(var n=0,i=e.count;n0)return t;var r=e*n,o=Ye[r];if(void 0===o&&(o=new Float32Array(r),Ye[r]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function $e(t,e){var n=Ze[e];void 0===n&&(n=new Int32Array(e),Ze[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function tn(t,e){t.uniform1f(this.addr,e)}function en(t,e){t.uniform1i(this.addr,e)}function nn(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function rn(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function on(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function an(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function sn(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Qe.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Qe))}function cn(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Je.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Je))}function hn(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||We,i)}function un(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||Xe,i)}function ln(t,e){t.uniform2iv(this.addr,e)}function dn(t,e){t.uniform3iv(this.addr,e)}function pn(t,e){t.uniform4iv(this.addr,e)}function fn(t,e){t.uniform1fv(this.addr,e)}function mn(t,e){t.uniform1iv(this.addr,e)}function gn(t,e){t.uniform2fv(this.addr,Ke(e,this.size,2))}function vn(t,e){t.uniform3fv(this.addr,Ke(e,this.size,3))}function yn(t,e){t.uniform4fv(this.addr,Ke(e,this.size,4))}function xn(t,e){t.uniformMatrix2fv(this.addr,!1,Ke(e,this.size,4))}function bn(t,e){t.uniformMatrix3fv(this.addr,!1,Ke(e,this.size,9))}function _n(t,e){t.uniformMatrix4fv(this.addr,!1,Ke(e,this.size,16))}function wn(t,e,n){var i=e.length,r=$e(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||We,r[o])}function Mn(t,e,n){var i=e.length,r=$e(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||Xe,r[o])}function En(t,e,n){this.id=t,this.addr=n,this.setValue=function(t){switch(t){case 5126:return tn;case 35664:return nn;case 35665:return rn;case 35666:return on;case 35674:return an;case 35675:return sn;case 35676:return cn;case 35678:return hn;case 35680:return un;case 5124:case 35670:return en;case 35667:case 35671:return ln;case 35668:case 35672:return dn;case 35669:case 35673:return pn}}(e.type)}function Tn(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return fn;case 35664:return gn;case 35665:return vn;case 35666:return yn;case 35674:return xn;case 35675:return bn;case 35676:return _n;case 35678:return wn;case 35680:return Mn;case 5124:case 35670:return mn;case 35667:case 35671:return ln;case 35668:case 35672:return dn;case 35669:case 35673:return pn}}(e.type)}function Sn(t){this.id=t,qe.call(this)}Sn.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var An=/([\w\d_]+)(\])?(\[|\.)?/g;function Ln(t,e){t.seq.push(e),t.map[e.id]=e}function Rn(t,e,n){var i=t.name,r=i.length;for(An.lastIndex=0;;){var o=An.exec(i),a=An.lastIndex,s=o[1],c="]"===o[2],h=o[3];if(c&&(s|=0),void 0===h||"["===h&&a+2===r){Ln(n,void 0===h?new En(s,t,e):new Tn(s,t,e));break}var u=n.map[s];void 0===u&&Ln(n,u=new Sn(s)),n=u}}function Pn(t,e,n){qe.call(this),this.renderer=n;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=Ae.euclideanModulo(e,1),n=Ae.clamp(n,0,1),i=Ae.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h,u=(h=n[1]).length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}t&&t.length>0&&(void 0!==(h=Cn[t])?this.setHex(h):console.warn("THREE.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),h=(c+s)/2;if(c===s)e=0,n=0;else{var u=s-c;switch(n=h<=.5?u/(s+c):u/(2-s-c),s){case r:e=(o-a)/u+(o 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i/(2.0 * PI);\n}\nfloat ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length(f);\n\treturn max((l*l + f.z)/(l+1.0), 0.0);\n}\nvec3 EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot(v1, v2);\n\tfloat y = abs(x);\n\tfloat a = 0.86267 + (0.49788 + 0.01436*y)*y;\n\tfloat b = 3.45068 + (4.18814 + y)*y;\n\tfloat v = a/b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(1.0 - x*x) - v;\n\treturn cross(v1, v2)*theta_sintheta;\n}\nvec3 integrateLtcBrdfOverRectOptimized( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[4];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tvec3 v1 = clippedRect[1] - clippedRect[0];\n\tvec3 v2 = clippedRect[3] - clippedRect[0];\n\tvec3 lightNormal = cross(v1, v2);\n\tbool bSameSide = dot(lightNormal, clippedRect[0]) > 0.0;\n\tif( !bSameSide )\n\t\treturn vec3(0.0);\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tvec3 edgeVectorFormFactor = vec3(0.0);\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[0], clippedRect[1] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[1], clippedRect[2] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[2], clippedRect[3] );\n\tedgeVectorFormFactor += EdgeVectorFormFactor( clippedRect[3], clippedRect[0] );\n\tvec3 Lo_i = vec3( ClippedSphereFormFactor( edgeVectorFormFactor ) );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3( 1, 0, t.y ),\n\t\tvec3( 0, t.z, 0 ),\n\t\tvec3( t.w, 0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRectOptimized( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRectOptimized( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 matDiffColor = material.diffuseColor;\n\t\tvec3 matSpecColor = material.specularColor;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 spec = Rect_Area_Light_Specular_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n\t\t\t\troughness,\n\t\t\t\tltcMat, ltcMag );\n\t\tvec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n\t\t\t\tgeometry,\n\t\t\t\trectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n\t\treflectedLight.directSpecular += lightColor * matSpecColor * spec;\n\t\treflectedLight.directDiffuse += lightColor * matDiffColor * diff;\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#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 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include \n#include \n#include \nvoid main () {\n\t#include \n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},Dn={basic:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.fog,Un.lights,{emissive:{value:new In(0)}}]),vertexShader:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.gradientmap,Un.fog,Un.lights,{emissive:{value:new In(0)},specular:{value:new In(1118481)},shininess:{value:30}}]),vertexShader:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:Nn.merge([Un.common,Un.aomap,Un.lightmap,Un.emissivemap,Un.bumpmap,Un.normalmap,Un.displacementmap,Un.roughnessmap,Un.metalnessmap,Un.fog,Un.lights,{emissive:{value:new In(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},points:{uniforms:Nn.merge([Un.points,Un.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:Nn.merge([Un.common,Un.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:Nn.merge([Un.common,Un.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:Nn.merge([Un.common,Un.bumpmap,Un.normalmap,Un.displacementmap,{opacity:{value:1}}]),vertexShader:On.normal_vert,fragmentShader:On.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new He}},vertexShader:On.distanceRGBA_vert,fragmentShader:On.distanceRGBA_frag}};function Fn(t,e){this.min=void 0!==t?t:new Le(1/0,1/0),this.max=void 0!==e?e:new Le(-1/0,-1/0)}function Bn(t,e){var n,i,r,o,a,s,c,h,u=t.context,l=t.state;function d(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),d=new Uint16Array([0,1,2,0,2,3]);n=u.createBuffer(),i=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,n),u.bufferData(u.ARRAY_BUFFER,e,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),u.bufferData(u.ELEMENT_ARRAY_BUFFER,d,u.STATIC_DRAW),c=u.createTexture(),h=u.createTexture(),l.bindTexture(u.TEXTURE_2D,c),u.texImage2D(u.TEXTURE_2D,0,u.RGB,16,16,0,u.RGB,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),l.bindTexture(u.TEXTURE_2D,h),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,16,16,0,u.RGBA,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),r={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},o=function(e){var n=u.createProgram(),i=u.createShader(u.FRAGMENT_SHADER),r=u.createShader(u.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return u.shaderSource(i,o+e.fragmentShader),u.shaderSource(r,o+e.vertexShader),u.compileShader(i),u.compileShader(r),u.attachShader(n,i),u.attachShader(n,r),u.linkProgram(n),n}(r),a={vertex:u.getAttribLocation(o,"position"),uv:u.getAttribLocation(o,"uv")},s={renderType:u.getUniformLocation(o,"renderType"),map:u.getUniformLocation(o,"map"),occlusionMap:u.getUniformLocation(o,"occlusionMap"),opacity:u.getUniformLocation(o,"opacity"),color:u.getUniformLocation(o,"color"),scale:u.getUniformLocation(o,"scale"),rotation:u.getUniformLocation(o,"rotation"),screenPosition:u.getUniformLocation(o,"screenPosition")}}this.render=function(r,p,f){if(0!==e.length){var m=new He,g=f.w/f.z,v=.5*f.z,y=.5*f.w,x=16/f.w,b=new Le(x*g,x),_=new He(1,1,0),w=new Le(1,1),M=new Fn;M.min.set(f.x,f.y),M.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===o&&d(),u.useProgram(o),l.initAttributes(),l.enableAttribute(a.vertex),l.enableAttribute(a.uv),l.disableUnusedAttributes(),u.uniform1i(s.occlusionMap,0),u.uniform1i(s.map,1),u.bindBuffer(u.ARRAY_BUFFER,n),u.vertexAttribPointer(a.vertex,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(a.uv,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,i),l.disable(u.CULL_FACE),l.buffers.depth.setMask(!1);for(var E=0,T=e.length;E.001&&R.scale>.001&&(_.x=R.x,_.y=R.y,_.z=R.z,x=R.size*R.scale/f.w,b.x=x*g,b.y=x,u.uniform3f(s.screenPosition,_.x,_.y,_.z),u.uniform2f(s.scale,b.x,b.y),u.uniform1f(s.rotation,R.rotation),u.uniform1f(s.opacity,R.opacity),u.uniform3f(s.color,R.color.r,R.color.g,R.color.b),l.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),t.setTexture2D(R.texture,1),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0))}}}l.enable(u.CULL_FACE),l.enable(u.DEPTH_TEST),l.buffers.depth.setMask(!0),t.resetGLState()}}}function zn(t,e){var n,i,r,o,a,s,c=t.context,h=t.state,u=new He,l=new Ge,d=new He;function p(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),h=new Uint16Array([0,1,2,0,2,3]);n=c.createBuffer(),i=c.createBuffer(),c.bindBuffer(c.ARRAY_BUFFER,n),c.bufferData(c.ARRAY_BUFFER,e,c.STATIC_DRAW),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i),c.bufferData(c.ELEMENT_ARRAY_BUFFER,h,c.STATIC_DRAW),r=function(){var e=c.createProgram(),n=c.createShader(c.VERTEX_SHADER),i=c.createShader(c.FRAGMENT_SHADER);return c.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),c.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),c.compileShader(n),c.compileShader(i),c.attachShader(e,n),c.attachShader(e,i),c.linkProgram(e),e}(),o={position:c.getAttribLocation(r,"position"),uv:c.getAttribLocation(r,"uv")},a={uvOffset:c.getUniformLocation(r,"uvOffset"),uvScale:c.getUniformLocation(r,"uvScale"),rotation:c.getUniformLocation(r,"rotation"),scale:c.getUniformLocation(r,"scale"),color:c.getUniformLocation(r,"color"),map:c.getUniformLocation(r,"map"),opacity:c.getUniformLocation(r,"opacity"),modelViewMatrix:c.getUniformLocation(r,"modelViewMatrix"),projectionMatrix:c.getUniformLocation(r,"projectionMatrix"),fogType:c.getUniformLocation(r,"fogType"),fogDensity:c.getUniformLocation(r,"fogDensity"),fogNear:c.getUniformLocation(r,"fogNear"),fogFar:c.getUniformLocation(r,"fogFar"),fogColor:c.getUniformLocation(r,"fogColor"),alphaTest:c.getUniformLocation(r,"alphaTest")};var u=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");u.width=8,u.height=8;var l=u.getContext("2d");l.fillStyle="white",l.fillRect(0,0,8,8),(s=new De(u)).needsUpdate=!0}function f(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(m,g){if(0!==e.length){void 0===r&&p(),c.useProgram(r),h.initAttributes(),h.enableAttribute(o.position),h.enableAttribute(o.uv),h.disableUnusedAttributes(),h.disable(c.CULL_FACE),h.enable(c.BLEND),c.bindBuffer(c.ARRAY_BUFFER,n),c.vertexAttribPointer(o.position,2,c.FLOAT,!1,16,0),c.vertexAttribPointer(o.uv,2,c.FLOAT,!1,16,8),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i),c.uniformMatrix4fv(a.projectionMatrix,!1,g.projectionMatrix.elements),h.activeTexture(c.TEXTURE0),c.uniform1i(a.map,0);var v=0,y=0,x=m.fog;x?(c.uniform3f(a.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(c.uniform1f(a.fogNear,x.near),c.uniform1f(a.fogFar,x.far),c.uniform1i(a.fogType,1),v=1,y=1):x.isFogExp2&&(c.uniform1f(a.fogDensity,x.density),c.uniform1i(a.fogType,2),v=2,y=2)):(c.uniform1i(a.fogType,0),v=0,y=0);for(var b=0,_=e.length;b<_;b++){(M=e[b]).modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,M.matrixWorld),M.z=-M.modelViewMatrix.elements[14]}e.sort(f);var w=[];for(b=0,_=e.length;b<_;b++){var M,E=(M=e[b]).material;if(!1!==E.visible){c.uniform1f(a.alphaTest,E.alphaTest),c.uniformMatrix4fv(a.modelViewMatrix,!1,M.modelViewMatrix.elements),M.matrixWorld.decompose(u,l,d),w[0]=d.x,w[1]=d.y;var T=0;m.fog&&E.fog&&(T=y),v!==T&&(c.uniform1i(a.fogType,T),v=T),null!==E.map?(c.uniform2f(a.uvOffset,E.map.offset.x,E.map.offset.y),c.uniform2f(a.uvScale,E.map.repeat.x,E.map.repeat.y)):(c.uniform2f(a.uvOffset,0,0),c.uniform2f(a.uvScale,1,1)),c.uniform1f(a.opacity,E.opacity),c.uniform3f(a.color,E.color.r,E.color.g,E.color.b),c.uniform1f(a.rotation,E.rotation),c.uniform2fv(a.scale,w),h.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),h.buffers.depth.setTest(E.depthTest),h.buffers.depth.setMask(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(s,0),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}}h.enable(c.CULL_FACE),t.resetGLState()}}}Dn.physical={uniforms:Nn.merge([Dn.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},Object.assign(Fn.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new Le).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new Le).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Le;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Gn,Hn,Vn,kn,jn,Wn,Xn,qn,Yn,Zn,Jn,Qn=0;function Kn(){Object.defineProperty(this,"id",{value:Qn++}),this.uuid=Ae.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=P,this.side=_,this.shading=T,this.vertexColors=S,this.opacity=1,this.transparent=!1,this.blendSrc=j,this.blendDst=W,this.blendEquation=O,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=tt,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,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.overdraw=0,this.visible=!0,this.needsUpdate=!0}function $n(t){Kn.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function ti(t){Kn.call(this),this.type="MeshDepthMaterial",this.depthPacking=Te,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.lights=!1,this.setValues(t)}function ei(t,e){this.min=void 0!==t?t:new He(1/0,1/0,1/0),this.max=void 0!==e?e:new He(-1/0,-1/0,-1/0)}function ni(t,e){this.center=void 0!==t?t:new He,this.radius=void 0!==e?e:0}function ii(){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.")}function ri(t,e){this.normal=void 0!==t?t:new He(1,0,0),this.constant=void 0!==e?e:0}function oi(t,e,n,i,r,o){this.planes=[void 0!==t?t:new ri,void 0!==e?e:new ri,void 0!==n?n:new ri,void 0!==i?i:new ri,void 0!==r?r:new ri,void 0!==o?o:new ri]}function ai(t,e,n,i){var r=t.context,o=t.state,a=new oi,s=new Ve,c=e.shadows,h=new Le,u=new Le(i.maxTextureSize,i.maxTextureSize),l=new He,d=new He,p=1,f=2,m=1+(p|f),g=new Array(m),v=new Array(m),y={},b=[new He(1,0,0),new He(-1,0,0),new He(0,0,1),new He(0,0,-1),new He(0,1,0),new He(0,-1,0)],E=[new He(0,1,0),new He(0,1,0),new He(0,1,0),new He(0,1,0),new He(0,0,1),new He(0,0,-1)],T=[new Fe,new Fe,new Fe,new Fe,new Fe,new Fe],S=new ti;S.depthPacking=Se,S.clipping=!0;for(var A=Dn.distanceRGBA,L=Nn.clone(A.uniforms),R=0;R!==m;++R){var P=0!=(R&p),C=0!=(R&f),I=S.clone();I.morphTargets=P,I.skinning=C,g[R]=I;var U=new $n({defines:{USE_SHADOWMAP:""},uniforms:L,vertexShader:A.vertexShader,fragmentShader:A.fragmentShader,morphTargets:P,skinning:C,clipping:!0});v[R]=U}var N=this;function O(e,n,i,r){var o=e.geometry,a=null,s=g,c=e.customDepthMaterial;if(i&&(s=v,c=e.customDistanceMaterial),c)a=c;else{var h=!1;n.morphTargets&&(o&&o.isBufferGeometry?h=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(h=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var u=e.isSkinnedMesh&&n.skinning,l=0;h&&(l|=p),u&&(l|=f),a=s[l]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=a.uuid,m=n.uuid,x=y[d];void 0===x&&(x={},y[d]=x);var b=x[m];void 0===b&&(b=a.clone(),x[m]=b),a=b}a.visible=n.visible,a.wireframe=n.wireframe;var E=n.side;return N.renderSingleSided&&E==M&&(E=_),N.renderReverseSided&&(E===_?E=w:E===w&&(E=_)),a.side=E,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function D(e,i,r,o){if(!1!==e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||a.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var s=n.update(e),c=e.material;if(Array.isArray(c))for(var h=s.groups,u=0,l=h.length;u0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,e){var r=i(t.textures),o=i(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$n.prototype=Object.create(Kn.prototype),$n.prototype.constructor=$n,$n.prototype.isShaderMaterial=!0,$n.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Nn.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},$n.prototype.toJSON=function(t){var e=Kn.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},ti.prototype=Object.create(Kn.prototype),ti.prototype.constructor=ti,ti.prototype.isMeshDepthMaterial=!0,ti.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(ei.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;sr&&(r=h),u>o&&(o=u),l>a&&(a=l)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;sr&&(r=h),u>o&&(o=u),l>a&&(a=l)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new He).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:(Hn=new He,function(t){return this.clampPoint(t.center,Hn),Hn.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new He).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new He;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new He;return function(e){var n=e||new ni;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(Gn=[new He,new He,new He,new He,new He,new He,new He,new He],function(t){return this.isEmpty()?this:(Gn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Gn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Gn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Gn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Gn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Gn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Gn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Gn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Gn),this)}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(ni.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Vn=new ei,function(t,e){var n=this.center;void 0!==e?n.copy(e):Vn.setFromPoints(t).getCenter(n);for(var i=0,r=0,o=t.length;rthis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new ei;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(ii.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var h=this.elements;return h[0]=t,h[1]=i,h[2]=a,h[3]=e,h[4]=r,h[5]=s,h[6]=n,h[7]=o,h[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(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new He;return function(e){for(var n=0,i=e.count;n1?void 0:i.copy(r).multiplyScalar(a).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new He).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new He,e=new ii;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),o=i||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(oi.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],h=n[6],u=n[7],l=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,u-s,f-l,y-m).normalize(),e[1].setComponents(a+i,u+s,f+l,y+m).normalize(),e[2].setComponents(a+r,u+c,f+d,y+g).normalize(),e[3].setComponents(a-r,u-c,f-d,y-g).normalize(),e[4].setComponents(a-o,u-h,f-p,y-v).normalize(),e[5].setComponents(a+o,u+h,f+p,y+v).normalize(),this},intersectsObject:(Wn=new ni,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Wn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Wn)}),intersectsSprite:function(){var t=new ni;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)0?t.min.x:t.max.x,jn.x=i.normal.x>0?t.max.x:t.min.x,kn.y=i.normal.y>0?t.min.y:t.max.y,jn.y=i.normal.y>0?t.max.y:t.min.y,kn.z=i.normal.z>0?t.min.z:t.max.z,jn.z=i.normal.z>0?t.max.z:t.min.z;var r=i.distanceToPoint(kn),o=i.distanceToPoint(jn);if(r<0&&o<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}),Object.assign(si.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new He).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new He;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new He;n.subVectors(t,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new He;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:(qn=new He,Yn=new He,Zn=new He,function(t,e,n,i){qn.copy(t).add(e).multiplyScalar(.5),Yn.copy(e).sub(t).normalize(),Zn.copy(this.origin).sub(qn);var r,o,a,s,c=.5*t.distanceTo(e),h=-this.direction.dot(Yn),u=Zn.dot(this.direction),l=-Zn.dot(Yn),d=Zn.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(o=h*u-l,s=c*p,(r=h*l-u)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(r*=f)*(r+h*(o*=f)+2*u)+o*(h*r+o+2*l)+d}else o=c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;else o=-c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;else o<=-s?a=-(r=Math.max(0,-(-h*c+u)))*r+(o=r>0?-c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d:o<=s?(r=0,a=(o=Math.min(Math.max(-c,-l),c))*(o+2*l)+d):a=-(r=Math.max(0,-(h*c+u)))*r+(o=r>0?c:Math.min(Math.max(-c,-l),c))*(o+2*l)+d;else o=h>0?-c:c,a=-(r=Math.max(0,-(h*o+u)))*r+o*(o+2*l)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Yn).multiplyScalar(o).add(qn),a}),intersectSphere:function(){var t=new He;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,l=this.origin;return c>=0?(n=(t.min.x-l.x)*c,i=(t.max.x-l.x)*c):(n=(t.max.x-l.x)*c,i=(t.min.x-l.x)*c),h>=0?(r=(t.min.y-l.y)*h,o=(t.max.y-l.y)*h):(r=(t.max.y-l.y)*h,o=(t.min.y-l.y)*h),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o=0?(a=(t.min.z-l.z)*u,s=(t.max.z-l.z)*u):(a=(t.max.z-l.z)*u,s=(t.min.z-l.z)*u),n>s||a>i?null:((a>n||n!=n)&&(n=a),(s=0?n:i,e)))},intersectsBox:(Xn=new He,function(t){return null!==this.intersectBox(t,Xn)}),intersectTriangle:function(){var t=new He,e=new He,n=new He,i=new He;return function(r,o,a,s,c){e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n);var h,u=this.direction.dot(i);if(u>0){if(s)return null;h=1}else{if(!(u<0))return null;h=-1,u=-u}t.subVectors(this.origin,r);var l=h*this.direction.dot(n.crossVectors(t,n));if(l<0)return null;var d=h*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>u)return null;var p=-h*t.dot(i);return p<0?null:this.at(p/u,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),ci.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ci.DefaultOrder="XYZ",Object.defineProperties(ci.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ci.prototype,{isEuler:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=Ae.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],c=r[1],h=r[5],u=r[9],l=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-l,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-l,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,h),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new Ve;return function(e,n,i){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(Jn=new Ge,function(t){return Jn.setFromEuler(this),this.setFromQuaternion(Jn,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new He(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(hi.prototype,{set:function(t){this.mask=1<e&&(e=t[n]);return e}yi.DefaultUp=new He(0,1,0),yi.DefaultMatrixAutoUpdate=!0,Object.assign(yi.prototype,i.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(pi=new Ge,function(t,e){return pi.setFromAxisAngle(t,e),this.quaternion.multiply(pi),this}),rotateX:function(){var t=new He(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new He(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new He(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new He;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new He(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new He(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new He(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(di=new Ve,function(t){return t.applyMatrix4(di.getInverse(this.matrixWorld))}),lookAt:function(){var t=new Ve;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e1)for(var e=0;e0){i.children=[];for(a=0;a0&&(n.geometries=c),h.length>0&&(n.materials=h),u.length>0&&(n.textures=u),l.length>0&&(n.images=l)}return n.object=i,n;function d(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}),barycoordFromPoint:function(){var t=new He,e=new He,n=new He;return function(i,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),n.subVectors(i,r);var c=t.dot(t),h=t.dot(e),u=t.dot(n),l=e.dot(e),d=e.dot(n),p=c*l-h*h,f=s||new He;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(l*u-h*d)*m,v=(c*d-h*u)*m;return f.set(1-g-v,v,g)}}(),containsPoint:function(){var t=new He;return function(e,n,i,r){var o=bi.barycoordFromPoint(e,n,i,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(bi.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new He,e=new He;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new He).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return bi.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new ri).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return bi.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return bi.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new ri,e=[new xi,new xi,new xi],n=new He,i=new He;return function(r,o){var a=o||new He,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0,a=r[1]&&r[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var h=0;h0){u=[];for(h=0;h0?1:-1,h.push(R.x,R.y,R.z),u.push(y/m),u.push(1-x/g),A+=1}}for(x=0;x65535?Pi:Li)(a,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),r[n.id]=i,i}}}function nr(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new He,color:new In,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"SpotLight":n={position:new He,direction:new He,color:new In,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"PointLight":n={position:new He,color:new In,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"HemisphereLight":n={direction:new He,skyColor:new In,groundColor:new In};break;case"RectAreaLight":n={color:new In,position:new He,halfWidth:new He,halfHeight:new He}}return t[e.id]=n,n}}}function ir(t,e,n){var i={};return{update:function(t){var r=n.frame,o=t.geometry,a=e.get(t,o);return i[a.id]!==r&&(o.isGeometry&&a.updateFromObject(t),e.update(a),i[a.id]=r),a},clear:function(){i={}}}}function rr(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),function(t){for(var e=t.split("\n"),n=0;n0)for(d=0;d0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,i,r;for(n=0,i=this.faces.length;n0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ei),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new ni),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1!==(t&&t.isGeometry)){var i,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],u=t.faceVertexUvs[0],l=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(i=(new ii).getNormalMatrix(e));for(var p=0,f=a.length;p=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),a.push(x),a.push(p.a,p.b,p.c),a.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];a.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&a.push(E(p.normal)),g){var _=p.vertexNormals;a.push(E(_[0]),E(_[1]),E(_[2]))}if(v&&a.push(T(p.color)),y){var w=p.vertexColors;a.push(T(w[0]),T(w[1]),T(w[2]))}}function M(t,e,n){return n?t|1<0&&(t.data.colors=h),l.length>0&&(t.data.uvs=[l]),t.data.faces=a,t},clone:function(){return(new Bi).copy(this)},copy:function(t){var e,n,i,r,o,a;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=t.name;var s=t.vertices;for(e=0,n=s.length;e65535?Pi:Li)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new Mi(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new ii).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new Ve;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new Ve;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new Ve;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new Ve;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new Ve;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new yi;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Ci(3*e.vertices.length,3),i=new Ci(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Ci(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e,n=t.geometry;if(t.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(n.vertices),e.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(n.normals),e.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(n.colors),e.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(n.uvs),e.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(n.lineDistances),e.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(t.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Ui).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new Mi(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new Mi(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new Mi(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new Mi(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new Mi(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=new(Ni(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new Mi(a,1).copyIndicesArray(t.indices))}for(var s in this.groups=t.groups,t.morphTargets){for(var c=[],h=t.morphTargets[s],u=0,l=h.length;u0){var f=new Ci(4*t.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var m=new Ci(4*t.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ei);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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(){var t=new ei,e=new He;return function(){null===this.boundingSphere&&(this.boundingSphere=new ni);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new zi).copy(this)},copy:function(t){var e,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],h=s[e];for(n=0,i=h.length;n0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;ee.far?null:{distance:c,point:f.clone(),object:t}}function v(t,e,n,a,s,c,d,f){i.fromBufferAttribute(a,c),r.fromBufferAttribute(a,d),o.fromBufferAttribute(a,f);var v=g(t,e,n,i,r,o,p);return v&&(s&&(h.fromBufferAttribute(s,c),u.fromBufferAttribute(s,d),l.fromBufferAttribute(s,f),v.uv=m(p,i,r,o,h,u,l)),v.face=new _i(c,d,f,bi.normal(i,r,o)),v.faceIndex=c),v}return function(d,f){var y,x=this.geometry,b=this.material,_=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),n.copy(x.boundingSphere),n.applyMatrix4(_),!1!==d.ray.intersectsSphere(n)&&(t.getInverse(_),e.copy(d.ray).applyMatrix4(t),null===x.boundingBox||!1!==e.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var w,M,E,T,S,A=x.index,L=x.attributes.position,R=x.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(U=F);for(var B=0,z=D.length;B/gm,function(t,e){var n=On[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return vr(n)})}function yr(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,n,i){for(var r="",o=parseInt(e);o0?t.gammaFactor:1,_=function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(mr).join("\n")}(o,i,t.extensions),w=function(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(a),M=r.createProgram();n.isRawShaderMaterial?(p=[w,"\n"].filter(mr).join("\n"),f=[_,w,"\n"].filter(mr).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(mr).join("\n"),f=[_,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,w,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.envMap?"#define "+l:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+h:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==ct?"#define TONE_MAPPING":"",i.toneMapping!==ct?On.tonemapping_pars_fragment:"",i.toneMapping!==ct?fr("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?On.encodings_pars_fragment:"",i.mapEncoding?pr("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?pr("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?pr("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?(m="linearToOutputTexel",g=i.outputEncoding,v=dr(g),"vec4 "+m+"( vec4 value ) { return LinearTo"+v[0]+v[1]+"; }"):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(mr).join("\n")),s=gr(s=vr(s),i),c=gr(c=vr(c),i),n.isShaderMaterial||(s=yr(s),c=yr(c));var E=p+s,T=f+c,S=rr(r,r.VERTEX_SHADER,E),A=rr(r,r.FRAGMENT_SHADER,T);r.attachShader(M,S),r.attachShader(M,A),void 0!==n.index0AttributeName?r.bindAttribLocation(M,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(M,0,"position"),r.linkProgram(M);var L,R,P=r.getProgramInfoLog(M),C=r.getShaderInfoLog(S),I=r.getShaderInfoLog(A),U=!0,N=!0;return!1===r.getProgramParameter(M,r.LINK_STATUS)?(U=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(M,r.VALIDATE_STATUS),"gl.getProgramInfoLog",P,C,I)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==C&&""!==I||(N=!1),N&&(this.diagnostics={runnable:U,material:n,programLog:P,vertexShader:{log:C,prefix:p},fragmentShader:{log:I,prefix:f}}),r.deleteShader(S),r.deleteShader(A),this.getUniforms=function(){return void 0===L&&(L=new Pn(r,M,t)),L},this.getAttributes=function(){return void 0===R&&(R=function(t,e,n){for(var i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o0,maxBones:l,useVertexTexture:e.floatVertexTextures,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:s,numClipIntersection:c,dithering:n.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&r.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===M,flipSided:n.side===w,depthPacking:void 0!==n.depthPacking&&n.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);for(var o=0;oe||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function h(t){return Ae.isPowerOfTwo(t.width)&&Ae.isPowerOfTwo(t.height)}function u(e){return e===Et||e===Tt||e===St?t.NEAREST:t.LINEAR}function l(e){var n=e.target;n.removeEventListener("dispose",l),function(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i.remove(e)}(n),a.textures--}function d(e){var n=e.target;n.removeEventListener("dispose",d),function(e){var n=i.get(e),r=i.get(e.texture);if(!e)return;void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}(n),a.textures--}function p(e,u){var d=i.get(e);if(e.version>0&&d.__version!==e.version){var p=e.image;if(void 0===p)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==p.complete)return void function(e,i,u){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",l),e.__webglTexture=t.createTexture(),a.textures++);n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var d=c(i.image,r.maxTextureSize);(function(t){return t.wrapS!==wt||t.wrapT!==wt||t.minFilter!==Et&&t.minFilter!==At})(i)&&!1===h(d)&&(d=function(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.width=Ae.nearestPowerOfTwo(t.width),e.height=Ae.nearestPowerOfTwo(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}(d));var p=h(d),m=o(i.format),g=o(i.type);f(t.TEXTURE_2D,i,p);var v,y=i.mipmaps;if(i.isDepthTexture){var x=t.DEPTH_COMPONENT;if(i.type===Dt){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else s&&(x=t.DEPTH_COMPONENT16);i.format===Yt&&x===t.DEPTH_COMPONENT&&i.type!==Ut&&i.type!==Ot&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ut,g=o(i.type)),i.format===Zt&&(x=t.DEPTH_STENCIL,i.type!==Ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Ht,g=o(i.type))),n.texImage2D(t.TEXTURE_2D,0,x,d.width,d.height,0,m,g,null)}else if(i.isDataTexture)if(y.length>0&&p){for(var b=0,_=y.length;b<_;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,d.width,d.height,0,m,g,d.data);else if(i.isCompressedTexture)for(var b=0,_=y.length;b<_;b++)v=y[b],i.format!==jt&&i.format!==kt?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&p){for(var b=0,_=y.length;b<_;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,m,g,v);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,g,d);i.generateMipmaps&&p&&t.generateMipmap(t.TEXTURE_2D);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(d,e,u);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_2D,d.__webglTexture)}function f(n,a,s){var c;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===wt&&a.wrapT===wt||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,u(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,u(a.minFilter)),a.minFilter!==Et&&a.minFilter!==At&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Dt&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ft&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function m(e,r,a,s){var c=o(r.texture.format),h=o(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,h,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function g(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function v(e){var n=i.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),p(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Yt)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),g(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),g(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}this.setTexture2D=p,this.setTextureCube=function(e,s){var u=i.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",l),u.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var d=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=d||p?p?e.image[g].image:e.image[g]:c(e.image[g],r.maxCubemapSize);var v=h(m[0]),y=o(e.format),x=o(e.type);for(f(t.TEXTURE_CUBE_MAP,e,v),g=0;g<6;g++)if(d)for(var b,_=m[g].mipmaps,w=0,M=_.length;w-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,w,y,b.width,b.height,0,y,x,b.data);else p?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,m[g].width,m[g].height,0,y,x,m[g].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,y,y,x,m[g]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+s),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)},this.setupRenderTarget=function(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,c=h(e);if(s){r.__webglFramebuffer=[];for(var u=0;u<6;u++)r.__webglFramebuffer[u]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){for(n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),f(t.TEXTURE_CUBE_MAP,e.texture,c),u=0;u<6;u++)m(r.__webglFramebuffer[u],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+u);e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),f(t.TEXTURE_2D,e.texture,c),m(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&v(e)},this.updateRenderTargetMipmap=function(e){var r=e.texture;if(r.generateMipmaps&&h(e)&&r.minFilter!==Et&&r.minFilter!==At){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}}function wr(){var t={};return{get:function(e){var n=e.uuid,i=t[n];return void 0===i&&(i={},t[n]=i),i},remove:function(e){delete t[e.uuid]},clear:function(){t={}}}}function Mr(t,e,n){var i=new function(){var e=!1,n=new Fe,i=null,r=new Fe;return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),!1===r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(0,0,0,1)}}},r=new function(){var e=!1,n=null,i=null,r=null;return{setTest:function(e){e?X(t.DEPTH_TEST):q(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case Q:t.depthFunc(t.NEVER);break;case K:t.depthFunc(t.ALWAYS);break;case $:t.depthFunc(t.LESS);break;case tt:t.depthFunc(t.LEQUAL);break;case et:t.depthFunc(t.EQUAL);break;case nt:t.depthFunc(t.GEQUAL);break;case it:t.depthFunc(t.GREATER);break;case rt:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},o=new function(){var e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,h=null;return{setTest:function(e){e?X(t.STENCIL_TEST):q(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&o===a||(t.stencilFunc(e,n,a),i=e,r=n,o=a)},setOp:function(e,n,i){a===e&&s===n&&c===i||(t.stencilOp(e,n,i),a=e,s=n,c=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,h=null}}},a=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),h=new Uint8Array(a),u={},l=null,m=null,g=null,v=null,y=null,x=null,b=null,_=null,E=!1,T=null,S=null,A=null,L=null,O=null,D=null,F=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),B=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),z=parseFloat(B)>=1,G=null,H={},V=new Fe,k=new Fe;function j(e,n,i){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),l=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),f=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=h>0,v=!!e.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=e.get("EXT_texture_filter_anisotropic");return i=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:l,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function Tr(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}function Sr(){var t=this,e=null,n=0,i=!1,r=!1,o=new ri,a=new ii,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(e,n,i,r){var c=null!==e?e.length:0,h=null;if(0!==c){if(h=s.value,!0!==r||null===h){var u=i+4*c,l=n.matrixWorldInverse;a.getNormalMatrix(l),(null===h||h.length=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(u=0;u=0&&t.numSupportedMorphNormals++}var l=i.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=nt.numPlanes,i.numIntersection=nt.numIntersection,l.clippingPlanes=nt.uniform),i.fog=e,i.lightsHash=ut.hash,t.lights&&(l.ambientLightColor.value=ut.ambient,l.directionalLights.value=ut.directional,l.spotLights.value=ut.spot,l.rectAreaLights.value=ut.rectArea,l.pointLights.value=ut.point,l.hemisphereLights.value=ut.hemi,l.directionalShadowMap.value=ut.directionalShadowMap,l.directionalShadowMatrix.value=ut.directionalShadowMatrix,l.spotShadowMap.value=ut.spotShadowMap,l.spotShadowMatrix.value=ut.spotShadowMatrix,l.pointShadowMap.value=ut.pointShadowMap,l.pointShadowMatrix.value=ut.pointShadowMatrix);var d=i.program.getUniforms(),p=Pn.seqWithValue(d.seq,l);i.uniformsList=p}function Ie(t,e,n,i){P=0;var r=vt.get(n);if(it&&(rt||t!==T)){var o=t===T&&n.id===_;nt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,o)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==ut.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===nt.numPlanes&&r.numIntersection===nt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(Ce(n,e,i),n.needsUpdate=!1);var a,s,c=!1,h=!1,u=!1,l=r.program,d=l.getUniforms(),p=r.__webglShader.uniforms;if(l.id!==y&&(m.useProgram(l.program),y=l.id,c=!0,h=!0,u=!0),n.id!==_&&(_=n.id,h=!0),c||t!==T){if(d.setValue(m,"projectionMatrix",t.projectionMatrix),mt.logarithmicDepthBuffer&&d.setValue(m,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==T&&(T=t,h=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=d.map.cameraPosition;void 0!==f&&f.setValue(m,at.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&d.setValue(m,"viewMatrix",t.matrixWorldInverse),d.setValue(m,"toneMappingExposure",v.toneMappingExposure),d.setValue(m,"toneMappingWhitePoint",v.toneMappingWhitePoint)}if(n.skinning){d.setOptional(m,i,"bindMatrix"),d.setOptional(m,i,"bindMatrixInverse");var g=i.skeleton;if(g){var x=g.bones;if(mt.floatVertexTextures){if(void 0===g.boneTexture){var b=Math.sqrt(4*x.length);b=Ae.nextPowerOfTwo(Math.ceil(b)),b=Math.max(b,4);var w=new Float32Array(b*b*4);w.set(g.boneMatrices);var M=new ke(w,b,b,jt,Dt);g.boneMatrices=w,g.boneTexture=M,g.boneTextureSize=b}d.setValue(m,"boneTexture",g.boneTexture),d.setValue(m,"boneTextureSize",g.boneTextureSize)}else d.setOptional(m,g,"boneMatrices")}}return h&&(n.lights&&(s=u,(a=p).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),e&&n.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(p,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&function(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity);t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity);e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap);if(void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}(p,n),n.isLineBasicMaterial?Ue(p,n):n.isLineDashedMaterial?(Ue(p,n),function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(p,n)):n.isPointsMaterial?function(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Q,t.scale.value=.5*N,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}(p,n):n.isMeshLambertMaterial?function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(p,n):n.isMeshToonMaterial?function(t,e){Ne(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(p,n):n.isMeshPhongMaterial?Ne(p,n):n.isMeshPhysicalMaterial?function(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,Oe(t,e)}(p,n):n.isMeshStandardMaterial?Oe(p,n):n.isMeshDepthMaterial?n.displacementMap&&(p.displacementMap.value=n.displacementMap,p.displacementScale.value=n.displacementScale,p.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(p,n),void 0!==p.ltcMat&&(p.ltcMat.value=Un.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=Un.LTC_MAG_TEXTURE),Pn.upload(m,r.uniformsList,p,v)),d.setValue(m,"modelViewMatrix",i.modelViewMatrix),d.setValue(m,"normalMatrix",i.normalMatrix),d.setValue(m,"modelMatrix",i.matrixWorld),l}function Ue(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function Ne(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Oe(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function De(t,e){var n,i,r,o,a,s,c,h,u=0,l=0,d=0,p=e.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(n=0,i=t.length;n8&&(u.length=8);var g=n.morphAttributes;for(l=0,p=u.length;l=0){var h=r[s];if(void 0!==h){var u=h.normalized,l=h.itemSize,d=xt.get(h),p=d.buffer,f=d.type,g=d.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,y=v.stride,x=h.offset;v&&v.isInstancedInterleavedBuffer?(gt.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):gt.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,l,f,u,y*g,(i*y+x)*g)}else h.isInstancedBufferAttribute?(gt.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=h.meshPerAttribute*h.count)):gt.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,l,f,u,0,i*l*g)}else if(void 0!==a){var b=a[s];if(void 0!==b)switch(b.length){case 2:m.vertexAttrib2fv(c,b);break;case 3:m.vertexAttrib3fv(c,b);break;case 4:m.vertexAttrib4fv(c,b);break;default:m.vertexAttrib1fv(c,b)}}}}gt.disableUnusedAttributes()}(i,a,n),null!==v&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,xt.get(v).buffer));var w=0;null!==v?w=v.count:void 0!==x&&(w=x.count);var E=n.drawRange.start*b,T=n.drawRange.count*b,S=null!==o?o.start*b:0,A=null!==o?o.count*b:1/0,L=Math.max(E,S),R=Math.min(w,E+T,S+A)-1,P=Math.max(0,R-L+1);if(0!==P){if(r.isMesh)if(!0===i.wireframe)gt.setLineWidth(i.wireframeLinewidth*ve()),_.setMode(m.LINES);else switch(r.drawMode){case fe:_.setMode(m.TRIANGLES);break;case me:_.setMode(m.TRIANGLE_STRIP);break;case ge:_.setMode(m.TRIANGLE_FAN)}else if(r.isLine){var C=i.linewidth;void 0===C&&(C=1),gt.setLineWidth(C*ve()),r.isLineSegments?_.setMode(m.LINES):r.isLineLoop?_.setMode(m.LINE_LOOP):_.setMode(m.LINE_STRIP)}else r.isPoints&&_.setMode(m.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&_.renderInstances(n,L,P):_.render(L,P)}},this.compile=function(t,e){h=[],t.traverse(function(t){t.isLight&&h.push(t)}),De(h,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=mt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+mt.maxTextures),P+=1,t},this.setTexture2D=(_e=!1,function(t,e){t&&t.isWebGLRenderTarget&&(_e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),_e=!0),t=t.texture),yt.setTexture2D(t,e)}),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),yt.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?yt.setTextureCube(e,n):yt.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return x},this.setRenderTarget=function(t){x=t,t&&void 0===vt.get(t).__webglFramebuffer&&yt.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=vt.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,A.copy(t.scissor),L=t.scissorTest,R.copy(t.viewport)}else e=null,A.copy(K).multiplyScalar(Q),L=$,R.copy(tt).multiplyScalar(Q);if(b!==e&&(m.bindFramebuffer(m.FRAMEBUFFER,e),b=e),gt.scissor(A),gt.setScissorTest(L),gt.viewport(R),n){var r=vt.get(t.texture);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(!1!==(t&&t.isWebGLRenderTarget)){var a=vt.get(t).__webglFramebuffer;if(a){var s=!1;a!==b&&(m.bindFramebuffer(m.FRAMEBUFFER,a),s=!0);try{var c=t.texture,h=c.format,u=c.type;if(h!==jt&&Be(h)!==m.getParameter(m.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Pt||Be(u)===m.getParameter(m.IMPLEMENTATION_COLOR_READ_TYPE)||u===Dt&&(ft.get("OES_texture_float")||ft.get("WEBGL_color_buffer_float"))||u===Ft&&ft.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");m.checkFramebufferStatus(m.FRAMEBUFFER)===m.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&m.readPixels(e,n,i,r,Be(h),Be(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&m.bindFramebuffer(m.FRAMEBUFFER,b)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Lr(t,e){this.name="",this.color=new In(t),this.density=void 0!==e?e:25e-5}function Rr(t,e,n){this.name="",this.color=new In(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Pr(){yi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Cr(t,e,n,i,r){yi.call(this),this.lensFlares=[],this.positionScreen=new He,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,i,r)}function Ir(t){Kn.call(this),this.type="SpriteMaterial",this.color=new In(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Ur(t){yi.call(this),this.type="Sprite",this.material=void 0!==t?t:new Ir}function Nr(){yi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Or(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}()}function Xr(t,e,n,i,r,o,a,s,c,h,u,l){De.call(this,null,o,a,s,c,h,i,r,u,l),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function qr(t,e,n,i,r,o,a,s,c){De.call(this,t,e,n,i,r,o,a,s,c),this.needsUpdate=!0}function Yr(t,e,n,i,r,o,a,s,c,h){if((h=void 0!==h?h:Yt)!==Yt&&h!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===Yt&&(n=Ut),void 0===n&&h===Zt&&(n=Ht),De.call(this,null,i,r,o,a,s,h,n,c),this.image={width:t,height:e},this.magFilter=void 0!==a?a:Et,this.minFilter=void 0!==s?s:Et,this.flipY=!1,this.generateMipmaps=!1}function Zr(t){zi.call(this),this.type="WireframeGeometry";var e,n,i,r,o,a,s,c,h,u,l=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,i=m.length;e=0?(l=t(g-1e-5,m,l),d.subVectors(u,l)):(l=t(g+1e-5,m,l),d.subVectors(l,u)),m-1e-5>=0?(l=t(g,m-1e-5,l),p.subVectors(u,l)):(l=t(g,m+1e-5,l),p.subVectors(l,u)),h.crossVectors(d,p).normalize(),s.push(h.x,h.y,h.z),c.push(g,m)}}for(i=0;i.9&&a<.1&&(e<.2&&(o[t+0]+=1),n<.2&&(o[t+2]+=1),i<.2&&(o[t+4]+=1))}}()}(),this.addAttribute("position",new Ci(r,3)),this.addAttribute("normal",new Ci(r.slice(),3)),this.addAttribute("uv",new Ci(o,2)),this.normalizeNormals()}function to(t,e){Bi.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new eo(t,e)),this.mergeVertices()}function eo(t,e){$r.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function no(t,e){Bi.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new io(t,e)),this.mergeVertices()}function io(t,e){$r.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ro(t,e){Bi.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new oo(t,e)),this.mergeVertices()}function oo(t,e){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];$r.call(this,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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function ao(t,e){Bi.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new so(t,e)),this.mergeVertices()}function so(t,e){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];$r.call(this,r,[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],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function co(t,e,n,i,r,o){Bi.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new ho(t,e,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function ho(t,e,n,i,r){zi.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},e=e||64,n=n||1,i=i||8,r=r||!1;var o=t.computeFrenetFrames(e,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new He,h=new He,u=new Le,l=[],d=[],p=[],f=[];function m(r){var a=t.getPointAt(r/e),u=o.normals[r],p=o.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);h.x=g*u.x+m*p.x,h.y=g*u.y+m*p.y,h.z=g*u.z+m*p.z,h.normalize(),d.push(h.x,h.y,h.z),c.x=a.x+n*h.x,c.y=a.y+n*h.y,c.z=a.z+n*h.z,l.push(c.x,c.y,c.z)}}!function(){for(a=0;an)){var i=t.ray.origin.distanceTo(or);it.far||e.push({distance:i,point:or.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),Nr.prototype=Object.assign(Object.create(yi.prototype),{constructor:Nr,copy:function(t){yi.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;oa))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}else for(v=0,y=m.length/3-1;va))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var _=s.vertices,w=_.length;for(v=0;va))d.applyMatrix4(this.matrixWorld),(M=i.ray.origin.distanceTo(d))i.far||r.push({distance:M,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Gr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Gr,isLineSegments:!0}),Hr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Hr,isLineLoop:!0}),Vr.prototype=Object.create(Kn.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isPointsMaterial=!0,Vr.prototype.copy=function(t){return Kn.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},kr.prototype=Object.assign(Object.create(yi.prototype),{constructor:kr,isPoints:!0,raycast:function(){var t=new Ve,e=new si,n=new ni;return function(i,r){var o=this,a=this.geometry,s=this.matrixWorld,c=i.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),n.copy(a.boundingSphere),n.applyMatrix4(s),n.radius+=c,!1!==i.ray.intersectsSphere(n)){t.getInverse(s),e.copy(i.ray).applyMatrix4(t);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),u=h*h,l=new He;if(a.isBufferGeometry){var d=a.index,p=a.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length;mi.far)return;r.push({distance:h,distanceToRay:Math.sqrt(a),point:c.clone(),index:n,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),jr.prototype=Object.assign(Object.create(yi.prototype),{constructor:jr}),Wr.prototype=Object.create(De.prototype),Wr.prototype.constructor=Wr,Xr.prototype=Object.create(De.prototype),Xr.prototype.constructor=Xr,Xr.prototype.isCompressedTexture=!0,qr.prototype=Object.create(De.prototype),qr.prototype.constructor=qr,Yr.prototype=Object.create(De.prototype),Yr.prototype.constructor=Yr,Yr.prototype.isDepthTexture=!0,Zr.prototype=Object.create(zi.prototype),Zr.prototype.constructor=Zr,Jr.prototype=Object.create(Bi.prototype),Jr.prototype.constructor=Jr,Qr.prototype=Object.create(zi.prototype),Qr.prototype.constructor=Qr,Kr.prototype=Object.create(Bi.prototype),Kr.prototype.constructor=Kr,$r.prototype=Object.create(zi.prototype),$r.prototype.constructor=$r,to.prototype=Object.create(Bi.prototype),to.prototype.constructor=to,eo.prototype=Object.create($r.prototype),eo.prototype.constructor=eo,no.prototype=Object.create(Bi.prototype),no.prototype.constructor=no,io.prototype=Object.create($r.prototype),io.prototype.constructor=io,ro.prototype=Object.create(Bi.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create($r.prototype),oo.prototype.constructor=oo,ao.prototype=Object.create(Bi.prototype),ao.prototype.constructor=ao,so.prototype=Object.create($r.prototype),so.prototype.constructor=so,co.prototype=Object.create(Bi.prototype),co.prototype.constructor=co,ho.prototype=Object.create(zi.prototype),ho.prototype.constructor=ho,uo.prototype=Object.create(Bi.prototype),uo.prototype.constructor=uo,lo.prototype=Object.create(zi.prototype),lo.prototype.constructor=lo,po.prototype=Object.create(Bi.prototype),po.prototype.constructor=po,fo.prototype=Object.create(zi.prototype),fo.prototype.constructor=fo;var mo={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r=-Number.EPSILON&&w>=-Number.EPSILON&&_>=-Number.EPSILON))return!1;return!0}return function(e,n){var i=e.length;if(i<3)return null;var r,o,a,s=[],c=[],h=[];if(mo.area(e)>0)for(o=0;o2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?h:s;if(u<=(r=o)&&(r=0),u<=(o=r+1)&&(o=0),u<=(a=o+1)&&(a=0),t(e,r,o,a,u,c)){var d,p,f,m,g;for(d=c[r],p=c[o],f=c[a],s.push([e[d],e[p],e[f]]),h.push([c[r],c[o],c[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function i(t,e,n){return t.x!==e.x?t.xNumber.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=h*u-c*l)<0||f>d)return[]}else{if(p>0||p0||fM?[]:y===M?o?[]:[g]:x<=M?[g,v]:[g,_])}function o(t,e,n,i){var r=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,c=i.x-t.x,h=i.y-t.y,u=r*s-o*a,l=r*h-o*c;if(Math.abs(u)>Number.EPSILON){var d=c*s-h*a;return u>0?l>=0&&d>=0:l>=0||d>=0}return l>0}n(t),e.forEach(n);for(var a,s,c,h,u,l,d={},p=t.concat(),f=0,m=e.length;fr&&(s=0);var c=o(i[t],i[a],i[s],n[e]);if(!c)return!1;var h=n.length-1,u=e-1;u<0&&(u=h);var l=e+1;return l>h&&(l=0),!!(c=o(n[e],n[u],n[l],i[t]))}function s(t,e){var n,o;for(n=0;n0)return!0;return!1}var c=[];function h(t,n){var i,o,a,s;for(i=0;i0)return!0;return!1}for(var u,l,d,p,f,m,g,v,y,x,b=[],_=0,w=e.length;_0;){if(--E<0){console.log("Infinite Loop! Holes left:"+c.length+", Probably Hole outside Shape!");break}for(l=M;l=0)break;b[m]=!0}if(u>=0)break}}return i}(t,e),v=mo.triangulate(g,!1);for(a=0,s=v.length;a0)&&f.push(_,w,E),(c!==n-1||h0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.addAttribute("position",new Ci(u,3)),this.addAttribute("normal",new Ci(l,3)),this.addAttribute("uv",new Ci(d,2))}function Co(t,e,n,i,r,o,a){Ro.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Io(t,e,n,i,r,o,a){Po.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function Uo(t,e,n,i){Bi.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new No(t,e,n,i)),this.mergeVertices()}function No(t,e,n,i){zi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,o,a=[],s=[],c=[],h=[],u=new He,l=new Le;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),o=0,r=3;o<=e;o++,r+=3){var d=n+o/e*i;u.x=t*Math.cos(d),u.y=t*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),l.x=(s[r]/t+1)/2,l.y=(s[r+1]/t+1)/2,h.push(l.x,l.y)}for(r=1;r<=e;r++)a.push(r,r+1,0);this.setIndex(a),this.addAttribute("position",new Ci(s,3)),this.addAttribute("normal",new Ci(c,3)),this.addAttribute("uv",new Ci(h,2))}go.prototype=Object.create(Bi.prototype),go.prototype.constructor=go,vo.prototype=Object.create(zi.prototype),vo.prototype.constructor=vo,vo.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:e,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},vo.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var i=0;iNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+h*h),f=e.x-s/d,m=e.y+a/d,g=((n.x-h/p-f)*h-(n.y+c/p-m)*c)/(a*h-s*c),v=(i=f+a*g-t.x)*i+(r=m+s*g-t.y)*r;if(v<=2)return new Le(i,r);o=Math.sqrt(v/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(i=-s,r=a,o=Math.sqrt(u)):(i=a,r=s,o=Math.sqrt(u/2))}return new Le(i/o,r/o)}for(var V=[],k=0,j=C.length,W=j-1,X=k+1;k=0;U--){for(O=U/y,D=g*Math.cos(O*Math.PI/2),N=v*Math.sin(O*Math.PI/2),k=0,j=C.length;k=0;){n=k,(i=k-1)<0&&(i=t.length-1);var r=0,o=_+2*y;for(r=0;r0||0===t.search(/^data\:image\/jpeg/);o.format=n?kt:jt,o.needsUpdate=!0,void 0!==e&&e(o)},n,i),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),ea.prototype=Object.assign(Object.create(yi.prototype),{constructor:ea,isLight:!0,copy:function(t){return yi.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=yi.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),na.prototype=Object.assign(Object.create(ea.prototype),{constructor:na,isHemisphereLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(ia.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),ra.prototype=Object.assign(Object.create(ia.prototype),{constructor:ra,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*Ae.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix())}}),oa.prototype=Object.assign(Object.create(ea.prototype),{constructor:oa,isSpotLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),aa.prototype=Object.assign(Object.create(ea.prototype),{constructor:aa,isPointLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),sa.prototype=Object.assign(Object.create(ia.prototype),{constructor:sa}),ca.prototype=Object.assign(Object.create(ea.prototype),{constructor:ca,isDirectionalLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ha.prototype=Object.assign(Object.create(ea.prototype),{constructor:ha,isAmbientLight:!0}),ua.prototype=Object.assign(Object.create(ea.prototype),{constructor:ua,isRectAreaLight:!0,copy:function(t){return ea.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=ea.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var la,da={arraySlice:function(t,e,n){return da.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=new Array(e),i=0;i!==e;++i)n[i]=i;return n.sort(function(e,n){return t[e]-t[n]}),n},sortedArray:function(t,e,n){for(var i=t.length,r=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,n,i){for(var r=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[i])&&(e.push(o.time),n.push.apply(n,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[i])&&(e.push(o.time),a.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{void 0!==(a=o[i])&&(e.push(o.time),n.push(a)),o=t[r++]}while(void 0!==o)}}};function pa(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function fa(t,e,n,i){pa.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function ma(t,e,n,i){pa.call(this,t,e,n,i)}function ga(t,e,n,i){pa.call(this,t,e,n,i)}function va(t,e,n,i){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=da.convertArray(e,this.TimeBufferType),this.values=da.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function ya(t,e,n,i){va.call(this,t,e,n,i)}function xa(t,e,n,i){pa.call(this,t,e,n,i)}function ba(t,e,n,i){va.call(this,t,e,n,i)}function _a(t,e,n,i){va.call(this,t,e,n,i)}function wa(t,e,n,i){va.call(this,t,e,n,i)}function Ma(t,e,n){va.call(this,t,e,n)}function Ea(t,e,n,i){va.call(this,t,e,n,i)}function Ta(t,e,n,i){va.apply(this,arguments)}function Sa(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Ae.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Aa(t){this.manager=void 0!==t?t:Yo,this.textures={}}function La(t){this.manager=void 0!==t?t:Yo}Object.assign(pa.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{var o;n:{i:if(!(t=r)break t;var s=e[1];t=(r=e[--n-1]))break e}o=n,n=0}for(;n>>1;te;)--o;if(++o,0!==r||o!==i){r>=o&&(r=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=da.arraySlice(n,r,o),this.values=da.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&da.isTypedArray(i)){a=0;for(var c=i.length;a!==c;++a){var h=i[a];if(isNaN(h)){console.error("value is not a valid number",this,a,h),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=this.getInterpolation()===ue,r=1,o=t.length-1,a=1;a0){t[r]=t[o];for(f=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=da.arraySlice(t,0,r),this.values=da.arraySlice(e,0,r*n)),this}},ya.prototype=Object.assign(Object.create(la),{constructor:ya,ValueTypeName:"vector"}),xa.prototype=Object.assign(Object.create(pa.prototype),{constructor:xa,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(i-e),h=s+a;s!==h;s+=4)Ge.slerpFlat(r,0,o,s-a,o,s,c);return r}}),ba.prototype=Object.assign(Object.create(la),{constructor:ba,ValueTypeName:"quaternion",DefaultInterpolation:he,InterpolantFactoryMethodLinear:function(t){return new xa(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),_a.prototype=Object.assign(Object.create(la),{constructor:_a,ValueTypeName:"number"}),wa.prototype=Object.assign(Object.create(la),{constructor:wa,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ce,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ma.prototype=Object.assign(Object.create(la),{constructor:Ma,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ce,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ea.prototype=Object.assign(Object.create(la),{constructor:Ea,ValueTypeName:"color"}),Ta.prototype=la,la.constructor=Ta,Object.assign(Ta,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Ta._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],i=[];da.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:da.convertArray(t.times,Array),values:da.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _a;case"vector":case"vector2":case"vector3":case"vector4":return ya;case"color":return Ea;case"quaternion":return ba;case"bool":case"boolean":return Ma;case"string":return wa}throw new Error("Unsupported typeName: "+t)}}),Object.assign(Sa,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(Ta.parse(n[r]).scale(i));return new Sa(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e},r=0,o=n.length;r!==o;++r)e.push(Ta.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a1){var h=i[l=c[1]];h||(i[l]=h=[]),h.push(s)}}var u=[];for(var l in i)u.push(Sa.CreateFromMorphTargetSequence(l,i[l],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];da.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c1?t.skinWeights[i+1]:0,s=n>2?t.skinWeights[i+2]:0,c=n>3?t.skinWeights[i+3]:0;e.skinWeights.push(new Fe(o,a,s,c))}if(t.skinIndices)for(i=0,r=t.skinIndices.length;i1?t.skinIndices[i+1]:0,l=n>2?t.skinIndices[i+2]:0,d=n>3?t.skinIndices[i+3]:0;e.skinIndices.push(new Fe(h,u,l,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,n),function(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var i=0,r=t.morphTargets.length;i0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var u=e.faces,l=t.morphColors[0].colors;for(i=0,r=u.length;i0&&(e.animations=n)}(t,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:n}:{geometry:n,materials:Na.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}()}),Object.assign(Da.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new Zo(r.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?r.parse(o,e):console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.")},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new Oa,i=new La,r=0,o=t.length;r0){var o=new Ko(new qo(e));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new Fr(s,c):new Gi(s,c);break;case"LOD":r=new Nr;break;case"Line":r=new zr(o(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Hr(o(e.geometry),a(e.material));break;case"LineSegments":r=new Gr(o(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new kr(o(e.geometry),a(e.material));break;case"Sprite":r=new Ur(a(e.material));break;case"Group":r=new jr;break;default:r=new yi}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.children)for(var h in e.children)r.add(this.parseObject(e.children[h],n,i));if("LOD"===e.type)for(var u=e.levels,l=0;l0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(o-1);var h=i[r];return(r+(n-h)/(i[r+1]-h))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new He,a=[],s=[],c=[],h=new He,u=new Ve;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new He,c[0]=new He;var l=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=l&&(l=d,o.set(1,0,0)),p<=l&&(l=p,o.set(0,1,0)),f<=l&&o.set(0,0,1),h.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],h),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),h.crossVectors(a[n-1],a[n]),h.length()>Number.EPSILON&&(h.normalize(),r=Math.acos(Ae.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(h,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Ae.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(h.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(u.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}}}),ja.prototype=Object.create(ka.prototype),ja.prototype.constructor=ja,ja.prototype.isLineCurve=!0,ja.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},ja.prototype.getPointAt=function(t){return this.getPoint(t)},ja.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Wa.prototype=Object.assign(Object.create(ka.prototype),{constructor:Wa,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new ja(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),i=0;i=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Bi,n=0,i=t.length;ne;)n-=e;ne.length-2?e.length-1:i+1],c=e[i>e.length-3?e.length-1:i+2];return new Le(Ga(r,o.x,a.x,s.x,c.x),Ga(r,o.y,a.y,s.y,c.y))},Ya.prototype=Object.create(ka.prototype),Ya.prototype.constructor=Ya,Ya.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,r=this.v3;return new Le(Va(t,e.x,n.x,i.x,r.x),Va(t,e.y,n.y,i.y,r.y))},Za.prototype=Object.create(ka.prototype),Za.prototype.constructor=Za,Za.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new Le(Ha(t,e.x,n.x,i.x),Ha(t,e.y,n.y,i.y))};var Ja,Qa=Object.assign(Object.create(Wa.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)}});function Ka(t){Wa.call(this),this.currentPoint=new Le,t&&this.fromPoints(t)}function $a(){Ka.apply(this,arguments),this.holes=[]}function ts(){this.subPaths=[],this.currentPath=null}function es(t){this.data=t}function ns(t){this.manager=void 0!==t?t:Yo}Ka.prototype=Qa,Qa.constructor=Ka,$a.prototype=Object.assign(Object.create(Qa),{constructor:$a,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;nNumber.EPSILON){if(h<0&&(a=e[o],c=-c,s=e[r],h=-h),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=h*(t.x-a.x)-c*(t.y-a.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i}var r=mo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,c,h=[];if(1===o.length)return s=o[0],(c=new $a).curves=s.curves,h.push(c),h;var u=!r(o[0].getPoints());u=t?!u:u;var l,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=o.length;v1){for(var x=!1,b=[],_=0,w=f.length;_0&&(x||(m=p))}v=0;for(var L=f.length;v0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){Ge.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}}),Object.assign(Cs.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Is,{Composite:Cs,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Is.Composite(t,e,n):new Is(t,e,n)},parseTrackName:(ps=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),fs=["material","materials","bones"],function(t){var e=ps.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==fs.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n=n){var l=n++,d=e[l];i[d.uuid]=u,e[u]=d,i[h]=l,e[l]=c;for(var p=0,f=o;p!==f;++p){var m=r[p],g=m[l],v=m[u];m[u]=g,m[l]=v}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s].uuid,u=r[h];if(void 0!==u)if(delete r[h],u0)for(var c=this._interpolants,h=this._propertyBindings,u=0,l=c.length;u!==l;++u)c[u].evaluate(a),h[u].accumulate(i,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(i===oe){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=i===se;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=de,i.endingEnd=de):(i.endingStart=t?this.zeroSlopeAtStart?de:le:pe,i.endingEnd=e?this.zeroSlopeAtEnd?de:le:pe)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),Object.assign(Os.prototype,i.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var u=0;u!==r;++u){var l=i[u],d=l.name,p=h[d];if(void 0!==p)o[u]=p;else{if(void 0!==(p=o[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(p=new Ps(Is.create(n,d,f),l.ValueTypeName,l.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),o[u]=p}a[u].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e1)i[c=s[1]]||(i[c]={start:1/0,end:-1/0}),o<(h=i[c]).start&&(h.start=o),o>h.end&&(h.end=o),e||(e=c)}for(var c in i){var h=i[c];this.createAnimation(c,h.start,h.end,t)}this.firstAnimation=e},Ys.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},Ys.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},Ys.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},Ys.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},Ys.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},Ys.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},Ys.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},Ys.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},Ys.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},Ys.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},Ys.prototype.update=function(t){for(var e=0,n=this.animationsList.length;ei.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+Ae.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},Zs.prototype=Object.create(yi.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isImmediateRenderObject=!0,Js.prototype=Object.create(Gr.prototype),Js.prototype.constructor=Js,Js.prototype.update=function(){var t=new He,e=new He,n=new ii;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,h=0,u=0,l=c.length;u.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(bs.set(t.z,0,-t.x).normalize(),xs=Math.acos(t.y),this.quaternion.setFromAxisAngle(bs,xs))}),cc.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},cc.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},hc.prototype=Object.create(Gr.prototype),hc.prototype.constructor=hc;var lc=new He,dc=new uc,pc=new uc,fc=new uc;function mc(t){ka.call(this),this.points=t||[],this.closed=!1}function gc(t,e,n,i){ka.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=i}function vc(t,e,n){ka.call(this),this.v0=t,this.v1=e,this.v2=n}function yc(t,e){ka.call(this),this.v1=t,this.v2=e}function xc(t,e,n,i,r,o){Xa.call(this,t,e,n,n,i,r,o)}mc.prototype=Object.create(ka.prototype),mc.prototype.constructor=mc,mc.prototype.getPoint=function(t){var e=this.points,n=e.length;n<2&&console.log("duh, you need at least 2 points");var i,r,o,a,s=(n-(this.closed?0:1))*t,c=Math.floor(s),h=s-c;if(this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/e.length)+1)*e.length:0===h&&c===n-1&&(c=n-2,h=1),this.closed||c>0?i=e[(c-1)%n]:(lc.subVectors(e[0],e[1]).add(e[0]),i=lc),r=e[c%n],o=e[(c+1)%n],this.closed||c+2