// threejs.org/license (function(r,wb){"object"===typeof exports&&"undefined"!==typeof module?wb(exports):"function"===typeof define&&define.amd?define(["exports"],wb):(r="undefined"!==typeof globalthis?globalthis:r||self,wb(r.three={}))})(this,function(r){function wb(){}function oa(c,a,b,d,e,f,g,h,k,l){object.defineproperty(this,"id",{value:hk++});this.uuid=xa.generateuuid();this.name="";this.image=void 0!==c?c:oa.default_image;this.mipmaps=[];this.mapping=void 0!==a?a:oa.default_mapping;this.wraps=void 0!==b?b:1001;this.wrapt= void 0!==d?d:1001;this.magfilter=void 0!==e?e:1006;this.minfilter=void 0!==f?f:1008;this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:1023;this.internalformat=null;this.type=void 0!==h?h:1009;this.offset=new l(0,0);this.repeat=new l(1,1);this.center=new l(0,0);this.rotation=0;this.matrixautoupdate=!0;this.matrix=new da;this.generatemipmaps=!0;this.premultiplyalpha=!1;this.flipy=!0;this.unpackalignment=4;this.encoding=void 0!==l?l:3e3;this.version=0;this.onupdate=null}function db(c,a,b){this.width= c;this.height=a;this.scissor=new ca(0,0,c,a);this.scissortest=!1;this.viewport=new ca(0,0,c,a);b=b||{};this.texture=new oa(void 0,b.mapping,b.wraps,b.wrapt,b.magfilter,b.minfilter,b.format,b.type,b.anisotropy,b.encoding);this.texture.image={};this.texture.image.width=c;this.texture.image.height=a;this.texture.generatemipmaps=void 0!==b.generatemipmaps?b.generatemipmaps:!1;this.texture.minfilter=void 0!==b.minfilter?b.minfilter:1006;this.depthbuffer=void 0!==b.depthbuffer?b.depthbuffer:!0;this.stencilbuffer= void 0!==b.stencilbuffer?b.stencilbuffer:!1;this.depthtexture=void 0!==b.depthtexture?b.depthtexture:null}function dh(c,a,b){db.call(this,c,a,b);this.samples=4}function eh(c,a,b,d,e){for(var f=0,g=c.length-3;f<=g;f+=3){yc.fromarray(c,f);var h=e.x*math.abs(yc.x)+e.y*math.abs(yc.y)+e.z*math.abs(yc.z),k=a.dot(yc),l=b.dot(yc),m=d.dot(yc);if(math.max(-math.max(k,l,m),math.min(k,l,m))>h)return!1}return!0}function ha(){object.defineproperty(this,"id",{value:ik++});this.uuid=xa.generateuuid();this.name=""; this.type="object3d";this.parent=null;this.children=[];this.up=ha.defaultup.clone();var c=new w,a=new hb,b=new ua,d=new w(1,1,1);a._onchange(function(){b.setfromeuler(a,!1)});b._onchange(function(){a.setfromquaternion(b,void 0,!1)});object.defineproperties(this,{position:{configurable:!0,enumerable:!0,value:c},rotation:{configurable:!0,enumerable:!0,value:a},quaternion:{configurable:!0,enumerable:!0,value:b},scale:{configurable:!0,enumerable:!0,value:d},modelviewmatrix:{value:new da},normalmatrix:{value:new da}}); this.matrix=new da;this.matrixworld=new da;this.matrixautoupdate=ha.defaultmatrixautoupdate;this.matrixworldneedsupdate=!1;this.layers=new $b;this.visible=!0;this.receiveshadow=this.castshadow=!1;this.frustumculled=!0;this.renderorder=0;this.userdata={}}function fh(c,a,b){0>b&&(b+=1);1b?a:b<2/3?c+6*(a-c)*(2/3-b):c}function gh(c){return.04045>c?.0773993808*c:math.pow(.9478672986*c+.0521327014,2.4)}function hh(c){return.0031308>c?12.92*c:1.055*math.pow(c,.41666)- .055}function ra(){object.defineproperty(this,"id",{value:jk++});this.uuid=xa.generateuuid();this.name="";this.type="material";this.fog=!0;this.blending=1;this.side=0;this.vertexcolors=this.flatshading=!1;this.opacity=1;this.transparent=!1;this.blendsrc=204;this.blenddst=205;this.blendequation=100;this.blendequationalpha=this.blenddstalpha=this.blendsrcalpha=null;this.depthfunc=3;this.depthwrite=this.depthtest=!0;this.stencilwritemask=255;this.stencilfunc=519;this.stencilref=0;this.stencilfuncmask= 255;this.stencilzpass=this.stencilzfail=this.stencilfail=7680;this.stencilwrite=!1;this.clippingplanes=null;this.clipshadows=this.clipintersection=!1;this.shadowside=null;this.colorwrite=!0;this.precision=null;this.polygonoffset=!1;this.polygonoffsetunits=this.polygonoffsetfactor=0;this.dithering=!1;this.alphatest=0;this.premultipliedalpha=!1;this.tonemapped=this.visible=!0;this.userdata={};this.version=0}function kb(c){ra.call(this);this.type="meshbasicmaterial";this.color=new s(16777215);this.lightmap= this.map=null;this.lightmapintensity=1;this.aomap=null;this.aomapintensity=1;this.envmap=this.alphamap=this.specularmap=null;this.combine=0;this.reflectivity=1;this.refractionratio=.98;this.wireframe=!1;this.wireframelinewidth=1;this.wireframelinejoin=this.wireframelinecap="round";this.morphtargets=this.skinning=!1;this.setvalues(c)}function pa(c,a,b){if(array.isarray(c))throw new typeerror("three.bufferattribute: array should be a typed array.");this.name="";this.array=c;this.itemsize=a;this.count= void 0!==c?c.length/a:0;this.normalized=!0===b;this.usage=35044;this.updaterange={offset:0,count:-1};this.version=0}function ce(c,a,b){pa.call(this,new int8array(c),a,b)}function de(c,a,b){pa.call(this,new uint8array(c),a,b)}function ee(c,a,b){pa.call(this,new uint8clampedarray(c),a,b)}function fe(c,a,b){pa.call(this,new int16array(c),a,b)}function zc(c,a,b){pa.call(this,new uint16array(c),a,b)}function ge(c,a,b){pa.call(this,new int32array(c),a,b)}function $c(c,a,b){pa.call(this,new uint32array(c), a,b)}function ea(c,a,b){pa.call(this,new float32array(c),a,b)}function he(c,a,b){pa.call(this,new float64array(c),a,b)}function vi(c){if(0===c.length)return-infinity;for(var a=c[0],b=1,d=c.length;ba&&(a=c[b]);return a}function ka(){object.defineproperty(this,"id",{value:kk+=2});this.uuid=xa.generateuuid();this.name="";this.type="buffergeometry";this.index=null;this.attributes={};this.morphattributes={};this.morphtargetsrelative=!1;this.groups=[];this.boundingsphere=this.boundingbox=null; this.drawrange={start:0,count:infinity};this.userdata={}}function qa(c,a){ha.call(this);this.type="mesh";this.geometry=void 0!==c?c:new ka;this.material=void 0!==a?a:new kb;this.updatemorphtargets()}function wi(c,a,b,d,e,f,g,h){if(null===(1===a.side?d.intersecttriangle(g,f,e,!0,h):d.intersecttriangle(e,f,g,2!==a.side,h)))return null;of.copy(h);of.applymatrix4(c.matrixworld);a=b.ray.origin.distanceto(of);return ab.far?null:{distance:a,point:of.clone(),object:c}}function pf(c,a,b,d,e,f,g, h,k,l,m,n){yc.frombufferattribute(e,l);zc.frombufferattribute(e,m);ac.frombufferattribute(e,n);e=c.morphtargetinfluences;if(a.morphtargets&&f&&e){qf.set(0,0,0);rf.set(0,0,0);sf.set(0,0,0);for(var p=0,t=f.length;pq;q++)l.setrendertarget(b,q),l.clear(m,n,p);l.setrendertarget(t)}}}function cc(c,a,b){number.isinteger(a)&&(console.warn("three.webglcuberendertarget: constructor signature is now webglcuberendertarget( size, options )"),a=b);db.call(this,c,c,a);this.texture.iswebglcuberendertargettexture=!0}function bd(c,a,b,d,e,f,g,h,k,l,m,n){oa.call(this,null,f,g,h,k,l,d,e,m,n);this.image={data:c|| null,width:a||1,height:b||1};this.magfilter=void 0!==k?k:1003;this.minfilter=void 0!==l?l:1003;this.flipy=this.generatemipmaps=!1;this.unpackalignment=1;this.needsupdate=!0}function xi(){function c(f,g){d(f,g);e=a.requestanimationframe(c)}var a=null,b=!1,d=null,e=null;return{start:function(){!0!==b&&null!==d&&(e=a.requestanimationframe(c),b=!0)},stop:function(){a.cancelanimationframe(e);b=!1},setanimationloop:function(f){d=f},setcontext:function(f){a=f}}}function mk(c,a){function b(f,g){var h=f.array, k=f.usage,l=c.createbuffer();c.bindbuffer(g,l);c.bufferdata(g,h,k);f.onuploadcallback();g=5126;h instanceof float32array?g=5126:h instanceof float64array?console.warn("three.webglattributes: unsupported data buffer format: float64array."):h instanceof uint16array?g=5123:h instanceof int16array?g=5122:h instanceof uint32array?g=5125:h instanceof int32array?g=5124:h instanceof int8array?g=5120:h instanceof uint8array&&(g=5121);return{buffer:l,type:g,bytesperelement:h.bytes_per_element,version:f.version}} var d=a.iswebgl2,e=new weakmap;return{get:function(f){f.isinterleavedbufferattribute&&(f=f.data);return e.get(f)},remove:function(f){f.isinterleavedbufferattribute&&(f=f.data);var g=e.get(f);g&&(c.deletebuffer(g.buffer),e.delete(f))},update:function(f,g){if(f.isglbufferattribute)g=e.get(f),(!g||g.versione;e++)d[e]=[e,0];return{update:function(f,g,h,k){var l=f.morphtargetinfluences;f=void 0===l?0:l.length;var m=a[g.id];if(void 0===m){m=[];for(var n=0;nl;l++)ll;l++)p=d[l],n=p[0],p=p[1],n!==number.max_safe_integer&&p?(f&&g.getattribute("morphtarget"+l)!==f[n]&&g.setattribute("morphtarget"+l,f[n]),h&&g.getattribute("morphnormal"+l)!==h[n]&&g.setattribute("morphnormal"+l,h[n]),b[l]=p,m+=p):(f&&void 0!==g.getattribute("morphtarget"+l)&&g.deleteattribute("morphtarget"+l),h&&void 0!==g.getattribute("morphnormal"+l)&&g.deleteattribute("morphnormal"+l),b[l]=0);g=g.morphtargetsrelative?1:1-m;k.getuniforms().setvalue(c,"morphtargetbaseinfluence",g); k.getuniforms().setvalue(c,"morphtargetinfluences",b)}}}function ak(c,a,b,d){var e=new weakmap;return{update:function(f){var g=d.render.frame,h=f.geometry,k=a.get(f,h);e.get(k)!==g&&(h.isgeometry&&k.updatefromobject(f),a.update(k),e.set(k,g));f.isinstancedmesh&&(b.update(f.instancematrix,34962),null!==f.instancecolor&&b.update(f.instancecolor,34962));return k},dispose:function(){e=new weakmap}}}function kc(c,a,b,d,e,f,g,h,k,l){c=void 0!==c?c:[];oa.call(this,c,void 0!==a?a:301,b,d,e,f,void 0!==g?g: 1022,h,k,l);this.flipy=!1}function id(c,a,b,d){oa.call(this,null);this.image={data:c||null,width:a||1,height:b||1,depth:d||1};this.minfilter=this.magfilter=1003;this.wrapr=1001;this.flipy=this.generatemipmaps=!1;this.needsupdate=!0}function jd(c,a,b,d){oa.call(this,null);this.image={data:c||null,width:a||1,height:b||1,depth:d||1};this.minfilter=this.magfilter=1003;this.wrapr=1001;this.flipy=this.generatemipmaps=!1;this.needsupdate=!0}function kd(c,a,b){var d=c[0];if(0>=d||0");return c.replace(nh,mh)}function ni(c,a,b,d){console.warn("webglprogram: #pragma unroll_loop shader syntax is deprecated. please use #pragma unroll_loop_start syntax instead.");return oh(c,a,b,d)}function oh(c,a,b,d){c="";for(a=parseint(a);ad;d++)b.probe.push(new w);var e=new w,f=new da,g=new da;return{setup:function(h,k,l){for(var m=k=0,n=0,p=0;9>p;p++)b.probe[p].set(0,0,0);var t=p=0,q=0,v=0,u=0,a=0,b=0,d=0;l=l.matrixworldinverse;h.sort(yl);for(var g=0,i=h.length;gk;k++)b.probe[k].addscaledvector(e.sh.coefficients[k],m);else if(e.isdirectionallight){m=c.get(e);m.color.copy(e.color).multiplyscalar(e.intensity);m.direction.setfrommatrixposition(e.matrixworld);e.setfrommatrixposition(e.target.matrixworld);m.direction.sub(e);m.direction.transformdirection(l);if(e.castshadow){var p=e.shadow;h=a.get(e);h.shadowbias=p.bias;h.shadownormalbias=p.normalbias; h.shadowradius=p.radius;h.shadowmapsize=p.mapsize;b.directionalshadow[p]=h;b.directionalshadowmap[p]=k;b.directionalshadowmatrix[p]=e.shadow.matrix;a++}b.directional[p]=m;p++}else e.isspotlight?(p=c.get(e),p.position.setfrommatrixposition(e.matrixworld),p.position.applymatrix4(l),p.color.copy(h).multiplyscalar(m),p.distance=f,p.direction.setfrommatrixposition(e.matrixworld),e.setfrommatrixposition(e.target.matrixworld),p.direction.sub(e),p.direction.transformdirection(l),p.conecos=math.cos(e.angle), p.penumbracos=math.cos(e.angle*(1-e.penumbra)),p.decay=e.decay,e.castshadow&&(m=e.shadow,h=a.get(e),h.shadowbias=m.bias,h.shadownormalbias=m.normalbias,h.shadowradius=m.radius,h.shadowmapsize=m.mapsize,b.spotshadow[q]=h,b.spotshadowmap[q]=k,b.spotshadowmatrix[q]=e.shadow.matrix,d++),b.spot[q]=p,q++):e.isrectarealight?(k=c.get(e),k.color.copy(h).multiplyscalar(m),k.position.setfrommatrixposition(e.matrixworld),k.position.applymatrix4(l),g.identity(),f.copy(e.matrixworld),f.premultiply(l),g.extractrotation(f), k.halfwidth.set(.5*e.width,0,0),k.halfheight.set(0,.5*e.height,0),k.halfwidth.applymatrix4(g),k.halfheight.applymatrix4(g),b.rectarea[v]=k,v++):e.ispointlight?(m=c.get(e),m.position.setfrommatrixposition(e.matrixworld),m.position.applymatrix4(l),m.color.copy(e.color).multiplyscalar(e.intensity),m.distance=e.distance,m.decay=e.decay,e.castshadow&&(p=e.shadow,h=a.get(e),h.shadowbias=p.bias,h.shadownormalbias=p.normalbias,h.shadowradius=p.radius,h.shadowmapsize=p.mapsize,h.shadowcameranear=p.camera.near, h.shadowcamerafar=p.camera.far,b.pointshadow[t]=h,b.pointshadowmap[t]=k,b.pointshadowmatrix[t]=e.shadow.matrix,b++),b.point[t]=m,t++):e.ishemispherelight&&(k=c.get(e),k.direction.setfrommatrixposition(e.matrixworld),k.direction.transformdirection(l),k.direction.normalize(),k.skycolor.copy(e.color).multiplyscalar(m),k.groundcolor.copy(e.groundcolor).multiplyscalar(m),b.hemi[u]=k,u++)}0\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackrgbatodepth( texture2d( shadow_pass, ( gl_fragcoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += sample_rate) {\n\t\t#ifdef horizonal_pass\n\t\t\tvec2 distribution = unpackrgbato2half( texture2d( shadow_pass, ( gl_fragcoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackrgbatodepth( texture2d( shadow_pass, ( gl_fragcoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * half_sample_rate;\n\tsquared_mean = squared_mean * half_sample_rate;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_fragcolor = pack2halftorgba( vec2( mean, std_dev ) );\n}"}), u=v.clone();u.defines.horizonal_pass=1;var a=new ka;a.setattribute("position",new pa(new float32array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var b=new qa(a,v),d=this;this.enabled=!1;this.autoupdate=!0;this.needsupdate=!1;this.type=1;this.render=function(g,i,e){if(!1!==d.enabled&&(!1!==d.autoupdate||!1!==d.needsupdate)&&0!==g.length){var h=c.getrendertarget(),m=c.getactivecubeface(),f=c.getactivemipmaplevel(),k=c.state;k.setblending(0);k.buffers.color.setclear(1,1,1,1);k.buffers.depth.settest(!0);k.setscissortest(!1); for(var p=0,v=g.length;pb||k.y>b)k.x>b&&(l.x=math.floor(b/aa.x),k.x=l.x*aa.x,w.mapsize.x=l.x),k.y>b&&(l.y=math.floor(b/aa.y),k.y=l.y*aa.y,w.mapsize.y=l.y);null!==w.map||w.ispointlightshadow||3!==this.type||(aa={minfilter:1006,magfilter:1006,format:1023},w.map=new db(k.x, k.y,aa),w.map.texture.name=ia.name+".shadowmap",w.mappass=new db(k.x,k.y,aa),w.camera.updateprojectionmatrix());null===w.map&&(w.map=new db(k.x,k.y,{minfilter:1003,magfilter:1003,format:1023}),w.map.texture.name=ia.name+".shadowmap",w.camera.updateprojectionmatrix());c.setrendertarget(w.map);c.clear();aa=w.getviewportcount();for(var z=0;zq||z.height>q)t=q/math.max(z.width,z.height);if(1>t||!0===c){if("undefined"!==typeof htmlimageelement&&z instanceof htmlimageelement||"undefined"!==typeof htmlcanvaselement&&z instanceof htmlcanvaselement||"undefined"!==typeof imagebitmap&&z instanceof imagebitmap)return q=c?xa.floorpoweroftwo:math.floor,c=q(t*z.width),t=q(t*z.height),void 0===aa&&(aa=h(c,t)),y=y?h(c,t):aa,y.width=c,y.height=t,y.getcontext("2d").drawimage(z,0,0,c,t),console.warn("three.webglrenderer: texture has been resized from ("+ z.width+"x"+z.height+") to ("+c+"x"+t+")."),y;"data"in z&&console.warn("three.webglrenderer: image in datatexture is too big ("+z.width+"x"+z.height+").")}return z}function l(z){return xa.ispoweroftwo(z.width)&&xa.ispoweroftwo(z.height)}function m(z,c){return z.generatemipmaps&&c&&1003!==z.minfilter&&1006!==z.minfilter}function n(z,c,y,q){c.generatemipmap(z);d.get(c).__maxmiplevel=math.log(math.max(y,q))*math.log2e}function p(z,c,y){if(!1===f)return c;if(null!==z){if(void 0!==c[z])return c[z];console.warn("three.webglrenderer: attempt to use non-existing webgl internal format '"+ z+"'")}z=c;6403===c&&(5126===y&&(z=33326),5131===y&&(z=33325),5121===y&&(z=33321));6407===c&&(5126===y&&(z=34837),5131===y&&(z=34843),5121===y&&(z=32849));6408===c&&(5126===y&&(z=34836),5131===y&&(z=34842),5121===y&&(z=32856));33325!==z&&33326!==z&&34842!==z&&34836!==z||a.get("ext_color_buffer_float");return z}function t(z){return 1003===z||1004===z||1005===z?9728:9729}function q(z){z=z.target;z.removeeventlistener("dispose",q);var c=d.get(z);void 0!==c.__webglinit&&(c.deletetexture(c.__webgltexture), d.remove(z));z.isvideotexture&&w.delete(z);g.memory.textures--}function v(z){z=z.target;z.removeeventlistener("dispose",v);var c=d.get(z),y=d.get(z.texture);if(z){void 0!==y.__webgltexture&&c.deletetexture(y.__webgltexture);z.depthtexture&&z.depthtexture.dispose();if(z.iswebglcuberendertarget)for(y=0;6>y;y++)c.deleteframebuffer(c.__webglframebuffer[y]),c.__webgldepthbuffer&&c.deleterenderbuffer(c.__webgldepthbuffer[y]);else c.deleteframebuffer(c.__webglframebuffer),c.__webgldepthbuffer&&c.deleterenderbuffer(c.__webgldepthbuffer), c.__webglmultisampledframebuffer&&c.deleteframebuffer(c.__webglmultisampledframebuffer),c.__webglcolorrenderbuffer&&c.deleterenderbuffer(c.__webglcolorrenderbuffer),c.__webgldepthrenderbuffer&&c.deleterenderbuffer(c.__webgldepthrenderbuffer);d.remove(z.texture);d.remove(z)}g.memory.textures--}function u(z,c){var y=d.get(z);if(z.isvideotexture){var q=g.render.frame;w.get(z)!==q&&(w.set(z,q),z.update())}if(0ba;ba++)c[ba]=q||t?t?z.image[ba].image:z.image[ba]:k(z.image[ba],!1,!0,p);ba=c[0];var x=l(ba)||f,ta=f.convert(z.format),va=f.convert(z.type),ya=p(z.internalformat,ta,va);d(34067,z,x);if(q){for(t=0;6>t;t++){var pa=c[t].mipmaps;for(q=0;qq;q++)if(t)for(b.teximage2d(34069+q,0,ya,c[q].width,c[q].height,0,ta,va,c[q].data),u=0;u=k&&console.warn("three.webgltextures: trying to use "+z+" texture units while this gpu supports only "+k);ja+=1;return z};this.resettextureunits=function(){ja=0};this.settexture2d=u;this.settexture2darray=function(z,c){var y=d.get(z);0t;t++)c.__webglframebuffer[t]=c.createframebuffer();else if(c.__webglframebuffer=c.createframebuffer(),t)if(f){c.__webglmultisampledframebuffer=c.createframebuffer();c.__webglcolorrenderbuffer=c.createrenderbuffer();c.bindrenderbuffer(36161,c.__webglcolorrenderbuffer);t=f.convert(z.texture.format);var x=f.convert(z.texture.type);t=p(z.texture.internalformat, t,x);x=m(z);c.renderbufferstoragemultisample(36161,x,t,z.width,z.height);c.bindframebuffer(36160,c.__webglmultisampledframebuffer);c.framebufferrenderbuffer(36160,36064,36161,c.__webglcolorrenderbuffer);c.bindrenderbuffer(36161,null);z.depthbuffer&&(c.__webgldepthrenderbuffer=c.createrenderbuffer(),h(c.__webgldepthrenderbuffer,z,!0));c.bindframebuffer(36160,null)}else console.warn("three.webglrenderer: webglmultisamplerendertarget can only be used with webgl2.");if(q){b.bindtexture(34067,y.__webgltexture); d(34067,z.texture,ba);for(y=0;6>y;y++)e(c.__webglframebuffer[y],z,36064,34069+y);m(z.texture,ba)&&n(34067,z.texture,z.width,z.height);b.bindtexture(34067,null)}else b.bindtexture(3553,y.__webgltexture),d(3553,z.texture,ba),e(c.__webglframebuffer,z,36064,3553),m(z.texture,ba)&&n(3553,z.texture,z.width,z.height),b.bindtexture(3553,null);if(z.depthbuffer){c=d.get(z);ba=!0===z.iswebglcuberendertarget;if(z.depthtexture){if(ba)throw error("target.depthtexture not supported in cube render targets");if(z&& z.iswebglcuberendertarget)throw error("depth texture with cube render targets is not supported");c.bindframebuffer(36160,c.__webglframebuffer);if(!z.depthtexture||!z.depthtexture.isdepthtexture)throw error("rendertarget.depthtexture must be an instance of three.depthtexture");d.get(z.depthtexture).__webgltexture&&z.depthtexture.image.width===z.width&&z.depthtexture.image.height===z.height||(z.depthtexture.image.width=z.width,z.depthtexture.image.height=z.height,z.depthtexture.needsupdate=!0);u(z.depthtexture, 0);c=d.get(z.depthtexture).__webgltexture;if(1026===z.depthtexture.format)c.framebuffertexture2d(36160,36096,3553,c,0);else if(1027===z.depthtexture.format)c.framebuffertexture2d(36160,33306,3553,c,0);else throw error("unknown depthtexture format");}else if(ba)for(c.__webgldepthbuffer=[],ba=0;6>ba;ba++)c.bindframebuffer(36160,c.__webglframebuffer[ba]),c.__webgldepthbuffer[ba]=c.createrenderbuffer(),h(c.__webgldepthbuffer[ba],z,!1);else c.bindframebuffer(36160,c.__webglframebuffer),c.__webgldepthbuffer= c.createrenderbuffer(),h(c.__webgldepthbuffer,z,!1);c.bindframebuffer(36160,null)}};this.updaterendertargetmipmap=function(z){var c=z.texture,y=l(z)||f;if(m(c,y)){y=z.iswebglcuberendertarget?34067:3553;var q=d.get(c).__webgltexture;b.bindtexture(y,q);n(y,c,z.width,z.height);b.bindtexture(y,null)}};this.updatemultisamplerendertarget=function(z){if(z.iswebglmultisamplerendertarget)if(f){var c=d.get(z);c.bindframebuffer(36008,c.__webglmultisampledframebuffer);c.bindframebuffer(36009,c.__webglframebuffer); var y=z.width,q=z.height,t=16384;z.depthbuffer&&(t|=256);z.stencilbuffer&&(t|=1024);c.blitframebuffer(0,0,y,q,0,0,y,q,t,9728);c.bindframebuffer(36160,c.__webglmultisampledframebuffer)}else console.warn("three.webglrenderer: webglmultisamplerendertarget can only be used with webgl2.")};this.safesettexture2d=function(z,c){z&&z.iswebglrendertarget&&(!1===bb&&(console.warn("three.webgltextures.safesettexture2d: don't use render targets as textures. use their .texture property instead."),bb=!0),z=z.texture); u(z,c)};this.safesettexturecube=function(z,c){z&&z.iswebglcuberendertarget&&(!1===fb&&(console.warn("three.webgltextures.safesettexturecube: don't use cube render targets as textures. use their .texture property instead."),fb=!0),z=z.texture);z&&z.iscubetexture||array.isarray(z.image)&&6===z.image.length?a(z,c):b(z,c)}}function vi(c,a,b){var d=b.iswebgl2;return{convert:function(e){if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120; if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e){if(d)return 5131;var f=a.get("oes_texture_half_float");return null!==f?f.half_float_oes:null}if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032=== e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e)if(f=a.get("webgl_compressed_texture_s3tc"),null!==f){if(33776===e)return f.compressed_rgb_s3tc_dxt1_ext;if(33777===e)return f.compressed_rgba_s3tc_dxt1_ext;if(33778===e)return f.compressed_rgba_s3tc_dxt3_ext;if(33779===e)return f.compressed_rgba_s3tc_dxt5_ext}else return null;if(35840===e||35841===e||35842===e||35843===e)if(f=a.get("webgl_compressed_texture_pvrtc"),null!==f){if(35840===e)return f.compressed_rgb_pvrtc_4bppv1_img; if(35841===e)return f.compressed_rgb_pvrtc_2bppv1_img;if(35842===e)return f.compressed_rgba_pvrtc_4bppv1_img;if(35843===e)return f.compressed_rgba_pvrtc_2bppv1_img}else return null;if(36196===e)return f=a.get("webgl_compressed_texture_etc1"),null!==f?f.compressed_rgb_etc1_webgl:null;if(37492===e||37496===e)if(f=a.get("webgl_compressed_texture_etc"),null!==f){if(37492===e)return f.compressed_rgb8_etc2;if(37496===e)return f.compressed_rgba8_etc2_eac}if(37808===e||37809===e||37810===e||37811===e||37812=== e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e)return f=a.get("webgl_compressed_texture_astc"),null!==f?e:null;if(36492===e)return f=a.get("ext_texture_compression_bptc"),null!==f?e:null;if(1020===e){if(d)return 34042;f=a.get("webgl_depth_texture");return null!==f?f.unsigned_int_24_8_webgl:null}}}} function tf(c){eb.call(this);this.cameras=c||[]}function gc(){ha.call(this);this.type="group"}function me(){this._hand=this._grip=this._targetray=null}function wi(c,a){function b(f){var k=q.get(f.inputsource);k&&k.dispatchevent({type:f.type})}function d(){q.foreach(function(f,k){f.disconnect(k)});q.clear();c.setframebuffer(null);c.setrendertarget(c.getrendertarget());m.stop();h.ispresenting=!1;h.dispatchevent({type:"sessionend"})}function e(f){m=f;m.setcontext(k);m.start();h.ispresenting=!0;h.dispatchevent({type:"sessionstart"})} function f(f){for(var k=k.inputsources,p=0;py.matrixworld.determinant();x=p(x,n,o,y); ca.setmaterial(o,na);na=j.index;n=j.attributes.position;if(null===na){if(void 0===n||0===n.count)return}else if(0===na.count)return;var ha=1;!0===o.wireframe&&(na=ph.getwireframeattribute(j),ha=2);(o.morphtargets||o.morphnormals)&&xi.update(y,j,o,x);fb.setup(y,o,x,j,na);x=yi;if(null!==na){var fa=oe.get(na);x=zi;x.setindex(fa)}var ib=j.drawrange.start*ha,ia=null!==ma?ma.start*ha:0;fa=math.max(ib,ia);ma=math.max(0,math.min(null!==na?na.count:n.count,ib+j.drawrange.count*ha,ia+(null!==ma?ma.count*ha: infinity))-1-fa+1);0!==ma&&(y.ismesh?!0===o.wireframe?(ca.setlinewidth(o.wireframelinewidth*(null===w?y:1)),x.setmode(1)):x.setmode(4):y.isline?(o=o.linewidth,void 0===o&&(o=1),ca.setlinewidth(o*(null===w?y:1)),y.islinesegments?x.setmode(1):y.islineloop?x.setmode(2):x.setmode(3)):y.ispoints?x.setmode(0):y.issprite&&x.setmode(4),y.isinstancedmesh?x.renderinstances(fa,ma,y.count):j.isinstancedbuffergeometry?x.renderinstances(fa,ma,math.min(j.instancecount,j._maxinstancecount)):x.render(fa,ma))};this.compile= function(x,n){m=md.get(x,n);m.init();x.traverse(function(o){o.islight&&(m.pushlight(o),o.castshadow&&m.pushshadow(o))});m.setuplights(n);var j=new weakmap;x.traverse(function(o){var y=o.material;if(y)if(array.isarray(y))for(var ma=0;mae.far||f.push({distance:c,distancetoray:math.sqrt(h),point:b,index:a,face:null,object:g}))}function xh(c,a,b,d, e,f,g,h,k){function l(){m.needsupdate=!0;c.requestvideoframecallback(l)}oa.call(this,c,a,b,d,e,f,g,h,k);this.format=void 0!==g?g:1022;this.minfilter=void 0!==f?f:1006;this.magfilter=void 0!==e?e:1006;this.generatemipmaps=!1;var m=this;"requestvideoframecallback"in c&&c.requestvideoframecallback(l)}function qd(c,a,b,d,e,f,g,h,k,l,m,n){oa.call(this,null,f,g,h,k,l,d,e,m,n);this.image={width:a,height:b};this.mipmaps=c;this.generatemipmaps=this.flipy=!1}function te(c,a,b,d,e,f,g,h,k){oa.call(this,c,a, b,d,e,f,g,h,k);this.needsupdate=!0}function ue(c,a,b,d,e,f,g,h,k,l){l=void 0!==l?l:1026;if(1026!==l&&1027!==l)throw error("depthtexture format must be either three.depthformat or three.depthstencilformat");void 0===b&&1026===l&&(b=1012);void 0===b&&1027===l&&(b=1020);oa.call(this,null,d,e,f,g,h,l,b,k);this.image={width:c,height:a};this.magfilter=void 0!==g?g:1003;this.minfilter=void 0!==h?h:1003;this.generatemipmaps=this.flipy=!1}function rd(c){ka.call(this);this.type="wireframegeometry";var a=[], b=[0,0],d={},e=["a","b","c"];if(c&&c.isgeometry){for(var f=c.faces,g=0,h=f.length;gl;l++){var m=k[e[l]],n=k[e[(l+1)%3]];b[0]=math.min(m,n);b[1]=math.max(m,n);m=b[0]+","+b[1];void 0===d[m]&&(d[m]={index1:b[0],index2:b[1]})}for(var p in d)b=d[p],f=c.vertices[b.index1],a.push(f.x,f.y,f.z),f=c.vertices[b.index2],a.push(f.x,f.y,f.z)}else if(c&&c.isbuffergeometry)if(p=new w,null!==c.index){e=c.attributes.position;g=c.index;c=c.groups;0===c.length&&(c=[{start:0,count:g.count, materialindex:0}]);h=0;for(k=c.length;hn;n++){var t=g.getx(l+n),q=g.getx(l+(n+1)%3);b[0]=math.min(t,q);b[1]=math.max(t,q);t=b[0]+","+b[1];void 0===d[t]&&(d[t]={index1:b[0],index2:b[1]})}for(f in d)b=d[f],p.frombufferattribute(e,b.index1),a.push(p.x,p.y,p.z),p.frombufferattribute(e,b.index2),a.push(p.x,p.y,p.z)}else for(d=c.attributes.position,b=0,f=d.count/3;bc;c++)p.frombufferattribute(d,3*b+c),a.push(p.x,p.y,p.z),p.frombufferattribute(d, 3*b+(c+1)%3),a.push(p.x,p.y,p.z);this.setattribute("position",new ea(a,3))}function ve(c,a,b){sa.call(this);this.type="parametricgeometry";this.parameters={func:c,slices:a,stacks:b};this.frombuffergeometry(new sd(c,a,b));this.mergevertices()}function sd(c,a,b){ka.call(this);this.type="parametricbuffergeometry";this.parameters={func:c,slices:a,stacks:b};var d=[],e=[],f=[],g=[],h=new w,k=new w,l=new w,m=new w,n=new w;3>c.length&&console.error("three.parametricgeometry: function must now modify a vector3 as third parameter."); for(var p=a+1,t=0;t<=b;t++)for(var q=t/b,v=0;v<=a;v++){var u=v/a;c(u,q,k);e.push(k.x,k.y,k.z);0<=u-1e-5?(c(u-1e-5,q,l),m.subvectors(k,l)):(c(u+1e-5,q,l),m.subvectors(l,k));0<=q-1e-5?(c(u,q-1e-5,l),n.subvectors(k,l)):(c(u,q+1e-5,l),n.subvectors(l,k));h.crossvectors(m,n).normalize();f.push(h.x,h.y,h.z);g.push(u,q)}for(c=0;cp&&1===l.x&&(k[m]=l.x-1);0===n.x&&0===n.z&&(k[m]=p/2/math.pi+.5)}ka.call(this);this.type="polyhedronbuffergeometry";this.parameters={vertices:c,indices:a, radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(l){for(var m=new w,n=new w,p=new w,t=0;tt&&(.2>m&&(k[l+0]+=1),.2>n&&(k[l+2]+=1),.2>p&&(k[l+4]+=1))})();this.setattribute("position",new ea(h,3));this.setattribute("normal",new ea(h.slice(),3));this.setattribute("uv",new ea(k,2));0===d?this.computevertexnormals():this.normalizenormals()}function xe(c, a){sa.call(this);this.type="tetrahedrongeometry";this.parameters={radius:c,detail:a};this.frombuffergeometry(new td(c,a));this.mergevertices()}function td(c,a){zb.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],c,a);this.type="tetrahedronbuffergeometry";this.parameters={radius:c,detail:a}}function ye(c,a){sa.call(this);this.type="octahedrongeometry";this.parameters={radius:c,detail:a};this.frombuffergeometry(new fd(c,a));this.mergevertices()}function fd(c,a){zb.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],c,a);this.type="octahedronbuffergeometry";this.parameters={radius:c,detail:a}}function ze(c,a){sa.call(this);this.type="icosahedrongeometry";this.parameters={radius:c,detail:a};this.frombuffergeometry(new ud(c,a));this.mergevertices()}function ud(c,a){var b=(1+math.sqrt(5))/2;zb.call(this,[-1,b,0,1,b,0,-1,-b,0,1,-b,0,0,-1,b,0,1,b,0,-1,-b,0,1,-b,b,0,-1,b,0,1,-b,0,-1,-b,0,1],[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],c,a);this.type="icosahedronbuffergeometry";this.parameters={radius:c,detail:a}}function $e(c,a){sa.call(this);this.type="dodecahedrongeometry";this.parameters={radius:c,detail:a};this.frombuffergeometry(new vd(c,a));this.mergevertices()}function vd(c,a){var b=(1+math.sqrt(5))/2,d=1/b;zb.call(this,[-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,-d,-b,0,-d,b,0,d,-b,0,d,b,-d,-b,0,-d,b,0,d,-b,0, d,b,0,-b,0,-d,b,0,-d,-b,0,d,b,0,d],[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],c,a);this.type="dodecahedronbuffergeometry";this.parameters={radius:c,detail:a}}function af(c,a,b,d,e,f){sa.call(this);this.type="tubegeometry";this.parameters={path:c,tubularsegments:a,radius:b,radialsegments:d, closed:e};void 0!==f&&console.warn("three.tubegeometry: taper has been removed.");c=new gd(c,a,b,d,e);this.tangents=c.tangents;this.normals=c.normals;this.binormals=c.binormals;this.frombuffergeometry(c);this.mergevertices()}function gd(c,a,b,d,e){function f(v){m=c.getpointat(v/a,m);var u=g.normals[v];v=g.binormals[v];for(var a=0;a<=d;a++){var b=a/d*math.pi*2,d=math.sin(b);b=-math.cos(b);k.x=b*u.x+d*v.x;k.y=b*u.y+d*v.y;k.z=b*u.z+d*v.z;k.normalize();p.push(k.x,k.y,k.z);h.x=m.x+b*k.x;h.y=m.y+b*k.y; h.z=m.z+b*k.z;n.push(h.x,h.y,h.z)}}ka.call(this);this.type="tubebuffergeometry";this.parameters={path:c,tubularsegments:a,radius:b,radialsegments:d,closed:e};a=a||64;b=b||1;d=d||8;e=e||!1;var g=c.computefrenetframes(a,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new w,k=new w,l=new l,m=new w,n=[],p=[],t=[],q=[];(function(){for(var v=0;v=a;e-=d)f=cj(e,c[e],c[e+1],f);f&&ag(f,f.next)&&(df(f),f=f.next);return f}function mc(c,a){if(!c)return c;a||(a=c);do{var b=!1;if(c.steiner||!ag(c,c.next)&&0!==ab(c.prev,c,c.next))c=c.next;else{df(c);c=a= c.prev;if(c===c.next)break;b=!0}}while(b||c!==a);return a}function ef(c,a,b,d,e,f,g){if(c){if(!g&&f){var h=c,k=h;do null===k.z&&(k.z=yh(k.x,k.y,d,e,f)),k.prevz=k.prev,k=k.nextz=k.next;while(k!==h);k.prevz.nextz=null;k.prevz=null;h=k;var l,m,n,p,t=1;do{k=h;var q=h=null;for(m=0;k;){m++;var v=k;for(l=n=0;lt!==q.next.y>t&&q.next.y!==q.y&&n<(q.next.x-q.x)*(t-q.y)/(q.next.y-q.y)+q.x&&(m=!m),q=q.next;while(q!==k);q=m}q=q&&(ab(k.prev,k, v.prev)||ab(k,v.prev,v))||ag(k,v)&&0c.x?e.x>f.x?e.x:f.x:c.x>f.x?c.x:f.x,h=e.y>c.y?e.y>f.y?e.y:f.y:c.y>f.y?c.y:f.y,k=yh(e.x=k&&d&&d.z<=a;){if(b!==c.prev&&b!==c.next&&yd(e.x,e.y,c.x,c.y,f.x,f.y,b.x,b.y)&&0<=ab(b.prev,b,b.next))return!1;b=b.prevz;if(d!==c.prev&&d!==c.next&&yd(e.x,e.y,c.x,c.y,f.x,f.y,d.x,d.y)&&0<=ab(d.prev,d,d.next))return!1;d=d.nextz}for(;b&&b.z>=k;){if(b!==c.prev&&b!==c.next&&yd(e.x,e.y,c.x,c.y,f.x,f.y,b.x,b.y)&&0<=ab(b.prev,b,b.next))return!1;b=b.prevz}for(;d&&d.z<=a;){if(d!==c.prev&&d!==c.next&&yd(e.x,e.y,c.x,c.y,f.x,f.y,d.x,d.y)&&0<=ab(d.prev,d,d.next))return!1;d=d.nextz}return!0}function gl(c, a){return c.x-a.x}function hl(c,a){var b=a,d=c.x,e=c.y,f=-infinity;do{if(e<=b.y&&e>=b.next.y&&b.next.y!==b.y){var g=b.x+(e-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(g<=d&&g>f){f=g;if(g===d){if(e===b.y)return b;if(e===b.next.y)return b.next}var h=b.x=b.x&&b.x>=g&&d!==b.x&&yd(eh.x)&&(n=b.x===h.x)){n=h;var p=b;n=0>ab(n.prev,n,p.prev)&&0>ab(p.next,n,n.next)}n&&(h=b,l=m)}b=b.next}while(b!==a);return h}function yh(c,a,b,d,e){c=32767*(c-b)*e;a=32767*(a-d)*e;c=(c|c<<8)&16711935;c=(c|c<<4)&252645135;c=(c|c<<2)&858993459;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;return(c|c<<1)&1431655765|((a|a<<1)&1431655765)<<1}function il(c){var a=c,b=c;do{if(a.x=math.min(c.x,b.x)&&a.y<=math.max(c.y,b.y)&&a.y>=math.min(c.y,b.y)}function bg(c){return 0< c?1:0>c?-1:0}function ff(c,a){return 0>ab(c.prev,c,c.next)?0<=ab(c,a,c.next)&&0<=ab(c,c.prev,a):0>ab(c,a,c.prev)||0>ab(c,c.next,a)}function ej(c,a){var b=new zh(c.i,c.x,c.y),d=new zh(a.i,a.x,a.y),e=c.next,f=a.prev;c.next=a;a.prev=c;b.next=e;e.prev=b;d.next=b;b.prev=d;f.next=d;d.prev=f;return d}function cj(c,a,b,d){c=new zh(c,a,b);d?(c.next=d.next,c.prev=d,d.next.prev=c,d.next=c):(c.prev=c,c.next=c);return c}function df(c){c.next.prev=c.prev;c.prev.next=c.next;c.prevz&&(c.prevz.nextz=c.nextz);c.nextz&& (c.nextz.prevz=c.prevz)}function zh(c,a,b){this.i=c;this.x=a;this.y=b;this.nextz=this.prevz=this.z=this.next=this.prev=null;this.steiner=!1}function fj(c){var a=c.length;2number.epsilon){var ra=math.sqrt(ka),kb=math.sqrt(ea*ea+ca*ca);ka=la.x-qa/ra;la=la.y+r/ra;ca=((wa.x-ca/kb-ka)*ca-(wa.y+ea/kb-la)*ea)/(r*ca-qa*ea);ea=ka+r*ca-u.x;r=la+qa*ca-u.y;qa=ea*ea+r*r;if(2>=qa)return new l(ea,r);qa=math.sqrt(qa/2)}else u=!1,r>number.epsilon?ea>number.epsilon&&(u=!0):r<-number.epsilon?ea<-number.epsilon&&(u=!0):math.sign(qa)=== math.sign(ca)&&(u=!0),u?(ea=-qa,qa=math.sqrt(ka)):(ea=r,r=qa,qa=math.sqrt(ka/2));return new l(ea/qa,r/qa)}function n(u,la){for(var wa=u.length;0<=--wa;){var r=wa,qa=wa-1;0>qa&&(qa=u.length-1);for(var ea=0,ca=b+2*m;eam;m++){var n=l[f[m]];var p=l[f[(m+1)%3]];d[0]=math.min(n,p);d[1]=math.max(n,p);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=a)f=c[d.index1], b.push(f.x,f.y,f.z),f=c[d.index2],b.push(f.x,f.y,f.z);this.setattribute("position",new ea(b,3))}function ld(c,a,b,d,e,f,g,h){sa.call(this);this.type="cylindergeometry";this.parameters={radiustop:c,radiusbottom:a,height:b,radialsegments:d,heightsegments:e,openended:f,thetastart:g,thetalength:h};this.frombuffergeometry(new oc(c,a,b,d,e,f,g,h));this.mergevertices()}function oc(c,a,b,d,e,f,g,h){function k(b){for(var d=q,g=new l,i=new w,e=0,h=!0===b?c:a,m=!0===b?1:-1,f=1;f<=d;f++)n.push(0,u*m,0),p.push(0, m,0),t.push(.5,.5),q++;f=q;for(var k=0;k<=d;k++){var p=k/d*h+g,v=math.cos(p);p=math.sin(p);i.x=h*p;i.y=u*m;i.z=h*v;n.push(i.x,i.y,i.z);p.push(0,m,0);g.x=.5*v+.5;g.y=.5*p*m+.5;t.push(g.x,g.y);q++}for(g=0;gthis.duration&&this.resetduration()}function kl(c){switch(c.tolowercase()){case "scalar":case "double":case "float":case "number":case "integer":return de;case "vector":case "vector2":case "vector3":case "vector4":return ee;case "color":return gg;case "quaternion":return pf;case "bool":case "boolean":return fg;case "string":return ig}throw error("three.keyframetrack: unsupported typename: "+c);}function ll(c){if(void 0=== c.type)throw error("three.keyframetrack: track type undefined, can not parse");var a=kl(c.type);if(void 0===c.times){var b=[],d=[];va.flattenjson(c.keys,b,d,"value");c.times=b;c.values=d}return void 0!==a.parse?a.parse(c):new a(c.name,c.times,c.values,c.interpolation)}function ah(c,a,b){var d=this,e=!1,f=0,g=0,h=void 0,k=[];this.onstart=void 0;this.onload=c;this.onprogress=a;this.onerror=b;this.itemstart=function(l){g++;if(!1===e&&void 0!==d.onstart)d.onstart(l,f,g);e=!0};this.itemend=function(l){f++; if(void 0!==d.onprogress)d.onprogress(l,f,g);if(f===g&&(e=!1,void 0!==d.onload))d.onload()};this.itemerror=function(l){if(void 0!==d.onerror)d.onerror(l)};this.resolveurl=function(l){return h?h(l):l};this.seturlmodifier=function(l){h=l;return this};this.addhandler=function(l,m){k.push(l,m);return this};this.removehandler=function(l){l=k.indexof(l);-1!==l&&k.splice(l,2);return this};this.gethandler=function(l){for(var m=0,n=k.length;mb;b++,d++){var e=b/32*math.pi*2,f=d/32*math.pi*2;a.push(math.cos(e),math.sin(e),1,math.cos(f),math.sin(f),1)}c.setattribute("position",new ea(a,3));a=new ya({fog:!1, tonemapped:!1});this.cone=new za(c,a);this.add(this.cone);this.update()}function ke(c){for(var a=pj(c),b=new ka,d=[],e=[],f=new s(0,0,1),g=new s(0,1,0),h=0;h\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_fragcolor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputdirection = normalize( voutputdirection );\n\t\t\t\tvec2 uv = equirectuv( outputdirection );\n\n\t\t\t\tvec2 f = fract( uv / texelsize - 0.5 );\n\t\t\t\tuv -= f * texelsize;\n\t\t\t\tvec3 tl = envmaptexeltolinear( texture2d ( envmap, uv ) ).rgb;\n\t\t\t\tuv.x += texelsize.x;\n\t\t\t\tvec3 tr = envmaptexeltolinear( texture2d ( envmap, uv ) ).rgb;\n\t\t\t\tuv.y += texelsize.y;\n\t\t\t\tvec3 br = envmaptexeltolinear( texture2d ( envmap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelsize.x;\n\t\t\t\tvec3 bl = envmaptexeltolinear( texture2d ( envmap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_fragcolor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_fragcolor = lineartooutputtexel( gl_fragcolor );\n\n\t\t\t}\n\t\t", blending:0,depthtest:!1,depthwrite:!1})}function sj(){return new pc({name:"cubemaptocubeuv",uniforms:{envmap:{value:null},inputencoding:{value:hc[3e3]},outputencoding:{value:hc[3e3]}},vertexshader:vh(),fragmentshader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 voutputdirection;\n\n\t\t\tuniform samplercube envmap;\n\n\t\t\t"+wh()+"\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_fragcolor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_fragcolor.rgb = envmaptexeltolinear( texturecube( envmap, vec3( - voutputdirection.x, voutputdirection.yz ) ) ).rgb;\n\t\t\t\tgl_fragcolor = lineartooutputtexel( gl_fragcolor );\n\n\t\t\t}\n\t\t", blending:0,depthtest:!1,depthwrite:!1})}function vh(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceindex;\n\n\t\tvarying vec3 voutputdirection;\n\n\t\t// rh coordinate system; pmrem face-indexing convention\n\t\tvec3 getdirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvoutputdirection = getdirection( uv, faceindex );\n\t\t\tgl_position = vec4( position, 1.0 );\n\n\t\t}\n\t"} function wh(){return"\n\n\t\tuniform int inputencoding;\n\t\tuniform int outputencoding;\n\n\t\t#include \n\n\t\tvec4 inputtexeltolinear( vec4 value ) {\n\n\t\t\tif ( inputencoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputencoding == 1 ) {\n\n\t\t\t\treturn srgbtolinear( value );\n\n\t\t\t} else if ( inputencoding == 2 ) {\n\n\t\t\t\treturn rgbetolinear( value );\n\n\t\t\t} else if ( inputencoding == 3 ) {\n\n\t\t\t\treturn rgbmtolinear( value, 7.0 );\n\n\t\t\t} else if ( inputencoding == 4 ) {\n\n\t\t\t\treturn rgbmtolinear( value, 16.0 );\n\n\t\t\t} else if ( inputencoding == 5 ) {\n\n\t\t\t\treturn rgbdtolinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn gammatolinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 lineartooutputtexel( vec4 value ) {\n\n\t\t\tif ( outputencoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputencoding == 1 ) {\n\n\t\t\t\treturn lineartosrgb( value );\n\n\t\t\t} else if ( outputencoding == 2 ) {\n\n\t\t\t\treturn lineartorgbe( value );\n\n\t\t\t} else if ( outputencoding == 3 ) {\n\n\t\t\t\treturn lineartorgbm( value, 7.0 );\n\n\t\t\t} else if ( outputencoding == 4 ) {\n\n\t\t\t\treturn lineartorgbm( value, 16.0 );\n\n\t\t\t} else if ( outputencoding == 5 ) {\n\n\t\t\t\treturn lineartorgbd( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn lineartogamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envmaptexeltolinear( vec4 color ) {\n\n\t\t\treturn inputtexeltolinear( color );\n\n\t\t}\n\t"} function tj(c){console.warn("three.closedsplinecurve3 has been deprecated. use three.catmullromcurve3 instead.");ob.call(this,c);this.type="catmullrom";this.closed=!0}function uj(c){console.warn("three.splinecurve3 has been deprecated. use three.catmullromcurve3 instead.");ob.call(this,c);this.type="catmullrom"}function xh(c){console.warn("three.spline has been removed. use three.catmullromcurve3 instead.");ob.call(this,c);this.type="catmullrom"}void 0===number.epsilon&&(number.epsilon=math.pow(2, -52));void 0===number.isinteger&&(number.isinteger=function(c){return"number"===typeof c&&isfinite(c)&&math.floor(c)===c});void 0===math.sign&&(math.sign=function(c){return 0>c?-1:0zf;zf++)mb[zf]=(16>zf?"0":"")+zf.tostring(16);var bg=1234567,xa={deg2rad:math.pi/180,rad2deg:180/math.pi,generateuuid:function(){var c=4294967295*math.random()|0,a=4294967295*math.random()|0,b= 4294967295*math.random()|0,d=4294967295*math.random()|0;return(mb[c&255]+mb[c>>8&255]+mb[c>>16&255]+mb[c>>24&255]+"-"+mb[a&255]+mb[a>>8&255]+"-"+mb[a>>16&15|64]+mb[a>>24&255]+"-"+mb[b&63|128]+mb[b>>8&255]+"-"+mb[b>>16&255]+mb[b>>24&255]+mb[d&255]+mb[d>>8&255]+mb[d>>16&255]+mb[d>>24&255]).touppercase()},clamp:function(c,a,b){return math.max(a,math.min(b,c))},euclideanmodulo:function(c,a){return(c%a+a)%a},maplinear:function(c,a,b,d,e){return d+(c-a)*(e-d)/(b-a)},lerp:function(c,a,b){return(1-b)*c+b* a},smoothstep:function(c,a,b){if(c<=a)return 0;if(c>=b)return 1;c=(c-a)/(b-a);return c*c*(3-2*c)},smootherstep:function(c,a,b){if(c<=a)return 0;if(c>=b)return 1;c=(c-a)/(b-a);return c*c*c*(c*(6*c-15)+10)},randint:function(c,a){return c+math.floor(math.random()*(a-c+1))},randfloat:function(c,a){return c+math.random()*(a-c)},randfloatspread:function(c){return c*(.5-math.random())},seededrandom:function(c){void 0!==c&&(bg=c%2147483647);bg=16807*bg%2147483647;return(bg-1)/2147483646},degtorad:function(c){return c* xa.deg2rad},radtodeg:function(c){return c*xa.rad2deg},ispoweroftwo:function(c){return 0===(c&c-1)&&0!==c},ceilpoweroftwo:function(c){return math.pow(2,math.ceil(math.log(c)/math.ln2))},floorpoweroftwo:function(c){return math.pow(2,math.floor(math.log(c)/math.ln2))},setquaternionfrompropereuler:function(c,a,b,d,e){var f=math.cos,g=math.sin,h=f(b/2);b=g(b/2);var k=f((a+d)/2),l=g((a+d)/2),m=f((a-d)/2),n=g((a-d)/2);f=f((d-a)/2);a=g((d-a)/2);switch(e){case "xyx":c.set(h*l,b*m,b*n,h*k);break;case "yzy":c.set(b* n,h*l,b*m,h*k);break;case "zxz":c.set(b*m,b*n,h*l,h*k);break;case "xzx":c.set(h*l,b*a,b*f,h*k);break;case "yxy":c.set(b*f,h*l,b*a,h*k);break;case "zyz":c.set(b*a,b*f,h*l,h*k);break;default:console.warn("three.mathutils: .setquaternionfrompropereuler() encountered an unknown order: "+e)}}},l=function(c,a){void 0===c&&(c=0);void 0===a&&(a=0);object.defineproperty(this,"isvector2",{value:!0});this.x=c;this.y=a},af={width:{configurable:!0},height:{configurable:!0}};af.width.get=function(){return this.x}; af.width.set=function(c){this.x=c};af.height.get=function(){return this.y};af.height.set=function(c){this.y=c};l.prototype.set=function(c,a){this.x=c;this.y=a;return this};l.prototype.setscalar=function(c){this.y=this.x=c;return this};l.prototype.setx=function(c){this.x=c;return this};l.prototype.sety=function(c){this.y=c;return this};l.prototype.setcomponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;default:throw error("index is out of range: "+c);}return this};l.prototype.getcomponent= function(c){switch(c){case 0:return this.x;case 1:return this.y;default:throw error("index is out of range: "+c);}};l.prototype.clone=function(){return new this.constructor(this.x,this.y)};l.prototype.copy=function(c){this.x=c.x;this.y=c.y;return this};l.prototype.add=function(c,a){if(void 0!==a)return console.warn("three.vector2: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(c,a);this.x+=c.x;this.y+=c.y;return this};l.prototype.addscalar=function(c){this.x+= c;this.y+=c;return this};l.prototype.addvectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;return this};l.prototype.addscaledvector=function(c,a){this.x+=c.x*a;this.y+=c.y*a;return this};l.prototype.sub=function(c,a){if(void 0!==a)return console.warn("three.vector2: .sub() now only accepts one argument. use .subvectors( a, b ) instead."),this.subvectors(c,a);this.x-=c.x;this.y-=c.y;return this};l.prototype.subscalar=function(c){this.x-=c;this.y-=c;return this};l.prototype.subvectors=function(c,a){this.x= c.x-a.x;this.y=c.y-a.y;return this};l.prototype.multiply=function(c){this.x*=c.x;this.y*=c.y;return this};l.prototype.multiplyscalar=function(c){this.x*=c;this.y*=c;return this};l.prototype.divide=function(c){this.x/=c.x;this.y/=c.y;return this};l.prototype.dividescalar=function(c){return this.multiplyscalar(1/c)};l.prototype.applymatrix3=function(c){var a=this.x,b=this.y;c=c.elements;this.x=c[0]*a+c[3]*b+c[6];this.y=c[1]*a+c[4]*b+c[7];return this};l.prototype.min=function(c){this.x=math.min(this.x, c.x);this.y=math.min(this.y,c.y);return this};l.prototype.max=function(c){this.x=math.max(this.x,c.x);this.y=math.max(this.y,c.y);return this};l.prototype.clamp=function(c,a){this.x=math.max(c.x,math.min(a.x,this.x));this.y=math.max(c.y,math.min(a.y,this.y));return this};l.prototype.clampscalar=function(c,a){this.x=math.max(c,math.min(a,this.x));this.y=math.max(c,math.min(a,this.y));return this};l.prototype.clamplength=function(c,a){var b=this.length();return this.dividescalar(b||1).multiplyscalar(math.max(c, math.min(a,b)))};l.prototype.floor=function(){this.x=math.floor(this.x);this.y=math.floor(this.y);return this};l.prototype.ceil=function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);return this};l.prototype.round=function(){this.x=math.round(this.x);this.y=math.round(this.y);return this};l.prototype.roundtozero=function(){this.x=0>this.x?math.ceil(this.x):math.floor(this.x);this.y=0>this.y?math.ceil(this.y):math.floor(this.y);return this};l.prototype.negate=function(){this.x=-this.x;this.y= -this.y;return this};l.prototype.dot=function(c){return this.x*c.x+this.y*c.y};l.prototype.cross=function(c){return this.x*c.y-this.y*c.x};l.prototype.lengthsq=function(){return this.x*this.x+this.y*this.y};l.prototype.length=function(){return math.sqrt(this.x*this.x+this.y*this.y)};l.prototype.manhattanlength=function(){return math.abs(this.x)+math.abs(this.y)};l.prototype.normalize=function(){return this.dividescalar(this.length()||1)};l.prototype.angle=function(){return math.atan2(-this.y,-this.x)+ math.pi};l.prototype.distanceto=function(c){return math.sqrt(this.distancetosquared(c))};l.prototype.distancetosquared=function(c){var a=this.x-c.x;c=this.y-c.y;return a*a+c*c};l.prototype.manhattandistanceto=function(c){return math.abs(this.x-c.x)+math.abs(this.y-c.y)};l.prototype.setlength=function(c){return this.normalize().multiplyscalar(c)};l.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;return this};l.prototype.lerpvectors=function(c,a,b){this.x=c.x+(a.x-c.x)*b; this.y=c.y+(a.y-c.y)*b;return this};l.prototype.equals=function(c){return c.x===this.x&&c.y===this.y};l.prototype.fromarray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y=c[a+1];return this};l.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;return c};l.prototype.frombufferattribute=function(c,a,b){void 0!==b&&console.warn("three.vector2: offset has been removed from .frombufferattribute().");this.x=c.getx(a);this.y=c.gety(a);return this};l.prototype.rotatearound= function(c,a){var b=math.cos(a);a=math.sin(a);var d=this.x-c.x,e=this.y-c.y;this.x=d*b-e*a+c.x;this.y=d*a+e*b+c.y;return this};l.prototype.random=function(){this.x=math.random();this.y=math.random();return this};object.defineproperties(l.prototype,af);var da=function(){object.defineproperty(this,"ismatrix3",{value:!0});this.elements=[1,0,0,0,1,0,0,0,1];0b;b++)if(a[b]!==c[b])return!1;return!0};da.prototype.fromarray=function(c,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=c[b+a];return this};da.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);var b=this.elements;c[a]=b[0];c[a+1]=b[1];c[a+2]=b[2];c[a+3]=b[3];c[a+4]=b[4];c[a+5]=b[5];c[a+6]=b[6];c[a+7]=b[7];c[a+8]=b[8];return c};var oe, sc={getdataurl:function(c){if(/^data:/i.test(c.src)||"undefined"==typeof htmlcanvaselement)return c.src;if(!(c instanceof htmlcanvaselement)){void 0===oe&&(oe=document.createelementns("http://www.w3.org/1999/xhtml","canvas"));oe.width=c.width;oe.height=c.height;var a=oe.getcontext("2d");c instanceof imagedata?a.putimagedata(c,0,0):a.drawimage(c,0,0,c.width,c.height);c=oe}return 2048c.x||1c.x?0:1;break;case 1002:c.x=1===math.abs(math.floor(c.x)%2)?math.ceil(c.x)-c.x:c.x-math.floor(c.x)}if(0>c.y||1c.y?0:1;break;case 1002:c.y=1===math.abs(math.floor(c.y)%2)?math.ceil(c.y)-c.y:c.y-math.floor(c.y)}this.flipy&&(c.y=1-c.y);return c}});object.defineproperty(oa.prototype,"needsupdate",{set:function(c){!0===c&&this.version++}});var ca= function(c,a,b,d){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=1);object.defineproperty(this,"isvector4",{value:!0});this.x=c;this.y=a;this.z=b;this.w=d},bf={width:{configurable:!0},height:{configurable:!0}};bf.width.get=function(){return this.z};bf.width.set=function(c){this.z=c};bf.height.get=function(){return this.w};bf.height.set=function(c){this.w=c};ca.prototype.set=function(c,a,b,d){this.x=c;this.y=a;this.z=b;this.w=d;return this};ca.prototype.setscalar=function(c){this.w= this.z=this.y=this.x=c;return this};ca.prototype.setx=function(c){this.x=c;return this};ca.prototype.sety=function(c){this.y=c;return this};ca.prototype.setz=function(c){this.z=c;return this};ca.prototype.setw=function(c){this.w=c;return this};ca.prototype.setcomponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw error("index is out of range: "+c);}return this};ca.prototype.getcomponent=function(c){switch(c){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw error("index is out of range: "+c);}};ca.prototype.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)};ca.prototype.copy=function(c){this.x=c.x;this.y=c.y;this.z=c.z;this.w=void 0!==c.w?c.w:1;return this};ca.prototype.add=function(c,a){if(void 0!==a)return console.warn("three.vector4: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(c,a);this.x+=c.x;this.y+=c.y; this.z+=c.z;this.w+=c.w;return this};ca.prototype.addscalar=function(c){this.x+=c;this.y+=c;this.z+=c;this.w+=c;return this};ca.prototype.addvectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;this.z=c.z+a.z;this.w=c.w+a.w;return this};ca.prototype.addscaledvector=function(c,a){this.x+=c.x*a;this.y+=c.y*a;this.z+=c.z*a;this.w+=c.w*a;return this};ca.prototype.sub=function(c,a){if(void 0!==a)return console.warn("three.vector4: .sub() now only accepts one argument. use .subvectors( a, b ) instead."), this.subvectors(c,a);this.x-=c.x;this.y-=c.y;this.z-=c.z;this.w-=c.w;return this};ca.prototype.subscalar=function(c){this.x-=c;this.y-=c;this.z-=c;this.w-=c;return this};ca.prototype.subvectors=function(c,a){this.x=c.x-a.x;this.y=c.y-a.y;this.z=c.z-a.z;this.w=c.w-a.w;return this};ca.prototype.multiplyscalar=function(c){this.x*=c;this.y*=c;this.z*=c;this.w*=c;return this};ca.prototype.applymatrix4=function(c){var a=this.x,b=this.y,d=this.z,e=this.w;c=c.elements;this.x=c[0]*a+c[4]*b+c[8]*d+c[12]*e; this.y=c[1]*a+c[5]*b+c[9]*d+c[13]*e;this.z=c[2]*a+c[6]*b+c[10]*d+c[14]*e;this.w=c[3]*a+c[7]*b+c[11]*d+c[15]*e;return this};ca.prototype.dividescalar=function(c){return this.multiplyscalar(1/c)};ca.prototype.setaxisanglefromquaternion=function(c){this.w=2*math.acos(c.w);var a=math.sqrt(1-c.w*c.w);1e-4>a?(this.x=1,this.z=this.y=0):(this.x=c.x/a,this.y=c.y/a,this.z=c.z/a);return this};ca.prototype.setaxisanglefromrotationmatrix=function(c){c=c.elements;var a=c[0];var b=c[4];var d=c[8],e=c[1],f=c[5], g=c[9];var h=c[2];var k=c[6];var l=c[10];if(.01>math.abs(b-e)&&.01>math.abs(d-h)&&.01>math.abs(g-k)){if(.1>math.abs(b+e)&&.1>math.abs(d+h)&&.1>math.abs(g+k)&&.1>math.abs(a+f+l-3))return this.set(1,0,0,0),this;c=math.pi;a=(a+1)/2;f=(f+1)/2;l=(l+1)/2;b=(b+e)/4;d=(d+h)/4;g=(g+k)/4;a>f&&a>l?.01>a?(k=0,b=h=.707106781):(k=math.sqrt(a),h=b/k,b=d/k):f>l?.01>f?(k=.707106781,h=0,b=.707106781):(h=math.sqrt(f),k=b/h,b=g/h):.01>l?(h=k=.707106781,b=0):(b=math.sqrt(l),k=d/b,h=g/b);this.set(k,h,b,c);return this}c= math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-b)*(e-b));.001>math.abs(c)&&(c=1);this.x=(k-g)/c;this.y=(d-h)/c;this.z=(e-b)/c;this.w=math.acos((a+f+l-1)/2);return this};ca.prototype.min=function(c){this.x=math.min(this.x,c.x);this.y=math.min(this.y,c.y);this.z=math.min(this.z,c.z);this.w=math.min(this.w,c.w);return this};ca.prototype.max=function(c){this.x=math.max(this.x,c.x);this.y=math.max(this.y,c.y);this.z=math.max(this.z,c.z);this.w=math.max(this.w,c.w);return this};ca.prototype.clamp=function(c,a){this.x= math.max(c.x,math.min(a.x,this.x));this.y=math.max(c.y,math.min(a.y,this.y));this.z=math.max(c.z,math.min(a.z,this.z));this.w=math.max(c.w,math.min(a.w,this.w));return this};ca.prototype.clampscalar=function(c,a){this.x=math.max(c,math.min(a,this.x));this.y=math.max(c,math.min(a,this.y));this.z=math.max(c,math.min(a,this.z));this.w=math.max(c,math.min(a,this.w));return this};ca.prototype.clamplength=function(c,a){var b=this.length();return this.dividescalar(b||1).multiplyscalar(math.max(c,math.min(a, b)))};ca.prototype.floor=function(){this.x=math.floor(this.x);this.y=math.floor(this.y);this.z=math.floor(this.z);this.w=math.floor(this.w);return this};ca.prototype.ceil=function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);this.z=math.ceil(this.z);this.w=math.ceil(this.w);return this};ca.prototype.round=function(){this.x=math.round(this.x);this.y=math.round(this.y);this.z=math.round(this.z);this.w=math.round(this.w);return this};ca.prototype.roundtozero=function(){this.x=0>this.x?math.ceil(this.x): math.floor(this.x);this.y=0>this.y?math.ceil(this.y):math.floor(this.y);this.z=0>this.z?math.ceil(this.z):math.floor(this.z);this.w=0>this.w?math.ceil(this.w):math.floor(this.w);return this};ca.prototype.negate=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this};ca.prototype.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z+this.w*c.w};ca.prototype.lengthsq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};ca.prototype.length=function(){return math.sqrt(this.x* this.x+this.y*this.y+this.z*this.z+this.w*this.w)};ca.prototype.manhattanlength=function(){return math.abs(this.x)+math.abs(this.y)+math.abs(this.z)+math.abs(this.w)};ca.prototype.normalize=function(){return this.dividescalar(this.length()||1)};ca.prototype.setlength=function(c){return this.normalize().multiplyscalar(c)};ca.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;this.z+=(c.z-this.z)*a;this.w+=(c.w-this.w)*a;return this};ca.prototype.lerpvectors=function(c,a,b){this.x= c.x+(a.x-c.x)*b;this.y=c.y+(a.y-c.y)*b;this.z=c.z+(a.z-c.z)*b;this.w=c.w+(a.w-c.w)*b;return this};ca.prototype.equals=function(c){return c.x===this.x&&c.y===this.y&&c.z===this.z&&c.w===this.w};ca.prototype.fromarray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y=c[a+1];this.z=c[a+2];this.w=c[a+3];return this};ca.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;c[a+2]=this.z;c[a+3]=this.w;return c};ca.prototype.frombufferattribute=function(c,a,b){void 0!== b&&console.warn("three.vector4: offset has been removed from .frombufferattribute().");this.x=c.getx(a);this.y=c.gety(a);this.z=c.getz(a);this.w=c.getw(a);return this};ca.prototype.random=function(){this.x=math.random();this.y=math.random();this.z=math.random();this.w=math.random();return this};object.defineproperties(ca.prototype,bf);db.prototype=object.assign(object.create(wb.prototype),{constructor:db,iswebglrendertarget:!0,setsize:function(c,a){if(this.width!==c||this.height!==a)this.width=c, this.height=a,this.texture.image.width=c,this.texture.image.height=a,this.dispose();this.viewport.set(0,0,c,a);this.scissor.set(0,0,c,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(c){this.width=c.width;this.height=c.height;this.viewport.copy(c.viewport);this.texture=c.texture.clone();this.depthbuffer=c.depthbuffer;this.stencilbuffer=c.stencilbuffer;this.depthtexture=c.depthtexture;return this},dispose:function(){this.dispatchevent({type:"dispose"})}});dh.prototype=object.assign(object.create(db.prototype), {constructor:dh,iswebglmultisamplerendertarget:!0,copy:function(c){db.prototype.copy.call(this,c);this.samples=c.samples;return this}});var ua=function(c,a,b,d){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=1);object.defineproperty(this,"isquaternion",{value:!0});this._x=c;this._y=a;this._z=b;this._w=d},rc={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0},w:{configurable:!0}};ua.slerp=function(c,a,b,d){return b.copy(c).slerp(a,d)};ua.slerpflat=function(c,a,b,d,e, f,g){var h=b[d+0],k=b[d+1],l=b[d+2];b=b[d+3];d=e[f+0];var m=e[f+1],n=e[f+2];e=e[f+3];if(b!==e||h!==d||k!==m||l!==n){f=1-g;var p=h*d+k*m+l*n+b*e,t=0<=p?1:-1,q=1-p*p;q>number.epsilon&&(q=math.sqrt(q),p=math.atan2(q,p*t),f=math.sin(f*p)/q,g=math.sin(g*p)/q);t*=g;h=h*f+d*t;k=k*f+m*t;l=l*f+n*t;b=b*f+e*t;f===1-g&&(g=1/math.sqrt(h*h+k*k+l*l+b*b),h*=g,k*=g,l*=g,b*=g)}c[a]=h;c[a+1]=k;c[a+2]=l;c[a+3]=b};ua.multiplyquaternionsflat=function(c,a,b,d,e,f){var g=b[d],h=b[d+1],k=b[d+2];b=b[d+3];d=e[f];var l=e[f+ 1],m=e[f+2];e=e[f+3];c[a]=g*e+b*d+h*m-k*l;c[a+1]=h*e+b*l+k*d-g*m;c[a+2]=k*e+b*m+g*l-h*d;c[a+3]=b*e-g*d-h*l-k*m;return c};rc.x.get=function(){return this._x};rc.x.set=function(c){this._x=c;this._onchangecallback()};rc.y.get=function(){return this._y};rc.y.set=function(c){this._y=c;this._onchangecallback()};rc.z.get=function(){return this._z};rc.z.set=function(c){this._z=c;this._onchangecallback()};rc.w.get=function(){return this._w};rc.w.set=function(c){this._w=c;this._onchangecallback()};ua.prototype.set= function(c,a,b,d){this._x=c;this._y=a;this._z=b;this._w=d;this._onchangecallback();return this};ua.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)};ua.prototype.copy=function(c){this._x=c.x;this._y=c.y;this._z=c.z;this._w=c.w;this._onchangecallback();return this};ua.prototype.setfromeuler=function(c,a){if(!c||!c.iseuler)throw error("three.quaternion: .setfromeuler() now expects an euler rotation rather than a vector3 and order.");var b=c._x,d=c._y,e=c._z;c= c._order;var f=math.cos,g=math.sin,h=f(b/2),k=f(d/2);f=f(e/2);b=g(b/2);d=g(d/2);e=g(e/2);switch(c){case "xyz":this._x=b*k*f+h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f-b*d*e;break;case "yxz":this._x=b*k*f+h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f+b*d*e;break;case "zxy":this._x=b*k*f-h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f-b*d*e;break;case "zyx":this._x=b*k*f-h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f+b*d*e;break;case "yzx":this._x= b*k*f+h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f-b*d*e;break;case "xzy":this._x=b*k*f-h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f+b*d*e;break;default:console.warn("three.quaternion: .setfromeuler() encountered an unknown order: "+c)}!1!==a&&this._onchangecallback();return this};ua.prototype.setfromaxisangle=function(c,a){a/=2;var b=math.sin(a);this._x=c.x*b;this._y=c.y*b;this._z=c.z*b;this._w=math.cos(a);this._onchangecallback();return this};ua.prototype.setfromrotationmatrix= function(c){var a=c.elements,b=a[0];c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9],h=a[2],k=a[6];a=a[10];var l=b+f+a;0f&&b>a?(b=2*math.sqrt(1+b-f-a),this._w=(k-g)/b,this._x=.25*b,this._y=(c+e)/b,this._z=(d+h)/b):f>a?(b=2*math.sqrt(1+f-b-a),this._w=(d-h)/b,this._x=(c+e)/b,this._y=.25*b,this._z=(g+k)/b):(b=2*math.sqrt(1+a-b-f),this._w=(e-c)/b,this._x=(d+h)/b,this._y=(g+k)/b,this._z=.25*b);this._onchangecallback();return this}; ua.prototype.setfromunitvectors=function(c,a){var b=c.dot(a)+1;1e-6>b?(b=0,math.abs(c.x)>math.abs(c.z)?(this._x=-c.y,this._y=c.x,this._z=0):(this._x=0,this._y=-c.z,this._z=c.y)):(this._x=c.y*a.z-c.z*a.y,this._y=c.z*a.x-c.x*a.z,this._z=c.x*a.y-c.y*a.x);this._w=b;return this.normalize()};ua.prototype.angleto=function(c){return 2*math.acos(math.abs(xa.clamp(this.dot(c),-1,1)))};ua.prototype.rotatetowards=function(c,a){var b=this.angleto(c);if(0===b)return this;this.slerp(c,math.min(1,a/b));return this}; ua.prototype.identity=function(){return this.set(0,0,0,1)};ua.prototype.inverse=function(){return this.conjugate()};ua.prototype.conjugate=function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onchangecallback();return this};ua.prototype.dot=function(c){return this._x*c._x+this._y*c._y+this._z*c._z+this._w*c._w};ua.prototype.lengthsq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w};ua.prototype.length=function(){return math.sqrt(this._x*this._x+this._y*this._y+this._z* this._z+this._w*this._w)};ua.prototype.normalize=function(){var c=this.length();0===c?(this._z=this._y=this._x=0,this._w=1):(c=1/c,this._x*=c,this._y*=c,this._z*=c,this._w*=c);this._onchangecallback();return this};ua.prototype.multiply=function(c,a){return void 0!==a?(console.warn("three.quaternion: .multiply() now only accepts one argument. use .multiplyquaternions( a, b ) instead."),this.multiplyquaternions(c,a)):this.multiplyquaternions(this,c)};ua.prototype.premultiply=function(c){return this.multiplyquaternions(c, this)};ua.prototype.multiplyquaternions=function(c,a){var b=c._x,d=c._y,e=c._z;c=c._w;var f=a._x,g=a._y,h=a._z;a=a._w;this._x=b*a+c*f+d*h-e*g;this._y=d*a+c*g+e*f-b*h;this._z=e*a+c*h+b*g-d*f;this._w=c*a-b*f-d*g-e*h;this._onchangecallback();return this};ua.prototype.slerp=function(c,a){if(0===a)return this;if(1===a)return this.copy(c);var b=this._x,d=this._y,e=this._z,f=this._w,g=f*c._w+b*c._x+d*c._y+e*c._z;0>g?(this._w=-c._w,this._x=-c._x,this._y=-c._y,this._z=-c._z,g=-g):this.copy(c);if(1<=g)return this._w= f,this._x=b,this._y=d,this._z=e,this;c=1-g*g;if(c<=number.epsilon)return g=1-a,this._w=g*f+a*this._w,this._x=g*b+a*this._x,this._y=g*d+a*this._y,this._z=g*e+a*this._z,this.normalize(),this._onchangecallback(),this;c=math.sqrt(c);var h=math.atan2(c,g);g=math.sin((1-a)*h)/c;a=math.sin(a*h)/c;this._w=f*g+this._w*a;this._x=b*g+this._x*a;this._y=d*g+this._y*a;this._z=e*g+this._z*a;this._onchangecallback();return this};ua.prototype.equals=function(c){return c._x===this._x&&c._y===this._y&&c._z===this._z&& c._w===this._w};ua.prototype.fromarray=function(c,a){void 0===a&&(a=0);this._x=c[a];this._y=c[a+1];this._z=c[a+2];this._w=c[a+3];this._onchangecallback();return this};ua.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this._x;c[a+1]=this._y;c[a+2]=this._z;c[a+3]=this._w;return c};ua.prototype.frombufferattribute=function(c,a){this._x=c.getx(a);this._y=c.gety(a);this._z=c.getz(a);this._w=c.getw(a);return this};ua.prototype._onchange=function(c){this._onchangecallback=c;return this}; ua.prototype._onchangecallback=function(){};object.defineproperties(ua.prototype,rc);var w=function(c,a,b){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);object.defineproperty(this,"isvector3",{value:!0});this.x=c;this.y=a;this.z=b};w.prototype.set=function(c,a,b){void 0===b&&(b=this.z);this.x=c;this.y=a;this.z=b;return this};w.prototype.setscalar=function(c){this.z=this.y=this.x=c;return this};w.prototype.setx=function(c){this.x=c;return this};w.prototype.sety=function(c){this.y=c;return this}; w.prototype.setz=function(c){this.z=c;return this};w.prototype.setcomponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw error("index is out of range: "+c);}return this};w.prototype.getcomponent=function(c){switch(c){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw error("index is out of range: "+c);}};w.prototype.clone=function(){return new this.constructor(this.x,this.y,this.z)};w.prototype.copy=function(c){this.x= c.x;this.y=c.y;this.z=c.z;return this};w.prototype.add=function(c,a){if(void 0!==a)return console.warn("three.vector3: .add() now only accepts one argument. use .addvectors( a, b ) instead."),this.addvectors(c,a);this.x+=c.x;this.y+=c.y;this.z+=c.z;return this};w.prototype.addscalar=function(c){this.x+=c;this.y+=c;this.z+=c;return this};w.prototype.addvectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;this.z=c.z+a.z;return this};w.prototype.addscaledvector=function(c,a){this.x+=c.x*a;this.y+=c.y* a;this.z+=c.z*a;return this};w.prototype.sub=function(c,a){if(void 0!==a)return console.warn("three.vector3: .sub() now only accepts one argument. use .subvectors( a, b ) instead."),this.subvectors(c,a);this.x-=c.x;this.y-=c.y;this.z-=c.z;return this};w.prototype.subscalar=function(c){this.x-=c;this.y-=c;this.z-=c;return this};w.prototype.subvectors=function(c,a){this.x=c.x-a.x;this.y=c.y-a.y;this.z=c.z-a.z;return this};w.prototype.multiply=function(c,a){if(void 0!==a)return console.warn("three.vector3: .multiply() now only accepts one argument. use .multiplyvectors( a, b ) instead."), this.multiplyvectors(c,a);this.x*=c.x;this.y*=c.y;this.z*=c.z;return this};w.prototype.multiplyscalar=function(c){this.x*=c;this.y*=c;this.z*=c;return this};w.prototype.multiplyvectors=function(c,a){this.x=c.x*a.x;this.y=c.y*a.y;this.z=c.z*a.z;return this};w.prototype.applyeuler=function(c){c&&c.iseuler||console.error("three.vector3: .applyeuler() now expects an euler rotation rather than a vector3 and order.");return this.applyquaternion(vj.setfromeuler(c))};w.prototype.applyaxisangle=function(c, a){return this.applyquaternion(vj.setfromaxisangle(c,a))};w.prototype.applymatrix3=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;this.x=c[0]*a+c[3]*b+c[6]*d;this.y=c[1]*a+c[4]*b+c[7]*d;this.z=c[2]*a+c[5]*b+c[8]*d;return this};w.prototype.applynormalmatrix=function(c){return this.applymatrix3(c).normalize()};w.prototype.applymatrix4=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;var e=1/(c[3]*a+c[7]*b+c[11]*d+c[15]);this.x=(c[0]*a+c[4]*b+c[8]*d+c[12])*e;this.y=(c[1]*a+c[5]*b+c[9]* d+c[13])*e;this.z=(c[2]*a+c[6]*b+c[10]*d+c[14])*e;return this};w.prototype.applyquaternion=function(c){var a=this.x,b=this.y,d=this.z,e=c.x,f=c.y,g=c.z;c=c.w;var h=c*a+f*d-g*b,k=c*b+g*a-e*d,l=c*d+e*b-f*a;a=-e*a-f*b-g*d;this.x=h*c+a*-e+k*-g-l*-f;this.y=k*c+a*-f+l*-e-h*-g;this.z=l*c+a*-g+h*-f-k*-e;return this};w.prototype.project=function(c){return this.applymatrix4(c.matrixworldinverse).applymatrix4(c.projectionmatrix)};w.prototype.unproject=function(c){return this.applymatrix4(c.projectionmatrixinverse).applymatrix4(c.matrixworld)}; w.prototype.transformdirection=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;this.x=c[0]*a+c[4]*b+c[8]*d;this.y=c[1]*a+c[5]*b+c[9]*d;this.z=c[2]*a+c[6]*b+c[10]*d;return this.normalize()};w.prototype.divide=function(c){this.x/=c.x;this.y/=c.y;this.z/=c.z;return this};w.prototype.dividescalar=function(c){return this.multiplyscalar(1/c)};w.prototype.min=function(c){this.x=math.min(this.x,c.x);this.y=math.min(this.y,c.y);this.z=math.min(this.z,c.z);return this};w.prototype.max=function(c){this.x= math.max(this.x,c.x);this.y=math.max(this.y,c.y);this.z=math.max(this.z,c.z);return this};w.prototype.clamp=function(c,a){this.x=math.max(c.x,math.min(a.x,this.x));this.y=math.max(c.y,math.min(a.y,this.y));this.z=math.max(c.z,math.min(a.z,this.z));return this};w.prototype.clampscalar=function(c,a){this.x=math.max(c,math.min(a,this.x));this.y=math.max(c,math.min(a,this.y));this.z=math.max(c,math.min(a,this.z));return this};w.prototype.clamplength=function(c,a){var b=this.length();return this.dividescalar(b|| 1).multiplyscalar(math.max(c,math.min(a,b)))};w.prototype.floor=function(){this.x=math.floor(this.x);this.y=math.floor(this.y);this.z=math.floor(this.z);return this};w.prototype.ceil=function(){this.x=math.ceil(this.x);this.y=math.ceil(this.y);this.z=math.ceil(this.z);return this};w.prototype.round=function(){this.x=math.round(this.x);this.y=math.round(this.y);this.z=math.round(this.z);return this};w.prototype.roundtozero=function(){this.x=0>this.x?math.ceil(this.x):math.floor(this.x);this.y=0>this.y? math.ceil(this.y):math.floor(this.y);this.z=0>this.z?math.ceil(this.z):math.floor(this.z);return this};w.prototype.negate=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this};w.prototype.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z};w.prototype.lengthsq=function(){return this.x*this.x+this.y*this.y+this.z*this.z};w.prototype.length=function(){return math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};w.prototype.manhattanlength=function(){return math.abs(this.x)+math.abs(this.y)+ math.abs(this.z)};w.prototype.normalize=function(){return this.dividescalar(this.length()||1)};w.prototype.setlength=function(c){return this.normalize().multiplyscalar(c)};w.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;this.z+=(c.z-this.z)*a;return this};w.prototype.lerpvectors=function(c,a,b){this.x=c.x+(a.x-c.x)*b;this.y=c.y+(a.y-c.y)*b;this.z=c.z+(a.z-c.z)*b;return this};w.prototype.cross=function(c,a){return void 0!==a?(console.warn("three.vector3: .cross() now only accepts one argument. use .crossvectors( a, b ) instead."), this.crossvectors(c,a)):this.crossvectors(this,c)};w.prototype.crossvectors=function(c,a){var b=c.x,d=c.y;c=c.z;var e=a.x,f=a.y;a=a.z;this.x=d*a-c*f;this.y=c*e-b*a;this.z=b*f-d*e;return this};w.prototype.projectonvector=function(c){var a=c.lengthsq();if(0===a)return this.set(0,0,0);a=c.dot(this)/a;return this.copy(c).multiplyscalar(a)};w.prototype.projectonplane=function(c){yh.copy(this).projectonvector(c);return this.sub(yh)};w.prototype.reflect=function(c){return this.sub(yh.copy(c).multiplyscalar(2* this.dot(c)))};w.prototype.angleto=function(c){var a=math.sqrt(this.lengthsq()*c.lengthsq());if(0===a)return math.pi/2;c=this.dot(c)/a;return math.acos(xa.clamp(c,-1,1))};w.prototype.distanceto=function(c){return math.sqrt(this.distancetosquared(c))};w.prototype.distancetosquared=function(c){var a=this.x-c.x,b=this.y-c.y;c=this.z-c.z;return a*a+b*b+c*c};w.prototype.manhattandistanceto=function(c){return math.abs(this.x-c.x)+math.abs(this.y-c.y)+math.abs(this.z-c.z)};w.prototype.setfromspherical=function(c){return this.setfromsphericalcoords(c.radius, c.phi,c.theta)};w.prototype.setfromsphericalcoords=function(c,a,b){var d=math.sin(a)*c;this.x=d*math.sin(b);this.y=math.cos(a)*c;this.z=d*math.cos(b);return this};w.prototype.setfromcylindrical=function(c){return this.setfromcylindricalcoords(c.radius,c.theta,c.y)};w.prototype.setfromcylindricalcoords=function(c,a,b){this.x=c*math.sin(a);this.y=b;this.z=c*math.cos(a);return this};w.prototype.setfrommatrixposition=function(c){c=c.elements;this.x=c[12];this.y=c[13];this.z=c[14];return this};w.prototype.setfrommatrixscale= function(c){var a=this.setfrommatrixcolumn(c,0).length(),b=this.setfrommatrixcolumn(c,1).length();c=this.setfrommatrixcolumn(c,2).length();this.x=a;this.y=b;this.z=c;return this};w.prototype.setfrommatrixcolumn=function(c,a){return this.fromarray(c.elements,4*a)};w.prototype.setfrommatrix3column=function(c,a){return this.fromarray(c.elements,3*a)};w.prototype.equals=function(c){return c.x===this.x&&c.y===this.y&&c.z===this.z};w.prototype.fromarray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y= c[a+1];this.z=c[a+2];return this};w.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;c[a+2]=this.z;return c};w.prototype.frombufferattribute=function(c,a,b){void 0!==b&&console.warn("three.vector3: offset has been removed from .frombufferattribute().");this.x=c.getx(a);this.y=c.gety(a);this.z=c.getz(a);return this};w.prototype.random=function(){this.x=math.random();this.y=math.random();this.z=math.random();return this};var yh=new w,vj=new ua,za=function(c, a){object.defineproperty(this,"isbox3",{value:!0});this.min=void 0!==c?c:new w(infinity,infinity,infinity);this.max=void 0!==a?a:new w(-infinity,-infinity,-infinity)};za.prototype.set=function(c,a){this.min.copy(c);this.max.copy(a);return this};za.prototype.setfromarray=function(c){for(var a=infinity,b=infinity,d=infinity,e=-infinity,f=-infinity,g=-infinity,h=0,k=c.length;he&&(e=l);m>f&&(f=m);n>g&&(g=n)}this.min.set(a,b,d);this.max.set(e, f,g);return this};za.prototype.setfrombufferattribute=function(c){for(var a=infinity,b=infinity,d=infinity,e=-infinity,f=-infinity,g=-infinity,h=0,k=c.count;he&&(e=l);m>f&&(f=m);n>g&&(g=n)}this.min.set(a,b,d);this.max.set(e,f,g);return this};za.prototype.setfrompoints=function(c){this.makeempty();for(var a=0,b=c.length;athis.max.x||c.ythis.max.y||c.zthis.max.z?!1:!0};za.prototype.containsbox=function(c){return this.min.x<=c.min.x&&c.max.x<=this.max.x&&this.min.y<=c.min.y&&c.max.y<=this.max.y&&this.min.z<=c.min.z&&c.max.z<=this.max.z};za.prototype.getparameter=function(c,a){void 0===a&&(console.warn("three.box3: .getparameter() target is now required"),a=new w);return a.set((c.x-this.min.x)/(this.max.x-this.min.x),(c.y-this.min.y)/(this.max.y- this.min.y),(c.z-this.min.z)/(this.max.z-this.min.z))};za.prototype.intersectsbox=function(c){return c.max.xthis.max.x||c.max.ythis.max.y||c.max.zthis.max.z?!1:!0};za.prototype.intersectssphere=function(c){this.clamppoint(c.center,cf);return cf.distancetosquared(c.center)<=c.radius*c.radius};za.prototype.intersectsplane=function(c){if(0=-c.constant};za.prototype.intersectstriangle=function(c){if(this.isempty())return!1;this.getcenter(df);cg.subvectors(this.max,df);pe.subvectors(c.a,df);qe.subvectors(c.b,df);re.subvectors(c.c,df);tc.subvectors(qe,pe);uc.subvectors(re, qe);sd.subvectors(pe,re);c=[0,-tc.z,tc.y,0,-uc.z,uc.y,0,-sd.z,sd.y,tc.z,0,-tc.x,uc.z,0,-uc.x,sd.z,0,-sd.x,-tc.y,tc.x,0,-uc.y,uc.x,0,-sd.y,sd.x,0];if(!eh(c,pe,qe,re,cg))return!1;c=[1,0,0,0,1,0,0,0,1];if(!eh(c,pe,qe,re,cg))return!1;dg.crossvectors(tc,uc);c=[dg.x,dg.y,dg.z];return eh(c,pe,qe,re,cg)};za.prototype.clamppoint=function(c,a){void 0===a&&(console.warn("three.box3: .clamppoint() target is now required"),a=new w);return a.copy(c).clamp(this.min,this.max)};za.prototype.distancetopoint=function(c){return cf.copy(c).clamp(this.min, this.max).sub(c).length()};za.prototype.getboundingsphere=function(c){void 0===c&&console.error("three.box3: .getboundingsphere() target is now required");this.getcenter(c.center);c.radius=.5*this.getsize(cf).length();return c};za.prototype.intersect=function(c){this.min.max(c.min);this.max.min(c.max);this.isempty()&&this.makeempty();return this};za.prototype.union=function(c){this.min.min(c.min);this.max.max(c.max);return this};za.prototype.applymatrix4=function(c){if(this.isempty())return this; sc[0].set(this.min.x,this.min.y,this.min.z).applymatrix4(c);sc[1].set(this.min.x,this.min.y,this.max.z).applymatrix4(c);sc[2].set(this.min.x,this.max.y,this.min.z).applymatrix4(c);sc[3].set(this.min.x,this.max.y,this.max.z).applymatrix4(c);sc[4].set(this.max.x,this.min.y,this.min.z).applymatrix4(c);sc[5].set(this.max.x,this.min.y,this.max.z).applymatrix4(c);sc[6].set(this.max.x,this.max.y,this.min.z).applymatrix4(c);sc[7].set(this.max.x,this.max.y,this.max.z).applymatrix4(c);this.setfrompoints(sc); return this};za.prototype.translate=function(c){this.min.add(c);this.max.add(c);return this};za.prototype.equals=function(c){return c.min.equals(this.min)&&c.max.equals(this.max)};var sc=[new w,new w,new w,new w,new w,new w,new w,new w],cf=new w,zh=new za,pe=new w,qe=new w,re=new w,tc=new w,uc=new w,sd=new w,df=new w,cg=new w,dg=new w,yc=new w,ml=new za,wa=function(c,a){this.center=void 0!==c?c:new w;this.radius=void 0!==a?a:-1};wa.prototype.set=function(c,a){this.center.copy(c);this.radius=a;return this}; wa.prototype.setfrompoints=function(c,a){var b=this.center;void 0!==a?b.copy(a):ml.setfrompoints(c).getcenter(b);for(var d=a=0,e=c.length;dthis.radius};wa.prototype.makeempty=function(){this.center.set(0,0,0);this.radius= -1;return this};wa.prototype.containspoint=function(c){return c.distancetosquared(this.center)<=this.radius*this.radius};wa.prototype.distancetopoint=function(c){return c.distanceto(this.center)-this.radius};wa.prototype.intersectssphere=function(c){var a=this.radius+c.radius;return c.center.distancetosquared(this.center)<=a*a};wa.prototype.intersectsbox=function(c){return c.intersectssphere(this)};wa.prototype.intersectsplane=function(c){return math.abs(c.distancetopoint(this.center))<=this.radius}; wa.prototype.clamppoint=function(c,a){var b=this.center.distancetosquared(c);void 0===a&&(console.warn("three.sphere: .clamppoint() target is now required"),a=new w);a.copy(c);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyscalar(this.radius).add(this.center));return a};wa.prototype.getboundingbox=function(c){void 0===c&&(console.warn("three.sphere: .getboundingbox() target is now required"),c=new za);if(this.isempty())return c.makeempty(),c;c.set(this.center,this.center);c.expandbyscalar(this.radius); return c};wa.prototype.applymatrix4=function(c){this.center.applymatrix4(c);this.radius*=c.getmaxscaleonaxis();return this};wa.prototype.translate=function(c){this.center.add(c);return this};wa.prototype.equals=function(c){return c.center.equals(this.center)&&c.radius===this.radius};var tc=new w,$h=new w,eg=new w,vc=new w,ai=new w,fg=new w,bi=new w,ta=function(c,a){this.origin=void 0!==c?c:new w;this.direction=void 0!==a?a:new w(0,0,-1)};ta.prototype.set=function(c,a){this.origin.copy(c);this.direction.copy(a); return this};ta.prototype.clone=function(){return(new this.constructor).copy(this)};ta.prototype.copy=function(c){this.origin.copy(c.origin);this.direction.copy(c.direction);return this};ta.prototype.at=function(c,a){void 0===a&&(console.warn("three.ray: .at() target is now required"),a=new w);return a.copy(this.direction).multiplyscalar(c).add(this.origin)};ta.prototype.lookat=function(c){this.direction.copy(c).sub(this.origin).normalize();return this};ta.prototype.recast=function(c){this.origin.copy(this.at(c, tc));return this};ta.prototype.closestpointtopoint=function(c,a){void 0===a&&(console.warn("three.ray: .closestpointtopoint() target is now required"),a=new w);a.subvectors(c,this.origin);c=a.dot(this.direction);return 0>c?a.copy(this.origin):a.copy(this.direction).multiplyscalar(c).add(this.origin)};ta.prototype.distancetopoint=function(c){return math.sqrt(this.distancesqtopoint(c))};ta.prototype.distancesqtopoint=function(c){var a=tc.subvectors(c,this.origin).dot(this.direction);if(0>a)return this.origin.distancetosquared(c); tc.copy(this.direction).multiplyscalar(a).add(this.origin);return tc.distancetosquared(c)};ta.prototype.distancesqtosegment=function(c,a,b,d){$h.copy(c).add(a).multiplyscalar(.5);eg.copy(a).sub(c).normalize();vc.copy(this.origin).sub($h);var e=.5*c.distanceto(a),f=-this.direction.dot(eg),g=vc.dot(this.direction),h=-vc.dot(eg),k=vc.lengthsq(),l=math.abs(1-f*f);if(0=-m?a<=m?(e=1/l,c*=e,a*=e,f=c*(c+f*a+2*g)+a*(f*c+a+2*h)+k):(a=e,c=math.max(0,-(f*a+g)),f=-c*c+a*(a+ 2*h)+k):(a=-e,c=math.max(0,-(f*a+g)),f=-c*c+a*(a+2*h)+k):a<=-m?(c=math.max(0,-(-f*e+g)),a=0c)return null;c=math.sqrt(c-d);d=b-c;b+=c;return 0>d&&0>b?null:0>d?this.at(b,a):this.at(d,a)};ta.prototype.intersectssphere=function(c){return this.distancesqtopoint(c.center)<=c.radius*c.radius};ta.prototype.distancetoplane=function(c){var a=c.normal.dot(this.direction);if(0===a)return 0===c.distancetopoint(this.origin)?0:null;c=-(this.origin.dot(c.normal)+c.constant)/a;return 0<=c?c:null};ta.prototype.intersectplane= function(c,a){c=this.distancetoplane(c);return null===c?null:this.at(c,a)};ta.prototype.intersectsplane=function(c){var a=c.distancetopoint(this.origin);return 0===a||0>c.normal.dot(this.direction)*a?!0:!1};ta.prototype.intersectbox=function(c,a){var b=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=b){var g=(c.min.x-f.x)*b;b*=c.max.x-f.x}else g=(c.max.x-f.x)*b,b*=c.min.x-f.x;if(0<=d){var h=(c.min.y-f.y)*d;d*=c.max.y-f.y}else h=(c.max.y-f.y)*d,d*=c.min.y-f.y; if(g>d||h>b)return null;if(h>g||g!==g)g=h;if(dc||h>b)return null;if(h>g||g!==g)g=h;if(cb?null:this.at(0<=g?g:b,a)};ta.prototype.intersectsbox=function(c){return null!==this.intersectbox(c,tc)};ta.prototype.intersecttriangle=function(c,a,b,d,e){ai.subvectors(a,c);fg.subvectors(b,c);bi.crossvectors(ai,fg);a=this.direction.dot(bi);if(0a)d=-1,a= -a;else return null;vc.subvectors(this.origin,c);c=d*this.direction.dot(fg.crossvectors(vc,fg));if(0>c)return null;b=d*this.direction.dot(ai.cross(vc));if(0>b||c+b>a)return null;c=-d*vc.dot(bi);return 0>c?null:this.at(c/a,e)};ta.prototype.applymatrix4=function(c){this.origin.applymatrix4(c);this.direction.transformdirection(c);return this};ta.prototype.equals=function(c){return c.origin.equals(this.origin)&&c.direction.equals(this.direction)};var da=function(){object.defineproperty(this,"ismatrix4", {value:!0});this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0this.determinant()&&(e=-e);c.x=d[12];c.y=d[13];c.z=d[14];gb.copy(this);c=1/e;d=1/f;var h=1/g;gb.elements[0]*= c;gb.elements[1]*=c;gb.elements[2]*=c;gb.elements[4]*=d;gb.elements[5]*=d;gb.elements[6]*=d;gb.elements[8]*=h;gb.elements[9]*=h;gb.elements[10]*=h;a.setfromrotationmatrix(gb);b.x=e;b.y=f;b.z=g;return this};da.prototype.makeperspective=function(c,a,b,d,e,f){void 0===f&&console.warn("three.matrix4: .makeperspective() has been redefined and has a new signature. please check the docs.");var g=this.elements;g[0]=2*e/(a-c);g[4]=0;g[8]=(a+c)/(a-c);g[12]=0;g[1]=0;g[5]=2*e/(b-d);g[9]=(b+d)/(b-d);g[13]=0;g[2]= 0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this};da.prototype.makeorthographic=function(c,a,b,d,e,f){var g=this.elements,h=1/(a-c),k=1/(b-d),l=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((a+c)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((b+d)*k);g[2]=0;g[6]=0;g[10]=-2*l;g[14]=-((f+e)*l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this};da.prototype.equals=function(c){var a=this.elements;c=c.elements;for(var b=0;16>b;b++)if(a[b]!==c[b])return!1;return!0};da.prototype.fromarray= function(c,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=c[b+a];return this};da.prototype.toarray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);var b=this.elements;c[a]=b[0];c[a+1]=b[1];c[a+2]=b[2];c[a+3]=b[3];c[a+4]=b[4];c[a+5]=b[5];c[a+6]=b[6];c[a+7]=b[7];c[a+8]=b[8];c[a+9]=b[9];c[a+10]=b[10];c[a+11]=b[11];c[a+12]=b[12];c[a+13]=b[13];c[a+14]=b[14];c[a+15]=b[15];return c};var se=new w,gb=new da,nl=new w(0,0,0),ol=new w(1,1,1),wc=new w,gg=new w,ub=new w,hb=function f(a,b,d,e){void 0=== a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=0);void 0===e&&(e=f.defaultorder);object.defineproperty(this,"iseuler",{value:!0});this._x=a;this._y=b;this._z=d;this._order=e},uc={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0},order:{configurable:!0}};uc.x.get=function(){return this._x};uc.x.set=function(a){this._x=a;this._onchangecallback()};uc.y.get=function(){return this._y};uc.y.set=function(a){this._y=a;this._onchangecallback()};uc.z.get=function(){return this._z};uc.z.set=function(a){this._z= a;this._onchangecallback()};uc.order.get=function(){return this._order};uc.order.set=function(a){this._order=a;this._onchangecallback()};hb.prototype.set=function(a,b,d,e){this._x=a;this._y=b;this._z=d;this._order=e||this._order;this._onchangecallback();return this};hb.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)};hb.prototype.copy=function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onchangecallback();return this};hb.prototype.setfromrotationmatrix= function(a,b,d){var e=xa.clamp,f=a.elements;a=f[0];var g=f[4],h=f[8],k=f[1],l=f[5],m=f[9],n=f[2],p=f[6];f=f[10];b=b||this._order;switch(b){case "xyz":this._y=math.asin(e(h,-1,1));.9999999>math.abs(h)?(this._x=math.atan2(-m,f),this._z=math.atan2(-g,a)):(this._x=math.atan2(p,l),this._z=0);break;case "yxz":this._x=math.asin(-e(m,-1,1));.9999999>math.abs(m)?(this._y=math.atan2(h,f),this._z=math.atan2(k,l)):(this._y=math.atan2(-n,a),this._z=0);break;case "zxy":this._x=math.asin(e(p,-1,1));.9999999>math.abs(p)? (this._y=math.atan2(-n,f),this._z=math.atan2(-g,l)):(this._y=0,this._z=math.atan2(k,a));break;case "zyx":this._y=math.asin(-e(n,-1,1));.9999999>math.abs(n)?(this._x=math.atan2(p,f),this._z=math.atan2(k,a)):(this._x=0,this._z=math.atan2(-g,l));break;case "yzx":this._z=math.asin(e(k,-1,1));.9999999>math.abs(k)?(this._x=math.atan2(-m,l),this._y=math.atan2(-n,a)):(this._x=0,this._y=math.atan2(h,f));break;case "xzy":this._z=math.asin(-e(g,-1,1));.9999999>math.abs(g)?(this._x=math.atan2(p,l),this._y=math.atan2(h, a)):(this._x=math.atan2(-m,f),this._y=0);break;default:console.warn("three.euler: .setfromrotationmatrix() encountered an unknown order: "+b)}this._order=b;!1!==d&&this._onchangecallback();return this};hb.prototype.setfromquaternion=function(a,b,d){wj.makerotationfromquaternion(a);return this.setfromrotationmatrix(wj,b,d)};hb.prototype.setfromvector3=function(a,b){return this.set(a.x,a.y,a.z,b||this._order)};hb.prototype.reorder=function(a){xj.setfromeuler(this);return this.setfromquaternion(xj,a)}; hb.prototype.equals=function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order};hb.prototype.fromarray=function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onchangecallback();return this};hb.prototype.toarray=function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a};hb.prototype.tovector3=function(a){return a?a.set(this._x,this._y,this._z):new w(this._x,this._y,this._z)}; hb.prototype._onchange=function(a){this._onchangecallback=a;return this};hb.prototype._onchangecallback=function(){};object.defineproperties(hb.prototype,uc);hb.defaultorder="xyz";hb.rotationorders="xyz yzx zxy xzy yxz zyx".split(" ");var wj=new da,xj=new ua,$b=function(){this.mask=1};$b.prototype.set=function(a){this.mask=1<e||1b&&0a&&0=xc.x+xc.y};ga.getuv=function(a,b,d,e,f,g,h,k){this.getbarycoord(a,b,d,e,xc);k.set(0,0);k.addscaledvector(f, xc.x);k.addscaledvector(g,xc.y);k.addscaledvector(h,xc.z);return k};ga.isfrontfacing=function(a,b,d,e){yb.subvectors(d,b);wc.subvectors(a,b);return 0>yb.cross(wc).dot(e)?!0:!1};ga.prototype.set=function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this};ga.prototype.setfrompointsandindices=function(a,b,d,e){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[e]);return this};ga.prototype.clone=function(){return(new this.constructor).copy(this)};ga.prototype.copy=function(a){this.a.copy(a.a); this.b.copy(a.b);this.c.copy(a.c);return this};ga.prototype.getarea=function(){yb.subvectors(this.c,this.b);wc.subvectors(this.a,this.b);return.5*yb.cross(wc).length()};ga.prototype.getmidpoint=function(a){void 0===a&&(console.warn("three.triangle: .getmidpoint() target is now required"),a=new w);return a.addvectors(this.a,this.b).add(this.c).multiplyscalar(1/3)};ga.prototype.getnormal=function(a){return ga.getnormal(this.a,this.b,this.c,a)};ga.prototype.getplane=function(a){void 0===a&&(console.warn("three.triangle: .getplane() target is now required"), a=new na);return a.setfromcoplanarpoints(this.a,this.b,this.c)};ga.prototype.getbarycoord=function(a,b){return ga.getbarycoord(a,this.a,this.b,this.c,b)};ga.prototype.getuv=function(a,b,d,e,f){return ga.getuv(a,this.a,this.b,this.c,b,d,e,f)};ga.prototype.containspoint=function(a){return ga.containspoint(a,this.a,this.b,this.c)};ga.prototype.isfrontfacing=function(a){return ga.isfrontfacing(this.a,this.b,this.c,a)};ga.prototype.intersectsbox=function(a){return a.intersectstriangle(this)};ga.prototype.closestpointtopoint= function(a,b){void 0===b&&(console.warn("three.triangle: .closestpointtopoint() target is now required"),b=new w);var d=this.a,e=this.b,f=this.c;ue.subvectors(e,d);ve.subvectors(f,d);ei.subvectors(a,d);var g=ue.dot(ei),h=ve.dot(ei);if(0>=g&&0>=h)return b.copy(d);fi.subvectors(a,e);var k=ue.dot(fi),l=ve.dot(fi);if(0<=k&&l<=k)return b.copy(e);var m=g*l-k*h;if(0>=m&&0<=g&&0>=k)return e=g/(g-k),b.copy(d).addscaledvector(ue,e);gi.subvectors(a,f);a=ue.dot(gi);var n=ve.dot(gi);if(0<=n&&a<=n)return b.copy(f); g=a*h-g*n;if(0>=g&&0<=h&&0>=n)return m=h/(h-n),b.copy(d).addscaledvector(ve,m);h=k*n-a*l;if(0>=h&&0<=l-k&&0<=a-n)return cj.subvectors(f,e),m=(l-k)/(l-k+(a-n)),b.copy(e).addscaledvector(cj,m);f=1/(h+g+m);e=g*f;m*=f;return b.copy(d).addscaledvector(ue,e).addscaledvector(ve,m)};ga.prototype.equals=function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)};var dj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0, blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347, darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365, lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683, mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910, purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074}, bb={h:0,s:0,l:0},ig={h:0,s:0,l:0},s=function(a,b,d){object.defineproperty(this,"iscolor",{value:!0});return void 0===b&&void 0===d?this.set(a):this.setrgb(a,b,d)};s.prototype.set=function(a){a&&a.iscolor?this.copy(a):"number"===typeof a?this.sethex(a):"string"===typeof a&&this.setstyle(a);return this};s.prototype.setscalar=function(a){this.b=this.g=this.r=a;return this};s.prototype.sethex=function(a){a=math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this};s.prototype.setrgb= function(a,b,d){this.r=a;this.g=b;this.b=d;return this};s.prototype.sethsl=function(a,b,d){a=xa.euclideanmodulo(a,1);b=xa.clamp(b,0,1);d=xa.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=fh(d,b,a+1/3),this.g=fh(d,b,a),this.b=fh(d,b,a-1/3));return this};s.prototype.setstyle=function(a){function b(h){void 0!==h&&1>parsefloat(h)&&console.warn("three.color: alpha component of "+a+" will be ignored.")}var d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e=d[2];switch(d[1]){case "rgb":case "rgba":if(d= /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e))return this.r=math.min(255,parseint(d[1],10))/255,this.g=math.min(255,parseint(d[2],10))/255,this.b=math.min(255,parseint(d[3],10))/255,b(d[5]),this;if(d=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e))return this.r=math.min(100,parseint(d[1],10))/100,this.g=math.min(100,parseint(d[2],10))/100,this.b=math.min(100,parseint(d[3],10))/100,b(d[5]),this;break;case "hsl":case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e)){e= parsefloat(d[1])/360;var f=parseint(d[2],10)/100,g=parseint(d[3],10)/100;b(d[5]);return this.sethsl(e,f,g)}}}else if(d=/^#([a-fa-f0-9]+)$/.exec(a)){d=d[1];e=d.length;if(3===e)return this.r=parseint(d.charat(0)+d.charat(0),16)/255,this.g=parseint(d.charat(1)+d.charat(1),16)/255,this.b=parseint(d.charat(2)+d.charat(2),16)/255,this;if(6===e)return this.r=parseint(d.charat(0)+d.charat(1),16)/255,this.g=parseint(d.charat(2)+d.charat(3),16)/255,this.b=parseint(d.charat(4)+d.charat(5),16)/255,this}return a&& 0=k?l/(f+g):l/(2-f-g);switch(f){case b:h=(d-e)/l+(dthis.opacity&&(e.opacity=this.opacity);!0===this.transparent&&(e.transparent=this.transparent);e.depthfunc=this.depthfunc;e.depthtest=this.depthtest;e.depthwrite=this.depthwrite;e.stencilwrite=this.stencilwrite;e.stencilwritemask= this.stencilwritemask;e.stencilfunc=this.stencilfunc;e.stencilref=this.stencilref;e.stencilfuncmask=this.stencilfuncmask;e.stencilfail=this.stencilfail;e.stencilzfail=this.stencilzfail;e.stencilzpass=this.stencilzpass;this.rotation&&0!==this.rotation&&(e.rotation=this.rotation);!0===this.polygonoffset&&(e.polygonoffset=!0);0!==this.polygonoffsetfactor&&(e.polygonoffsetfactor=this.polygonoffsetfactor);0!==this.polygonoffsetunits&&(e.polygonoffsetunits=this.polygonoffsetunits);this.linewidth&&1!==this.linewidth&& (e.linewidth=this.linewidth);void 0!==this.dashsize&&(e.dashsize=this.dashsize);void 0!==this.gapsize&&(e.gapsize=this.gapsize);void 0!==this.scale&&(e.scale=this.scale);!0===this.dithering&&(e.dithering=!0);0h;h++)if(g[h]===g[(h+1)%3]){a.push(e);break}for(d=a.length-1;0<=d;d--)for(e=a[d],this.faces.splice(e,1),f=0,g=this.facevertexuvs.length;f\n\t\t\t\t#include \n\n\t\t\t}\n\t\t", fragmentshader:"\n\n\t\t\tuniform sampler2d tequirect;\n\n\t\t\tvarying vec3 vworlddirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vworlddirection );\n\n\t\t\t\tvec2 sampleuv = equirectuv( direction );\n\n\t\t\t\tgl_fragcolor = texture2d( tequirect, sampleuv );\n\n\t\t\t}\n\t\t",side:1,blending:0});e.uniforms.tequirect.value=b;d=new qa(d,e);e=b.minfilter;1008===b.minfilter&&(b.minfilter=1006);(new hd(1,10,this)).update(a,d);b.minfilter=e;d.geometry.dispose(); d.material.dispose();return this};bd.prototype=object.create(oa.prototype);bd.prototype.constructor=bd;bd.prototype.isdatatexture=!0;var xe=new wa,lg=new w,xb=function(a,b,d,e,f,g){this.planes=[void 0!==a?a:new na,void 0!==b?b:new na,void 0!==d?d:new na,void 0!==e?e:new na,void 0!==f?f:new na,void 0!==g?g:new na]};xb.prototype.set=function(a,b,d,e,f,g){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(d);h[3].copy(e);h[4].copy(f);h[5].copy(g);return this};xb.prototype.clone=function(){return(new this.constructor).copy(this)}; xb.prototype.copy=function(a){for(var b=this.planes,d=0;6>d;d++)b[d].copy(a.planes[d]);return this};xb.prototype.setfromprojectionmatrix=function(a){var b=this.planes,d=a.elements;a=d[0];var e=d[1],f=d[2],g=d[3],h=d[4],k=d[5],l=d[6],m=d[7],n=d[8],p=d[9],t=d[10],q=d[11],v=d[12],u=d[13],a=d[14];d=d[15];b[0].setcomponents(g-a,m-h,q-n,d-v).normalize();b[1].setcomponents(g+a,m+h,q+n,d+v).normalize();b[2].setcomponents(g+e,m+k,q+p,d+u).normalize();b[3].setcomponents(g-e,m-k,q-p,d-u).normalize();b[4].setcomponents(g- f,m-l,q-t,d-a).normalize();b[5].setcomponents(g+f,m+l,q+t,d+a).normalize();return this};xb.prototype.intersectsobject=function(a){var b=a.geometry;null===b.boundingsphere&&b.computeboundingsphere();xe.copy(b.boundingsphere).applymatrix4(a.matrixworld);return this.intersectssphere(xe)};xb.prototype.intersectssprite=function(a){xe.center.set(0,0,0);xe.radius=.7071067811865476;xe.applymatrix4(a.matrixworld);return this.intersectssphere(xe)};xb.prototype.intersectssphere=function(a){var b=this.planes, d=a.center;a=-a.radius;for(var e=0;6>e;e++)if(b[e].distancetopoint(d)d;d++){var e=b[d];lg.x=0e.distancetopoint(lg))return!1}return!0};xb.prototype.containspoint=function(a){for(var b=this.planes,d=0;6>d;d++)if(0>b[d].distancetopoint(a))return!1;return!0};je.prototype=object.create(sa.prototype);je.prototype.constructor= je;cd.prototype=object.create(ka.prototype);cd.prototype.constructor=cd;var ba={alphamap_fragment:"#ifdef use_alphamap\n\tdiffusecolor.a *= texture2d( alphamap, vuv ).g;\n#endif",alphamap_pars_fragment:"#ifdef use_alphamap\n\tuniform sampler2d alphamap;\n#endif",alphatest_fragment:"#ifdef alphatest\n\tif ( diffusecolor.a < alphatest ) discard;\n#endif",aomap_fragment:"#ifdef use_aomap\n\tfloat ambientocclusion = ( texture2d( aomap, vuv2 ).r - 1.0 ) * aomapintensity + 1.0;\n\treflectedlight.indirectdiffuse *= ambientocclusion;\n\t#if defined( use_envmap ) && defined( standard )\n\t\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\t\treflectedlight.indirectspecular *= computespecularocclusion( dotnv, ambientocclusion, material.specularroughness );\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef use_aomap\n\tuniform sampler2d aomap;\n\tuniform float aomapintensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectnormal = vec3( normal );\n#ifdef use_tangent\n\tvec3 objecttangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integratespecularbrdf( const in float dotnv, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctuallightintensitytoirradiancefactor( const in float lightdistance, const in float cutoffdistance, const in float decayexponent ) {\n#if defined ( physically_correct_lights )\n\tfloat distancefalloff = 1.0 / max( pow( lightdistance, decayexponent ), 0.01 );\n\tif( cutoffdistance > 0.0 ) {\n\t\tdistancefalloff *= pow2( saturate( 1.0 - pow4( lightdistance / cutoffdistance ) ) );\n\t}\n\treturn distancefalloff;\n#else\n\tif( cutoffdistance > 0.0 && decayexponent > 0.0 ) {\n\t\treturn pow( saturate( -lightdistance / cutoffdistance + 1.0 ), decayexponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 f_schlick_roughnessdependent( const in vec3 f0, const in float dotnv, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotnv - 6.98316 ) * dotnv );\n\tvec3 fr = max( vec3( 1.0 - roughness ), f0 ) - f0;\n\treturn fr * fresnel + f0;\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 vec3 viewdir, const in vec3 normal, const in vec3 specularcolor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfdir = normalize( incidentlight.direction + viewdir );\n\tfloat dotnl = saturate( dot( normal, incidentlight.direction ) );\n\tfloat dotnv = saturate( dot( normal, viewdir ) );\n\tfloat dotnh = saturate( dot( 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 ltc_uv( const in vec3 n, const in vec3 v, 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\tfloat dotnv = saturate( dot( n, v ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotnv ) );\n\tuv = uv * lut_scale + lut_bias;\n\treturn uv;\n}\nfloat ltc_clippedsphereformfactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 ltc_edgevectorformfactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 ltc_evaluate( const in vec3 n, const in vec3 v, const in vec3 p, const in mat3 minv, const in vec3 rectcoords[ 4 ] ) {\n\tvec3 v1 = rectcoords[ 1 ] - rectcoords[ 0 ];\n\tvec3 v2 = rectcoords[ 3 ] - rectcoords[ 0 ];\n\tvec3 lightnormal = cross( v1, v2 );\n\tif( dot( lightnormal, p - rectcoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 t1, t2;\n\tt1 = normalize( v - n * dot( v, n ) );\n\tt2 = - cross( n, t1 );\n\tmat3 mat = minv * transposemat3( mat3( t1, t2, n ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectcoords[ 0 ] - p );\n\tcoords[ 1 ] = mat * ( rectcoords[ 1 ] - p );\n\tcoords[ 2 ] = mat * ( rectcoords[ 2 ] - p );\n\tcoords[ 3 ] = mat * ( rectcoords[ 3 ] - p );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorformfactor = vec3( 0.0 );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 0 ], coords[ 1 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 1 ], coords[ 2 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 2 ], coords[ 3 ] );\n\tvectorformfactor += ltc_edgevectorformfactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = ltc_clippedsphereformfactor( vectorformfactor );\n\treturn vec3( result );\n}\nvec3 brdf_specular_ggx_environment( const in vec3 viewdir, const in vec3 normal, const in vec3 specularcolor, const in float roughness ) {\n\tfloat dotnv = saturate( dot( normal, viewdir ) );\n\tvec2 brdf = integratespecularbrdf( dotnv, roughness );\n\treturn specularcolor * brdf.x + brdf.y;\n}\nvoid brdf_specular_multiscattering_environment( const in geometriccontext geometry, const in vec3 specularcolor, const in float roughness, inout vec3 singlescatter, inout vec3 multiscatter ) {\n\tfloat dotnv = saturate( dot( geometry.normal, geometry.viewdir ) );\n\tvec3 f = f_schlick_roughnessdependent( specularcolor, dotnv, roughness );\n\tvec2 brdf = integratespecularbrdf( dotnv, roughness );\n\tvec3 fssess = f * brdf.x + brdf.y;\n\tfloat ess = brdf.x + brdf.y;\n\tfloat ems = 1.0 - ess;\n\tvec3 favg = specularcolor + ( 1.0 - specularcolor ) * 0.047619;\tvec3 fms = fssess * favg / ( 1.0 - ems * favg );\n\tsinglescatter += fssess;\n\tmultiscatter += fms * ems;\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#if defined( use_sheen )\nfloat d_charlie(float roughness, float noh) {\n\tfloat invalpha = 1.0 / roughness;\n\tfloat cos2h = noh * noh;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invalpha) * pow(sin2h, invalpha * 0.5) / (2.0 * pi);\n}\nfloat v_neubelt(float nov, float nol) {\n\treturn saturate(1.0 / (4.0 * (nol + nov - nol * nov)));\n}\nvec3 brdf_specular_sheen( const in float roughness, const in vec3 l, const in geometriccontext geometry, vec3 specularcolor ) {\n\tvec3 n = geometry.normal;\n\tvec3 v = geometry.viewdir;\n\tvec3 h = normalize( v + l );\n\tfloat dotnh = saturate( dot( n, h ) );\n\treturn specularcolor * d_charlie( roughness, dotnh ) * v_neubelt( dot(n, v), dot(n, l) );\n}\n#endif", 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 = vec3( dfdx( surf_pos.x ), dfdx( surf_pos.y ), dfdx( surf_pos.z ) );\n\t\tvec3 vsigmay = vec3( dfdy( surf_pos.x ), dfdy( surf_pos.y ), dfdy( surf_pos.z ) );\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\tfdet *= ( float( gl_frontfacing ) * 2.0 - 1.0 );\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", clipping_planes_fragment:"#if num_clipping_planes > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < union_clipping_planes; i ++ ) {\n\t\tplane = clippingplanes[ i ];\n\t\tif ( dot( vclipposition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if union_clipping_planes < num_clipping_planes\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = union_clipping_planes; i < num_clipping_planes; i ++ ) {\n\t\t\tplane = clippingplanes[ i ];\n\t\t\tclipped = ( dot( vclipposition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if num_clipping_planes > 0\n\tvarying vec3 vclipposition;\n\tuniform vec4 clippingplanes[ num_clipping_planes ];\n#endif",clipping_planes_pars_vertex:"#if num_clipping_planes > 0\n\tvarying vec3 vclipposition;\n#endif",clipping_planes_vertex:"#if num_clipping_planes > 0\n\tvclipposition = - mvposition.xyz;\n#endif",color_fragment:"#ifdef use_color\n\tdiffusecolor.rgb *= vcolor;\n#endif",color_pars_fragment:"#ifdef use_color\n\tvarying vec3 vcolor;\n#endif",color_pars_vertex:"#if defined( use_color ) || defined( use_instancing_color )\n\tvarying vec3 vcolor;\n#endif", color_vertex:"#if defined( use_color ) || defined( use_instancing_color )\n\tvcolor = vec3( 1.0 );\n#endif\n#ifdef use_color\n\tvcolor.xyz *= color.xyz;\n#endif\n#ifdef use_instancing_color\n\tvcolor.xyz *= instancecolor.xyz;\n#endif",common:"#define pi 3.141592653589793\n#define pi2 6.283185307179586\n#define pi_half 1.5707963267948966\n#define reciprocal_pi 0.3183098861837907\n#define reciprocal_pi2 0.15915494309189535\n#define epsilon 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whitecomplement(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}\n#ifdef high_precision\n\tfloat precisionsafelength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionsafelength( vec3 v ) {\n\t\tfloat maxcomponent = max3( abs( v ) );\n\t\treturn length( v / maxcomponent ) * maxcomponent;\n\t}\n#endif\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#ifdef clearcoat\n\tvec3 clearcoatnormal;\n#endif\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 transposemat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat lineartorelativeluminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isperspectivematrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectuv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * reciprocal_pi2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * reciprocal_pi + 0.5;\n\treturn vec2( u, v );\n}", cube_uv_reflection_fragment:"#ifdef envmap_type_cube_uv\n\t#define cubeuv_maxmiplevel 8.0\n\t#define cubeuv_minmiplevel 4.0\n\t#define cubeuv_maxtilesize 256.0\n\t#define cubeuv_mintilesize 16.0\n\tfloat getface( vec3 direction ) {\n\t\tvec3 absdirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absdirection.x > absdirection.z ) {\n\t\t\tif ( absdirection.x > absdirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absdirection.z > absdirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getuv( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearcubeuv( sampler2d envmap, vec3 direction, float mipint ) {\n\t\tfloat face = getface( direction );\n\t\tfloat filterint = max( cubeuv_minmiplevel - mipint, 0.0 );\n\t\tmipint = max( mipint, cubeuv_minmiplevel );\n\t\tfloat facesize = exp2( mipint );\n\t\tfloat texelsize = 1.0 / ( 3.0 * cubeuv_maxtilesize );\n\t\tvec2 uv = getuv( direction, face ) * ( facesize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += facesize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * facesize;\n\t\tif ( mipint < cubeuv_maxmiplevel ) {\n\t\t\tuv.y += 2.0 * cubeuv_maxtilesize;\n\t\t}\n\t\tuv.y += filterint * 2.0 * cubeuv_mintilesize;\n\t\tuv.x += 3.0 * max( 0.0, cubeuv_maxtilesize - 2.0 * facesize );\n\t\tuv *= texelsize;\n\t\tvec3 tl = envmaptexeltolinear( texture2d( envmap, uv ) ).rgb;\n\t\tuv.x += texelsize;\n\t\tvec3 tr = envmaptexeltolinear( texture2d( envmap, uv ) ).rgb;\n\t\tuv.y += texelsize;\n\t\tvec3 br = envmaptexeltolinear( texture2d( envmap, uv ) ).rgb;\n\t\tuv.x -= texelsize;\n\t\tvec3 bl = envmaptexeltolinear( texture2d( envmap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnesstomip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 texturecubeuv( sampler2d envmap, vec3 sampledir, float roughness ) {\n\t\tfloat mip = clamp( roughnesstomip( roughness ), m0, cubeuv_maxmiplevel );\n\t\tfloat mipf = fract( mip );\n\t\tfloat mipint = floor( mip );\n\t\tvec3 color0 = bilinearcubeuv( envmap, sampledir, mipint );\n\t\tif ( mipf == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearcubeuv( envmap, sampledir, mipint + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipf ), 1.0 );\n\t\t}\n\t}\n#endif", defaultnormal_vertex:"vec3 transformednormal = objectnormal;\n#ifdef use_instancing\n\tmat3 m = mat3( instancematrix );\n\ttransformednormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformednormal = m * transformednormal;\n#endif\ntransformednormal = normalmatrix * transformednormal;\n#ifdef flip_sided\n\ttransformednormal = - transformednormal;\n#endif\n#ifdef use_tangent\n\tvec3 transformedtangent = ( modelviewmatrix * vec4( objecttangent, 0.0 ) ).xyz;\n\t#ifdef flip_sided\n\t\ttransformedtangent = - transformedtangent;\n\t#endif\n#endif", displacementmap_pars_vertex:"#ifdef use_displacementmap\n\tuniform sampler2d displacementmap;\n\tuniform float displacementscale;\n\tuniform float displacementbias;\n#endif",displacementmap_vertex:"#ifdef use_displacementmap\n\ttransformed += normalize( objectnormal ) * ( texture2d( displacementmap, vuv ).x * displacementscale + displacementbias );\n#endif",emissivemap_fragment:"#ifdef use_emissivemap\n\tvec4 emissivecolor = texture2d( emissivemap, vuv );\n\temissivecolor.rgb = emissivemaptexeltolinear( emissivecolor ).rgb;\n\ttotalemissiveradiance *= emissivecolor.rgb;\n#endif", emissivemap_pars_fragment:"#ifdef use_emissivemap\n\tuniform sampler2d emissivemap;\n#endif",encodings_fragment:"gl_fragcolor = lineartooutputtexel( gl_fragcolor );",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.rgb, vec3( gammafactor ) ), value.a );\n}\nvec4 lineartogamma( in vec4 value, in float gammafactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammafactor ) ), value.a );\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.a );\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.a );\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.rgb * value.a * maxrange, 1.0 );\n}\nvec4 lineartorgbm( in vec4 value, in float maxrange ) {\n\tfloat maxrgb = max( value.r, 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.r, max( value.g, value.b ) );\n\tfloat d = max( maxrange / maxrgb, 1.0 );\n\td = clamp( floor( d ) / 255.0, 0.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 = clogluvm * value.rgb;\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 = clogluvinversem * xp_y_xyzp.rgb;\n\treturn vec4( max( vrgb, 0.0 ), 1.0 );\n}", envmap_fragment:"#ifdef use_envmap\n\t#ifdef env_worldpos\n\t\tvec3 cameratofrag;\n\t\tif ( isorthographic ) {\n\t\t\tcameratofrag = normalize( vec3( - viewmatrix[ 0 ][ 2 ], - viewmatrix[ 1 ][ 2 ], - viewmatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameratofrag = normalize( vworldposition - cameraposition );\n\t\t}\n\t\tvec3 worldnormal = inversetransformdirection( normal, viewmatrix );\n\t\t#ifdef envmap_mode_reflection\n\t\t\tvec3 reflectvec = reflect( cameratofrag, worldnormal );\n\t\t#else\n\t\t\tvec3 reflectvec = refract( cameratofrag, 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, vec3( flipenvmap * reflectvec.x, reflectvec.yz ) );\n\t#elif defined( envmap_type_cube_uv )\n\t\tvec4 envcolor = texturecubeuv( envmap, reflectvec, 0.0 );\n\t#else\n\t\tvec4 envcolor = vec4( 0.0 );\n\t#endif\n\t#ifndef envmap_type_cube_uv\n\t\tenvcolor = envmaptexeltolinear( envcolor );\n\t#endif\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", envmap_common_pars_fragment:"#ifdef use_envmap\n\tuniform float envmapintensity;\n\tuniform float flipenvmap;\n\tuniform int maxmiplevel;\n\t#ifdef envmap_type_cube\n\t\tuniform samplercube envmap;\n\t#else\n\t\tuniform sampler2d envmap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef use_envmap\n\tuniform float reflectivity;\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) || defined( phong )\n\t\t#define env_worldpos\n\t#endif\n\t#ifdef env_worldpos\n\t\tvarying vec3 vworldposition;\n\t\tuniform float refractionratio;\n\t#else\n\t\tvarying vec3 vreflect;\n\t#endif\n#endif", envmap_pars_vertex:"#ifdef use_envmap\n\t#if defined( use_bumpmap ) || defined( use_normalmap ) ||defined( phong )\n\t\t#define env_worldpos\n\t#endif\n\t#ifdef env_worldpos\n\t\t\n\t\tvarying vec3 vworldposition;\n\t#else\n\t\tvarying vec3 vreflect;\n\t\tuniform float refractionratio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( use_envmap )\n\t#ifdef envmap_mode_refraction\n\t\tuniform float refractionratio;\n\t#endif\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\tvec4 envmapcolor = texturecubeuv( envmap, worldnormal, 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 roughness, const in int maxmiplevel ) {\n\t\tfloat maxmiplevelscalar = float( maxmiplevel );\n\t\tfloat sigma = pi * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredmiplevel = maxmiplevelscalar + log2( sigma );\n\t\treturn clamp( desiredmiplevel, 0.0, maxmiplevelscalar );\n\t}\n\tvec3 getlightprobeindirectradiance( const in vec3 viewdir, const in vec3 normal, const in float roughness, const in int maxmiplevel ) {\n\t\t#ifdef envmap_mode_reflection\n\t\t\tvec3 reflectvec = reflect( -viewdir, normal );\n\t\t\treflectvec = normalize( mix( reflectvec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectvec = refract( -viewdir, normal, refractionratio );\n\t\t#endif\n\t\treflectvec = inversetransformdirection( reflectvec, viewmatrix );\n\t\tfloat specularmiplevel = getspecularmiplevel( roughness, 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\tvec4 envmapcolor = texturecubeuv( envmap, reflectvec, roughness );\n\t\t#endif\n\t\treturn envmapcolor.rgb * envmapintensity;\n\t}\n#endif", envmap_vertex:"#ifdef use_envmap\n\t#ifdef env_worldpos\n\t\tvworldposition = worldposition.xyz;\n\t#else\n\t\tvec3 cameratovertex;\n\t\tif ( isorthographic ) {\n\t\t\tcameratovertex = normalize( vec3( - viewmatrix[ 0 ][ 2 ], - viewmatrix[ 1 ][ 2 ], - viewmatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameratovertex = normalize( worldposition.xyz - cameraposition );\n\t\t}\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", fog_vertex:"#ifdef use_fog\n\tfogdepth = - mvposition.z;\n#endif",fog_pars_vertex:"#ifdef use_fog\n\tvarying float fogdepth;\n#endif",fog_fragment:"#ifdef use_fog\n\t#ifdef fog_exp2\n\t\tfloat fogfactor = 1.0 - exp( - fogdensity * fogdensity * fogdepth * fogdepth );\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",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", gradientmap_pars_fragment:"#ifdef use_gradientmap\n\tuniform sampler2d gradientmap;\n#endif\nvec3 getgradientirradiance( vec3 normal, vec3 lightdirection ) {\n\tfloat dotnl = dot( normal, lightdirection );\n\tvec2 coord = vec2( dotnl * 0.5 + 0.5, 0.0 );\n\t#ifdef use_gradientmap\n\t\treturn texture2d( gradientmap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef use_lightmap\n\tvec4 lightmaptexel= texture2d( lightmap, vuv2 );\n\treflectedlight.indirectdiffuse += pi * lightmaptexeltolinear( lightmaptexel ).rgb * lightmapintensity;\n#endif", 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 = ( isorthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvposition.xyz );\ngeometriccontext backgeometry;\nbackgeometry.position = geometry.position;\nbackgeometry.normal = -geometry.normal;\nbackgeometry.viewdir = geometry.viewdir;\nvlightfront = vec3( 0.0 );\nvindirectfront = vec3( 0.0 );\n#ifdef double_sided\n\tvlightback = vec3( 0.0 );\n\tvindirectback = vec3( 0.0 );\n#endif\nincidentlight directlight;\nfloat dotnl;\nvec3 directlightcolor_diffuse;\nvindirectfront += getambientlightirradiance( ambientlightcolor );\nvindirectfront += getlightprobeirradiance( lightprobe, geometry );\n#ifdef double_sided\n\tvindirectback += getambientlightirradiance( ambientlightcolor );\n\tvindirectback += getlightprobeirradiance( lightprobe, backgeometry );\n#endif\n#if num_point_lights > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if num_spot_lights > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if num_dir_lights > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if num_hemi_lights > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_hemi_lights; i ++ ) {\n\t\tvindirectfront += gethemispherelightirradiance( hemispherelights[ i ], geometry );\n\t\t#ifdef double_sided\n\t\t\tvindirectback += gethemispherelightirradiance( hemispherelights[ i ], backgeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif", lights_pars_begin:"uniform bool receiveshadow;\nuniform vec3 ambientlightcolor;\nuniform vec3 lightprobe[ 9 ];\nvec3 shgetirradianceat( in vec3 normal, in vec3 shcoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shcoefficients[ 0 ] * 0.886227;\n\tresult += shcoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shcoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shcoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shcoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shcoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shcoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shcoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shcoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getlightprobeirradiance( const in vec3 lightprobe[ 9 ], const in geometriccontext geometry ) {\n\tvec3 worldnormal = inversetransformdirection( geometry.normal, viewmatrix );\n\tvec3 irradiance = shgetirradianceat( worldnormal, lightprobe );\n\treturn irradiance;\n}\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};\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};\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};\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 ltc_1;\tuniform sampler2d ltc_2;\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", lights_toon_fragment:"toonmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb;",lights_toon_pars_fragment:"varying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\nstruct toonmaterial {\n\tvec3 diffusecolor;\n};\nvoid re_direct_toon( const in incidentlight directlight, const in geometriccontext geometry, const in toonmaterial material, inout reflectedlight reflectedlight ) {\n\tvec3 irradiance = getgradientirradiance( geometry.normal, directlight.direction ) * directlight.color;\n\t#ifndef physically_correct_lights\n\t\tirradiance *= pi;\n\t#endif\n\treflectedlight.directdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n}\nvoid re_indirectdiffuse_toon( const in vec3 irradiance, const in geometriccontext geometry, const in toonmaterial material, inout reflectedlight reflectedlight ) {\n\treflectedlight.indirectdiffuse += irradiance * brdf_diffuse_lambert( material.diffusecolor );\n}\n#define re_direct\t\t\t\tre_direct_toon\n#define re_indirectdiffuse\t\tre_indirectdiffuse_toon\n#define material_lightprobelod( material )\t(0)", lights_phong_fragment:"blinnphongmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb;\nmaterial.specularcolor = specular;\nmaterial.specularshininess = shininess;\nmaterial.specularstrength = specularstrength;",lights_phong_pars_fragment:"varying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n#endif\nstruct blinnphongmaterial {\n\tvec3 diffusecolor;\n\tvec3 specularcolor;\n\tfloat specularshininess;\n\tfloat specularstrength;\n};\nvoid re_direct_blinnphong( const in incidentlight directlight, const in geometriccontext geometry, const in blinnphongmaterial 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\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_indirectdiffuse\t\tre_indirectdiffuse_blinnphong\n#define material_lightprobelod( material )\t(0)", lights_physical_fragment:"physicalmaterial material;\nmaterial.diffusecolor = diffusecolor.rgb * ( 1.0 - metalnessfactor );\nvec3 dxy = max( abs( dfdx( geometrynormal ) ), abs( dfdy( geometrynormal ) ) );\nfloat geometryroughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularroughness = max( roughnessfactor, 0.0525 );material.specularroughness += geometryroughness;\nmaterial.specularroughness = min( material.specularroughness, 1.0 );\n#ifdef reflectivity\n\tmaterial.specularcolor = mix( vec3( maximum_specular_coefficient * pow2( reflectivity ) ), diffusecolor.rgb, metalnessfactor );\n#else\n\tmaterial.specularcolor = mix( vec3( default_specular_coefficient ), diffusecolor.rgb, metalnessfactor );\n#endif\n#ifdef clearcoat\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatroughness = clearcoatroughness;\n\t#ifdef use_clearcoatmap\n\t\tmaterial.clearcoat *= texture2d( clearcoatmap, vuv ).x;\n\t#endif\n\t#ifdef use_clearcoat_roughnessmap\n\t\tmaterial.clearcoatroughness *= texture2d( clearcoatroughnessmap, vuv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatroughness = max( material.clearcoatroughness, 0.0525 );\n\tmaterial.clearcoatroughness += geometryroughness;\n\tmaterial.clearcoatroughness = min( material.clearcoatroughness, 1.0 );\n#endif\n#ifdef use_sheen\n\tmaterial.sheencolor = sheen;\n#endif", lights_physical_pars_fragment:"struct physicalmaterial {\n\tvec3 diffusecolor;\n\tfloat specularroughness;\n\tvec3 specularcolor;\n#ifdef clearcoat\n\tfloat clearcoat;\n\tfloat clearcoatroughness;\n#endif\n#ifdef use_sheen\n\tvec3 sheencolor;\n#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 normal = geometry.normal;\n\t\tvec3 viewdir = geometry.viewdir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightpos = rectarealight.position;\n\t\tvec3 halfwidth = rectarealight.halfwidth;\n\t\tvec3 halfheight = rectarealight.halfheight;\n\t\tvec3 lightcolor = rectarealight.color;\n\t\tfloat roughness = material.specularroughness;\n\t\tvec3 rectcoords[ 4 ];\n\t\trectcoords[ 0 ] = lightpos + halfwidth - halfheight;\t\trectcoords[ 1 ] = lightpos - halfwidth - halfheight;\n\t\trectcoords[ 2 ] = lightpos - halfwidth + halfheight;\n\t\trectcoords[ 3 ] = lightpos + halfwidth + halfheight;\n\t\tvec2 uv = ltc_uv( normal, viewdir, roughness );\n\t\tvec4 t1 = texture2d( ltc_1, uv );\n\t\tvec4 t2 = texture2d( ltc_2, uv );\n\t\tmat3 minv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularcolor * t2.x + ( vec3( 1.0 ) - material.specularcolor ) * t2.y );\n\t\treflectedlight.directspecular += lightcolor * fresnel * ltc_evaluate( normal, viewdir, position, minv, rectcoords );\n\t\treflectedlight.directdiffuse += lightcolor * material.diffusecolor * ltc_evaluate( normal, viewdir, position, mat3( 1.0 ), rectcoords );\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#ifdef clearcoat\n\t\tfloat ccdotnl = saturate( dot( geometry.clearcoatnormal, directlight.direction ) );\n\t\tvec3 ccirradiance = ccdotnl * directlight.color;\n\t\t#ifndef physically_correct_lights\n\t\t\tccirradiance *= pi;\n\t\t#endif\n\t\tfloat clearcoatdhr = material.clearcoat * clearcoatdhrapprox( material.clearcoatroughness, ccdotnl );\n\t\treflectedlight.directspecular += ccirradiance * material.clearcoat * brdf_specular_ggx( directlight, geometry.viewdir, geometry.clearcoatnormal, vec3( default_specular_coefficient ), material.clearcoatroughness );\n\t#else\n\t\tfloat clearcoatdhr = 0.0;\n\t#endif\n\t#ifdef use_sheen\n\t\treflectedlight.directspecular += ( 1.0 - clearcoatdhr ) * irradiance * brdf_specular_sheen(\n\t\t\tmaterial.specularroughness,\n\t\t\tdirectlight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheencolor\n\t\t);\n\t#else\n\t\treflectedlight.directspecular += ( 1.0 - clearcoatdhr ) * irradiance * brdf_specular_ggx( directlight, geometry.viewdir, geometry.normal, material.specularcolor, material.specularroughness);\n\t#endif\n\treflectedlight.directdiffuse += ( 1.0 - clearcoatdhr ) * irradiance * brdf_diffuse_lambert( material.diffusecolor );\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 irradiance, const in vec3 clearcoatradiance, const in geometriccontext geometry, const in physicalmaterial material, inout reflectedlight reflectedlight) {\n\t#ifdef clearcoat\n\t\tfloat ccdotnv = saturate( dot( geometry.clearcoatnormal, geometry.viewdir ) );\n\t\treflectedlight.indirectspecular += clearcoatradiance * material.clearcoat * brdf_specular_ggx_environment( geometry.viewdir, geometry.clearcoatnormal, vec3( default_specular_coefficient ), material.clearcoatroughness );\n\t\tfloat ccdotnl = ccdotnv;\n\t\tfloat clearcoatdhr = material.clearcoat * clearcoatdhrapprox( material.clearcoatroughness, ccdotnl );\n\t#else\n\t\tfloat clearcoatdhr = 0.0;\n\t#endif\n\tfloat clearcoatinv = 1.0 - clearcoatdhr;\n\tvec3 singlescattering = vec3( 0.0 );\n\tvec3 multiscattering = vec3( 0.0 );\n\tvec3 cosineweightedirradiance = irradiance * reciprocal_pi;\n\tbrdf_specular_multiscattering_environment( geometry, material.specularcolor, material.specularroughness, singlescattering, multiscattering );\n\tvec3 diffuse = material.diffusecolor * ( 1.0 - ( singlescattering + multiscattering ) );\n\treflectedlight.indirectspecular += clearcoatinv * radiance * singlescattering;\n\treflectedlight.indirectspecular += multiscattering * cosineweightedirradiance;\n\treflectedlight.indirectdiffuse += diffuse * cosineweightedirradiance;\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\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}", lights_fragment_begin:"\ngeometriccontext geometry;\ngeometry.position = - vviewposition;\ngeometry.normal = normal;\ngeometry.viewdir = ( isorthographic ) ? vec3( 0, 0, 1 ) : normalize( vviewposition );\n#ifdef clearcoat\n\tgeometry.clearcoatnormal = clearcoatnormal;\n#endif\nincidentlight directlight;\n#if ( num_point_lights > 0 ) && defined( re_direct )\n\tpointlight pointlight;\n\t#if defined( use_shadowmap ) && num_point_light_shadows > 0\n\tpointlightshadow pointlightshadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_point_lights; i ++ ) {\n\t\tpointlight = pointlights[ i ];\n\t\tgetpointdirectlightirradiance( pointlight, geometry, directlight );\n\t\t#if defined( use_shadowmap ) && ( unrolled_loop_index < num_point_light_shadows )\n\t\tpointlightshadow = pointlightshadows[ i ];\n\t\tdirectlight.color *= all( bvec2( directlight.visible, receiveshadow ) ) ? getpointshadow( pointshadowmap[ i ], pointlightshadow.shadowmapsize, pointlightshadow.shadowbias, pointlightshadow.shadowradius, vpointshadowcoord[ i ], pointlightshadow.shadowcameranear, pointlightshadow.shadowcamerafar ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( num_spot_lights > 0 ) && defined( re_direct )\n\tspotlight spotlight;\n\t#if defined( use_shadowmap ) && num_spot_light_shadows > 0\n\tspotlightshadow spotlightshadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_spot_lights; i ++ ) {\n\t\tspotlight = spotlights[ i ];\n\t\tgetspotdirectlightirradiance( spotlight, geometry, directlight );\n\t\t#if defined( use_shadowmap ) && ( unrolled_loop_index < num_spot_light_shadows )\n\t\tspotlightshadow = spotlightshadows[ i ];\n\t\tdirectlight.color *= all( bvec2( directlight.visible, receiveshadow ) ) ? getshadow( spotshadowmap[ i ], spotlightshadow.shadowmapsize, spotlightshadow.shadowbias, spotlightshadow.shadowradius, vspotshadowcoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( num_dir_lights > 0 ) && defined( re_direct )\n\tdirectionallight directionallight;\n\t#if defined( use_shadowmap ) && num_dir_light_shadows > 0\n\tdirectionallightshadow directionallightshadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_dir_lights; i ++ ) {\n\t\tdirectionallight = directionallights[ i ];\n\t\tgetdirectionaldirectlightirradiance( directionallight, geometry, directlight );\n\t\t#if defined( use_shadowmap ) && ( unrolled_loop_index < num_dir_light_shadows )\n\t\tdirectionallightshadow = directionallightshadows[ i ];\n\t\tdirectlight.color *= all( bvec2( directlight.visible, receiveshadow ) ) ? getshadow( directionalshadowmap[ i ], directionallightshadow.shadowmapsize, directionallightshadow.shadowbias, directionallightshadow.shadowradius, vdirectionalshadowcoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tre_direct( directlight, geometry, material, reflectedlight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( num_rect_area_lights > 0 ) && defined( re_direct_rectarea )\n\trectarealight rectarealight;\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if defined( re_indirectdiffuse )\n\tvec3 iblirradiance = vec3( 0.0 );\n\tvec3 irradiance = getambientlightirradiance( ambientlightcolor );\n\tirradiance += getlightprobeirradiance( lightprobe, geometry );\n\t#if ( num_hemi_lights > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < num_hemi_lights; i ++ ) {\n\t\t\tirradiance += gethemispherelightirradiance( hemispherelights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( re_indirectspecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatradiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( re_indirectdiffuse )\n\t#ifdef use_lightmap\n\t\tvec4 lightmaptexel= texture2d( lightmap, vuv2 );\n\t\tvec3 lightmapirradiance = lightmaptexeltolinear( lightmaptexel ).rgb * 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 defined( use_envmap ) && defined( standard ) && defined( envmap_type_cube_uv )\n\t\tiblirradiance += getlightprobeindirectirradiance( geometry, maxmiplevel );\n\t#endif\n#endif\n#if defined( use_envmap ) && defined( re_indirectspecular )\n\tradiance += getlightprobeindirectradiance( geometry.viewdir, geometry.normal, material.specularroughness, maxmiplevel );\n\t#ifdef clearcoat\n\t\tclearcoatradiance += getlightprobeindirectradiance( geometry.viewdir, geometry.clearcoatnormal, material.clearcoatroughness, maxmiplevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( re_indirectdiffuse )\n\tre_indirectdiffuse( irradiance, geometry, material, reflectedlight );\n#endif\n#if defined( re_indirectspecular )\n\tre_indirectspecular( radiance, iblirradiance, clearcoatradiance, geometry, material, reflectedlight );\n#endif",logdepthbuf_fragment:"#if defined( use_logdepthbuf ) && defined( use_logdepthbuf_ext )\n\tgl_fragdepthext = visperspective == 0.0 ? gl_fragcoord.z : log2( vfragdepth ) * logdepthbuffc * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( use_logdepthbuf ) && defined( use_logdepthbuf_ext )\n\tuniform float logdepthbuffc;\n\tvarying float vfragdepth;\n\tvarying float visperspective;\n#endif", logdepthbuf_pars_vertex:"#ifdef use_logdepthbuf\n\t#ifdef use_logdepthbuf_ext\n\t\tvarying float vfragdepth;\n\t\tvarying float visperspective;\n\t#else\n\t\tuniform float logdepthbuffc;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef use_logdepthbuf\n\t#ifdef use_logdepthbuf_ext\n\t\tvfragdepth = 1.0 + gl_position.w;\n\t\tvisperspective = float( isperspectivematrix( projectionmatrix ) );\n\t#else\n\t\tif ( isperspectivematrix( projectionmatrix ) ) {\n\t\t\tgl_position.z = log2( max( epsilon, gl_position.w + 1.0 ) ) * logdepthbuffc - 1.0;\n\t\t\tgl_position.z *= gl_position.w;\n\t\t}\n\t#endif\n#endif", map_fragment:"#ifdef use_map\n\tvec4 texelcolor = texture2d( map, vuv );\n\ttexelcolor = maptexeltolinear( texelcolor );\n\tdiffusecolor *= texelcolor;\n#endif",map_pars_fragment:"#ifdef use_map\n\tuniform sampler2d map;\n#endif",map_particle_fragment:"#if defined( use_map ) || defined( use_alphamap )\n\tvec2 uv = ( uvtransform * vec3( gl_pointcoord.x, 1.0 - gl_pointcoord.y, 1 ) ).xy;\n#endif\n#ifdef use_map\n\tvec4 maptexel = texture2d( map, uv );\n\tdiffusecolor *= maptexeltolinear( maptexel );\n#endif\n#ifdef use_alphamap\n\tdiffusecolor.a *= texture2d( alphamap, uv ).g;\n#endif", map_particle_pars_fragment:"#if defined( use_map ) || defined( use_alphamap )\n\tuniform mat3 uvtransform;\n#endif\n#ifdef use_map\n\tuniform sampler2d map;\n#endif\n#ifdef use_alphamap\n\tuniform sampler2d alphamap;\n#endif",metalnessmap_fragment:"float metalnessfactor = metalness;\n#ifdef use_metalnessmap\n\tvec4 texelmetalness = texture2d( metalnessmap, vuv );\n\tmetalnessfactor *= texelmetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef use_metalnessmap\n\tuniform sampler2d metalnessmap;\n#endif", morphnormal_vertex:"#ifdef use_morphnormals\n\tobjectnormal *= morphtargetbaseinfluence;\n\tobjectnormal += morphnormal0 * morphtargetinfluences[ 0 ];\n\tobjectnormal += morphnormal1 * morphtargetinfluences[ 1 ];\n\tobjectnormal += morphnormal2 * morphtargetinfluences[ 2 ];\n\tobjectnormal += morphnormal3 * morphtargetinfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef use_morphtargets\n\tuniform float morphtargetbaseinfluence;\n\t#ifndef use_morphnormals\n\t\tuniform float morphtargetinfluences[ 8 ];\n\t#else\n\t\tuniform float morphtargetinfluences[ 4 ];\n\t#endif\n#endif", morphtarget_vertex:"#ifdef use_morphtargets\n\ttransformed *= morphtargetbaseinfluence;\n\ttransformed += morphtarget0 * morphtargetinfluences[ 0 ];\n\ttransformed += morphtarget1 * morphtargetinfluences[ 1 ];\n\ttransformed += morphtarget2 * morphtargetinfluences[ 2 ];\n\ttransformed += morphtarget3 * morphtargetinfluences[ 3 ];\n\t#ifndef use_morphnormals\n\t\ttransformed += morphtarget4 * morphtargetinfluences[ 4 ];\n\t\ttransformed += morphtarget5 * morphtargetinfluences[ 5 ];\n\t\ttransformed += morphtarget6 * morphtargetinfluences[ 6 ];\n\t\ttransformed += morphtarget7 * morphtargetinfluences[ 7 ];\n\t#endif\n#endif", normal_fragment_begin:"#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 );\n\t#ifdef double_sided\n\t\tnormal = normal * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef use_tangent\n\t\tvec3 tangent = normalize( vtangent );\n\t\tvec3 bitangent = normalize( vbitangent );\n\t\t#ifdef double_sided\n\t\t\ttangent = tangent * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( tangentspace_normalmap ) || defined( use_clearcoat_normalmap )\n\t\t\tmat3 vtbn = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometrynormal = normal;", normal_fragment_maps:"#ifdef objectspace_normalmap\n\tnormal = texture2d( normalmap, vuv ).xyz * 2.0 - 1.0;\n\t#ifdef flip_sided\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef double_sided\n\t\tnormal = normal * ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalmatrix * normal );\n#elif defined( tangentspace_normalmap )\n\tvec3 mapn = texture2d( normalmap, vuv ).xyz * 2.0 - 1.0;\n\tmapn.xy *= normalscale;\n\t#ifdef use_tangent\n\t\tnormal = normalize( vtbn * mapn );\n\t#else\n\t\tnormal = perturbnormal2arb( -vviewposition, normal, mapn );\n\t#endif\n#elif defined( use_bumpmap )\n\tnormal = perturbnormalarb( -vviewposition, normal, dhdxy_fwd() );\n#endif", normalmap_pars_fragment:"#ifdef use_normalmap\n\tuniform sampler2d normalmap;\n\tuniform vec2 normalscale;\n#endif\n#ifdef objectspace_normalmap\n\tuniform mat3 normalmatrix;\n#endif\n#if ! defined ( use_tangent ) && ( defined ( tangentspace_normalmap ) || defined ( use_clearcoat_normalmap ) )\n\tvec3 perturbnormal2arb( vec3 eye_pos, vec3 surf_norm, vec3 mapn ) {\n\t\tvec3 q0 = vec3( dfdx( eye_pos.x ), dfdx( eye_pos.y ), dfdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dfdy( eye_pos.x ), dfdy( eye_pos.y ), dfdy( eye_pos.z ) );\n\t\tvec2 st0 = dfdx( vuv.st );\n\t\tvec2 st1 = dfdy( vuv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 s = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 t = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 n = normalize( surf_norm );\n\t\tmat3 tsn = mat3( s, t, n );\n\t\tmapn.xy *= ( float( gl_frontfacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapn );\n\t}\n#endif", clearcoat_normal_fragment_begin:"#ifdef clearcoat\n\tvec3 clearcoatnormal = geometrynormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef use_clearcoat_normalmap\n\tvec3 clearcoatmapn = texture2d( clearcoatnormalmap, vuv ).xyz * 2.0 - 1.0;\n\tclearcoatmapn.xy *= clearcoatnormalscale;\n\t#ifdef use_tangent\n\t\tclearcoatnormal = normalize( vtbn * clearcoatmapn );\n\t#else\n\t\tclearcoatnormal = perturbnormal2arb( - vviewposition, clearcoatnormal, clearcoatmapn );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef use_clearcoatmap\n\tuniform sampler2d clearcoatmap;\n#endif\n#ifdef use_clearcoat_roughnessmap\n\tuniform sampler2d clearcoatroughnessmap;\n#endif\n#ifdef use_clearcoat_normalmap\n\tuniform sampler2d clearcoatnormalmap;\n\tuniform vec2 clearcoatnormalscale;\n#endif", packing:"vec3 packnormaltorgb( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackrgbtonormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\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}\nvec4 pack2halftorgba( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackrgbato2half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\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}", premultiplied_alpha_fragment:"#ifdef premultiplied_alpha\n\tgl_fragcolor.rgb *= gl_fragcolor.a;\n#endif",project_vertex:"vec4 mvposition = vec4( transformed, 1.0 );\n#ifdef use_instancing\n\tmvposition = instancematrix * mvposition;\n#endif\nmvposition = modelviewmatrix * mvposition;\ngl_position = projectionmatrix * mvposition;",dithering_fragment:"#ifdef dithering\n\tgl_fragcolor.rgb = dithering( gl_fragcolor.rgb );\n#endif",dithering_pars_fragment:"#ifdef 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", roughnessmap_fragment:"float roughnessfactor = roughness;\n#ifdef use_roughnessmap\n\tvec4 texelroughness = texture2d( roughnessmap, vuv );\n\troughnessfactor *= texelroughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef use_roughnessmap\n\tuniform sampler2d roughnessmap;\n#endif",shadowmap_pars_fragment:"#ifdef use_shadowmap\n\t#if num_dir_light_shadows > 0\n\t\tuniform sampler2d directionalshadowmap[ num_dir_light_shadows ];\n\t\tvarying vec4 vdirectionalshadowcoord[ num_dir_light_shadows ];\n\t\tstruct directionallightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t};\n\t\tuniform directionallightshadow directionallightshadows[ num_dir_light_shadows ];\n\t#endif\n\t#if num_spot_light_shadows > 0\n\t\tuniform sampler2d spotshadowmap[ num_spot_light_shadows ];\n\t\tvarying vec4 vspotshadowcoord[ num_spot_light_shadows ];\n\t\tstruct spotlightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t};\n\t\tuniform spotlightshadow spotlightshadows[ num_spot_light_shadows ];\n\t#endif\n\t#if num_point_light_shadows > 0\n\t\tuniform sampler2d pointshadowmap[ num_point_light_shadows ];\n\t\tvarying vec4 vpointshadowcoord[ num_point_light_shadows ];\n\t\tstruct pointlightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t\tfloat shadowcameranear;\n\t\t\tfloat shadowcamerafar;\n\t\t};\n\t\tuniform pointlightshadow pointlightshadows[ num_point_light_shadows ];\n\t#endif\n\tfloat texture2dcompare( sampler2d depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackrgbatodepth( texture2d( depths, uv ) ) );\n\t}\n\tvec2 texture2ddistribution( sampler2d shadow, vec2 uv ) {\n\t\treturn unpackrgbato2half( texture2d( shadow, uv ) );\n\t}\n\tfloat vsmshadow (sampler2d shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2ddistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getshadow( sampler2d shadowmap, vec2 shadowmapsize, float shadowbias, float shadowradius, vec4 shadowcoord ) {\n\t\tfloat shadow = 1.0;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\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( dx2, dy2 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 0.0, dy2 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx3, dy2 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx0, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx2, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy, shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( 0.0, dy3 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, shadowcoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( shadowmap_type_pcf_soft )\n\t\t\tvec2 texelsize = vec2( 1.0 ) / shadowmapsize;\n\t\t\tfloat dx = texelsize.x;\n\t\t\tfloat dy = texelsize.y;\n\t\t\tvec2 uv = shadowcoord.xy;\n\t\t\tvec2 f = fract( uv * shadowmapsize + 0.5 );\n\t\t\tuv -= f * texelsize;\n\t\t\tshadow = (\n\t\t\t\ttexture2dcompare( shadowmap, uv, shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, uv + vec2( dx, 0.0 ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, uv + vec2( 0.0, dy ), shadowcoord.z ) +\n\t\t\t\ttexture2dcompare( shadowmap, uv + texelsize, shadowcoord.z ) +\n\t\t\t\tmix( texture2dcompare( shadowmap, uv + vec2( -dx, 0.0 ), shadowcoord.z ), \n\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( 2.0 * dx, 0.0 ), shadowcoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2dcompare( shadowmap, uv + vec2( -dx, dy ), shadowcoord.z ), \n\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( 2.0 * dx, dy ), shadowcoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2dcompare( shadowmap, uv + vec2( 0.0, -dy ), shadowcoord.z ), \n\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( 0.0, 2.0 * dy ), shadowcoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2dcompare( shadowmap, uv + vec2( dx, -dy ), shadowcoord.z ), \n\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( dx, 2.0 * dy ), shadowcoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2dcompare( shadowmap, uv + vec2( -dx, -dy ), shadowcoord.z ), \n\t\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( 2.0 * dx, -dy ), shadowcoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2dcompare( shadowmap, uv + vec2( -dx, 2.0 * dy ), shadowcoord.z ), \n\t\t\t\t\t\t texture2dcompare( shadowmap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowcoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( shadowmap_type_vsm )\n\t\t\tshadow = vsmshadow( shadowmap, shadowcoord.xy, shadowcoord.z );\n\t\t#else\n\t\t\tshadow = texture2dcompare( shadowmap, shadowcoord.xy, shadowcoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\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, float shadowcameranear, float shadowcamerafar ) {\n\t\tvec2 texelsize = vec2( 1.0 ) / ( shadowmapsize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lighttoposition = shadowcoord.xyz;\n\t\tfloat dp = ( length( lighttoposition ) - shadowcameranear ) / ( shadowcamerafar - shadowcameranear );\t\tdp += shadowbias;\n\t\tvec3 bd3d = normalize( lighttoposition );\n\t\t#if defined( shadowmap_type_pcf ) || defined( shadowmap_type_pcf_soft ) || defined( shadowmap_type_vsm )\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", shadowmap_pars_vertex:"#ifdef use_shadowmap\n\t#if num_dir_light_shadows > 0\n\t\tuniform mat4 directionalshadowmatrix[ num_dir_light_shadows ];\n\t\tvarying vec4 vdirectionalshadowcoord[ num_dir_light_shadows ];\n\t\tstruct directionallightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t};\n\t\tuniform directionallightshadow directionallightshadows[ num_dir_light_shadows ];\n\t#endif\n\t#if num_spot_light_shadows > 0\n\t\tuniform mat4 spotshadowmatrix[ num_spot_light_shadows ];\n\t\tvarying vec4 vspotshadowcoord[ num_spot_light_shadows ];\n\t\tstruct spotlightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t};\n\t\tuniform spotlightshadow spotlightshadows[ num_spot_light_shadows ];\n\t#endif\n\t#if num_point_light_shadows > 0\n\t\tuniform mat4 pointshadowmatrix[ num_point_light_shadows ];\n\t\tvarying vec4 vpointshadowcoord[ num_point_light_shadows ];\n\t\tstruct pointlightshadow {\n\t\t\tfloat shadowbias;\n\t\t\tfloat shadownormalbias;\n\t\t\tfloat shadowradius;\n\t\t\tvec2 shadowmapsize;\n\t\t\tfloat shadowcameranear;\n\t\t\tfloat shadowcamerafar;\n\t\t};\n\t\tuniform pointlightshadow pointlightshadows[ num_point_light_shadows ];\n\t#endif\n#endif", shadowmap_vertex:"#ifdef use_shadowmap\n\t#if num_dir_light_shadows > 0 || num_spot_light_shadows > 0 || num_point_light_shadows > 0\n\t\tvec3 shadowworldnormal = inversetransformdirection( transformednormal, viewmatrix );\n\t\tvec4 shadowworldposition;\n\t#endif\n\t#if num_dir_light_shadows > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_dir_light_shadows; i ++ ) {\n\t\tshadowworldposition = worldposition + vec4( shadowworldnormal * directionallightshadows[ i ].shadownormalbias, 0 );\n\t\tvdirectionalshadowcoord[ i ] = directionalshadowmatrix[ i ] * shadowworldposition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if num_spot_light_shadows > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_spot_light_shadows; i ++ ) {\n\t\tshadowworldposition = worldposition + vec4( shadowworldnormal * spotlightshadows[ i ].shadownormalbias, 0 );\n\t\tvspotshadowcoord[ i ] = spotshadowmatrix[ i ] * shadowworldposition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if num_point_light_shadows > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_point_light_shadows; i ++ ) {\n\t\tshadowworldposition = worldposition + vec4( shadowworldnormal * pointlightshadows[ i ].shadownormalbias, 0 );\n\t\tvpointshadowcoord[ i ] = pointshadowmatrix[ i ] * shadowworldposition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif", shadowmask_pars_fragment:"float getshadowmask() {\n\tfloat shadow = 1.0;\n\t#ifdef use_shadowmap\n\t#if num_dir_light_shadows > 0\n\tdirectionallightshadow directionallight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_dir_light_shadows; i ++ ) {\n\t\tdirectionallight = directionallightshadows[ i ];\n\t\tshadow *= receiveshadow ? getshadow( directionalshadowmap[ i ], directionallight.shadowmapsize, directionallight.shadowbias, directionallight.shadowradius, vdirectionalshadowcoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if num_spot_light_shadows > 0\n\tspotlightshadow spotlight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_spot_light_shadows; i ++ ) {\n\t\tspotlight = spotlightshadows[ i ];\n\t\tshadow *= receiveshadow ? getshadow( spotshadowmap[ i ], spotlight.shadowmapsize, spotlight.shadowbias, spotlight.shadowradius, vspotshadowcoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if num_point_light_shadows > 0\n\tpointlightshadow pointlight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < num_point_light_shadows; i ++ ) {\n\t\tpointlight = pointlightshadows[ i ];\n\t\tshadow *= receiveshadow ? getpointshadow( pointshadowmap[ i ], pointlight.shadowmapsize, pointlight.shadowbias, pointlight.shadowradius, vpointshadowcoord[ i ], pointlight.shadowcameranear, pointlight.shadowcamerafar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\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 highp 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", 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\ttransformed = ( bindmatrixinverse * skinned ).xyz;\n#endif",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\t#ifdef use_tangent\n\t\tobjecttangent = vec4( skinmatrix * vec4( objecttangent, 0.0 ) ).xyz;\n\t#endif\n#endif", 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\tgl_fragcolor.rgb = tonemapping( gl_fragcolor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float tonemappingexposure;\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}\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}\nvec3 rrtandodtfit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 acesfilmictonemapping( vec3 color ) {\n\tconst mat3 acesinputmat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 acesoutputmat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= tonemappingexposure / 0.6;\n\tcolor = acesinputmat * color;\n\tcolor = rrtandodtfit( color );\n\tcolor = acesoutputmat * color;\n\treturn saturate( color );\n}\nvec3 customtonemapping( vec3 color ) { return color; }", transmissionmap_fragment:"#ifdef use_transmissionmap\n\ttotaltransmission *= texture2d( transmissionmap, vuv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef use_transmissionmap\n\tuniform sampler2d transmissionmap;\n#endif",uv_pars_fragment:"#if ( defined( use_uv ) && ! defined( uvs_vertex_only ) )\n\tvarying vec2 vuv;\n#endif",uv_pars_vertex:"#ifdef use_uv\n\t#ifdef uvs_vertex_only\n\t\tvec2 vuv;\n\t#else\n\t\tvarying vec2 vuv;\n\t#endif\n\tuniform mat3 uvtransform;\n#endif",uv_vertex:"#ifdef use_uv\n\tvuv = ( uvtransform * vec3( uv, 1 ) ).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\tuniform mat3 uv2transform;\n#endif",uv2_vertex:"#if defined( use_lightmap ) || defined( use_aomap )\n\tvuv2 = ( uv2transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( use_envmap ) || defined( distance ) || defined ( use_shadowmap )\n\tvec4 worldposition = vec4( transformed, 1.0 );\n\t#ifdef use_instancing\n\t\tworldposition = instancematrix * worldposition;\n\t#endif\n\tworldposition = modelmatrix * worldposition;\n#endif", background_frag:"uniform sampler2d t2d;\nvarying vec2 vuv;\nvoid main() {\n\tvec4 texcolor = texture2d( t2d, vuv );\n\tgl_fragcolor = maptexeltolinear( texcolor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vuv;\nuniform mat3 uvtransform;\nvoid main() {\n\tvuv = ( uvtransform * vec3( uv, 1 ) ).xy;\n\tgl_position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vworlddirection;\n#include \nvoid main() {\n\tvec3 vreflect = vworlddirection;\n\t#include \n\tgl_fragcolor = envcolor;\n\tgl_fragcolor.a *= opacity;\n\t#include \n\t#include \n}", cube_vert:"varying vec3 vworlddirection;\n#include \nvoid main() {\n\tvworlddirection = transformdirection( position, modelmatrix );\n\t#include \n\t#include \n\tgl_position.z = gl_position.w;\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 \nvarying vec2 vhighprecisionzw;\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\tfloat fragcoordz = 0.5 * vhighprecisionzw[0] / vhighprecisionzw[1] + 0.5;\n\t#if depth_packing == 3200\n\t\tgl_fragcolor = vec4( vec3( 1.0 - fragcoordz ), opacity );\n\t#elif depth_packing == 3201\n\t\tgl_fragcolor = packdepthtorgba( fragcoordz );\n\t#endif\n}", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vhighprecisionzw;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef use_displacementmap\n\t\t#include \n\t\t#include \n\t\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\tvhighprecisionzw = gl_position.zw;\n}", distancergba_frag:"#define distance\nuniform vec3 referenceposition;\nuniform float neardistance;\nuniform float fardistance;\nvarying vec3 vworldposition;\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#include \n\t#include \n\t#include \n\tfloat dist = length( vworldposition - referenceposition );\n\tdist = ( dist - neardistance ) / ( fardistance - neardistance );\n\tdist = saturate( dist );\n\tgl_fragcolor = packdepthtorgba( dist );\n}", distancergba_vert:"#define distance\nvarying vec3 vworldposition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef use_displacementmap\n\t\t#include \n\t\t#include \n\t\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\tvworldposition = worldposition.xyz;\n}", equirect_frag:"uniform sampler2d tequirect;\nvarying vec3 vworlddirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vworlddirection );\n\tvec2 sampleuv = equirectuv( direction );\n\tvec4 texcolor = texture2d( tequirect, sampleuv );\n\tgl_fragcolor = maptexeltolinear( texcolor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vworlddirection;\n#include \nvoid main() {\n\tvworlddirection = transformdirection( position, modelmatrix );\n\t#include \n\t#include \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}", linedashed_vert:"uniform float scale;\nattribute float linedistance;\nvarying float vlinedistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvlinedistance = scale * linedistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \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\n\t\tvec4 lightmaptexel= texture2d( lightmap, vuv2 );\n\t\treflectedlight.indirectdiffuse += lightmaptexeltolinear( lightmaptexel ).rgb * 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\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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}", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vlightfront;\nvarying vec3 vindirectfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n\tvarying vec3 vindirectback;\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 \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#ifdef double_sided\n\t\treflectedlight.indirectdiffuse += ( gl_frontfacing ) ? vindirectfront : vindirectback;\n\t#else\n\t\treflectedlight.indirectdiffuse += vindirectfront;\n\t#endif\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\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_vert:"#define lambert\nvarying vec3 vlightfront;\nvarying vec3 vindirectfront;\n#ifdef double_sided\n\tvarying vec3 vlightback;\n\tvarying vec3 vindirectback;\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}", meshmatcap_frag:"#define matcap\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2d matcap;\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 \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\t#include \n\tvec3 viewdir = normalize( vviewposition );\n\tvec3 x = normalize( vec3( viewdir.z, 0.0, - viewdir.x ) );\n\tvec3 y = cross( viewdir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef use_matcap\n\t\tvec4 matcapcolor = texture2d( matcap, uv );\n\t\tmatcapcolor = matcaptexeltolinear( matcapcolor );\n\t#else\n\t\tvec4 matcapcolor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoinglight = diffusecolor.rgb * matcapcolor.rgb;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_vert:"#define matcap\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 \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#ifndef flat_shaded\n\t\tvnormal = normalize( transformednormal );\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\tvviewposition = - mvposition.xyz;\n}", meshtoon_frag:"#define toon\nuniform vec3 diffuse;\nuniform vec3 emissive;\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 \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\tvec3 outgoinglight = reflectedlight.directdiffuse + reflectedlight.indirectdiffuse + totalemissiveradiance;\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshtoon_vert:"#define toon\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 \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}", 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 \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\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}", 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}", meshphysical_frag:"#define standard\n#ifdef physical\n\t#define reflectivity\n\t#define clearcoat\n\t#define transmission\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef transmission\n\tuniform float transmission;\n#endif\n#ifdef reflectivity\n\tuniform float reflectivity;\n#endif\n#ifdef clearcoat\n\tuniform float clearcoat;\n\tuniform float clearcoatroughness;\n#endif\n#ifdef use_sheen\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n\t#ifdef use_tangent\n\t\tvarying vec3 vtangent;\n\t\tvarying vec3 vbitangent;\n\t#endif\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 \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#ifdef transmission\n\t\tfloat totaltransmission = transmission;\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\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#ifdef transmission\n\t\tdiffusecolor.a *= saturate( 1. - totaltransmission + lineartorelativeluminance( reflectedlight.directspecular + reflectedlight.indirectspecular ) );\n\t#endif\n\tgl_fragcolor = vec4( outgoinglight, diffusecolor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_vert:"#define standard\nvarying vec3 vviewposition;\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n\t#ifdef use_tangent\n\t\tvarying vec3 vtangent;\n\t\tvarying vec3 vbitangent;\n\t#endif\n#endif\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\t#ifdef use_tangent\n\t\tvtangent = normalize( transformedtangent );\n\t\tvbitangent = normalize( cross( vnormal, vtangent ) * tangent.w );\n\t#endif\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}", normal_frag:"#define normal\nuniform float opacity;\n#if defined( flat_shaded ) || defined( use_bumpmap ) || defined( tangentspace_normalmap )\n\tvarying vec3 vviewposition;\n#endif\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n\t#ifdef use_tangent\n\t\tvarying vec3 vtangent;\n\t\tvarying vec3 vbitangent;\n\t#endif\n#endif\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\tgl_fragcolor = vec4( packnormaltorgb( normal ), opacity );\n}", normal_vert:"#define normal\n#if defined( flat_shaded ) || defined( use_bumpmap ) || defined( tangentspace_normalmap )\n\tvarying vec3 vviewposition;\n#endif\n#ifndef flat_shaded\n\tvarying vec3 vnormal;\n\t#ifdef use_tangent\n\t\tvarying vec3 vtangent;\n\t\tvarying vec3 vbitangent;\n\t#endif\n#endif\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#ifndef flat_shaded\n\tvnormal = normalize( transformednormal );\n\t#ifdef use_tangent\n\t\tvtangent = normalize( transformedtangent );\n\t\tvbitangent = normalize( cross( vnormal, vtangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \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( tangentspace_normalmap )\n\tvviewposition = - mvposition.xyz;\n#endif\n}", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}", 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#include \n\tgl_pointsize = size;\n\t#ifdef use_sizeattenuation\n\t\tbool isperspective = isperspectivematrix( projectionmatrix );\n\t\tif ( isperspective ) gl_pointsize *= ( scale / - mvposition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}", shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_fragcolor = vec4( color, opacity * ( 1.0 - getshadowmask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#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}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvposition = modelviewmatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelmatrix[ 0 ].x, modelmatrix[ 0 ].y, modelmatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelmatrix[ 1 ].x, modelmatrix[ 1 ].y, modelmatrix[ 1 ].z ) );\n\t#ifndef use_sizeattenuation\n\t\tbool isperspective = isperspectivematrix( projectionmatrix );\n\t\tif ( isperspective ) scale *= - mvposition.z;\n\t#endif\n\tvec2 alignedposition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedposition;\n\trotatedposition.x = cos( rotation ) * alignedposition.x - sin( rotation ) * alignedposition.y;\n\trotatedposition.y = sin( rotation ) * alignedposition.x + cos( rotation ) * alignedposition.y;\n\tmvposition.xy += rotatedposition;\n\tgl_position = projectionmatrix * mvposition;\n\t#include \n\t#include \n\t#include \n}"}, fa={common:{diffuse:{value:new s(15658734)},opacity:{value:1},map:{value:null},uvtransform:{value:new da},uv2transform:{value:new da},alphamap:{value:null}},specularmap:{specularmap:{value:null}},envmap:{envmap:{value:null},flipenvmap:{value:-1},reflectivity:{value:1},refractionratio:{value:.98},maxmiplevel:{value:0}},aomap:{aomap:{value:null},aomapintensity:{value:1}},lightmap:{lightmap:{value:null},lightmapintensity:{value:1}},emissivemap:{emissivemap:{value:null}},bumpmap:{bumpmap:{value:null}, bumpscale:{value:1}},normalmap:{normalmap:{value:null},normalscale:{value:new l(1,1)}},displacementmap:{displacementmap:{value:null},displacementscale:{value:1},displacementbias:{value:0}},roughnessmap:{roughnessmap:{value:null}},metalnessmap:{metalnessmap:{value:null}},gradientmap:{gradientmap:{value:null}},fog:{fogdensity:{value:2.5e-4},fognear:{value:1},fogfar:{value:2e3},fogcolor:{value:new s(16777215)}},lights:{ambientlightcolor:{value:[]},lightprobe:{value:[]},directionallights:{value:[],properties:{direction:{}, color:{}}},directionallightshadows:{value:[],properties:{shadowbias:{},shadownormalbias:{},shadowradius:{},shadowmapsize:{}}},directionalshadowmap:{value:[]},directionalshadowmatrix:{value:[]},spotlights:{value:[],properties:{color:{},position:{},direction:{},distance:{},conecos:{},penumbracos:{},decay:{}}},spotlightshadows:{value:[],properties:{shadowbias:{},shadownormalbias:{},shadowradius:{},shadowmapsize:{}}},spotshadowmap:{value:[]},spotshadowmatrix:{value:[]},pointlights:{value:[],properties:{color:{}, position:{},decay:{},distance:{}}},pointlightshadows:{value:[],properties:{shadowbias:{},shadownormalbias:{},shadowradius:{},shadowmapsize:{},shadowcameranear:{},shadowcamerafar:{}}},pointshadowmap:{value:[]},pointshadowmatrix:{value:[]},hemispherelights:{value:[],properties:{direction:{},skycolor:{},groundcolor:{}}},rectarealights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new s(15658734)},opacity:{value:1},size:{value:1}, scale:{value:1},map:{value:null},alphamap:{value:null},uvtransform:{value:new da}},sprite:{diffuse:{value:new s(15658734)},opacity:{value:1},center:{value:new l(.5,.5)},rotation:{value:0},map:{value:null},alphamap:{value:null},uvtransform:{value:new da}}},pb={basic:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.fog]),vertexshader:ba.meshbasic_vert,fragmentshader:ba.meshbasic_frag},lambert:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap, fa.fog,fa.lights,{emissive:{value:new s(0)}}]),vertexshader:ba.meshlambert_vert,fragmentshader:ba.meshlambert_frag},phong:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.fog,fa.lights,{emissive:{value:new s(0)},specular:{value:new s(1118481)},shininess:{value:30}}]),vertexshader:ba.meshphong_vert,fragmentshader:ba.meshphong_frag},standard:{uniforms:nb([fa.common,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap, fa.normalmap,fa.displacementmap,fa.roughnessmap,fa.metalnessmap,fa.fog,fa.lights,{emissive:{value:new s(0)},roughness:{value:1},metalness:{value:0},envmapintensity:{value:1}}]),vertexshader:ba.meshphysical_vert,fragmentshader:ba.meshphysical_frag},toon:{uniforms:nb([fa.common,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.gradientmap,fa.fog,fa.lights,{emissive:{value:new s(0)}}]),vertexshader:ba.meshtoon_vert,fragmentshader:ba.meshtoon_frag},matcap:{uniforms:nb([fa.common, fa.bumpmap,fa.normalmap,fa.displacementmap,fa.fog,{matcap:{value:null}}]),vertexshader:ba.meshmatcap_vert,fragmentshader:ba.meshmatcap_frag},points:{uniforms:nb([fa.points,fa.fog]),vertexshader:ba.points_vert,fragmentshader:ba.points_frag},dashed:{uniforms:nb([fa.common,fa.fog,{scale:{value:1},dashsize:{value:1},totalsize:{value:2}}]),vertexshader:ba.linedashed_vert,fragmentshader:ba.linedashed_frag},depth:{uniforms:nb([fa.common,fa.displacementmap]),vertexshader:ba.depth_vert,fragmentshader:ba.depth_frag}, normal:{uniforms:nb([fa.common,fa.bumpmap,fa.normalmap,fa.displacementmap,{opacity:{value:1}}]),vertexshader:ba.normal_vert,fragmentshader:ba.normal_frag},sprite:{uniforms:nb([fa.sprite,fa.fog]),vertexshader:ba.sprite_vert,fragmentshader:ba.sprite_frag},background:{uniforms:{uvtransform:{value:new da},t2d:{value:null}},vertexshader:ba.background_vert,fragmentshader:ba.background_frag},cube:{uniforms:nb([fa.envmap,{opacity:{value:1}}]),vertexshader:ba.cube_vert,fragmentshader:ba.cube_frag},equirect:{uniforms:{tequirect:{value:null}}, vertexshader:ba.equirect_vert,fragmentshader:ba.equirect_frag},distancergba:{uniforms:nb([fa.common,fa.displacementmap,{referenceposition:{value:new w},neardistance:{value:1},fardistance:{value:1e3}}]),vertexshader:ba.distancergba_vert,fragmentshader:ba.distancergba_frag},shadow:{uniforms:nb([fa.lights,fa.fog,{color:{value:new s(0)},opacity:{value:1}}]),vertexshader:ba.shadow_vert,fragmentshader:ba.shadow_frag}};pb.physical={uniforms:nb([pb.standard.uniforms,{clearcoat:{value:0},clearcoatmap:{value:null}, clearcoatroughness:{value:0},clearcoatroughnessmap:{value:null},clearcoatnormalscale:{value:new l(1,1)},clearcoatnormalmap:{value:null},sheen:{value:new s(0)},transmission:{value:0},transmissionmap:{value:null}}]),vertexshader:ba.meshphysical_vert,fragmentshader:ba.meshphysical_frag};kc.prototype=object.create(oa.prototype);kc.prototype.constructor=kc;kc.prototype.iscubetexture=!0;object.defineproperty(kc.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});id.prototype= object.create(oa.prototype);id.prototype.constructor=id;id.prototype.isdatatexture2darray=!0;jd.prototype=object.create(oa.prototype);jd.prototype.constructor=jd;jd.prototype.isdatatexture3d=!0;var ei=new oa,kk=new id,mk=new jd,fi=new kc,yi=[],ai=[],di=new float32array(16),ci=new float32array(9),bi=new float32array(4);gi.prototype.updatecache=function(a){var b=this.cache;a instanceof float32array&&b.length!==a.length&&(this.cache=new float32array(a.length));eb(b,a)};hi.prototype.setvalue=function(a, b,d){for(var e=this.seq,f=0,g=e.length;f!==g;++f){var h=e[f];h.setvalue(a,b[h.id],d)}};var lh=/([\w\d_]+)(\])?(\[|\.)?/g;dc.prototype.setvalue=function(a,b,d,e){b=this.map[b];void 0!==b&&b.setvalue(a,d,e)};dc.prototype.setoptional=function(a,b,d){b=b[d];void 0!==b&&this.setvalue(a,d,b)};dc.upload=function(a,b,d,e){for(var f=0,g=b.length;f!==g;++f){var h=b[f],k=d[h.id];!1!==k.needsupdate&&h.setvalue(a,k.value,e)}};dc.seqwithvalue=function(a,b){for(var d=[],e=0,f=a.length;e!==f;++e){var g=a[e];g.id in b&&d.push(g)}return d};var ql=0,nh=/^[ \t]*#include +<([\w\d./]+)>/gm,qi=/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\s]+?)(?=\})\}/g,pi=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\s]+?)}\s+#pragma unroll_loop_end/g,al=0;ec.prototype=object.create(ra.prototype);ec.prototype.constructor=ec;ec.prototype.ismeshdepthmaterial=!0;ec.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.depthpacking=a.depthpacking; this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.map=a.map;this.alphamap=a.alphamap;this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;return this};fc.prototype=object.create(ra.prototype);fc.prototype.constructor=fc;fc.prototype.ismeshdistancematerial=!0;fc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.referenceposition.copy(a.referenceposition); this.neardistance=a.neardistance;this.fardistance=a.fardistance;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.map=a.map;this.alphamap=a.alphamap;this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;return this};tf.prototype=object.assign(object.create(eb.prototype),{constructor:tf,isarraycamera:!0});gc.prototype=object.assign(object.create(ha.prototype),{constructor:gc,isgroup:!0});object.assign(me.prototype,{constructor:me, gethandspace:function(){if(null===this._hand&&(this._hand=new gc,this._hand.matrixautoupdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputstate={pinching:!1},window.xrhand))for(var a=0;a<=window.xrhand.little_phalanx_tip;a++){var b=new gc;b.matrixautoupdate=!1;b.visible=!1;this._hand.joints.push(b);this._hand.add(b)}return this._hand},gettargetrayspace:function(){null===this._targetray&&(this._targetray=new gc,this._targetray.matrixautoupdate=!1,this._targetray.visible=!1);return this._targetray}, getgripspace:function(){null===this._grip&&(this._grip=new gc,this._grip.matrixautoupdate=!1,this._grip.visible=!1);return this._grip},dispatchevent:function(a){null!==this._targetray&&this._targetray.dispatchevent(a);null!==this._grip&&this._grip.dispatchevent(a);null!==this._hand&&this._hand.dispatchevent(a);return this},disconnect:function(a){this.dispatchevent({type:"disconnected",data:a});null!==this._targetray&&(this._targetray.visible=!1);null!==this._grip&&(this._grip.visible=!1);null!==this._hand&& (this._hand.visible=!1);return this},update:function(a,b,d){var e=null,f=null,g=null,h=this._targetray,k=this._grip,l=this._hand;if(a)if(l&&a.hand){g=!0;for(var m=0;m<=window.xrhand.little_phalanx_tip;m++)if(a.hand[m]){var n=b.getjointpose(a.hand[m],d),p=l.joints[m];null!==n&&(p.matrix.fromarray(n.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointradius=n.radius);p.visible=null!==n;n=l.joints[window.xrhand.index_phalanx_tip].position.distanceto(l.joints[window.xrhand.thumb_phalanx_tip].position); l.inputstate.pinching&&.025=n&&(l.inputstate.pinching=!0,this.dispatchevent({type:"pinchstart",handedness:a.handedness,target:this}))}}else null!==h&&(e=b.getpose(a.targetrayspace,d),null!==e&&(h.matrix.fromarray(e.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale))),null!==k&&a.gripspace&&(f=b.getpose(a.gripspace,d),null!==f&&(k.matrix.fromarray(f.transform.matrix), k.matrix.decompose(k.position,k.rotation,k.scale)));null!==h&&(h.visible=null!==e);null!==k&&(k.visible=null!==f);null!==l&&(l.visible=null!==g);return this}});object.assign(wi.prototype,wb.prototype);th.prototype=object.assign(object.create(ne.prototype),{constructor:th,iswebgl1renderer:!0});var gf=function(a,b){object.defineproperty(this,"isfogexp2",{value:!0});this.name="";this.color=new s(a);this.density=void 0!==b?b:2.5e-4};gf.prototype.clone=function(){return new gf(this.color,this.density)}; gf.prototype.tojson=function(){return{type:"fogexp2",color:this.color.gethex(),density:this.density}};var hf=function(a,b,d){object.defineproperty(this,"isfog",{value:!0});this.name="";this.color=new s(a);this.near=void 0!==b?b:1;this.far=void 0!==d?d:1e3};hf.prototype.clone=function(){return new hf(this.color,this.near,this.far)};hf.prototype.tojson=function(){return{type:"fog",color:this.color.gethex(),near:this.near,far:this.far}};jc.prototype=object.create(ha.prototype);jc.prototype.constructor= jc;jc.prototype.copy=function(a,b){ha.prototype.copy.call(this,a,b);null!==a.background&&(this.background=a.background.clone());null!==a.environment&&(this.environment=a.environment.clone());null!==a.fog&&(this.fog=a.fog.clone());null!==a.overridematerial&&(this.overridematerial=a.overridematerial.clone());this.autoupdate=a.autoupdate;this.matrixautoupdate=a.matrixautoupdate;return this};jc.prototype.tojson=function(a){var b=ha.prototype.tojson.call(this,a);null!==this.background&&(b.object.background= this.background.tojson(a));null!==this.environment&&(b.object.environment=this.environment.tojson(a));null!==this.fog&&(b.object.fog=this.fog.tojson());return b};object.defineproperty(gb.prototype,"needsupdate",{set:function(a){!0===a&&this.version++}});object.assign(gb.prototype,{isinterleavedbuffer:!0,onuploadcallback:function(){},setusage:function(a){this.usage=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.usage=a.usage; return this},copyat:function(a,b,d){a*=this.stride;d*=b.stride;for(var e=0,f=this.stride;ea.far||b.push({distance:f,point:if.clone(),uv:ga.getuv(if,mg,jf,ng,fj,li,gj,new l),face:null,object:this})},copy:function(a){ha.prototype.copy.call(this, a);void 0!==a.center&&this.center.copy(a.center);this.material=a.material;return this}});var og=new w,hj=new w;se.prototype=object.assign(object.create(ha.prototype),{constructor:se,islod:!0,copy:function(a){ha.prototype.copy.call(this,a,!1);for(var b=a.levels,d=0,e=b.length;d=b[e].distance)b[e-1].object.visible=!1,b[e].object.visible=!0;else break;for(this._currentlevel=e-1;eg;g++)if(l=d.getcomponent(g),0!==l){var m=b.getcomponent(g);f.multiplymatrices(k.bones[m].matrixworld, k.boneinverses[m]);h.addscaledvector(e.copy(a).applymatrix4(f),l)}return h.applymatrix4(this.bindmatrixinverse)}}()});var ij=new da,vl=new da;object.assign(yf.prototype,{calculateinverses:function(){this.boneinverses=[];for(var a=0,b=this.bones.length;ae||(k.applymatrix4(this.matrixworld),t=a.ray.origin.distanceto(k),ta.far||b.push({distance:t,point:f.clone().applymatrix4(this.matrixworld),index:n,face:null,faceindex:null,object:this}))}}else for(m=0,n=d.length/3-1;me||(k.applymatrix4(this.matrixworld),p=a.ray.origin.distanceto(k),pa.far||b.push({distance:p,point:f.clone().applymatrix4(this.matrixworld),index:m,face:null,faceindex:null,object:this}))}else if(d.isgeometry)for(g=d.vertices,h=g.length,d=0;de||(k.applymatrix4(this.matrixworld),m=a.ray.origin.distanceto(k),ma.far||b.push({distance:m,point:f.clone().applymatrix4(this.matrixworld), index:d,face:null,faceindex:null,object:this}))}},updatemorphtargets:function(){var a=this.geometry;if(a.isbuffergeometry){a=a.morphattributes;var b=object.keys(a);if(0=a.have_current_data&&(this.needsupdate=!0)}});qd.prototype=object.create(oa.prototype);qd.prototype.constructor=qd;qd.prototype.iscompressedtexture=!0;te.prototype=object.create(oa.prototype);te.prototype.constructor=te;te.prototype.iscanvastexture=!0;ue.prototype=object.create(oa.prototype);ue.prototype.constructor=ue;ue.prototype.isdepthtexture=!0;rd.prototype=object.create(ka.prototype); rd.prototype.constructor=rd;ve.prototype=object.create(sa.prototype);ve.prototype.constructor=ve;sd.prototype=object.create(ka.prototype);sd.prototype.constructor=sd;we.prototype=object.create(sa.prototype);we.prototype.constructor=we;zb.prototype=object.create(ka.prototype);zb.prototype.constructor=zb;xe.prototype=object.create(sa.prototype);xe.prototype.constructor=xe;td.prototype=object.create(zb.prototype);td.prototype.constructor=td;ye.prototype=object.create(sa.prototype);ye.prototype.constructor= ye;fd.prototype=object.create(zb.prototype);fd.prototype.constructor=fd;ze.prototype=object.create(sa.prototype);ze.prototype.constructor=ze;ud.prototype=object.create(zb.prototype);ud.prototype.constructor=ud;$e.prototype=object.create(sa.prototype);$e.prototype.constructor=$e;vd.prototype=object.create(zb.prototype);vd.prototype.constructor=vd;af.prototype=object.create(sa.prototype);af.prototype.constructor=af;gd.prototype=object.create(ka.prototype);gd.prototype.constructor=gd;gd.prototype.tojson= function(){var a=ka.prototype.tojson.call(this);a.path=this.parameters.path.tojson();return a};bf.prototype=object.create(sa.prototype);bf.prototype.constructor=bf;wd.prototype=object.create(ka.prototype);wd.prototype.constructor=wd;cf.prototype=object.create(sa.prototype);cf.prototype.constructor=cf;xd.prototype=object.create(ka.prototype);xd.prototype.constructor=xd;var wl={triangulate:function(a,b,d){d=d||2;var e=b&&b.length,f=e?b[0]*d:a.length,g=bj(a,0,f,d,!0),h=[];if(!g||g.next===g.prev)return h; var k;if(e){var l=d;e=[];var m;var n=0;for(m=b.length;n80*d){var q=k=a[0];var v=e=a[1];for(l=d;lk&&(k=n),b>e&&(e=b);k=math.max(k-q,e-v);k=0!==k?1/k:0}ef(g,h,d,q,v,k);return h}},nc={area:function(a){for(var b=a.length,d=0, e=b-1,f=0;fnc.area(a)},triangulateshape:function(a,b){var d=[],e=[],f=[];fj(a);gj(d,a);a=a.length;b.foreach(fj);for(var g=0;gmath.abs(h-l)?[new l(a,1-d),new l(k,1-e),new l(m,1-f),new l(p,1-b)]:[new l(h,1-d),new l(l,1-e),new l(n,1-f),new l(t,1-b)]}};gf.prototype=object.create(sa.prototype);gf.prototype.constructor=gf;zd.prototype=object.create(bc.prototype);zd.prototype.constructor=zd;hf.prototype=object.create(sa.prototype);hf.prototype.constructor=hf;id.prototype=object.create(ka.prototype);id.prototype.constructor=id;jf.prototype=object.create(sa.prototype);jf.prototype.constructor= jf;$d.prototype=object.create(ka.prototype);$d.prototype.constructor=$d;kf.prototype=object.create(sa.prototype);kf.prototype.constructor=kf;ae.prototype=object.create(ka.prototype);ae.prototype.constructor=ae;jd.prototype=object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.tojson=function(){var a=sa.prototype.tojson.call(this);return ij(this.parameters.shapes,a)};kd.prototype=object.create(ka.prototype);kd.prototype.constructor=kd;kd.prototype.tojson=function(){var a=ka.prototype.tojson.call(this); return ij(this.parameters.shapes,a)};be.prototype=object.create(ka.prototype);be.prototype.constructor=be;ld.prototype=object.create(sa.prototype);ld.prototype.constructor=ld;oc.prototype=object.create(ka.prototype);oc.prototype.constructor=oc;lf.prototype=object.create(ld.prototype);lf.prototype.constructor=lf;mf.prototype=object.create(oc.prototype);mf.prototype.constructor=mf;nf.prototype=object.create(sa.prototype);nf.prototype.constructor=nf;ce.prototype=object.create(ka.prototype);ce.prototype.constructor= ce;var vb=object.freeze({__proto__:null,wireframegeometry:rd,parametricgeometry:ve,parametricbuffergeometry:sd,tetrahedrongeometry:xe,tetrahedronbuffergeometry:td,octahedrongeometry:ye,octahedronbuffergeometry:fd,icosahedrongeometry:ze,icosahedronbuffergeometry:ud,dodecahedrongeometry:$e,dodecahedronbuffergeometry:vd,polyhedrongeometry:we,polyhedronbuffergeometry:zb,tubegeometry:af,tubebuffergeometry:gd,torusknotgeometry:bf,torusknotbuffergeometry:wd,torusgeometry:cf,torusbuffergeometry:xd,textgeometry:gf, textbuffergeometry:zd,spheregeometry:hf,spherebuffergeometry:id,ringgeometry:jf,ringbuffergeometry:$d,planegeometry:je,planebuffergeometry:cd,lathegeometry:kf,lathebuffergeometry:ae,shapegeometry:jd,shapebuffergeometry:kd,extrudegeometry:hd,extrudebuffergeometry:bc,edgesgeometry:be,conegeometry:lf,conebuffergeometry:mf,cylindergeometry:ld,cylinderbuffergeometry:oc,circlegeometry:nf,circlebuffergeometry:ce,boxgeometry:fd,boxbuffergeometry:bc});md.prototype=object.create(ra.prototype);md.prototype.constructor= md;md.prototype.isshadowmaterial=!0;md.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);return this};pc.prototype=object.create(sb.prototype);pc.prototype.constructor=pc;pc.prototype.israwshadermaterial=!0;cc.prototype=object.create(ra.prototype);cc.prototype.constructor=cc;cc.prototype.ismeshstandardmaterial=!0;cc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.defines={standard:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness= a.metalness;this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias= a.displacementbias;this.roughnessmap=a.roughnessmap;this.metalnessmap=a.metalnessmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.envmapintensity=a.envmapintensity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;this.vertextangents=a.vertextangents;return this}; nc.prototype=object.create(cc.prototype);nc.prototype.constructor=nc;nc.prototype.ismeshphysicalmaterial=!0;nc.prototype.copy=function(a){cc.prototype.copy.call(this,a);this.defines={standard:"",physical:""};this.clearcoat=a.clearcoat;this.clearcoatmap=a.clearcoatmap;this.clearcoatroughness=a.clearcoatroughness;this.clearcoatroughnessmap=a.clearcoatroughnessmap;this.clearcoatnormalmap=a.clearcoatnormalmap;this.clearcoatnormalscale.copy(a.clearcoatnormalscale);this.reflectivity=a.reflectivity;this.sheen= a.sheen?(this.sheen||new s).copy(a.sheen):null;this.transmission=a.transmission;this.transmissionmap=a.transmissionmap;return this};oc.prototype=object.create(ra.prototype);oc.prototype.constructor=oc;oc.prototype.ismeshphongmaterial=!0;oc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity= a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.specularmap=a.specularmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.combine=a.combine;this.reflectivity= a.reflectivity;this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};nd.prototype=object.create(ra.prototype);nd.prototype.constructor=nd;nd.prototype.ismeshtoonmaterial=!0;nd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color); this.map=a.map;this.gradientmap=a.gradientmap;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale; this.displacementbias=a.displacementbias;this.alphamap=a.alphamap;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};od.prototype=object.create(ra.prototype);od.prototype.constructor=od;od.prototype.ismeshnormalmaterial=!0;od.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.bumpmap= a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};pd.prototype=object.create(ra.prototype);pd.prototype.constructor= pd;pd.prototype.ismeshlambertmaterial=!0;pd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightmap=a.lightmap;this.lightmapintensity=a.lightmapintensity;this.aomap=a.aomap;this.aomapintensity=a.aomapintensity;this.emissive.copy(a.emissive);this.emissivemap=a.emissivemap;this.emissiveintensity=a.emissiveintensity;this.specularmap=a.specularmap;this.alphamap=a.alphamap;this.envmap=a.envmap;this.combine=a.combine;this.reflectivity=a.reflectivity; this.refractionratio=a.refractionratio;this.wireframe=a.wireframe;this.wireframelinewidth=a.wireframelinewidth;this.wireframelinecap=a.wireframelinecap;this.wireframelinejoin=a.wireframelinejoin;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};qd.prototype=object.create(ra.prototype);qd.prototype.constructor=qd;qd.prototype.ismeshmatcapmaterial=!0;qd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.defines={matcap:""};this.color.copy(a.color); this.matcap=a.matcap;this.map=a.map;this.bumpmap=a.bumpmap;this.bumpscale=a.bumpscale;this.normalmap=a.normalmap;this.normalmaptype=a.normalmaptype;this.normalscale.copy(a.normalscale);this.displacementmap=a.displacementmap;this.displacementscale=a.displacementscale;this.displacementbias=a.displacementbias;this.alphamap=a.alphamap;this.skinning=a.skinning;this.morphtargets=a.morphtargets;this.morphnormals=a.morphnormals;return this};rd.prototype=object.create(ya.prototype);rd.prototype.constructor= rd;rd.prototype.islinedashedmaterial=!0;rd.prototype.copy=function(a){ya.prototype.copy.call(this,a);this.scale=a.scale;this.dashsize=a.dashsize;this.gapsize=a.gapsize;return this};var xl=object.freeze({__proto__:null,shadowmaterial:md,spritematerial:lc,rawshadermaterial:pc,shadermaterial:sb,pointsmaterial:rb,meshphysicalmaterial:nc,meshstandardmaterial:cc,meshphongmaterial:oc,meshtoonmaterial:nd,meshnormalmaterial:od,meshlambertmaterial:pd,meshdepthmaterial:ec,meshdistancematerial:fc,meshbasicmaterial:kb, meshmatcapmaterial:qd,linedashedmaterial:rd,linebasicmaterial:ya,material:ra}),va={arrayslice:function(a,b,d){return va.istypedarray(a)?new a.constructor(a.subarray(b,void 0!==d?d:a.length)):a.slice(b,d)},convertarray:function(a,b,d){return!a||!d&&a.constructor===b?a:"number"===typeof b.bytes_per_element?new b(a):array.prototype.slice.call(a)},istypedarray:function(a){return arraybuffer.isview(a)&&!(a instanceof dataview)},getkeyframeorder:function(a){for(var b=a.length,d=array(b),e=0;e!==b;++e)d[e]= e;d.sort(function(f,g){return a[f]-a[g]});return d},sortedarray:function(a,b,d){for(var e=a.length,f=new a.constructor(e),g=0,h=0;h!==e;++g)for(var k=d[g]*b,l=0;l!==b;++l)f[h++]=a[k+l];return f},flattenjson:function(a,b,d,e){for(var f=1,g=a[0];void 0!==g&&void 0===g[e];)g=a[f++];if(void 0!==g){var h=g[e];if(void 0!==h)if(array.isarray(h)){do h=g[e],void 0!==h&&(b.push(g.time),d.push.apply(d,h)),g=a[f++];while(void 0!==g)}else if(void 0!==h.toarray){do h=g[e],void 0!==h&&(b.push(g.time),h.toarray(d, d.length)),g=a[f++];while(void 0!==g)}else{do h=g[e],void 0!==h&&(b.push(g.time),d.push(h)),g=a[f++];while(void 0!==g)}}},subclip:function(a,b,d,e,f){f=f||30;a=a.clone();a.name=b;b=[];for(var g=0;g=e))for(l.push(h.times[n]),p=0;pa.tracks[e].times[0]&&(d=a.tracks[e].times[0]);for(e=0;e=e)e=30;var f=a.tracks.length,g=b/e;b=function(h){var k=d.tracks[h],l=k.valuetypename;if("bool"!==l&&"string"!==l&&(h=a.tracks.find(function(b){return b.name===k.name&&b.valuetypename===l}),void 0!==h)){var m=0,n=k.getvaluesize(); k.createinterpolant.isinterpolantfactorymethodgltfcubicspline&&(m=n/3);var p=0,t=h.getvaluesize();h.createinterpolant.isinterpolantfactorymethodgltfcubicspline&&(p=t/3);var q=k.times.length-1,v=void 0;g<=k.times[0]?v=va.arrayslice(k.values,m,n-m):g>=k.times[q]?(v=q*n+m,v=va.arrayslice(k.values,v,v+n-m)):(v=k.createinterpolant(),q=m,m=n-m,v.evaluate(g),v=va.arrayslice(v.resultbuffer,q,m));"quaternion"===l&&(new ua).fromarray(v).normalize().conjugate().toarray(v);m=h.times.length;for(n=0;n=f)break a; else{g=b[1];a=f)break b}e=d;d=0}}for(;d>>1,ab;)--g;++g;if(0!==f||g!==e)f>=g&&(g=math.max(g, 1),f=g-1),a=this.getvaluesize(),this.times=va.arrayslice(d,f,g),this.values=va.arrayslice(this.values,f*a,g*a);return this},validate:function(){var a=!0,b=this.getvaluesize();0!==b-math.floor(b)&&(console.error("three.keyframetrack: invalid value size in track.",this),a=!1);var d=this.times;b=this.values;var e=d.length;0===e&&(console.error("three.keyframetrack: track is empty.",this),a=!1);for(var f=null,g=0;g!==e;g++){var h=d[g];if("number"===typeof h&&isnan(h)){console.error("three.keyframetrack: time is not a valid number.", this,g,h);a=!1;break}if(null!==f&&f>h){console.error("three.keyframetrack: out of order keys.",this,g,h,f);a=!1;break}f=h}if(void 0!==b&&va.istypedarray(b))for(d=0,e=b.length;d!==e;++d)if(f=b[d],isnan(f)){console.error("three.keyframetrack: value is not a valid number.",this,d,f);a=!1;break}return a},optimize:function(){for(var a=va.arrayslice(this.times),b=va.arrayslice(this.values),d=this.getvaluesize(),e=2302===this.getinterpolation(),f=a.length-1,g=1,h=1;hh)f=a+1;else if(0d&&(d=0);1number.epsilon&&(h.normalize(), l=math.acos(xa.clamp(e[d-1].dot(e[d]),-1,1)),f[d].applymatrix4(k.makerotationaxis(h,l))),g[d].crossvectors(e[d],f[d]);if(!0===b)for(b=math.acos(xa.clamp(f[0].dot(f[a]),-1,1)),b/=a,0e;)e+=d;for(;e>d;)e-=d;ef&&(f=1);1e-4>e&&(e=f);1e-4>l&&(l=f);mi.initnonuniformcatmullrom(g.x,h.x,k.x,d.x, e,f,l);ni.initnonuniformcatmullrom(g.y,h.y,k.y,d.y,e,f,l);oi.initnonuniformcatmullrom(g.z,h.z,k.z,d.z,e,f,l)}else"catmullrom"===this.curvetype&&(mi.initcatmullrom(g.x,h.x,k.x,d.x,this.tension),ni.initcatmullrom(g.y,h.y,k.y,d.y,this.tension),oi.initcatmullrom(g.z,h.z,k.z,d.z,this.tension));b.set(mi.calc(a),ni.calc(a),oi.calc(a));return b};ob.prototype.copy=function(a){oa.prototype.copy.call(this,a);this.points=[];for(var b=0,d=a.points.length;bd.length-2?d.length-1:a+1];d=d[a>d.length-3?d.length-1:a+2];b.set(kj(e,f.x,g.x,h.x,d.x),kj(e,f.y,g.y,h.y,d.y));return b};vb.prototype.copy=function(a){oa.prototype.copy.call(this,a);this.points=[];for(var b=0,d=a.points.length;b=b)return b=d[a]-b,a=this.curves[a],d=a.getlength(),a.getpointat(0===d?0:1-b/d);a++}return null},getlength:function(){var a=this.getcurvelengths();return a[a.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 a=[],b=0,d=0,e=this.curves.length;da;a++)this.coefficients.push(new w)};pb.prototype.set=function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this};pb.prototype.zero=function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this};pb.prototype.getat=function(a,b){var d=a.x,e=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyscalar(.282095);b.addscaledvector(f[1],.488603*e); b.addscaledvector(f[2],.488603*a);b.addscaledvector(f[3],.488603*d);b.addscaledvector(f[4],1.092548*d*e);b.addscaledvector(f[5],1.092548*e*a);b.addscaledvector(f[6],.315392*(3*a*a-1));b.addscaledvector(f[7],1.092548*d*a);b.addscaledvector(f[8],.546274*(d*d-e*e));return b};pb.prototype.getirradianceat=function(a,b){var d=a.x,e=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyscalar(.886227);b.addscaledvector(f[1],1.023328*e);b.addscaledvector(f[2],1.023328*a);b.addscaledvector(f[3],1.023328* d);b.addscaledvector(f[4],.858086*d*e);b.addscaledvector(f[5],.858086*e*a);b.addscaledvector(f[6],.743125*a*a-.247708);b.addscaledvector(f[7],.858086*d*a);b.addscaledvector(f[8],.429043*(d*d-e*e));return b};pb.prototype.add=function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this};pb.prototype.addscaledsh=function(a,b){for(var d=0;9>d;d++)this.coefficients[d].addscaledvector(a.coefficients[d],b);return this};pb.prototype.scale=function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyscalar(a); return this};pb.prototype.lerp=function(a,b){for(var d=0;9>d;d++)this.coefficients[d].lerp(a.coefficients[d],b);return this};pb.prototype.equals=function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0};pb.prototype.copy=function(a){return this.set(a.coefficients)};pb.prototype.clone=function(){return(new this.constructor).copy(this)};pb.prototype.fromarray=function(a,b){void 0===b&&(b=0);for(var d=this.coefficients,e=0;9>e;e++)d[e].fromarray(a,b+3*e);return this}; pb.prototype.toarray=function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var d=this.coefficients,e=0;9>e;e++)d[e].toarray(a,b+3*e);return a};pb.getbasisat=function(a,b){var d=a.x,e=a.y;a=a.z;b[0]=.282095;b[1]=.488603*e;b[2]=.488603*a;b[3]=.488603*d;b[4]=1.092548*d*e;b[5]=1.092548*e*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*d*a;b[8]=.546274*(d*d-e*e)};ob.prototype=object.assign(object.create(sa.prototype),{constructor:ob,islightprobe:!0,copy:function(a){sa.prototype.copy.call(this,a);this.sh.copy(a.sh); return this},fromjson:function(a){this.intensity=a.intensity;this.sh.fromarray(a.sh);return this},tojson:function(a){a=sa.prototype.tojson.call(this,a);a.object.sh=this.sh.toarray();return a}});sg.prototype=object.assign(object.create(ma.prototype),{constructor:sg,load:function(a,b,d,e){var f=this,g=new nb(f.manager);g.setpath(f.path);g.setrequestheader(f.requestheader);g.load(a,function(h){try{b(f.parse(json.parse(h)))}catch(k){e?e(k):console.error(k),f.manager.itemerror(a)}},d,e)},parse:function(a){function b(k){void 0=== d[k]&&console.warn("three.materialloader: undefined texture",k);return d[k]}var d=this.textures,e=new xl[a.type];void 0!==a.uuid&&(e.uuid=a.uuid);void 0!==a.name&&(e.name=a.name);void 0!==a.color&&e.color.sethex(a.color);void 0!==a.roughness&&(e.roughness=a.roughness);void 0!==a.metalness&&(e.metalness=a.metalness);void 0!==a.sheen&&(e.sheen=(new s).sethex(a.sheen));void 0!==a.emissive&&e.emissive.sethex(a.emissive);void 0!==a.specular&&e.specular.sethex(a.specular);void 0!==a.shininess&&(e.shininess= a.shininess);void 0!==a.clearcoat&&(e.clearcoat=a.clearcoat);void 0!==a.clearcoatroughness&&(e.clearcoatroughness=a.clearcoatroughness);void 0!==a.fog&&(e.fog=a.fog);void 0!==a.flatshading&&(e.flatshading=a.flatshading);void 0!==a.blending&&(e.blending=a.blending);void 0!==a.combine&&(e.combine=a.combine);void 0!==a.side&&(e.side=a.side);void 0!==a.opacity&&(e.opacity=a.opacity);void 0!==a.transparent&&(e.transparent=a.transparent);void 0!==a.alphatest&&(e.alphatest=a.alphatest);void 0!==a.depthtest&& (e.depthtest=a.depthtest);void 0!==a.depthwrite&&(e.depthwrite=a.depthwrite);void 0!==a.colorwrite&&(e.colorwrite=a.colorwrite);void 0!==a.stencilwrite&&(e.stencilwrite=a.stencilwrite);void 0!==a.stencilwritemask&&(e.stencilwritemask=a.stencilwritemask);void 0!==a.stencilfunc&&(e.stencilfunc=a.stencilfunc);void 0!==a.stencilref&&(e.stencilref=a.stencilref);void 0!==a.stencilfuncmask&&(e.stencilfuncmask=a.stencilfuncmask);void 0!==a.stencilfail&&(e.stencilfail=a.stencilfail);void 0!==a.stencilzfail&& (e.stencilzfail=a.stencilzfail);void 0!==a.stencilzpass&&(e.stencilzpass=a.stencilzpass);void 0!==a.wireframe&&(e.wireframe=a.wireframe);void 0!==a.wireframelinewidth&&(e.wireframelinewidth=a.wireframelinewidth);void 0!==a.wireframelinecap&&(e.wireframelinecap=a.wireframelinecap);void 0!==a.wireframelinejoin&&(e.wireframelinejoin=a.wireframelinejoin);void 0!==a.rotation&&(e.rotation=a.rotation);1!==a.linewidth&&(e.linewidth=a.linewidth);void 0!==a.dashsize&&(e.dashsize=a.dashsize);void 0!==a.gapsize&& (e.gapsize=a.gapsize);void 0!==a.scale&&(e.scale=a.scale);void 0!==a.polygonoffset&&(e.polygonoffset=a.polygonoffset);void 0!==a.polygonoffsetfactor&&(e.polygonoffsetfactor=a.polygonoffsetfactor);void 0!==a.polygonoffsetunits&&(e.polygonoffsetunits=a.polygonoffsetunits);void 0!==a.skinning&&(e.skinning=a.skinning);void 0!==a.morphtargets&&(e.morphtargets=a.morphtargets);void 0!==a.morphnormals&&(e.morphnormals=a.morphnormals);void 0!==a.dithering&&(e.dithering=a.dithering);void 0!==a.vertextangents&& (e.vertextangents=a.vertextangents);void 0!==a.visible&&(e.visible=a.visible);void 0!==a.tonemapped&&(e.tonemapped=a.tonemapped);void 0!==a.userdata&&(e.userdata=a.userdata);void 0!==a.vertexcolors&&(e.vertexcolors="number"===typeof a.vertexcolors?0number.epsilon){if(0>k&&(h=b[e],f=-f,m=b[i],k=-k),!(a.ym.y))if(a.y===h.y){if(a.x===h.x)return!0}else{i=k*(a.x-h.x)-f*(a.y-h.y);if(0===i)return!0;0>i||(g=!g)}}else if(a.y=== h.y&&(m.x<=a.x&&a.x<=h.x||h.x<=a.x&&a.x<=m.x))return!0}return g}var f=nc.isclockwise,g=this.subpaths;if(0===g.length)return[];if(!0===b)return d(g);b=[];if(1===g.length){var h=g[0];var k=new pc;k.curves=h.curves;b.push(k);return b}var l=!f(g[0].getpoints());l=a?!l:l;k=[];var m=[],n=[],p=0;m[p]=void 0;n[p]=[];for(var t=0,q=g.length;te&&this._mixbufferregion(d,a,b*this._origindex,1-e,b);0=f){var n=f++,p=a[n];b[p.uuid]=m;a[m]=p;b[l]=n;a[n]=k;k=0;for(l=e;k!==l;++k){p=d[k];var t=p[m];p[m]=p[n];p[n]=t}}}this.ncachedobjects_=f},uncache:function(){for(var a=this._objects,b=this._indicesbyuuid,d=this._bindings,e=d.length,f=this.ncachedobjects_,g=a.length,h=0,k=arguments.length;h!==k;++h){var l=arguments[h].uuid,m=b[l];if(void 0!==m)if(delete b[l],mb||0=== d)return;this._starttime=null;b*=d}b*=this._updatetimescale(a);d=this._updatetime(b);a=this._updateweight(a);if(0d.parameterpositions[1]&&(this.stopfading(),0===e&&(this.enabled=!1))}}return this._effectiveweight=b};la.prototype._updatetimescale=function(a){var b=0;if(!this.paused){b=this.timescale;var d=this._timescaleinterpolant;if(null!==d){var e=d.evaluate(a)[0];b*=e;a>d.parameterpositions[1]&&(this.stopwarping(),0===b?this.paused=!0:this.timescale=b)}}return this._effectivetimescale=b};la.prototype._updatetime=function(a){var b=this._clip.duration,d=this.loop,e=this.time+ a,f=this._loopcount,g=2202===d;if(0===a)return-1===f?e:g&&1===(f&1)?b-e:e;if(2200===d)a:{if(-1===f&&(this._loopcount=0,this._setendings(!0,!0,!1)),e>=b)e=b;else if(0>e)e=0;else{this.time=e;break a}this.clampwhenfinished?this.paused=!0:this.enabled=!1;this.time=e;this._mixer.dispatchevent({type:"finished",action:this,direction:0>a?-1:1})}else{-1===f&&(0<=a?(f=0,this._setendings(!0,0===this.repetitions,g)):this._setendings(0===this.repetitions,!0,g));if(e>=b||0>e){d=math.floor(e/b);e-=b*d;f+=math.abs(d); var h=this.repetitions-f;0>=h?(this.clampwhenfinished?this.paused=!0:this.enabled=!1,this.time=e=0a,this._setendings(a,!a,g)):this._setendings(!1,!1,g),this._loopcount=f,this.time=e,this._mixer.dispatchevent({type:"loop",action:this,loopdelta:d}))}else this.time=e;if(g&&1===(f&1))return b-e}return e};la.prototype._setendings=function(a,b,d){var e=this._interpolantsettings;d?(e.endingstart=2401,e.endingend= 2401):(e.endingstart=a?this.zeroslopeatstart?2401:2400:2402,e.endingend=b?this.zeroslopeatend?2401:2400:2402)};la.prototype._schedulefading=function(a,b,d){var e=this._mixer,f=e.time,g=this._weightinterpolant;null===g&&(this._weightinterpolant=g=e._lendcontrolinterpolant());e=g.parameterpositions;g=g.samplevalues;e[0]=f;g[0]=b;e[1]=f+a;g[1]=d;return this};ph.prototype=object.assign(object.create(wb.prototype),{constructor:ph,_bindaction:function(a,b){var d=a._localroot||this._root,e=a._clip.tracks, f=e.length,g=a._propertybindings;a=a._interpolants;var h=d.uuid,k=this._bindingsbyrootandname,l=k[h];void 0===l&&(l={},k[h]=l);for(k=0;k!==f;++k){var m=e[k],n=m.name,p=l[n];if(void 0===p){p=g[k];if(void 0!==p){null===p._cacheindex&&(++p.referencecount,this._addinactivebinding(p,h,n));continue}p=new oh(qb.create(d,n,b&&b._propertybindings[k].binding.parsedpath),m.valuetypename,m.getvaluesize());++p.referencecount;this._addinactivebinding(p,h,n)}g[k]=p;a[k].resultbuffer=p.buffer}},_activateaction:function(a){if(!this._isactiveaction(a)){if(null=== a._cacheindex){var b=(a._localroot||this._root).uuid,d=a._clip.uuid,e=this._actionsbyclip[d];this._bindaction(a,e&&e.knownactions[0]);this._addinactiveaction(a,d,b)}b=a._propertybindings;d=0;for(e=b.length;d!==e;++d){var f=b[d];0===f.usecount++&&(this._lendbinding(f),f.saveoriginalstate())}this._lendaction(a)}},_deactivateaction:function(a){if(this._isactiveaction(a)){for(var b=a._propertybindings,d=0,e=b.length;d!==e;++d){var f=b[d];0===--f.usecount&&(f.restoreoriginalstate(),this._takebackbinding(f))}this._takebackaction(a)}}, _initmemorymanager:function(){this._actions=[];this._nactiveactions=0;this._actionsbyclip={};this._bindings=[];this._nactivebindings=0;this._bindingsbyrootandname={};this._controlinterpolants=[];this._nactivecontrolinterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inuse(){return a._nactiveactions}},bindings:{get total(){return a._bindings.length},get inuse(){return a._nactivebindings}},controlinterpolants:{get total(){return a._controlinterpolants.length},get inuse(){return a._nactivecontrolinterpolants}}}}, _isactiveaction:function(a){a=a._cacheindex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0};$a.prototype.containsbox=function(a){return this.min.x<= a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y};$a.prototype.getparameter=function(a,b){void 0===b&&(console.warn("three.box2: .getparameter() target is now required"),b=new l);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))};$a.prototype.intersectsbox=function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0};$a.prototype.clamppoint=function(a,b){void 0===b&&(console.warn("three.box2: .clamppoint() target is now required"), b=new l);return b.copy(a).clamp(this.min,this.max)};$a.prototype.distancetopoint=function(a){return vj.copy(a).clamp(this.min,this.max).sub(a).length()};$a.prototype.intersect=function(a){this.min.max(a.min);this.max.min(a.max);return this};$a.prototype.union=function(a){this.min.min(a.min);this.max.max(a.max);return this};$a.prototype.translate=function(a){this.min.add(a);this.max.add(a);return this};$a.prototype.equals=function(a){return a.min.equals(this.min)&&a.max.equals(this.max)};var wj=new w, zg=new w,cb=function(a,b){this.start=void 0!==a?a:new w;this.end=void 0!==b?b:new w};cb.prototype.set=function(a,b){this.start.copy(a);this.end.copy(b);return this};cb.prototype.clone=function(){return(new this.constructor).copy(this)};cb.prototype.copy=function(a){this.start.copy(a.start);this.end.copy(a.end);return this};cb.prototype.getcenter=function(a){void 0===a&&(console.warn("three.line3: .getcenter() target is now required"),a=new w);return a.addvectors(this.start,this.end).multiplyscalar(.5)}; cb.prototype.delta=function(a){void 0===a&&(console.warn("three.line3: .delta() target is now required"),a=new w);return a.subvectors(this.end,this.start)};cb.prototype.distancesq=function(){return this.start.distancetosquared(this.end)};cb.prototype.distance=function(){return this.start.distanceto(this.end)};cb.prototype.at=function(a,b){void 0===b&&(console.warn("three.line3: .at() target is now required"),b=new w);return this.delta(b).multiplyscalar(a).add(this.start)};cb.prototype.closestpointtopointparameter= function(a,b){wj.subvectors(a,this.start);zg.subvectors(this.end,this.start);a=zg.dot(zg);a=zg.dot(wj)/a;b&&(a=xa.clamp(a,0,1));return a};cb.prototype.closestpointtopoint=function(a,b,d){a=this.closestpointtopointparameter(a,b);void 0===d&&(console.warn("three.line3: .closestpointtopoint() target is now required"),d=new w);return this.delta(d).multiplyscalar(a).add(this.start)};cb.prototype.applymatrix4=function(a){this.start.applymatrix4(a);this.end.applymatrix4(a);return this};cb.prototype.equals= function(a){return a.start.equals(this.start)&&a.end.equals(this.end)};tf.prototype=object.create(ha.prototype);tf.prototype.constructor=tf;tf.prototype.isimmediaterenderobject=!0;var xj=new w;je.prototype=object.create(ha.prototype);je.prototype.constructor=je;je.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};je.prototype.update=function(){this.light.updatematrixworld();var a=this.light.distance?this.light.distance:1e3,b=a*math.tan(this.light.angle);this.cone.scale.set(b, b,a);xj.setfrommatrixposition(this.light.target.matrixworld);this.cone.lookat(xj);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var xc=new w,$g=new da,ri=new da;ke.prototype=object.create(za.prototype);ke.prototype.constructor=ke;ke.prototype.updatematrixworld=function(a){var b=this.bones,d=this.geometry,e=d.getattribute("position");ri.getinverse(this.root.matrixworld);for(var f=0,g=0;fmath.abs(b)&&(b=1e-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side= 0>b?1:0;this.lookat(this.plane.normal);yb.prototype.updatematrixworld.call(this,a)};var ck=new w,zg,uh;rc.prototype=object.create(ha.prototype);rc.prototype.constructor=rc;rc.prototype.setdirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(ck.set(a.z,0,-a.x).normalize(),this.quaternion.setfromaxisangle(ck,math.acos(a.y)))};rc.prototype.setlength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,math.max(1e-4,a-b),1); this.line.updatematrix();this.cone.scale.set(d,b,d);this.cone.position.y=a;this.cone.updatematrix()};rc.prototype.setcolor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};rc.prototype.copy=function(a){ha.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};yf.prototype=object.create(za.prototype);yf.prototype.constructor=yf;var gc=math.pow(2,8),dk=[.125,.215,.35,.446,.526,.582],ek=5+dk.length,hc={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5, 3007:6},si=new he,ti=function(){for(var a=[],b=[],d=[],e=8,f=0;fm;m++){var n=m%3*2/3-1,p=2\n\n\t\t\tvec3 getsample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat costheta = cos( theta );\n\t\t\t\t// rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampledirection = voutputdirection * costheta\n\t\t\t\t\t+ cross( axis, voutputdirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, voutputdirection ) * ( 1.0 - costheta );\n\n\t\t\t\treturn bilinearcubeuv( envmap, sampledirection, mipint );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleaxis : cross( poleaxis, voutputdirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( voutputdirection.z, 0.0, - voutputdirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_fragcolor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_fragcolor.rgb += weights[ 0 ] * getsample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dtheta * float( i );\n\t\t\t\t\tgl_fragcolor.rgb += weights[ i ] * getsample( -1.0 * theta, axis );\n\t\t\t\t\tgl_fragcolor.rgb += weights[ i ] * getsample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_fragcolor = lineartooutputtexel( gl_fragcolor );\n\n\t\t\t}\n\t\t", blending:0,depthtest:!1,depthwrite:!1});this._cubemapshader=this._equirectshader=null;this._compilematerial(this._blurmaterial)};rb.prototype.fromscene=function(a,b,d,e){void 0===b&&(b=0);void 0===d&&(d=.1);void 0===e&&(e=100);ui=this._renderer.getrendertarget();var f=this._allocatetargets();this._scenetocubeuv(a,d,e,f);0n;n++)p=n%3,0==p?(b.up.set(0,d[n],0),b.lookat(f[n],0,0)):1==p?(b.up.set(0,0,d[n]),b.lookat(0,f[n],0)):(b.up.set(0,d[n],0),b.lookat(0,0,f[n])),ag(e,p*gc,2v;++v){var u=v/p;u=math.exp(-u*u/2);f.push(u);0==v?q+=u:v